diff --git a/fdbclient/DatabaseContext.h b/fdbclient/DatabaseContext.h index de41f9d46f..52c1945f8e 100644 --- a/fdbclient/DatabaseContext.h +++ b/fdbclient/DatabaseContext.h @@ -428,7 +428,12 @@ public: static const std::vector debugTransactionTagChoices; std::unordered_map> watchMap; + // Adds or updates the specified (SS, TSS) pair in the TSS mapping (if not already present). + // Requests to the storage server will be duplicated to the TSS. void addTssMapping(StorageServerInterface const& ssi, StorageServerInterface const& tssi); + + // Removes the storage server and its TSS pair from the TSS mapping (if present). + // Requests to the storage server will no longer be duplicated to its pair TSS. void removeTssMapping(StorageServerInterface const& ssi); }; diff --git a/fdbrpc/QueueModel.h b/fdbrpc/QueueModel.h index f0b3d5f867..84ec5c5afe 100644 --- a/fdbrpc/QueueModel.h +++ b/fdbrpc/QueueModel.h @@ -109,8 +109,13 @@ public: int laggingRequestCount; int laggingTSSCompareCount; + // Updates this endpoint data to duplicate requests to the specified TSS endpoint void updateTssEndpoint(uint64_t endpointId, const TSSEndpointData& endpointData); + + // Removes the TSS mapping from this endpoint to stop duplicating requests to a TSS endpoint void removeTssEndpoint(uint64_t endpointId); + + // Retrieves the data for this endpoint's pair TSS endpoint, if present Optional getTssData(uint64_t endpointId); QueueModel() : secondMultiplier(1.0), secondBudget(0), laggingRequestCount(0) { @@ -147,4 +152,4 @@ private: }; */ -#endif \ No newline at end of file +#endif diff --git a/fdbserver/CMakeLists.txt b/fdbserver/CMakeLists.txt index 267d67d2d9..9220dfed5b 100644 --- a/fdbserver/CMakeLists.txt +++ b/fdbserver/CMakeLists.txt @@ -103,7 +103,7 @@ set(FDBSERVER_SRCS TesterInterface.actor.h TLogInterface.h TLogServer.actor.cpp - TSSMappingUtil.h + TSSMappingUtil.actor.h TSSMappingUtil.actor.cpp VersionedBTree.actor.cpp VFSAsync.h diff --git a/fdbserver/CommitProxyServer.actor.cpp b/fdbserver/CommitProxyServer.actor.cpp index 8f4a56c61c..39f0b004bd 100644 --- a/fdbserver/CommitProxyServer.actor.cpp +++ b/fdbserver/CommitProxyServer.actor.cpp @@ -1430,6 +1430,7 @@ ACTOR Future commitBatch(ProxyCommitData* self, return Void(); } +// Add tss mapping data to the reply, if any of the included storage servers have a TSS pair void maybeAddTssMapping(GetKeyServerLocationsReply& reply, ProxyCommitData* commitData, std::unordered_set& included, diff --git a/fdbserver/MoveKeys.actor.cpp b/fdbserver/MoveKeys.actor.cpp index 9975a6993e..59e1c13261 100644 --- a/fdbserver/MoveKeys.actor.cpp +++ b/fdbserver/MoveKeys.actor.cpp @@ -24,7 +24,7 @@ #include "fdbclient/SystemData.h" #include "fdbserver/MoveKeys.actor.h" #include "fdbserver/Knobs.h" -#include "fdbserver/TSSMappingUtil.h" +#include "fdbserver/TSSMappingUtil.actor.h" #include "flow/actorcompiler.h" // This must be the last #include. using std::max; diff --git a/fdbserver/TSSMappingUtil.actor.cpp b/fdbserver/TSSMappingUtil.actor.cpp index b0ca848536..e34611ce26 100644 --- a/fdbserver/TSSMappingUtil.actor.cpp +++ b/fdbserver/TSSMappingUtil.actor.cpp @@ -20,25 +20,9 @@ #include "fdbclient/SystemData.h" #include "fdbclient/KeyBackedTypes.h" -#include "fdbserver/TSSMappingUtil.h" +#include "fdbserver/TSSMappingUtil.actor.h" #include "flow/actorcompiler.h" // This must be the last #include. -// TODO should I just change back to not use KeyBackedMap at this point? - -/*ACTOR Future> readTSSMapping(Database cx) { - state Reference tr = makeReference(cx); - loop { - try { - state std::map mapping; - tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - readTSSMappingRYW(tr, &mapping); - return mapping; - } catch (Error& e) { - wait(tr->onError(e)); - } - } -}*/ - ACTOR Future readTSSMappingRYW(Reference tr, std::map* tssMapping) { KeyBackedMap tssMapDB = KeyBackedMap(tssMappingKeys.begin); state std::vector> uidMapping = wait(tssMapDB.getRange(tr, UID(), Optional(), CLIENT_KNOBS->TOO_MANY)); @@ -85,4 +69,4 @@ ACTOR Future removeTSSPairsFromCluster(Database cx, vector readTSSMappingRYW(Reference tr, std::map* tssMapping); + +// Reads the current cluster TSS mapping as part of the given Transaction +ACTOR Future readTSSMapping(Transaction* tr, std::map* tssMapping); + +// Removes the TSS pairs from the cluster +ACTOR Future removeTSSPairsFromCluster(Database cx, vector> pairsToRemove); + +#include "flow/unactorcompiler.h" +#endif diff --git a/fdbserver/TSSMappingUtil.h b/fdbserver/TSSMappingUtil.h deleted file mode 100644 index 963270156d..0000000000 --- a/fdbserver/TSSMappingUtil.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * TSSMappingUtil.h - * - * This source file is part of the FoundationDB open source project - * - * Copyright 2013-2018 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. - */ - -#ifndef TSS_MAPPING_UTIL_SERVER_H -#define TSS_MAPPING_UTIL_SERVER_H -#pragma once - -#include "fdbclient/StorageServerInterface.h" - -// TODO unused -// Future> readTSSMapping(Database cx); - -Future readTSSMappingRYW(Reference const& tr, std::map* const& tssMapping); - -Future readTSSMapping(Transaction* const& tr, std::map* const& tssMapping); - -Future removeTSSPairsFromCluster(Database const& cx, vector> const& pairsToRemove); - -#endif \ No newline at end of file diff --git a/fdbserver/workloads/ConsistencyCheck.actor.cpp b/fdbserver/workloads/ConsistencyCheck.actor.cpp index 799c5368b0..ab20b3041d 100644 --- a/fdbserver/workloads/ConsistencyCheck.actor.cpp +++ b/fdbserver/workloads/ConsistencyCheck.actor.cpp @@ -32,7 +32,7 @@ #include "fdbserver/StorageMetrics.h" #include "fdbserver/DataDistribution.actor.h" #include "fdbserver/QuietDatabase.h" -#include "fdbserver/TSSMappingUtil.h" +#include "fdbserver/TSSMappingUtil.actor.h" #include "flow/DeterministicRandom.h" #include "fdbclient/ManagementAPI.actor.h" #include "fdbclient/StorageServerInterface.h"