Add write conflict ranges to metadata modifications on backup data dumps.

This commit is contained in:
Alex Miller 2017-09-20 15:50:20 -07:00
parent 87a1581871
commit f9b7ce9a2f
1 changed files with 5 additions and 3 deletions

View File

@ -554,7 +554,7 @@ ACTOR Future<Void> readCommitted(Database cx, PromiseStream<RCGroup> results, Re
}
}
ACTOR Future<int> dumpData(Database cx, PromiseStream<RCGroup> results, Reference<FlowLock> lock, Key uid, Key addPrefix, Key removePrefix, RequestStream<CommitTransactionRequest> commit,
ACTOR Future<int> dumpData(Database cx, PromiseStream<RCGroup> results, Reference<FlowLock> lock, Key uid, Key addPrefix, Key removePrefix, RequestStream<CommitTransactionRequest> commit,
NotifiedVersion* committedVersion, Optional<Version> endVersion, Key rangeBegin, PromiseStream<Future<Void>> addActor, FlowLock* commitLock, Reference<KeyRangeMap<Version>> keyVersion ) {
state Version lastVersion = invalidVersion;
state bool endOfStream = false;
@ -595,9 +595,11 @@ ACTOR Future<int> dumpData(Database cx, PromiseStream<RCGroup> results, Referenc
Key applyBegin = uid.withPrefix(applyMutationsBeginRange.begin);
Key versionKey = BinaryWriter::toValue(newBeginVersion, Unversioned());
Key rangeEnd = getApplyKey(newBeginVersion, uid);
req.transaction.mutations.push_back_deep(req.arena, MutationRef(MutationRef::SetValue, applyBegin, versionKey));
req.transaction.write_conflict_ranges.push_back_deep(req.arena, singleKeyRange(applyBegin));
req.transaction.mutations.push_back_deep(req.arena, MutationRef(MutationRef::ClearRange, rangeBegin, rangeEnd));
req.transaction.write_conflict_ranges.push_back_deep(req.arena, singleKeyRange(rangeBegin));
req.transaction.read_snapshot = committedVersion->get();
req.isLockAware = true;
@ -694,4 +696,4 @@ ACTOR Future<Void> applyMutations(Database cx, Key uid, Key addPrefix, Key remov
TraceEvent(e.code() == error_code_restore_missing_data ? SevWarnAlways : SevError, "AM_error").error(e);
throw;
}
}
}