Merge "libsnapshot: Allow multiple calls to FinishedSnapshotWrites"

This commit is contained in:
Yifan Hong 2019-09-04 18:52:30 +00:00 committed by Gerrit Code Review
commit 09a0c98506

View file

@ -152,7 +152,13 @@ bool SnapshotManager::FinishedSnapshotWrites() {
auto lock = LockExclusive();
if (!lock) return false;
if (ReadUpdateState(lock.get()) != UpdateState::Initiated) {
auto update_state = ReadUpdateState(lock.get());
if (update_state == UpdateState::Unverified) {
LOG(INFO) << "FinishedSnapshotWrites already called before. Ignored.";
return true;
}
if (update_state != UpdateState::Initiated) {
LOG(ERROR) << "Can only transition to the Unverified state from the Initiated state.";
return false;
}