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