Fix isMetadataMutation

This commit is contained in:
sfc-gh-tclinkenbeard 2020-09-19 09:40:40 -07:00
parent 12b07d024f
commit dbeb8772f0
2 changed files with 7 additions and 6 deletions

View File

@ -58,7 +58,7 @@ void applyMetadataMutations(UID const& dbgid, Arena& arena, VectorRef<MutationRe
for (auto const& m : mutations) { for (auto const& m : mutations) {
//TraceEvent("MetadataMutation", dbgid).detail("M", m.toString()); //TraceEvent("MetadataMutation", dbgid).detail("M", m.toString());
if (m.param1.size() && m.param1[0] == systemKeys.begin[0] && m.type == MutationRef::SetValue) { if (m.type == MutationRef::SetValue && systemKeys.contains(m.param1)) {
if(m.param1.startsWith(keyServersPrefix)) { if(m.param1.startsWith(keyServersPrefix)) {
if(keyInfo) { if(keyInfo) {
KeyRef k = m.param1.removePrefix(keyServersPrefix); KeyRef k = m.param1.removePrefix(keyServersPrefix);
@ -301,8 +301,7 @@ void applyMetadataMutations(UID const& dbgid, Arena& arena, VectorRef<MutationRe
confChange = true; confChange = true;
TEST(true); // Recovering at a higher version. TEST(true); // Recovering at a higher version.
} }
} } else if (m.type == MutationRef::ClearRange && KeyRangeRef(m.param1, m.param2).intersects(systemKeys)) {
else if (m.param2.size() && m.param2[0] == systemKeys.begin[0] && m.type == MutationRef::ClearRange) {
KeyRangeRef range(m.param1, m.param2); KeyRangeRef range(m.param1, m.param2);
if (keyServersKeys.intersects(range)) { if (keyServersKeys.intersects(range)) {
@ -571,4 +570,4 @@ void applyMetadataMutations(const UID& dbgid, Arena& arena, const VectorRef<Muta
/* keyInfo= */ nullptr, /* cacheInfo= */ nullptr, /* uid_applyMutationsData= */ nullptr, /* keyInfo= */ nullptr, /* cacheInfo= */ nullptr, /* uid_applyMutationsData= */ nullptr,
RequestStream<CommitTransactionRequest>(), Database(), /* commitVersion= */ nullptr, RequestStream<CommitTransactionRequest>(), Database(), /* commitVersion= */ nullptr,
/* storageCache= */ nullptr, /* tag_popped= */ nullptr, /* initialCommit= */ false); /* storageCache= */ nullptr, /* tag_popped= */ nullptr, /* initialCommit= */ false);
} }

View File

@ -33,8 +33,10 @@
inline bool isMetadataMutation(MutationRef const& m) { inline bool isMetadataMutation(MutationRef const& m) {
// FIXME: This is conservative - not everything in system keyspace is necessarily processed by applyMetadataMutations // FIXME: This is conservative - not everything in system keyspace is necessarily processed by applyMetadataMutations
return (m.type == MutationRef::SetValue && m.param1.size() && m.param1[0] == systemKeys.begin[0] && !m.param1.startsWith(nonMetadataSystemKeys.begin)) || return (m.type == MutationRef::SetValue && systemKeys.contains(m.param1) &&
(m.type == MutationRef::ClearRange && m.param2.size() && m.param2[0] == systemKeys.begin[0] && !nonMetadataSystemKeys.contains(KeyRangeRef(m.param1, m.param2)) ); !nonMetadataSystemKeys.contains(m.param1)) ||
(m.type == MutationRef::ClearRange && KeyRangeRef(m.param1, m.param2).intersects(systemKeys) &&
!nonMetadataSystemKeys.contains(KeyRangeRef(m.param1, m.param2)));
} }
Reference<StorageInfo> getStorageInfo(UID id, std::map<UID, Reference<StorageInfo>>* storageCache, IKeyValueStore* txnStateStore); Reference<StorageInfo> getStorageInfo(UID id, std::map<UID, Reference<StorageInfo>>* storageCache, IKeyValueStore* txnStateStore);