Details
Description
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.
134
|
for (auto it = first; it != last; it++, index++) { |
135
|
auto opTime = opTimeList.empty() ? repl::OpTime() : opTimeList[index];
|
136
|
|
137
|
if (inMultiDocumentTransaction) { |
138
|
const auto atClusterTime = repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime(); |
139
|
|
140
|
if (atClusterTime) { |
141
|
const auto shardKey = |
142
|
metadata->getShardKeyPattern().extractShardKeyFromDocThrows(it->doc);
|
143
|
assertIntersectingChunkHasNotMoved(opCtx, *metadata, shardKey, *atClusterTime);
|
144
|
}
|
145
|
|
146
|
return; |
147
|
}
|
148
|
|
149
|
auto cloner = MigrationSourceManager::getCurrentCloner(*csr);
|
150
|
if (cloner) { |
151
|
cloner->onInsertOp(opCtx, it->doc, opTime);
|
152
|
}
|
153
|
}
|
Attachments
Issue Links
- is caused by
-
SERVER-70437 Lost writes to unsharded collection during movePrimary
-
- Closed
-