diff options
author | Alex Taskov <alex.taskov@mongodb.com> | 2020-08-28 09:12:15 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-28 14:10:24 +0000 |
commit | 7d915a65b286e535397a5d79bf2109512003bda9 (patch) | |
tree | 79a98d26851b43e9f3075b669cd0f9ba1b4cad5a /src/mongo/db/exec | |
parent | 0c52e9773275d0c4a11c77e56d5ea0f914a903be (diff) | |
download | mongo-7d915a65b286e535397a5d79bf2109512003bda9.tar.gz |
SERVER-49895 Expose getLatestOplogTimestamp() in aggregation cursor command responses on oplog
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r-- | src/mongo/db/exec/collection_scan.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/exec/collection_scan.h b/src/mongo/db/exec/collection_scan.h index 3d79915b0fe..b67d8cd6603 100644 --- a/src/mongo/db/exec/collection_scan.h +++ b/src/mongo/db/exec/collection_scan.h @@ -35,6 +35,7 @@ #include "mongo/db/exec/requires_collection_stage.h" #include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/record_id.h" +#include "mongo/s/resharding/resume_token_gen.h" namespace mongo { @@ -74,7 +75,16 @@ public: } BSONObj getPostBatchResumeToken() const { - return _params.requestResumeToken ? BSON("$recordId" << _lastSeenId.repr()) : BSONObj(); + // Return a resume token compatible with resumable initial sync. + if (_params.requestResumeToken) { + return BSON("$recordId" << _lastSeenId.repr()); + } + // Return a resume token compatible with resharding oplog sync. + if (_params.shouldTrackLatestOplogTimestamp) { + return ResumeTokenOplogTimestamp{_latestOplogEntryTimestamp}.toBSON(); + } + + return {}; } std::unique_ptr<PlanStageStats> getStats() final; |