Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-21249

remote_downloaded stat should provide a single result.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 6.17.0
    • Fix Version/s: None
    • Component/s: AQL
    • Labels:
      None
    • Severity:
      Medium

      Description

      The customer is expecting a single returned result when querying the remote_downloaded.  They expect the behavior to be similar to downloaded.  The issue is the remote_downloaded will return a stat for every different origin/IP that has a smart remote pointing to this local. 

      They are expecting the query to return the last time it was remotely downloaded from any of the origins, a single returned result.  Their use case is to cleanup artifacts.  They want to be able to run the remote_downloaded artifacts and either delete it from the local if it has not been remotely downloaded from anywhere since a given date, or leave it if it has.

      The problem is there is no way to cleanup based on usage, when

       

      Reproduce

      Create a local on one artifactory instance.

      Create a smart remote on two other instances.

      Download the artifact through the smart remote on both instances.  You should see the remote download increased to 2 on the local repository.

      Run the following query:

      items.find(
      {"repo":{"$match":"<REPO_NAME>"}},
      {"name":{"$match":"<ARTIFACT_NAME"}}
      ).include("stat.remote_downloaded")

      This will return both of the downloads from both instances.

      Run the following query:

      {"repo":{"$match":"<REPO_NAME>"}},
      {"name":{"$match":"<ARTIFACT_NAME"}},

      {"stat.remote_downloaded":{"$lte":"2019-10-01T00:00:00.000Z"}}
      ).include("stat.remote_downloaded") 

      AN EXAMPLE

      The below is running the above AQL query on a local repository that has multiple instances pointing a smart remote to it.  There will be an entry for each unique origin as you can see below.

      curl -uadmin:password -XPOST http://art.com/artifactory/api/search/aql -T test.aql

      {

      "results" : [ {

        "repo" : "example-repo-local",

        "path" : ".",

        "name" : "test.txt",

        "type" : "file",

        "size" : 6,

        "created" : "2020-02-18T16:22:05.235Z",

        "created_by" : "admin",

        "modified" : "2020-02-18T16:22:04.000Z",

        "modified_by" : "admin",

        "updated" : "2020-02-18T16:22:05.241Z",

        "stats" : [

      *

      *

      {     *"downloaded" : "2020-02-18T16:38:11.946Z",**     **"downloaded_by" : "admin",**     **"downloads" : 2,**     **"remote_downloaded" : "2020-02-18T16:45:31.079Z",**     **"remote_downloaded_by" : "user",**     **"remote_downloads" : 2,**     **"remote_origin" : "11.111.1.11",**     **"remote_path" : "11.111.1.11"*   *}

      *

      *

      , {*

          "downloaded" : "2020-02-18T16:38:11.946Z",

          "downloaded_by" : "admin",

          "downloads" : 2,

          "remote_downloaded" : "2020-02-18T16:40:08.183Z",

          "remote_downloaded_by" : "user",

          "remote_downloads" : 5,

          "remote_origin" : "33.33.33.33",

          "remote_path" : "33.33.33.33"

        } ]

      } ]

       

      So if you are trying to delete unused artifacts that have not been remote downloaded, there is no way to do this based on the above results.  The expected behavior is to return a single result, regardless of the different origins.  The returned result should take into account all the different origins and return the single most recent remote download.  

       

      Let's say you want to delete everything has not been downloaded since 2020-02-18T16:42:08.183Z.  You would run the same query and see a single result get returned, but this would be wrong as there was a more recent remote download.

       

        Attachments

          Activity

              People

              Assignee:
              Unassigned
              Reporter:
              scottm Scott Mosher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Sync Status

                  Connection: RTFACT Sync
                  RTMID-21249 -
                  SYNCHRONIZED
                  • Last Sync Date: