summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2021-09-07 18:38:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-07 19:03:19 +0000
commitc37cabcb8913e6ac5353763f80bf5ac7d724de65 (patch)
treeb093a1ea93a26a53397f76119225a553261622f6 /src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp
parent9983b2e19415358abf36f30b14e009e996b8fee1 (diff)
downloadmongo-c37cabcb8913e6ac5353763f80bf5ac7d724de65.tar.gz
SERVER-59811 Fix afterClusterTime in ReshardingOplogFetcher.
Diffstat (limited to 'src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp')
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp b/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp
index e04cf21ef44..a4d7bb20352 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp
@@ -255,8 +255,12 @@ AggregateCommandRequest ReshardingOplogFetcher::_makeAggregateCommandRequest(
AggregateCommandRequest aggRequest(NamespaceString::kRsOplogNamespace,
std::move(serializedPipeline));
if (_useReadConcern) {
+ // We specify {afterClusterTime: <highest _id.clusterTime>, level: "majority"} as the read
+ // concern to guarantee the postBatchResumeToken when the batch is empty is non-decreasing.
+ // The ReshardingOplogFetcher depends on inserting documents in increasing _id order,
+ // including for the synthetic no-op oplog entries generated from the postBatchResumeToken.
auto readConcernArgs = repl::ReadConcernArgs(
- boost::optional<LogicalTime>(_startAt.getTs()),
+ boost::optional<LogicalTime>(_startAt.getClusterTime()),
boost::optional<repl::ReadConcernLevel>(repl::ReadConcernLevel::kMajorityReadConcern));
aggRequest.setReadConcern(readConcernArgs.toBSONInner());
}