How can I clear Indexing queue?

Joshua Han
2019-05-21 01:26


You may have pressed force re-indexing an entire repo by mistake! Here is how you can stop the indexing.


Indexing in Xray requires downloading each artifact from Artifactory, exploding it, doing deep scanning, updating relevant DBs, then removing the artifact. Each artifact needs to be indexed just once. If you did re-indexing by mistake, you may want to stop the indexing. Unfortunately, there is no Stop button for this, as the requests have already been sent to the queue, which is a table in mongo (events_states)


You may remove events queue both in Artifactory and Xray.

Clear Xray events queue in Artifactory

Run following REST API to clear Xray queue in Artifactory

<artifactory_url>/artifactory/api/xray/cleanXrayClientCaches POST <artifactory admin creds>

Clear Xray events queue in Xray's event_states table

1. Find indexing events

Run following commend in MongoDB to find everything in the artifactory ID "ARTI" and root level of the remote cache repo, for example, "bintray-docker-remote"

db.event_states.find({"art_path": /ARTI/bintray-docker-remote-cache//})

Sample output:

{ "_id" : "644070d7-1119-4b0a-5198-34bd10ef082a", "art_path" : "ARTI/bintray-docker-remote-cache/jfrog/artifactory-pro/4.0.0/manifest.json", "action" : "created", "source_action" : "", "sha1" : "fdf00000ee0c3d1ff8c141225ac5cd72b3e6329b", "created" : NumberLong("1549923121547") }

{ "_id" : "f55e0045-0e32-4bd4-5b24-46da29fdea7b", "art_path" : "ARTI/bintray-docker-remote-cache/jfrog/artifactory-pro/4.0.1/manifest.json", "action" : "created", "source_action" : "", "sha1" : "95a9fbb66aae57190e076a86fd20326c3b5c0c12", "created" : NumberLong("1549923121551") }

{ "_id" : "492c70e2-92d8-4b64-4d61-2ff2dd89093c", "art_path" : "ARTI/bintray-docker-remote-cache/jfrog/artifactory-pro/4.0.2/manifest.json", "action" : "created", "source_action" : "", "sha1" : "59dabe15831dbecd120d30d7d95ee5b5abb69ee0", "created" : NumberLong("1549923121557") }

2. Remove indexing events

Then run following command to delete (just change the command above from 'find' to 'remove'). For example,

db.event_states.remove({"art_path": /ARTI/bintray-docker-remote-cache//})

Sample Output:

WriteResult({ "nRemoved" : 39 })