summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/collection_scan.h
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2021-02-01 20:24:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-03 21:32:58 +0000
commite091024c39c3bbb0226e5628bf1ca7254e0b8a96 (patch)
tree49406e722cf9e2171553ca29ebfb74c78add1ff5 /src/mongo/db/exec/collection_scan.h
parent812956d932fcfaac9dd112c857adbf94e29f992c (diff)
downloadmongo-e091024c39c3bbb0226e5628bf1ca7254e0b8a96.tar.gz
SERVER-53986 Use ObjectId's as table keys for time-series collections
Diffstat (limited to 'src/mongo/db/exec/collection_scan.h')
-rw-r--r--src/mongo/db/exec/collection_scan.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mongo/db/exec/collection_scan.h b/src/mongo/db/exec/collection_scan.h
index 8b19ce56ab2..b74986a8698 100644
--- a/src/mongo/db/exec/collection_scan.h
+++ b/src/mongo/db/exec/collection_scan.h
@@ -77,7 +77,15 @@ public:
BSONObj getPostBatchResumeToken() const {
// Return a resume token compatible with resumable initial sync.
if (_params.requestResumeToken) {
- return BSON("$recordId" << _lastSeenId.as<int64_t>());
+ if (_lastSeenId.isNull()) {
+ return BSON("$recordId" << NullLabeler{});
+ }
+
+ if (_isClustered) {
+ return BSON("$recordId" << _lastSeenId.as<OID>());
+ } else {
+ return BSON("$recordId" << _lastSeenId.as<int64_t>());
+ }
}
// Return a resume token compatible with resharding oplog sync.
if (_params.shouldTrackLatestOplogTimestamp) {
@@ -130,6 +138,9 @@ private:
CollectionScanParams _params;
+ // Collections with clustered indexes on _id use the ObjectId format for RecordId. All other
+ // collections use int64_t for RecordId.
+ const bool _isClustered;
RecordId _lastSeenId; // Null if nothing has been returned from _cursor yet.
// If _params.shouldTrackLatestOplogTimestamp is set and the collection is the oplog, the latest