mirror of https://github.com/mongodb/mongo
SERVER-90356 Support PIT restore without entries after the checkpoint timestamp (#23957)
GitOrigin-RevId: 29a95ae25abe9eb39af6546431089d258a318c65
This commit is contained in:
parent
8778799c2f
commit
900c17bbde
|
|
@ -462,14 +462,17 @@ export class MagicRestoreUtils {
|
|||
/**
|
||||
* Retrieves all oplog entries that occurred after the checkpoint timestamp on the source node.
|
||||
* Returns an object with the timestamp of the last oplog entry, as well as the oplog
|
||||
* entry array
|
||||
* entry array. If there are no entries after the checkpoint timestamp, the returned timestamp
|
||||
* is the checkpoint timestamp of the backup cursor.
|
||||
*/
|
||||
getEntriesAfterBackup(sourceNode) {
|
||||
let oplog = sourceNode.getDB("local").getCollection('oplog.rs');
|
||||
const entriesAfterBackup =
|
||||
oplog.find({ts: {$gt: this.checkpointTimestamp}}).sort({ts: 1}).toArray();
|
||||
return {
|
||||
lastOplogEntryTs: entriesAfterBackup[entriesAfterBackup.length - 1].ts,
|
||||
lastOplogEntryTs: (entriesAfterBackup.length != 0
|
||||
? entriesAfterBackup[entriesAfterBackup.length - 1].ts
|
||||
: this.checkpointTimestamp),
|
||||
entriesAfterBackup
|
||||
};
|
||||
}
|
||||
|
|
@ -541,7 +544,6 @@ export class MagicRestoreUtils {
|
|||
writeObjsAndRunMagicRestore(restoreConfiguration, entriesAfterBackup, options) {
|
||||
this.pointInTimeTimestamp = restoreConfiguration.pointInTimeTimestamp;
|
||||
if (this.pointInTimeTimestamp) {
|
||||
assert(entriesAfterBackup.length > 0);
|
||||
this.isPit = true;
|
||||
}
|
||||
MagicRestoreUtils.writeObjsToMagicRestorePipe(
|
||||
|
|
|
|||
Loading…
Reference in New Issue