consistency check can use a UIDtoTag map at a different version from the keyservers which could result in missing entries

This commit is contained in:
Evan Tschannen 2020-05-08 17:45:06 -07:00
parent f0f52fb2be
commit ee0be88b99
3 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ const Value keyServersValue( const std::vector<Tag>& srcTag, const std::vector<T
}
void decodeKeyServersValue( Standalone<RangeResultRef> result, const ValueRef& value,
std::vector<UID>& src, std::vector<UID>& dest ) {
std::vector<UID>& src, std::vector<UID>& dest, bool missingIsError ) {
if (value.size() == 0) {
src.clear();
dest.clear();
@ -121,7 +121,7 @@ void decodeKeyServersValue( Standalone<RangeResultRef> result, const ValueRef& v
}
std::sort(src.begin(), src.end());
std::sort(dest.begin(), dest.end());
if(src.size() != srcTag.size() || dest.size() != destTag.size()) {
if(missingIsError && (src.size() != srcTag.size() || dest.size() != destTag.size())) {
TraceEvent(SevError, "AttemptedToDecodeMissingTag");
for (const KeyValueRef kv : result) {
Tag tag = decodeServerTagValue(kv.value);

View File

@ -58,7 +58,7 @@ const Value keyServersValue(
const std::vector<Tag>& destTag = std::vector<Tag>());
// `result` must be the full result of getting serverTagKeys
void decodeKeyServersValue( Standalone<RangeResultRef> result, const ValueRef& value,
std::vector<UID>& src, std::vector<UID>& dest );
std::vector<UID>& src, std::vector<UID>& dest, bool missingIsError = true );
// "\xff/storageCache/[[begin]]" := "[[vector<uint16_t>]]"
extern const KeyRangeRef storageCacheKeys;

View File

@ -669,7 +669,7 @@ struct ConsistencyCheckWorkload : TestWorkload
Standalone<RangeResultRef> UIDtoTagMap = wait( tr.getRange( serverTagKeys, CLIENT_KNOBS->TOO_MANY ) );
ASSERT( !UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY );
decodeKeyServersValue(UIDtoTagMap, keyLocations[shard].value, sourceStorageServers, destStorageServers);
decodeKeyServersValue(UIDtoTagMap, keyLocations[shard].value, sourceStorageServers, destStorageServers, false);
//If the destStorageServers is non-empty, then this shard is being relocated
state bool isRelocating = destStorageServers.size() > 0;