Description
We have seen a repeat of long running rgc remove operations - similarly to what was described in OAK-8351.
This time happening with the query generated by queryForDefaultNoBranch with the query shape for example similar to:
{ "_sdType" : 70, "_sdMaxRevTime" : { "$lt" : NumberLong(1603030303) }, "$or" : [ { "$or" : [ { "_id" : /.*-1\/0/ }, { "_id" : /[^-]*/, "_path" : /.*-1\/0/ } ], "_sdMaxRevTime" : { "$lt" : NumberLong(1602020202) } }, { "$or" : [ { "_id" : /.*-2\/0/ }, { "_id" : /[^-]*/, "_path" : /.*-2/0/ } ], "_sdMaxRevTime" : { "$lt" : NumberLong(1601010101) } } }
While setting an index filter with the query plan in mongodb is one option, we could additionally also look into simplifying the above query further into multiple queries : eg. by having 1 query per clusterNodeId, and then simplifying the _sdMaxRevTime accordingly, so that the above would translate into the following 2 queries (with the hope that mongodb finds the optimal query plan) :
{ "_sdType" : 70, "_sdMaxRevTime" : { "$lt" : NumberLong(1602020202) }, "$or" : [ { "_id" : /.*-1\/0/ }, { "_id" : /[^-]*/, "_path" : /.*-1\/0/ } } }
and
{ "_sdType" : 70, "_sdMaxRevTime" : { "$lt" : NumberLong(1601010101) }, "$or" : [ { "_id" : /.*-2\/0/ }, { "_id" : /[^-]*/, "_path" : /.*-2\/0/ } } }