Disallow reading write conflict range for SetVersionstampedKey

This commit is contained in:
Andrew Noyes 2020-05-01 01:41:25 +00:00
parent 77b396d5ff
commit 7f9e9224d2
2 changed files with 8 additions and 0 deletions

View File

@ -1581,6 +1581,9 @@ Standalone<RangeResultRef> ReadYourWritesTransaction::getReadConflictRangeInters
}
Standalone<RangeResultRef> ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRangeRef kr) {
if (writeConflictRangeUnknown) {
throw accessed_unreadable();
}
ASSERT(writeConflictRangeKeysRange.contains(kr));
Standalone<RangeResultRef> result;
@ -1682,6 +1685,7 @@ void ReadYourWritesTransaction::atomicOp( const KeyRef& key, const ValueRef& ope
}
if(operationType == MutationRef::SetVersionstampedKey) {
writeConflictRangeUnknown = true;
// this does validation of the key and needs to be performed before the readYourWritesDisabled path
KeyRangeRef range = getVersionstampKeyRange(arena, k, tr.getCachedReadVersion().orDefault(0), getMaxReadKey());
if(!options.readYourWritesDisabled) {

View File

@ -162,6 +162,10 @@ private:
double creationTime;
bool commitStarted;
// If true, then this transactions write conflict range is not known until commit time.
// Currently only set if this transaction has a SetVersionstampedKey mutation
bool writeConflictRangeUnknown = false;
Reference<TransactionDebugInfo> transactionDebugInfo;
void resetTimeout();