Respond to comments 9/27

This commit is contained in:
Dan Lambright 2021-09-29 09:46:54 -04:00
parent b78dd3b9dd
commit f3ebc47e75
2 changed files with 36 additions and 37 deletions

View File

@ -45,10 +45,6 @@ Reference<StorageInfo> getStorageInfo(UID id,
} }
namespace { namespace {
inline bool isSystemKey(KeyRef key) {
return key.size() && key[0] == systemKeys.begin[0];
}
// It is incredibly important that any modifications to txnStateStore are done in such a way that the same operations // It is incredibly important that any modifications to txnStateStore are done in such a way that the same operations
// will be done on all commit proxies at the same time. Otherwise, the data stored in txnStateStore will become // will be done on all commit proxies at the same time. Otherwise, the data stored in txnStateStore will become
// corrupted. // corrupted.
@ -1047,35 +1043,3 @@ void applyMetadataMutations(SpanID const& spanContext,
IKeyValueStore* txnStateStore) { IKeyValueStore* txnStateStore) {
ApplyMetadataMutationsImpl(spanContext, dbgid, arena, mutations, txnStateStore).apply(); ApplyMetadataMutationsImpl(spanContext, dbgid, arena, mutations, txnStateStore).apply();
} }
bool containsMetadataMutation(const VectorRef<MutationRef>& mutations) {
for (auto const& m : mutations) {
if (m.type == MutationRef::SetValue && isSystemKey(m.param1)) {
if (m.param1.startsWith(globalKeysPrefix) || (m.param1.startsWith(cacheKeysPrefix)) ||
(m.param1.startsWith(configKeysPrefix)) || (m.param1.startsWith(serverListPrefix)) ||
(m.param1.startsWith(storageCachePrefix)) || (m.param1.startsWith(serverTagPrefix)) ||
(m.param1.startsWith(tssMappingKeys.begin)) || (m.param1.startsWith(tssQuarantineKeys.begin)) ||
(m.param1.startsWith(applyMutationsEndRange.begin)) ||
(m.param1.startsWith(applyMutationsKeyVersionMapRange.begin)) ||
(m.param1.startsWith(logRangesRange.begin)) || (m.param1.startsWith(serverKeysPrefix)) ||
(m.param1.startsWith(keyServersPrefix)) || (m.param1.startsWith(cacheKeysPrefix))) {
return true;
}
} else if (m.type == MutationRef::ClearRange && isSystemKey(m.param2)) {
KeyRangeRef range(m.param1, m.param2);
if ((keyServersKeys.intersects(range)) || (configKeys.intersects(range)) ||
(serverListKeys.intersects(range)) || (tagLocalityListKeys.intersects(range)) ||
(serverTagKeys.intersects(range)) || (serverTagHistoryKeys.intersects(range)) ||
(range.intersects(applyMutationsEndRange)) || (range.intersects(applyMutationsKeyVersionMapRange)) ||
(range.intersects(logRangesRange)) || (tssMappingKeys.intersects(range)) ||
(tssQuarantineKeys.intersects(range)) || (range.contains(coordinatorsKey)) ||
(range.contains(databaseLockedKey)) || (range.contains(metadataVersionKey)) ||
(range.contains(mustContainSystemMutationsKey)) || (range.contains(writeRecoveryKey)) ||
(range.intersects(testOnlyTxnStateStorePrefixRange))) {
return true;
}
}
}
return false;
}

View File

@ -63,6 +63,41 @@ void applyMetadataMutations(SpanID const& spanContext,
Arena& arena, Arena& arena,
const VectorRef<MutationRef>& mutations, const VectorRef<MutationRef>& mutations,
IKeyValueStore* txnStateStore); IKeyValueStore* txnStateStore);
bool containsMetadataMutation(const VectorRef<MutationRef>& mutations);
inline bool isSystemKey(KeyRef key) {
return key.size() && key[0] == systemKeys.begin[0];
}
inline bool containsMetadataMutation(const VectorRef<MutationRef>& mutations) {
for (auto const& m : mutations) {
if (m.type == MutationRef::SetValue && isSystemKey(m.param1)) {
if (m.param1.startsWith(globalKeysPrefix) || (m.param1.startsWith(cacheKeysPrefix)) ||
(m.param1.startsWith(configKeysPrefix)) || (m.param1.startsWith(serverListPrefix)) ||
(m.param1.startsWith(storageCachePrefix)) || (m.param1.startsWith(serverTagPrefix)) ||
(m.param1.startsWith(tssMappingKeys.begin)) || (m.param1.startsWith(tssQuarantineKeys.begin)) ||
(m.param1.startsWith(applyMutationsEndRange.begin)) ||
(m.param1.startsWith(applyMutationsKeyVersionMapRange.begin)) ||
(m.param1.startsWith(logRangesRange.begin)) || (m.param1.startsWith(serverKeysPrefix)) ||
(m.param1.startsWith(keyServersPrefix)) || (m.param1.startsWith(cacheKeysPrefix))) {
return true;
}
} else if (m.type == MutationRef::ClearRange && isSystemKey(m.param2)) {
KeyRangeRef range(m.param1, m.param2);
if ((keyServersKeys.intersects(range)) || (configKeys.intersects(range)) ||
(serverListKeys.intersects(range)) || (tagLocalityListKeys.intersects(range)) ||
(serverTagKeys.intersects(range)) || (serverTagHistoryKeys.intersects(range)) ||
(range.intersects(applyMutationsEndRange)) || (range.intersects(applyMutationsKeyVersionMapRange)) ||
(range.intersects(logRangesRange)) || (tssMappingKeys.intersects(range)) ||
(tssQuarantineKeys.intersects(range)) || (range.contains(coordinatorsKey)) ||
(range.contains(databaseLockedKey)) || (range.contains(metadataVersionKey)) ||
(range.contains(mustContainSystemMutationsKey)) || (range.contains(writeRecoveryKey)) ||
(range.intersects(testOnlyTxnStateStorePrefixRange))) {
return true;
}
}
}
return false;
}
#endif #endif