The changes from 0323cbd as part of SERVER-70437 changed the interface of shardObserveInsertOp() to become the plural shardObserveInsertsOp(). However the changes mistakenly copied over the early return inside the for-loop. This turns out not to be a transaction consistency problem in practice because in every version where cross-shard transactions are supported (since MongoDB 4.2), the changes from SERVER-38583 had already made it so onInserts() is only called with a single element at a time.
We should change the early return to a continue statement to reflect the intended control flow though.
for (auto it = first; it != last; it++, index++) { auto opTime = opTimeList.empty() ? repl::OpTime() : opTimeList[index]; if (inMultiDocumentTransaction) { const auto atClusterTime = repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime(); if (atClusterTime) { const auto shardKey = metadata->getShardKeyPattern().extractShardKeyFromDocThrows(it->doc); assertIntersectingChunkHasNotMoved(opCtx, *metadata, shardKey, *atClusterTime); } return; } auto cloner = MigrationSourceManager::getCurrentCloner(*csr); if (cloner) { cloner->onInsertOp(opCtx, it->doc, opTime); } }
- is caused by
-
SERVER-70437 Lost writes to unsharded collection during movePrimary
- Closed