|
This appears to be another issue of metadata idempotency.
Consider
{ ts: Timestamp 1468367378000|6, t: 1, h: 1161015165816820222, v: 2, op: "c", ns: "test.$cmd", o: { renameCollection: "test.tmp.mr.mr_merge_1", to: "test.mr_merge_out", stayTemp: false, dropTarget: false } }
|
When we call listCollections, it returns test.mr_merge_out so we clone test.mr_merge_out.
We then get to the applyOps phase.
First we apply
{ ts: Timestamp 1468367378000|1, t: 1, h: -3741401790110643680, v: 2, op: "c", ns: "test.$cmd", o: { create: "tmp.mr.mr_merge_1", temp: true } }
|
Then eventually we apply
{ ts: Timestamp 1468367378000|6, t: 1, h: 1161015165816820222, v: 2, op: "c", ns: "test.$cmd", o: { renameCollection: "test.tmp.mr.mr_merge_1", to: "test.mr_merge_out", stayTemp: false, dropTarget: false } }
|
We have dropTarget: false, which means that it will return a "NamespaceExists" error since the target namespace already exists. In oplog.cpp, "NamespaceExists" is an acceptable error for renameCollection, so this renameCollection will fail silently and both collections will exist on the secondary, as we see.
|