fix: latestRestorable was incorrect
This commit is contained in:
parent
5ed080721d
commit
69f7409c37
|
@ -677,14 +677,20 @@ public:
|
|||
return configSpace.pack(LiteralStringRef(__FUNCTION__));
|
||||
}
|
||||
|
||||
// The end version of the first complete snapshot
|
||||
KeyBackedProperty<Version> firstSnapshotEndVersion() {
|
||||
return configSpace.pack(LiteralStringRef(__FUNCTION__));
|
||||
}
|
||||
|
||||
Future<Optional<Version>> getLatestRestorableVersion(Reference<ReadYourWritesTransaction> tr) {
|
||||
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOptions::READ_LOCK_AWARE);
|
||||
auto © = *this;
|
||||
auto lastLog = latestLogEndVersion().get(tr);
|
||||
auto lastSnapshot = latestSnapshotEndVersion().get(tr);
|
||||
return map(success(lastLog) && success(lastSnapshot), [=](Void) -> Optional<Version> {
|
||||
if(lastLog.get().present() && lastSnapshot.get().present()) {
|
||||
auto firstSnapshot = firstSnapshotEndVersion().get(tr);
|
||||
return map(success(lastLog) && success(firstSnapshot), [=](Void) -> Optional<Version> {
|
||||
// The latest log greater than the oldest snapshot is the restorable version
|
||||
if(lastLog.get().present() && firstSnapshot.get().present() && lastLog.get().get() >= firstSnapshot.get().get()) {
|
||||
return lastLog.get().get();
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -1845,10 +1845,16 @@ namespace fileBackup {
|
|||
state bool stopWhenDone;
|
||||
state EBackupState backupState;
|
||||
state Optional<Version> restorableVersion;
|
||||
state Optional<Version> firstSnapshotEndVersion;
|
||||
|
||||
Void _ = wait(store(config.stopWhenDone().getOrThrow(tr), stopWhenDone)
|
||||
&& store(config.stateEnum().getOrThrow(tr), backupState)
|
||||
&& store(config.getLatestRestorableVersion(tr), restorableVersion));
|
||||
&& store(config.getLatestRestorableVersion(tr), restorableVersion)
|
||||
&& store(config.firstSnapshotEndVersion().get(tr), firstSnapshotEndVersion));
|
||||
|
||||
if(!firstSnapshotEndVersion.present()) {
|
||||
config.firstSnapshotEndVersion().set(tr, Params.endVersion().get(task));
|
||||
}
|
||||
|
||||
// If the backup is restorable and the state isn't differential the set state to differential
|
||||
if(restorableVersion.present() && backupState != BackupAgentBase::STATE_DIFFERENTIAL)
|
||||
|
|
Loading…
Reference in New Issue