I tried some little chunk merge .
Eg on this little sub dataset :
db.getCollection('chunks').find({ns : 'softbridge4.cases', min:{
'$gte':{context:'orange', actionId:191, creation: ISODate('2019-06-17T03:41:41.000-0400')},
'$lte':{context:'orange', actionId:191, creation: ISODate('2019-06-24T03:21:05.000-0400')}
}}).sort({ns:1, min:1})
That corresponds to 4 chunks contiguous on the same shard :
softbridge4.cases-context_"orange"actionId_191creation_new Date(1560757301000),shard1,36932,2
softbridge4.cases-context_"orange"actionId_191creation_new Date(1561357092000),shard1,0,0
softbridge4.cases-context_"orange"actionId_191creation_new Date(1561359957000),shard1,0,0
softbridge4.cases-context_"orange"actionId_191creation_new Date(1561360865000),shard1,553980,30
With this command (balancer stopped):
db.adminCommand( {
mergeChunks: "softbridge4.cases",
bounds: [ {context:'orange', actionId:191, creation: ISODate('2019-06-17T03:41:41.000-0400')},
{context:'orange', actionId:191, creation: ISODate('2019-06-24T03:21:05.000-0400')} ]
} )
But I end with this error :
Failed to commit chunk merge :: caused by :: DuplicateKey: chunk operation commit failed: version 97732|17||5d5efd91753aa982feb1ecfb doesn't exist in namespace: softbridge4.cases. Unable to save chunk ops. Command: { applyOps: [ { op: "u", b: false, ns: "config.chunks", o: { _id: "softbridge4.cases-context_"orange"actionId_191.0creation_new Date(1560757301000)", ns: "softbridge4.cases", min: { context: "orange", actionId: 191.0, creation: new Date(1560757301000) }, max: { context: "orange", actionId: 191, creation: new Date(1561360865000) }, shard: "shard1", lastmod: Timestamp(97732, 17), lastmodEpoch: ObjectId('5d5efd91753aa982feb1ecfb') }, o2: { _id: "softbridge4.cases-context_"orange"actionId_191.0creation_new Date(1560757301000)" } }, { op: "d", ns: "config.chunks", o: { _id: "softbridge4.cases-context_"orange"actionId_191creation_new Date(1561357092000)" } }, { op: "d", ns: "config.chunks", o: { _id: "softbridge4.cases-context_"orange"actionId_191creation_new Date(1561359957000)" } } ], preCondition: [ { ns: "config.chunks", q: { query: { ns: "softbridge4.cases", min: { context: "orange", actionId: 191.0, creation: new Date(1560757301000) }, max: { context: "orange", actionId: 191, creation: new Date(1561357092000) } }, orderby: { lastmod: -1 } }, res: { lastmodEpoch: ObjectId('5d5efd91753aa982feb1ecfb'), shard: "shard1" } }, { ns: "config.chunks", q: { query: { ns: "softbridge4.cases", min: { context: "orange", actionId: 191, creation: new Date(1561357092000) }, max: { context: "orange", actionId: 191, creation: new Date(1561359957000) } }, orderby: { lastmod: -1 } }, res: { lastmodEpoch: ObjectId('5d5efd91753aa982feb1ecfb'), shard: "shard1" } }, { ns: "config.chunks", q: { query: { ns: "softbridge4.cases", min: { context: "orange", actionId: 191, creation: new Date(1561359957000) }, max: { context: "orange", actionId: 191, creation: new Date(1561360865000) } }, orderby: { lastmod: -1 } }, res: { lastmodEpoch: ObjectId('5d5efd91753aa982feb1ecfb'), shard: "shard1" } } ], writeConcern: { w: 0, wtimeout: 0 } }. Result: { applied: 1, code: 11000, codeName: "DuplicateKey", errmsg: "E11000 duplicate key error collection: config.chunks index: ns_1_min_1 dup key: { : "softbridge4.cases", : { context: "orange", actionId: 191.0, creat...", results: [ false ], ok: 0.0, operationTime: Timestamp(1600798453, 1609), $gleStats: { lastOpTime: { ts: Timestamp(1600798453, 1609), t: 6 }, electionId: ObjectId('7fffffff0000000000000006') }, $clusterTime: { clusterTime: Timestamp(1600798453, 2328), signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 } } } :: caused by :: E11000 duplicate key error collection: config.chunks index: ns_1_min_1 dup key: { : "softbridge4.cases", : { context: "orange", actionId: 191.0, creation: new Date(1560757301000) } }