Merge branch 'master' of https://github.com/apple/foundationdb into jfu-fix-snapshot-backup-agent

This commit is contained in:
Jon Fu 2020-10-12 12:42:08 -04:00
commit e11b518ab1
6 changed files with 64 additions and 6 deletions

View File

@ -96,6 +96,7 @@ int commit_transaction(FDBTransaction* transaction) {
f = fdb_transaction_commit(transaction);
fdb_wait_and_handle_error(commit_transaction, f, transaction);
fdb_future_destroy(f);
return FDB_SUCCESS;
}

View File

@ -305,8 +305,7 @@ void applyMetadataMutations(UID const& dbgid, Arena& arena, VectorRef<MutationRe
if (!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
TEST(true); // Snapshot created, setting writeRecoveryKey in txnStateStore
}
}
else if (m.param2.size() && m.param2[0] == systemKeys.begin[0] && m.type == MutationRef::ClearRange) {
} else if (m.param2.size() > 1 && m.param2[0] == systemKeys.begin[0] && m.type == MutationRef::ClearRange) {
KeyRangeRef range(m.param1, m.param2);
if (keyServersKeys.intersects(range)) {
@ -578,4 +577,4 @@ void applyMetadataMutations(const UID& dbgid, Arena& arena, const VectorRef<Muta
/* keyInfo= */ nullptr, /* cacheInfo= */ nullptr, /* uid_applyMutationsData= */ nullptr,
RequestStream<CommitTransactionRequest>(), Database(), /* commitVersion= */ nullptr,
/* storageCache= */ nullptr, /* tag_popped= */ nullptr, /* initialCommit= */ false);
}
}

View File

@ -33,8 +33,10 @@
inline bool isMetadataMutation(MutationRef const& m) {
// 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)) ||
(m.type == MutationRef::ClearRange && m.param2.size() && m.param2[0] == systemKeys.begin[0] && !nonMetadataSystemKeys.contains(KeyRangeRef(m.param1, m.param2)) );
return (m.type == MutationRef::SetValue && m.param1.size() && m.param1[0] == systemKeys.begin[0] &&
!m.param1.startsWith(nonMetadataSystemKeys.begin)) ||
(m.type == MutationRef::ClearRange && m.param2.size() > 1 && m.param2[0] == systemKeys.begin[0] &&
!nonMetadataSystemKeys.contains(KeyRangeRef(m.param1, m.param2)));
}
Reference<StorageInfo> getStorageInfo(UID id, std::map<UID, Reference<StorageInfo>>* storageCache, IKeyValueStore* txnStateStore);

View File

@ -0,0 +1,55 @@
/*
* BenchMetadataCheck.cpp
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2020 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "benchmark/benchmark.h"
#include "fdbclient/FDBTypes.h"
#include "fdbclient/SystemData.h"
// These benchmarks test the performance of different checks methods
// of checking for metadata mutations in applyMetadataMutations
static const std::array<MutationRef, 5> mutations = {
MutationRef(MutationRef::Type::ClearRange, normalKeys.begin, normalKeys.end),
MutationRef(MutationRef::Type::ClearRange, LiteralStringRef("a"), LiteralStringRef("b")),
MutationRef(MutationRef::Type::ClearRange, LiteralStringRef("aaaaaaaaaa"), LiteralStringRef("bbbbbbbbbb")),
MutationRef(MutationRef::Type::ClearRange, normalKeys.begin, systemKeys.end),
MutationRef(MutationRef::Type::ClearRange, LiteralStringRef("a").withPrefix(systemKeys.begin),
LiteralStringRef("b").withPrefix(systemKeys.begin)),
};
static void bench_check_metadata1(benchmark::State& state) {
const auto& m = mutations[state.range(0)];
while (state.KeepRunning()) {
benchmark::DoNotOptimize(KeyRangeRef(m.param1, m.param2).intersects(systemKeys));
}
state.SetItemsProcessed(static_cast<long>(state.iterations()));
}
static void bench_check_metadata2(benchmark::State& state) {
const auto& m = mutations[state.range(0)];
while (state.KeepRunning()) {
benchmark::DoNotOptimize(m.param2.size() > 1 && m.param2[0] == systemKeys.begin[0]); // && m.param2.size() > 1);
}
state.SetItemsProcessed(static_cast<long>(state.iterations()));
}
BENCHMARK(bench_check_metadata1)->DenseRange(0, mutations.size() - 1)->ReportAggregatesOnly(true);
BENCHMARK(bench_check_metadata2)->DenseRange(0, mutations.size() - 1)->ReportAggregatesOnly(true);

View File

@ -1,5 +1,6 @@
set(FLOWBENCH_SRCS
flowbench.actor.cpp
BenchMetadataCheck.cpp
BenchIterate.cpp
BenchPopulate.cpp
BenchRandom.cpp

View File

@ -170,7 +170,7 @@ if(WITH_PYTHON)
add_fdb_test(TEST_FILES rare/WriteTagThrottling.toml)
add_fdb_test(
TEST_FILES restarting/from_7.0.0/SnapIncrementalRestore-1.toml
restarting/from_7.0.0/SnapIncrementalRestore-2.toml)
restarting/from_7.0.0/SnapIncrementalRestore-2.toml IGNORE)
add_fdb_test(
TEST_FILES restarting/from_7.0.0/ConfigureTestRestart-1.txt
restarting/from_7.0.0/ConfigureTestRestart-2.txt)