2017-05-26 04:48:44 +08:00
|
|
|
/*
|
2020-09-11 08:44:15 +08:00
|
|
|
* CommitProxyServer.actor.cpp
|
2017-05-26 04:48:44 +08:00
|
|
|
*
|
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
|
*
|
2026-01-23 02:49:41 +08:00
|
|
|
* Copyright 2013-2026 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* 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
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
#include <algorithm>
|
2024-07-24 08:26:11 +08:00
|
|
|
#include <string_view>
|
2020-07-23 07:08:49 +08:00
|
|
|
#include <tuple>
|
2022-11-04 22:40:41 +08:00
|
|
|
#include <variant>
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2024-04-05 06:03:44 +08:00
|
|
|
#include "fdbclient/AccumulativeChecksum.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "fdbclient/Atomic.h"
|
2022-09-17 06:55:54 +08:00
|
|
|
#include "fdbclient/BackupAgent.actor.h"
|
2022-10-13 02:29:09 +08:00
|
|
|
#include "fdbclient/BuildIdempotencyIdMutations.h"
|
2021-10-09 09:03:01 +08:00
|
|
|
#include "fdbclient/CommitTransaction.h"
|
|
|
|
|
#include "fdbclient/DatabaseContext.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "fdbclient/FDBTypes.h"
|
2022-10-29 00:07:54 +08:00
|
|
|
#include "fdbclient/IdempotencyId.actor.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "fdbclient/Knobs.h"
|
2020-09-11 08:44:15 +08:00
|
|
|
#include "fdbclient/CommitProxyInterface.h"
|
2019-02-18 07:41:16 +08:00
|
|
|
#include "fdbclient/NativeAPI.actor.h"
|
2019-02-28 07:40:33 +08:00
|
|
|
#include "fdbclient/SystemData.h"
|
2023-06-09 07:59:17 +08:00
|
|
|
#include "fdbclient/Tracing.h"
|
2021-06-04 06:10:04 +08:00
|
|
|
#include "fdbclient/TransactionLineage.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "fdbrpc/sim_validation.h"
|
2026-03-13 07:20:54 +08:00
|
|
|
#include "fdbserver/core/AccumulativeChecksumUtil.h"
|
|
|
|
|
#include "fdbserver/core/ApplyMetadataMutation.h"
|
2026-03-16 08:42:43 +08:00
|
|
|
#include "fdbserver/core/ConflictBatch.h"
|
2026-03-13 07:20:54 +08:00
|
|
|
#include "fdbserver/core/DataDistributorInterface.h"
|
|
|
|
|
#include "fdbserver/core/FDBExecHelper.actor.h"
|
|
|
|
|
#include "fdbserver/core/IKeyValueStore.h"
|
|
|
|
|
#include "fdbserver/core/Knobs.h"
|
2026-03-13 05:42:53 +08:00
|
|
|
#include "fdbserver/core/LogSystem.h"
|
2026-03-13 06:15:39 +08:00
|
|
|
#include "fdbserver/core/LogSystemDiskQueueAdapter.h"
|
2026-03-13 07:20:54 +08:00
|
|
|
#include "fdbserver/core/MasterInterface.h"
|
|
|
|
|
#include "fdbserver/core/MutationTracking.h"
|
2026-03-13 06:15:39 +08:00
|
|
|
#include "fdbserver/core/ProxyCommitData.actor.h"
|
2026-03-13 07:20:54 +08:00
|
|
|
#include "fdbserver/core/RatekeeperInterface.h"
|
|
|
|
|
#include "fdbserver/core/RecoveryState.h"
|
|
|
|
|
#include "fdbserver/core/RestoreUtil.h"
|
2026-03-11 02:50:15 +08:00
|
|
|
#include "fdbserver/core/ServerDBInfo.actor.h"
|
2026-03-13 07:20:54 +08:00
|
|
|
#include "fdbserver/core/WaitFailure.actor.h"
|
2026-03-11 02:50:15 +08:00
|
|
|
#include "fdbserver/core/WorkerInterface.actor.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "flow/ActorCollection.h"
|
2022-10-13 05:18:56 +08:00
|
|
|
#include "flow/CodeProbe.h"
|
2022-09-15 01:58:32 +08:00
|
|
|
#include "flow/EncryptUtils.h"
|
2021-10-01 08:17:14 +08:00
|
|
|
#include "flow/Error.h"
|
2020-07-08 00:06:13 +08:00
|
|
|
#include "flow/IRandom.h"
|
2019-07-20 02:24:26 +08:00
|
|
|
#include "flow/Knobs.h"
|
2020-08-30 03:35:31 +08:00
|
|
|
#include "flow/Trace.h"
|
2023-06-09 07:59:17 +08:00
|
|
|
#include "flow/network.h"
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2018-08-11 06:18:24 +08:00
|
|
|
#include "flow/actorcompiler.h" // This must be the last #include.
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2022-11-04 22:40:41 +08:00
|
|
|
using WriteMutationRefVar = std::variant<MutationRef, VectorRef<MutationRef>>;
|
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
ACTOR void discardCommit(UID id, Future<LogSystemDiskQueueAdapter::CommitMessage> fcm, Future<Void> dummyCommitState) {
|
|
|
|
|
ASSERT(!dummyCommitState.isReady());
|
|
|
|
|
LogSystemDiskQueueAdapter::CommitMessage cm = wait(fcm);
|
2018-06-09 02:11:08 +08:00
|
|
|
TraceEvent("Discarding", id).detail("Count", cm.messages.size());
|
2017-05-26 04:48:44 +08:00
|
|
|
cm.acknowledge.send(Void());
|
|
|
|
|
ASSERT(dummyCommitState.isReady());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ResolutionRequestBuilder {
|
2021-10-09 09:03:01 +08:00
|
|
|
const ProxyCommitData* self;
|
|
|
|
|
|
|
|
|
|
// One request per resolver.
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<ResolveTransactionBatchRequest> requests;
|
2021-10-09 09:03:01 +08:00
|
|
|
|
|
|
|
|
// Txn i to resolvers that have i'th data sent
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<std::vector<int>> transactionResolverMap;
|
|
|
|
|
std::vector<CommitTransactionRef*> outTr;
|
2021-10-09 09:03:01 +08:00
|
|
|
|
|
|
|
|
// Used to report conflicting keys, the format is
|
|
|
|
|
// [CommitTransactionRef_Index][Resolver_Index][Read_Conflict_Range_Index_on_Resolver]
|
|
|
|
|
// -> read_conflict_range's original index in the commitTransactionRef
|
|
|
|
|
std::vector<std::vector<std::vector<int>>> txReadConflictRangeIndexMap;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-08 00:06:13 +08:00
|
|
|
ResolutionRequestBuilder(ProxyCommitData* self,
|
|
|
|
|
Version version,
|
|
|
|
|
Version prevVersion,
|
|
|
|
|
Version lastReceivedVersion,
|
2025-03-12 01:19:57 +08:00
|
|
|
Version lastShardMove,
|
2020-07-08 00:06:13 +08:00
|
|
|
Span& parentSpan)
|
|
|
|
|
: self(self), requests(self->resolvers.size()) {
|
|
|
|
|
for (auto& req : requests) {
|
2020-07-10 01:49:33 +08:00
|
|
|
req.spanContext = parentSpan.context;
|
2017-05-26 04:48:44 +08:00
|
|
|
req.prevVersion = prevVersion;
|
|
|
|
|
req.version = version;
|
|
|
|
|
req.lastReceivedVersion = lastReceivedVersion;
|
2025-03-12 01:19:57 +08:00
|
|
|
req.lastShardMove = lastShardMove;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommitTransactionRef& getOutTransaction(int resolver, Version read_snapshot) {
|
|
|
|
|
CommitTransactionRef*& out = outTr[resolver];
|
|
|
|
|
if (!out) {
|
|
|
|
|
ResolveTransactionBatchRequest& request = requests[resolver];
|
|
|
|
|
request.transactions.resize(request.arena, request.transactions.size() + 1);
|
|
|
|
|
out = &request.transactions.back();
|
|
|
|
|
out->read_snapshot = read_snapshot;
|
|
|
|
|
}
|
|
|
|
|
return *out;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-09 09:03:01 +08:00
|
|
|
// Returns a read conflict index map: [resolver_index][read_conflict_range_index_on_the_resolver]
|
|
|
|
|
// -> read_conflict_range's original index
|
|
|
|
|
std::vector<std::vector<int>> addReadConflictRanges(CommitTransactionRef& trIn) {
|
|
|
|
|
std::vector<std::vector<int>> rCRIndexMap(requests.size());
|
2020-05-22 20:24:15 +08:00
|
|
|
for (int idx = 0; idx < trIn.read_conflict_ranges.size(); ++idx) {
|
2020-05-22 19:44:09 +08:00
|
|
|
const auto& r = trIn.read_conflict_ranges[idx];
|
2017-05-26 04:48:44 +08:00
|
|
|
auto ranges = self->keyResolvers.intersectingRanges(r);
|
2025-10-01 00:34:44 +08:00
|
|
|
std::vector<int> resolvers;
|
|
|
|
|
resolvers.reserve(self->resolvers.size());
|
|
|
|
|
// O(1) de-dup keyed by resolver id (deterministic)
|
|
|
|
|
std::vector<unsigned char> seen(self->resolvers.size(), 0);
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto& ir : ranges) {
|
|
|
|
|
auto& version_resolver = ir.value();
|
|
|
|
|
for (int i = version_resolver.size() - 1; i >= 0; i--) {
|
2025-10-01 00:34:44 +08:00
|
|
|
const int resolver_id = version_resolver[i].second;
|
|
|
|
|
if (!seen[resolver_id]) {
|
|
|
|
|
seen[resolver_id] = 1;
|
|
|
|
|
resolvers.push_back(resolver_id);
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
if (version_resolver[i].first < trIn.read_snapshot)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
if (SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS && systemKeys.intersects(r)) {
|
2025-10-01 00:34:44 +08:00
|
|
|
// All resolvers are eligible; skip per-id de-dup and just fill 0..N-1.
|
|
|
|
|
resolvers.clear();
|
|
|
|
|
for (int k = 0; k < self->resolvers.size(); ++k) {
|
|
|
|
|
resolvers.push_back(k);
|
2021-10-09 09:03:01 +08:00
|
|
|
}
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
ASSERT(resolvers.size());
|
2020-05-22 20:24:15 +08:00
|
|
|
for (int resolver : resolvers) {
|
2017-05-26 04:48:44 +08:00
|
|
|
getOutTransaction(resolver, trIn.read_snapshot)
|
|
|
|
|
.read_conflict_ranges.push_back(requests[resolver].arena, r);
|
2020-05-22 19:44:09 +08:00
|
|
|
rCRIndexMap[resolver].push_back(idx);
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
return rCRIndexMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addWriteConflictRanges(CommitTransactionRef& trIn) {
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto& r : trIn.write_conflict_ranges) {
|
|
|
|
|
auto ranges = self->keyResolvers.intersectingRanges(r);
|
2025-10-01 00:34:44 +08:00
|
|
|
std::vector<int> resolvers;
|
|
|
|
|
resolvers.reserve(self->resolvers.size());
|
|
|
|
|
std::vector<unsigned char> seen(self->resolvers.size(), 0);
|
2021-10-09 09:03:01 +08:00
|
|
|
for (auto& ir : ranges) {
|
|
|
|
|
auto& version_resolver = ir.value();
|
|
|
|
|
if (!version_resolver.empty()) {
|
2025-10-01 00:34:44 +08:00
|
|
|
const int resolver_id = version_resolver.back().second;
|
|
|
|
|
if (!seen[resolver_id]) {
|
|
|
|
|
seen[resolver_id] = 1;
|
|
|
|
|
resolvers.push_back(resolver_id);
|
|
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS && systemKeys.intersects(r)) {
|
2025-10-01 00:34:44 +08:00
|
|
|
// All resolvers are eligible.
|
|
|
|
|
resolvers.clear();
|
|
|
|
|
for (int k = 0; k < self->resolvers.size(); ++k) {
|
|
|
|
|
resolvers.push_back(k);
|
2021-10-09 09:03:01 +08:00
|
|
|
}
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
ASSERT(resolvers.size());
|
|
|
|
|
for (int resolver : resolvers)
|
|
|
|
|
getOutTransaction(resolver, trIn.read_snapshot)
|
|
|
|
|
.write_conflict_ranges.push_back(requests[resolver].arena, r);
|
|
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addTransaction(CommitTransactionRequest& trRequest, Version ver, int transactionNumberInBatch) {
|
|
|
|
|
auto& trIn = trRequest.transaction;
|
|
|
|
|
// SOMEDAY: There are a couple of unnecessary O( # resolvers ) steps here
|
|
|
|
|
outTr.assign(requests.size(), nullptr);
|
|
|
|
|
ASSERT(transactionNumberInBatch >= 0 && transactionNumberInBatch < 32768);
|
|
|
|
|
|
|
|
|
|
bool isTXNStateTransaction = false;
|
|
|
|
|
for (auto& m : trIn.mutations) {
|
|
|
|
|
DEBUG_MUTATION("AddTr", ver, m, self->dbgid).detail("Idx", transactionNumberInBatch);
|
|
|
|
|
if (m.type == MutationRef::SetVersionstampedKey) {
|
|
|
|
|
transformVersionstampMutation(m, &MutationRef::param1, requests[0].version, transactionNumberInBatch);
|
|
|
|
|
trIn.write_conflict_ranges.push_back(requests[0].arena, singleKeyRange(m.param1, requests[0].arena));
|
|
|
|
|
} else if (m.type == MutationRef::SetVersionstampedValue) {
|
|
|
|
|
transformVersionstampMutation(m, &MutationRef::param2, requests[0].version, transactionNumberInBatch);
|
|
|
|
|
}
|
|
|
|
|
if (isMetadataMutation(m)) {
|
|
|
|
|
isTXNStateTransaction = true;
|
|
|
|
|
auto& tr = getOutTransaction(0, trIn.read_snapshot);
|
|
|
|
|
tr.mutations.push_back(requests[0].arena, m);
|
|
|
|
|
tr.lock_aware = trRequest.isLockAware();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isTXNStateTransaction && !trRequest.isLockAware()) {
|
|
|
|
|
// This mitigates https://github.com/apple/foundationdb/issues/3647. Since this transaction is not lock
|
|
|
|
|
// aware, if this transaction got a read version then \xff/dbLocked must not have been set at this
|
|
|
|
|
// transaction's read snapshot. If that changes by commit time, then it won't commit on any proxy because of
|
|
|
|
|
// a conflict. A client could set a read version manually so this isn't totally bulletproof.
|
|
|
|
|
trIn.read_conflict_ranges.push_back(trRequest.arena, KeyRangeRef(databaseLockedKey, databaseLockedKeyEnd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::vector<int>> rCRIndexMap = addReadConflictRanges(trIn);
|
|
|
|
|
txReadConflictRangeIndexMap.push_back(std::move(rCRIndexMap));
|
|
|
|
|
|
|
|
|
|
addWriteConflictRanges(trIn);
|
|
|
|
|
|
2021-10-03 11:25:47 +08:00
|
|
|
if (isTXNStateTransaction) {
|
2017-05-26 04:48:44 +08:00
|
|
|
for (int r = 0; r < requests.size(); r++) {
|
|
|
|
|
int transactionNumberInRequest =
|
|
|
|
|
&getOutTransaction(r, trIn.read_snapshot) - requests[r].transactions.begin();
|
|
|
|
|
requests[r].txnStateTransactions.push_back(requests[r].arena, transactionNumberInRequest);
|
|
|
|
|
}
|
2021-10-03 11:25:47 +08:00
|
|
|
// Note only Resolver 0 got the correct spanContext, which means
|
|
|
|
|
// the reply from Resolver 0 has the right one back.
|
2023-01-25 15:47:26 +08:00
|
|
|
auto& tr = getOutTransaction(0, trIn.read_snapshot);
|
|
|
|
|
tr.spanContext = trRequest.spanContext;
|
2021-10-03 11:25:47 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<int> resolversUsed;
|
2017-05-26 04:48:44 +08:00
|
|
|
for (int r = 0; r < outTr.size(); r++)
|
2020-03-25 00:48:03 +08:00
|
|
|
if (outTr[r]) {
|
2017-05-26 04:48:44 +08:00
|
|
|
resolversUsed.push_back(r);
|
2020-03-25 00:48:03 +08:00
|
|
|
outTr[r]->report_conflicting_keys = trIn.report_conflicting_keys;
|
|
|
|
|
}
|
2020-06-20 10:32:30 +08:00
|
|
|
transactionResolverMap.emplace_back(std::move(resolversUsed));
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-10 06:19:18 +08:00
|
|
|
ACTOR Future<Void> commitBatcher(ProxyCommitData* commitData,
|
|
|
|
|
PromiseStream<std::pair<std::vector<CommitTransactionRequest>, int>> out,
|
|
|
|
|
FutureStream<CommitTransactionRequest> in,
|
|
|
|
|
int desiredBytes,
|
|
|
|
|
int64_t memBytesLimit) {
|
2019-08-09 06:00:33 +08:00
|
|
|
wait(delayJittered(commitData->commitBatchInterval, TaskPriority::ProxyCommitBatcher));
|
2018-11-10 06:19:18 +08:00
|
|
|
|
|
|
|
|
state double lastBatch = 0;
|
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
|
state Future<Void> timeout;
|
|
|
|
|
state std::vector<CommitTransactionRequest> batch;
|
|
|
|
|
state int batchBytes = 0;
|
2022-01-04 14:51:00 +08:00
|
|
|
// TODO: Enable this assertion (currently failing with gcc)
|
|
|
|
|
// static_assert(std::is_nothrow_move_constructible_v<CommitTransactionRequest>);
|
2018-11-10 06:19:18 +08:00
|
|
|
|
|
|
|
|
if (SERVER_KNOBS->MAX_COMMIT_BATCH_INTERVAL <= 0) {
|
|
|
|
|
timeout = Never();
|
|
|
|
|
} else {
|
2019-06-25 17:47:35 +08:00
|
|
|
timeout = delayJittered(SERVER_KNOBS->MAX_COMMIT_BATCH_INTERVAL, TaskPriority::ProxyCommitBatcher);
|
2018-11-10 06:19:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!timeout.isReady() &&
|
|
|
|
|
!(batch.size() == SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_COUNT_MAX || batchBytes >= desiredBytes)) {
|
|
|
|
|
choose {
|
|
|
|
|
when(CommitTransactionRequest req = waitNext(in)) {
|
2020-03-14 09:31:22 +08:00
|
|
|
// WARNING: this code is run at a high priority, so it needs to do as little work as possible
|
2018-11-10 06:25:40 +08:00
|
|
|
int bytes = getBytes(req);
|
2018-11-10 06:19:18 +08:00
|
|
|
|
2018-11-10 06:25:40 +08:00
|
|
|
// Drop requests if memory is under severe pressure
|
|
|
|
|
if (commitData->commitBatchesMemBytesCount + bytes > memBytesLimit) {
|
2020-03-14 09:31:22 +08:00
|
|
|
++commitData->stats.txnCommitErrors;
|
2022-08-12 11:16:33 +08:00
|
|
|
req.reply.sendError(commit_proxy_memory_limit_exceeded());
|
2018-11-10 06:25:40 +08:00
|
|
|
TraceEvent(SevWarnAlways, "ProxyCommitBatchMemoryThresholdExceeded")
|
|
|
|
|
.suppressFor(60)
|
|
|
|
|
.detail("MemBytesCount", commitData->commitBatchesMemBytesCount)
|
|
|
|
|
.detail("MemLimit", memBytesLimit);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-11-10 06:19:18 +08:00
|
|
|
|
2019-07-20 02:10:48 +08:00
|
|
|
if (bytes > FLOW_KNOBS->PACKET_WARNING) {
|
2023-01-20 06:06:34 +08:00
|
|
|
TraceEvent(SevWarn, "LargeTransaction")
|
2019-07-20 02:10:48 +08:00
|
|
|
.suppressFor(1.0)
|
2019-07-20 02:24:26 +08:00
|
|
|
.detail("Size", bytes)
|
2019-07-20 02:10:48 +08:00
|
|
|
.detail("Client", req.reply.getEndpoint().getPrimaryAddress());
|
|
|
|
|
}
|
2022-04-27 00:28:38 +08:00
|
|
|
|
2018-11-10 06:25:40 +08:00
|
|
|
++commitData->stats.txnCommitIn;
|
Adds more detailed mutation logging to commit proxy
The commit proxy writes a `ProxyMetrics` trace every 5 seconds. This
event contains a lot of useful information, such as the number of commit
batches that arrived and exited, the number of mutations processed, the
number of bytes those mutations made up, etc.. However, it is difficult
to tell what the workload pattern looks like within these 5 second
intervals when the metrics are being calculated.
This PR adds a new trace, `ProxyDetailedMetrics`, which logs itself
every 100ms. It currently only writes the number of mutations and the
number of mutation bytes that arrived during the 100ms time period. But
it should be easy to add more metrics in the future.
It's possible this increased logging could cause issues. Based off a
simulation run of the `WriteDuringRead` test, I got the following
results:
```
$ rg ProxyDetailedMetrics trace.json | wc -l
6877
$ rg "Roles\": \".*CP.*\"" trace.json | wc -l
11402
$ wc -l trace.json
96147 trace.json
```
So on processes running as a commit proxy, this approximately doubled
the number of lines logged. But relative to the cluster overall, it only
added about 5% overhead.
If we want to reduce this number, one possibility would be to not write
a trace if all the values being written are 0. I'm not sure if this
would help much in production, but in simulation the large majority of
the traces (99%+) consist of zero values.
2023-02-17 08:31:27 +08:00
|
|
|
commitData->stats.uniqueClients.insert(req.reply.getEndpoint().getPrimaryAddress());
|
2018-11-10 06:19:18 +08:00
|
|
|
|
2018-11-10 06:25:40 +08:00
|
|
|
if (req.debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent("CommitDebug", req.debugID.get().first(), "CommitProxyServer.batcher");
|
2018-11-10 06:25:40 +08:00
|
|
|
}
|
2018-11-10 06:19:18 +08:00
|
|
|
|
2018-11-10 06:25:40 +08:00
|
|
|
if (!batch.size()) {
|
|
|
|
|
if (now() - lastBatch > commitData->commitBatchInterval) {
|
2019-06-25 17:47:35 +08:00
|
|
|
timeout = delayJittered(SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE,
|
|
|
|
|
TaskPriority::ProxyCommitBatcher);
|
2018-11-10 06:25:40 +08:00
|
|
|
} else {
|
2019-06-25 17:47:35 +08:00
|
|
|
timeout = delayJittered(commitData->commitBatchInterval - (now() - lastBatch),
|
|
|
|
|
TaskPriority::ProxyCommitBatcher);
|
2018-11-10 06:25:40 +08:00
|
|
|
}
|
2018-11-10 06:19:18 +08:00
|
|
|
}
|
2018-11-10 06:25:40 +08:00
|
|
|
|
|
|
|
|
if ((batchBytes + bytes > CLIENT_KNOBS->TRANSACTION_SIZE_LIMIT || req.firstInBatch()) &&
|
|
|
|
|
batch.size()) {
|
2023-01-13 01:11:30 +08:00
|
|
|
commitData->triggerCommit.set(false);
|
2020-04-07 04:45:13 +08:00
|
|
|
out.send({ std::move(batch), batchBytes });
|
2018-11-10 06:25:40 +08:00
|
|
|
lastBatch = now();
|
2019-06-25 17:47:35 +08:00
|
|
|
timeout = delayJittered(commitData->commitBatchInterval, TaskPriority::ProxyCommitBatcher);
|
2020-06-20 13:55:33 +08:00
|
|
|
batch.clear();
|
2018-11-10 06:25:40 +08:00
|
|
|
batchBytes = 0;
|
2018-11-10 06:19:18 +08:00
|
|
|
}
|
|
|
|
|
|
2018-11-10 06:25:40 +08:00
|
|
|
batch.push_back(req);
|
|
|
|
|
batchBytes += bytes;
|
|
|
|
|
commitData->commitBatchesMemBytesCount += bytes;
|
2018-11-10 06:19:18 +08:00
|
|
|
}
|
2018-11-11 05:04:24 +08:00
|
|
|
when(wait(timeout)) {}
|
2023-01-13 01:11:30 +08:00
|
|
|
when(wait(commitData->triggerCommit.onChange())) {
|
|
|
|
|
ASSERT(commitData->triggerCommit.get());
|
|
|
|
|
double commitTime = lastBatch + SERVER_KNOBS->COMMIT_TRIGGER_DELAY;
|
|
|
|
|
if (now() > commitTime) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timeout = timeout || delayJittered(commitTime - now(), TaskPriority::ProxyCommitBatcher);
|
|
|
|
|
}
|
2018-11-10 06:19:18 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-01-13 01:11:30 +08:00
|
|
|
commitData->triggerCommit.set(false);
|
2018-11-10 06:19:18 +08:00
|
|
|
out.send({ std::move(batch), batchBytes });
|
|
|
|
|
lastBatch = now();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-17 08:42:34 +08:00
|
|
|
void createWhitelistBinPathVec(const std::string& binPath, std::vector<Standalone<StringRef>>& binPathVec) {
|
2019-04-03 20:27:11 +08:00
|
|
|
TraceEvent(SevDebug, "BinPathConverter").detail("Input", binPath);
|
2019-04-21 03:58:24 +08:00
|
|
|
StringRef input(binPath);
|
|
|
|
|
while (input != StringRef()) {
|
2022-09-20 02:35:58 +08:00
|
|
|
StringRef token = input.eat(","_sr);
|
2019-04-21 03:58:24 +08:00
|
|
|
if (token != StringRef()) {
|
|
|
|
|
const uint8_t* ptr = token.begin();
|
|
|
|
|
while (ptr != token.end() && *ptr == ' ') {
|
|
|
|
|
ptr++;
|
|
|
|
|
}
|
|
|
|
|
if (ptr != token.end()) {
|
|
|
|
|
Standalone<StringRef> newElement(token.substr(ptr - token.begin()));
|
2019-04-23 21:55:55 +08:00
|
|
|
TraceEvent(SevDebug, "BinPathItem").detail("Element", newElement);
|
2019-04-21 03:58:24 +08:00
|
|
|
binPathVec.push_back(newElement);
|
|
|
|
|
}
|
2019-04-03 20:27:11 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-17 08:42:34 +08:00
|
|
|
bool isWhitelisted(const std::vector<Standalone<StringRef>>& binPathVec, StringRef binPath) {
|
2019-04-23 21:55:55 +08:00
|
|
|
TraceEvent("BinPath").detail("Value", binPath);
|
2019-04-21 03:58:24 +08:00
|
|
|
for (const auto& item : binPathVec) {
|
2019-04-23 21:55:55 +08:00
|
|
|
TraceEvent("Element").detail("Value", item);
|
2019-04-03 20:27:11 +08:00
|
|
|
}
|
2019-04-13 04:23:02 +08:00
|
|
|
return std::find(binPathVec.begin(), binPathVec.end(), binPath) != binPathVec.end();
|
2019-04-03 20:27:11 +08:00
|
|
|
}
|
|
|
|
|
|
2021-01-22 08:27:21 +08:00
|
|
|
ACTOR Future<Void> addBackupMutations(ProxyCommitData* self,
|
|
|
|
|
const std::map<Key, MutationListRef>* logRangeMutations,
|
|
|
|
|
LogPushData* toCommit,
|
|
|
|
|
Version commitVersion,
|
|
|
|
|
double* computeDuration,
|
|
|
|
|
double* computeStart) {
|
|
|
|
|
state std::map<Key, MutationListRef>::const_iterator logRangeMutation = logRangeMutations->cbegin();
|
2019-10-22 02:43:46 +08:00
|
|
|
state int32_t version = commitVersion / CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE;
|
|
|
|
|
state int yieldBytes = 0;
|
2019-11-15 07:49:56 +08:00
|
|
|
state BinaryWriter valueWriter(Unversioned());
|
2020-09-01 01:39:07 +08:00
|
|
|
|
2022-05-03 03:56:51 +08:00
|
|
|
toCommit->addTransactionInfo(SpanContext());
|
2020-08-28 07:16:05 +08:00
|
|
|
|
2019-08-31 07:16:19 +08:00
|
|
|
// Serialize the log range mutations within the map
|
2021-01-22 08:27:21 +08:00
|
|
|
for (; logRangeMutation != logRangeMutations->cend(); ++logRangeMutation) {
|
2019-11-15 07:49:56 +08:00
|
|
|
// FIXME: this is re-implementing the serialize function of MutationListRef in order to have a yield
|
2025-01-23 06:54:55 +08:00
|
|
|
// this is 0x0FDB00A200090001
|
2020-05-23 08:14:21 +08:00
|
|
|
valueWriter = BinaryWriter(IncludeVersion(ProtocolVersion::withBackupMutations()));
|
2025-01-23 06:54:55 +08:00
|
|
|
valueWriter << logRangeMutation->second.totalSize(); // this is int32 by default
|
2019-11-15 07:49:56 +08:00
|
|
|
|
|
|
|
|
state MutationListRef::Blob* blobIter = logRangeMutation->second.blob_begin;
|
|
|
|
|
while (blobIter) {
|
|
|
|
|
if (yieldBytes > SERVER_KNOBS->DESIRED_TOTAL_BYTES) {
|
|
|
|
|
yieldBytes = 0;
|
2020-02-22 11:09:16 +08:00
|
|
|
if (g_network->check_yield(TaskPriority::ProxyCommitYield1)) {
|
2023-06-08 10:09:23 +08:00
|
|
|
*computeDuration += g_network->timer_monotonic() - *computeStart;
|
2020-02-22 11:09:16 +08:00
|
|
|
wait(delay(0, TaskPriority::ProxyCommitYield1));
|
2023-06-08 10:09:23 +08:00
|
|
|
*computeStart = g_network->timer_monotonic();
|
2020-02-22 11:09:16 +08:00
|
|
|
}
|
2019-11-15 07:49:56 +08:00
|
|
|
}
|
|
|
|
|
valueWriter.serializeBytes(blobIter->data);
|
|
|
|
|
yieldBytes += blobIter->data.size();
|
|
|
|
|
blobIter = blobIter->next;
|
2019-10-22 02:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 07:49:56 +08:00
|
|
|
Key val = valueWriter.toValue();
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2025-01-23 06:54:55 +08:00
|
|
|
BinaryWriter wr(Unversioned()); // backupName/hash/commitVersion/part, so wr is param1
|
2019-08-31 07:16:19 +08:00
|
|
|
|
|
|
|
|
// Serialize the log destination
|
2019-10-22 02:43:46 +08:00
|
|
|
wr.serializeBytes(logRangeMutation->first);
|
2019-08-31 07:16:19 +08:00
|
|
|
|
|
|
|
|
// Write the log keys and version information
|
|
|
|
|
wr << (uint8_t)hashlittle(&version, sizeof(version), 0);
|
|
|
|
|
wr << bigEndian64(commitVersion);
|
|
|
|
|
|
2020-08-19 05:18:50 +08:00
|
|
|
uint32_t* partBuffer = nullptr;
|
2019-08-31 07:16:19 +08:00
|
|
|
|
|
|
|
|
for (int part = 0; part * CLIENT_KNOBS->MUTATION_BLOCK_SIZE < val.size(); part++) {
|
2019-10-22 02:43:46 +08:00
|
|
|
|
2024-02-10 05:36:41 +08:00
|
|
|
MutationRef backupMutation;
|
|
|
|
|
backupMutation.type = MutationRef::SetValue;
|
2019-08-31 07:16:19 +08:00
|
|
|
// Assign the second parameter as the part
|
|
|
|
|
// Define the mutation type and and location
|
2025-01-24 04:22:25 +08:00
|
|
|
backupMutation.param2 = getBackupValue(val, part);
|
2025-02-11 06:23:47 +08:00
|
|
|
Key key = getBackupKey(wr, &partBuffer, part); // holds the memory for backupMutation
|
|
|
|
|
backupMutation.param1 = key;
|
2019-10-22 02:43:46 +08:00
|
|
|
ASSERT(backupMutation.param1.startsWith(
|
|
|
|
|
logRangeMutation->first)); // We are writing into the configured destination
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2019-08-31 07:16:19 +08:00
|
|
|
auto& tags = self->tagsForKey(backupMutation.param1);
|
|
|
|
|
toCommit->addTags(tags);
|
2024-04-05 06:03:44 +08:00
|
|
|
|
|
|
|
|
if (self->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
self->acsBuilder,
|
|
|
|
|
backupMutation,
|
|
|
|
|
tags,
|
|
|
|
|
getCommitProxyAccumulativeChecksumIndex(self->commitProxyIndex),
|
|
|
|
|
self->epoch,
|
|
|
|
|
commitVersion,
|
|
|
|
|
self->dbgid);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-28 07:16:05 +08:00
|
|
|
toCommit->writeTypedMessage(backupMutation);
|
2019-08-31 07:16:19 +08:00
|
|
|
|
2020-05-14 05:28:04 +08:00
|
|
|
// if (DEBUG_MUTATION("BackupProxyCommit", commitVersion, backupMutation)) {
|
2019-10-22 02:43:46 +08:00
|
|
|
// TraceEvent("BackupProxyCommitTo", self->dbgid).detail("To",
|
|
|
|
|
// describe(tags)).detail("BackupMutation", backupMutation.toString())
|
|
|
|
|
// .detail("BackupMutationSize", val.size()).detail("Version", commitVersion).detail("DestPath",
|
|
|
|
|
// logRangeMutation.first) .detail("PartIndex", part).detail("PartIndexEndian",
|
2021-03-11 06:42:17 +08:00
|
|
|
// bigEndian32(part)).detail("PartData", backupMutation.param1);
|
2019-10-22 02:43:46 +08:00
|
|
|
// }
|
2019-08-31 07:16:19 +08:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-22 02:43:46 +08:00
|
|
|
return Void();
|
2019-08-31 07:16:19 +08:00
|
|
|
}
|
|
|
|
|
|
2020-01-24 10:31:51 +08:00
|
|
|
ACTOR Future<Void> releaseResolvingAfter(ProxyCommitData* self, Future<Void> releaseDelay, int64_t localBatchNumber) {
|
|
|
|
|
wait(releaseDelay);
|
|
|
|
|
ASSERT(self->latestLocalCommitBatchResolving.get() == localBatchNumber - 1);
|
|
|
|
|
self->latestLocalCommitBatchResolving.set(localBatchNumber);
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-06 00:17:37 +08:00
|
|
|
ACTOR static Future<ResolveTransactionBatchReply> trackResolutionMetrics(Reference<Histogram> dist,
|
|
|
|
|
Future<ResolveTransactionBatchReply> in) {
|
2023-06-08 10:09:23 +08:00
|
|
|
state double startTime = g_network->timer_monotonic();
|
2021-08-06 00:17:37 +08:00
|
|
|
ResolveTransactionBatchReply reply = wait(in);
|
2023-06-08 10:09:23 +08:00
|
|
|
dist->sampleSeconds(g_network->timer_monotonic() - startTime);
|
2021-08-06 00:17:37 +08:00
|
|
|
return reply;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
namespace CommitBatch {
|
|
|
|
|
|
2024-07-24 08:26:11 +08:00
|
|
|
constexpr const std::string_view UNSET = std::string_view();
|
|
|
|
|
constexpr const std::string_view INITIALIZE = "initialize"sv;
|
|
|
|
|
constexpr const std::string_view PRE_RESOLUTION = "preResolution"sv;
|
|
|
|
|
constexpr const std::string_view RESOLUTION = "resolution"sv;
|
|
|
|
|
constexpr const std::string_view POST_RESOLUTION = "postResolution"sv;
|
|
|
|
|
constexpr const std::string_view TRANSACTION_LOGGING = "transactionLogging"sv;
|
|
|
|
|
constexpr const std::string_view REPLY = "reply"sv;
|
|
|
|
|
constexpr const std::string_view COMPLETE = "complete"sv;
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
struct CommitBatchContext {
|
2020-08-04 12:19:14 +08:00
|
|
|
using StoreCommit_t = std::vector<std::pair<Future<LogSystemDiskQueueAdapter::CommitMessage>, Future<Void>>>;
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
ProxyCommitData* const pProxyCommitData;
|
|
|
|
|
std::vector<CommitTransactionRequest> trs;
|
2024-07-24 08:26:11 +08:00
|
|
|
const int currentBatchMemBytesCount;
|
2020-07-26 12:44:10 +08:00
|
|
|
|
|
|
|
|
double startTime;
|
|
|
|
|
|
2024-07-24 08:26:11 +08:00
|
|
|
// The current stage of batch commit
|
|
|
|
|
std::string_view stage = UNSET;
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
Optional<UID> debugID;
|
|
|
|
|
|
|
|
|
|
bool forceRecovery = false;
|
2021-01-22 06:10:48 +08:00
|
|
|
bool rejected = false; // If rejected due to long queue length
|
2020-07-26 12:44:10 +08:00
|
|
|
|
|
|
|
|
int64_t localBatchNumber;
|
|
|
|
|
LogPushData toCommit;
|
|
|
|
|
|
|
|
|
|
int batchOperations = 0;
|
|
|
|
|
|
2020-08-28 07:16:05 +08:00
|
|
|
Span span;
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2020-01-27 11:47:12 +08:00
|
|
|
int64_t batchBytes = 0;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
int latencyBucket = 0;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
Version commitVersion;
|
|
|
|
|
Version prevVersion;
|
|
|
|
|
|
|
|
|
|
int64_t maxTransactionBytes;
|
|
|
|
|
std::vector<std::vector<int>> transactionResolverMap;
|
|
|
|
|
std::vector<std::vector<std::vector<int>>> txReadConflictRangeIndexMap;
|
2018-06-02 06:21:40 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
Future<Void> releaseDelay;
|
|
|
|
|
Future<Void> releaseFuture;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
std::vector<ResolveTransactionBatchReply> resolution;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
double computeStart;
|
|
|
|
|
double computeDuration = 0;
|
|
|
|
|
|
|
|
|
|
Arena arena;
|
|
|
|
|
|
|
|
|
|
/// true if the batch is the 1st batch for this proxy, additional metadata
|
|
|
|
|
/// processing is involved for this batch.
|
|
|
|
|
bool isMyFirstBatch;
|
|
|
|
|
bool firstStateMutations;
|
2018-06-02 06:21:40 +08:00
|
|
|
|
2022-06-08 05:49:02 +08:00
|
|
|
Optional<Value> previousCoordinators;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
StoreCommit_t storeCommits;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
std::vector<uint8_t> committed;
|
|
|
|
|
|
|
|
|
|
Optional<Key> lockedKey;
|
|
|
|
|
bool locked;
|
|
|
|
|
|
|
|
|
|
int commitCount = 0;
|
|
|
|
|
|
|
|
|
|
std::vector<int> nextTr;
|
|
|
|
|
|
|
|
|
|
bool lockedAfter;
|
|
|
|
|
|
|
|
|
|
Optional<Value> metadataVersionAfter;
|
|
|
|
|
|
|
|
|
|
int mutationCount = 0;
|
|
|
|
|
int mutationBytes = 0;
|
|
|
|
|
|
|
|
|
|
std::map<Key, MutationListRef> logRangeMutations;
|
|
|
|
|
Arena logRangeMutationsArena;
|
|
|
|
|
|
|
|
|
|
int transactionNum = 0;
|
|
|
|
|
int yieldBytes = 0;
|
|
|
|
|
|
|
|
|
|
LogSystemDiskQueueAdapter::CommitMessage msg;
|
|
|
|
|
|
|
|
|
|
Future<Version> loggingComplete;
|
|
|
|
|
|
|
|
|
|
double commitStartTime;
|
|
|
|
|
|
2021-10-16 04:05:18 +08:00
|
|
|
std::unordered_map<uint16_t, Version> tpcvMap; // obtained from resolver
|
2021-09-24 04:05:41 +08:00
|
|
|
std::set<Tag> writtenTags; // final set tags written to in the batch
|
|
|
|
|
std::set<Tag> writtenTagsPreResolution; // tags written to in the batch not including any changes from the resolver.
|
2021-06-30 04:41:08 +08:00
|
|
|
|
2022-10-05 02:07:41 +08:00
|
|
|
IdempotencyIdKVBuilder idempotencyKVBuilder;
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
CommitBatchContext(ProxyCommitData*, const std::vector<CommitTransactionRequest>*, const int);
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2020-08-04 12:19:14 +08:00
|
|
|
void setupTraceBatch();
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2021-09-24 04:05:41 +08:00
|
|
|
std::set<Tag> getWrittenTagsPreResolution();
|
|
|
|
|
|
2023-11-01 00:01:34 +08:00
|
|
|
void checkHotShards();
|
|
|
|
|
|
2024-11-02 00:48:25 +08:00
|
|
|
bool rangeLockEnabled();
|
|
|
|
|
|
2025-03-12 01:19:57 +08:00
|
|
|
Version lastShardMove;
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
private:
|
|
|
|
|
void evaluateBatchSize();
|
|
|
|
|
};
|
2018-06-02 06:21:40 +08:00
|
|
|
|
2024-11-02 00:48:25 +08:00
|
|
|
bool CommitBatchContext::rangeLockEnabled() {
|
|
|
|
|
return pProxyCommitData->rangeLockEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-01 00:01:34 +08:00
|
|
|
void CommitBatchContext::checkHotShards() {
|
|
|
|
|
// removed expired hot shards
|
|
|
|
|
for (auto it = pProxyCommitData->hotShards.begin(); it != pProxyCommitData->hotShards.end();) {
|
|
|
|
|
if (now() > it->second) {
|
|
|
|
|
it = pProxyCommitData->hotShards.erase(it);
|
|
|
|
|
} else {
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pProxyCommitData->hotShards.empty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto trsBegin = trs.begin();
|
|
|
|
|
|
|
|
|
|
std::vector<size_t> transactionsToRemove;
|
|
|
|
|
for (int transactionNum = 0; transactionNum < trs.size(); transactionNum++) {
|
|
|
|
|
VectorRef<MutationRef>* pMutations = &trs[transactionNum].transaction.mutations;
|
|
|
|
|
bool abortTransaction = false;
|
|
|
|
|
for (int mutationNum = 0; mutationNum < pMutations->size(); mutationNum++) {
|
|
|
|
|
auto& m = (*pMutations)[mutationNum];
|
|
|
|
|
if (isSingleKeyMutation((MutationRef::Type)m.type)) {
|
|
|
|
|
for (const auto& shard : pProxyCommitData->hotShards) {
|
|
|
|
|
if (shard.first.contains(KeyRef(m.param1))) {
|
|
|
|
|
abortTransaction = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (m.type == MutationRef::ClearRange) {
|
|
|
|
|
for (const auto& shard : pProxyCommitData->hotShards) {
|
|
|
|
|
if (shard.first.intersects(KeyRangeRef(m.param1, m.param2))) {
|
|
|
|
|
abortTransaction = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
UNREACHABLE();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (abortTransaction) {
|
|
|
|
|
trs[transactionNum].reply.sendError(transaction_throttled_hot_shard());
|
|
|
|
|
transactionsToRemove.push_back(transactionNum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Remove transactions marked for removal in reverse order to avoid shifting indices
|
|
|
|
|
for (auto it = transactionsToRemove.rbegin(); it != transactionsToRemove.rend(); ++it) {
|
|
|
|
|
trs.erase(trsBegin + *it);
|
|
|
|
|
}
|
|
|
|
|
committed.resize(trs.size());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-10 09:18:59 +08:00
|
|
|
// Check whether the mutation intersects any legal backup ranges
|
|
|
|
|
// If so, it will be clamped to the intersecting range(s) later
|
|
|
|
|
inline bool shouldBackup(MutationRef const& m) {
|
|
|
|
|
if (normalKeys.contains(m.param1) || m.param1 == metadataVersionKey) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (m.type != MutationRef::Type::ClearRange) {
|
|
|
|
|
return systemBackupMutationMask().rangeContaining(m.param1).value();
|
|
|
|
|
} else {
|
|
|
|
|
for (auto& r : systemBackupMutationMask().intersectingRanges(KeyRangeRef(m.param1, m.param2))) {
|
|
|
|
|
if (r->value()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-22 06:30:06 +08:00
|
|
|
// Find the set of logs the batch is sent to. An empty set indicates it cannot be
|
|
|
|
|
// determined. In version vector, this means the batch should be sent to all logs.
|
2021-09-24 04:05:41 +08:00
|
|
|
std::set<Tag> CommitBatchContext::getWrittenTagsPreResolution() {
|
|
|
|
|
std::set<Tag> transactionTags;
|
2025-03-12 01:19:57 +08:00
|
|
|
lastShardMove = pProxyCommitData->lastShardMove;
|
2024-10-24 03:53:15 +08:00
|
|
|
if (pProxyCommitData->txnStateStore->getReplaceContent()) {
|
2025-03-22 06:30:06 +08:00
|
|
|
return std::set<Tag>();
|
|
|
|
|
}
|
|
|
|
|
if (pProxyCommitData->idempotencyClears.size()) {
|
|
|
|
|
return std::set<Tag>();
|
2024-10-24 03:53:15 +08:00
|
|
|
}
|
2021-09-24 04:05:41 +08:00
|
|
|
for (int transactionNum = 0; transactionNum < trs.size(); transactionNum++) {
|
|
|
|
|
int mutationNum = 0;
|
|
|
|
|
VectorRef<MutationRef>* pMutations = &trs[transactionNum].transaction.mutations;
|
2025-03-22 06:30:06 +08:00
|
|
|
if (trs[transactionNum].idempotencyId.valid()) {
|
|
|
|
|
return std::set<Tag>();
|
|
|
|
|
}
|
2021-09-24 04:05:41 +08:00
|
|
|
for (; mutationNum < pMutations->size(); mutationNum++) {
|
|
|
|
|
auto& m = (*pMutations)[mutationNum];
|
2024-09-10 09:18:59 +08:00
|
|
|
// disable version vector's effect if any mutation in the batch is backed up.
|
|
|
|
|
// TODO: make backup work with version vector.
|
|
|
|
|
if (pProxyCommitData->vecBackupKeys.size() > 1 && shouldBackup(m)) {
|
|
|
|
|
return std::set<Tag>();
|
|
|
|
|
}
|
2021-09-24 04:05:41 +08:00
|
|
|
if (isSingleKeyMutation((MutationRef::Type)m.type)) {
|
|
|
|
|
auto& tags = pProxyCommitData->tagsForKey(m.param1);
|
|
|
|
|
transactionTags.insert(tags.begin(), tags.end());
|
|
|
|
|
} else if (m.type == MutationRef::ClearRange) {
|
2025-04-27 01:45:46 +08:00
|
|
|
auto range = pProxyCommitData->keyInfo.rangeContaining(m.param1);
|
|
|
|
|
if (range.end() >= m.param2) {
|
|
|
|
|
range.value().populateTags();
|
|
|
|
|
transactionTags.insert(range.value().tags.begin(), range.value().tags.end());
|
2021-09-24 04:05:41 +08:00
|
|
|
} else {
|
|
|
|
|
std::set<Tag> allSources;
|
2025-04-27 01:45:46 +08:00
|
|
|
while (range.begin() < m.param2) {
|
|
|
|
|
range.value().populateTags();
|
|
|
|
|
allSources.insert(range.value().tags.begin(), range.value().tags.end());
|
|
|
|
|
transactionTags.insert(range.value().tags.begin(), range.value().tags.end());
|
|
|
|
|
++range;
|
2021-09-24 04:05:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-04-27 01:45:46 +08:00
|
|
|
KeyRangeRef clearRange(KeyRangeRef(m.param1, m.param2));
|
2021-09-24 04:05:41 +08:00
|
|
|
} else {
|
|
|
|
|
UNREACHABLE();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-11 03:31:32 +08:00
|
|
|
if (toCommit.getLogRouterTags()) {
|
|
|
|
|
toCommit.storeRandomRouterTag();
|
|
|
|
|
transactionTags.insert(toCommit.savedRandomRouterTag.get());
|
|
|
|
|
}
|
2024-09-06 23:20:30 +08:00
|
|
|
|
2021-09-24 04:05:41 +08:00
|
|
|
return transactionTags;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
CommitBatchContext::CommitBatchContext(ProxyCommitData* const pProxyCommitData_,
|
|
|
|
|
const std::vector<CommitTransactionRequest>* trs_,
|
|
|
|
|
const int currentBatchMemBytesCount)
|
2022-05-06 00:52:20 +08:00
|
|
|
: pProxyCommitData(pProxyCommitData_), trs(std::move(*const_cast<std::vector<CommitTransactionRequest>*>(trs_))),
|
|
|
|
|
currentBatchMemBytesCount(currentBatchMemBytesCount), startTime(g_network->now()),
|
|
|
|
|
localBatchNumber(++pProxyCommitData->localCommitBatchesStarted),
|
2022-05-07 02:19:37 +08:00
|
|
|
toCommit(pProxyCommitData->logSystem, pProxyCommitData->localTLogCount), span("MP:commitBatch"_loc),
|
2025-03-14 06:25:46 +08:00
|
|
|
committed(trs.size()), lastShardMove(invalidVersion) {
|
2020-07-26 12:44:10 +08:00
|
|
|
|
|
|
|
|
evaluateBatchSize();
|
|
|
|
|
|
|
|
|
|
if (batchOperations != 0) {
|
|
|
|
|
latencyBucket =
|
|
|
|
|
std::min<int>(SERVER_KNOBS->PROXY_COMPUTE_BUCKETS - 1,
|
|
|
|
|
SERVER_KNOBS->PROXY_COMPUTE_BUCKETS * batchBytes /
|
|
|
|
|
(batchOperations * (CLIENT_KNOBS->VALUE_SIZE_LIMIT + CLIENT_KNOBS->KEY_SIZE_LIMIT)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// since we are using just the former to limit the number of versions actually in flight!
|
|
|
|
|
ASSERT(SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS <= SERVER_KNOBS->MAX_VERSIONS_IN_FLIGHT);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
void CommitBatchContext::setupTraceBatch() {
|
2020-08-04 12:19:14 +08:00
|
|
|
for (const auto& tr : trs) {
|
2020-07-26 12:44:10 +08:00
|
|
|
if (tr.debugID.present()) {
|
|
|
|
|
if (!debugID.present()) {
|
2019-05-11 05:01:52 +08:00
|
|
|
debugID = nondeterministicRandom()->randomUniqueID();
|
2020-07-26 12:44:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_traceBatch.addAttach("CommitAttachID", tr.debugID.get().first(), debugID.get().first());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2022-05-03 03:56:51 +08:00
|
|
|
span.addLink(tr.spanContext);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
if (debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent("CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.Before");
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-07-26 12:44:10 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
void CommitBatchContext::evaluateBatchSize() {
|
2020-08-04 12:19:14 +08:00
|
|
|
for (const auto& tr : trs) {
|
|
|
|
|
const auto& mutations = tr.transaction.mutations;
|
2020-07-26 12:44:10 +08:00
|
|
|
batchOperations += mutations.size();
|
|
|
|
|
batchBytes += mutations.expectedSize();
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-07-26 12:44:10 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-01-22 02:19:53 +08:00
|
|
|
// Try to identify recovery transaction and backup's apply mutations (blind writes).
|
|
|
|
|
// Both cannot be rejected and are approximated by looking at first mutation
|
|
|
|
|
// starting with 0xff.
|
|
|
|
|
bool canReject(const std::vector<CommitTransactionRequest>& trs) {
|
|
|
|
|
for (const auto& tr : trs) {
|
|
|
|
|
if (tr.transaction.mutations.empty())
|
|
|
|
|
continue;
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
if (tr.transaction.mutations[0].param1.startsWith("\xff"_sr) || tr.transaction.read_conflict_ranges.empty()) {
|
2021-01-22 02:19:53 +08:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-21 06:02:08 +08:00
|
|
|
double computeReleaseDelay(CommitBatchContext* self, double latencyBucket) {
|
|
|
|
|
return std::min(SERVER_KNOBS->MAX_PROXY_COMPUTE,
|
|
|
|
|
self->batchOperations * self->pProxyCommitData->commitComputePerOperation[latencyBucket]);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> preresolutionProcessing(CommitBatchContext* self) {
|
2019-10-05 04:23:38 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
|
|
|
|
state std::vector<CommitTransactionRequest>& trs = self->trs;
|
|
|
|
|
state const int64_t localBatchNumber = self->localBatchNumber;
|
|
|
|
|
state const int latencyBucket = self->latencyBucket;
|
|
|
|
|
state const Optional<UID>& debugID = self->debugID;
|
2020-08-29 03:02:51 +08:00
|
|
|
state Span span("MP:preresolutionProcessing"_loc, self->span.context);
|
2023-06-08 10:09:23 +08:00
|
|
|
state double startTime = g_network->timer_monotonic();
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-10-20 13:51:56 +08:00
|
|
|
if (self->localBatchNumber - self->pProxyCommitData->latestLocalCommitBatchResolving.get() >
|
|
|
|
|
SERVER_KNOBS->RESET_MASTER_BATCHES &&
|
|
|
|
|
now() - self->pProxyCommitData->lastMasterReset > SERVER_KNOBS->RESET_MASTER_DELAY) {
|
2021-03-17 05:00:11 +08:00
|
|
|
TraceEvent(SevWarnAlways, "ResetMasterNetwork", self->pProxyCommitData->dbgid)
|
2020-10-20 13:51:56 +08:00
|
|
|
.detail("CurrentBatch", self->localBatchNumber)
|
|
|
|
|
.detail("InProcessBatch", self->pProxyCommitData->latestLocalCommitBatchResolving.get());
|
|
|
|
|
FlowTransport::transport().resetConnection(self->pProxyCommitData->master.address());
|
|
|
|
|
self->pProxyCommitData->lastMasterReset = now();
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
// Pre-resolution the commits
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(pProxyCommitData->latestLocalCommitBatchResolving.get() < localBatchNumber - 1, "Wait for local batch");
|
2020-07-26 12:44:10 +08:00
|
|
|
wait(pProxyCommitData->latestLocalCommitBatchResolving.whenAtLeast(localBatchNumber - 1));
|
2023-06-08 10:09:23 +08:00
|
|
|
double queuingDelay = g_network->timer_monotonic() - startTime;
|
|
|
|
|
pProxyCommitData->stats.computeLatency.addMeasurement(queuingDelay);
|
2021-08-06 00:17:37 +08:00
|
|
|
pProxyCommitData->stats.commitBatchQueuingDist->sampleSeconds(queuingDelay);
|
2021-01-22 02:19:53 +08:00
|
|
|
if ((queuingDelay > (double)SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS / SERVER_KNOBS->VERSIONS_PER_SECOND ||
|
|
|
|
|
(g_network->isSimulated() && BUGGIFY_WITH_PROB(0.01))) &&
|
|
|
|
|
SERVER_KNOBS->PROXY_REJECT_BATCH_QUEUED_TOO_LONG && canReject(trs)) {
|
|
|
|
|
// Disabled for the recovery transaction. otherwise, recovery can't finish and keeps doing more recoveries.
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(true, "Reject transactions in the batch");
|
2022-10-29 02:53:25 +08:00
|
|
|
TraceEvent(g_network->isSimulated() ? SevInfo : SevWarnAlways, "ProxyReject", pProxyCommitData->dbgid)
|
2021-01-22 02:19:53 +08:00
|
|
|
.suppressFor(0.1)
|
|
|
|
|
.detail("QDelay", queuingDelay)
|
|
|
|
|
.detail("Transactions", trs.size())
|
|
|
|
|
.detail("BatchNumber", localBatchNumber);
|
2021-01-22 03:11:21 +08:00
|
|
|
ASSERT(pProxyCommitData->latestLocalCommitBatchResolving.get() == localBatchNumber - 1);
|
|
|
|
|
pProxyCommitData->latestLocalCommitBatchResolving.set(localBatchNumber);
|
2021-01-22 02:19:53 +08:00
|
|
|
|
2021-01-22 03:11:21 +08:00
|
|
|
wait(pProxyCommitData->latestLocalCommitBatchLogging.whenAtLeast(localBatchNumber - 1));
|
|
|
|
|
ASSERT(pProxyCommitData->latestLocalCommitBatchLogging.get() == localBatchNumber - 1);
|
|
|
|
|
pProxyCommitData->latestLocalCommitBatchLogging.set(localBatchNumber);
|
2021-01-22 02:19:53 +08:00
|
|
|
for (const auto& tr : trs) {
|
|
|
|
|
tr.reply.sendError(transaction_too_old());
|
|
|
|
|
}
|
2021-01-22 03:11:21 +08:00
|
|
|
++pProxyCommitData->stats.commitBatchOut;
|
|
|
|
|
pProxyCommitData->stats.txnCommitOut += trs.size();
|
2021-02-08 06:56:34 +08:00
|
|
|
pProxyCommitData->stats.txnRejectedForQueuedTooLong += trs.size();
|
2021-01-22 06:10:48 +08:00
|
|
|
self->rejected = true;
|
2021-01-22 02:19:53 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-21 06:02:08 +08:00
|
|
|
self->releaseDelay = delay(computeReleaseDelay(self, latencyBucket), TaskPriority::ProxyMasterVersionReply);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
if (debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.GettingCommitVersion");
|
2020-07-26 12:44:10 +08:00
|
|
|
}
|
2019-10-05 04:23:38 +08:00
|
|
|
|
2021-09-24 04:05:41 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
|
|
|
|
self->writtenTagsPreResolution = self->getWrittenTagsPreResolution();
|
|
|
|
|
}
|
2023-11-01 00:01:34 +08:00
|
|
|
|
|
|
|
|
if (SERVER_KNOBS->HOT_SHARD_THROTTLING_ENABLED && !pProxyCommitData->hotShards.empty()) {
|
|
|
|
|
self->checkHotShards();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-29 03:02:51 +08:00
|
|
|
GetCommitVersionRequest req(span.context,
|
|
|
|
|
pProxyCommitData->commitVersionRequestNumber++,
|
2020-08-04 12:19:14 +08:00
|
|
|
pProxyCommitData->mostRecentProcessedRequestNumber,
|
2021-10-18 22:23:08 +08:00
|
|
|
pProxyCommitData->dbgid);
|
2023-06-08 10:09:23 +08:00
|
|
|
state double beforeGettingCommitVersion = g_network->timer_monotonic();
|
2020-07-26 12:44:10 +08:00
|
|
|
GetCommitVersionReply versionReply = wait(brokenPromiseToNever(
|
|
|
|
|
pProxyCommitData->master.getCommitVersion.getReply(req, TaskPriority::ProxyMasterVersionReply)));
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
pProxyCommitData->mostRecentProcessedRequestNumber = versionReply.requestNum;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
pProxyCommitData->stats.txnCommitVersionAssigned += trs.size();
|
|
|
|
|
pProxyCommitData->stats.lastCommitVersionAssigned = versionReply.version;
|
2023-06-08 10:09:23 +08:00
|
|
|
pProxyCommitData->stats.getCommitVersionDist->sampleSeconds(g_network->timer_monotonic() -
|
|
|
|
|
beforeGettingCommitVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
self->commitVersion = versionReply.version;
|
|
|
|
|
self->prevVersion = versionReply.prevVersion;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2025-03-12 01:19:57 +08:00
|
|
|
// TraceEvent("CPGetVersion", pProxyCommitData->dbgid).detail("Master", pProxyCommitData->master.id().toString()).detail("CommitVersion", self->commitVersion).detail("PrvVersion", self->prevVersion);
|
2022-01-07 04:15:51 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto it : versionReply.resolverChanges) {
|
2020-07-26 12:44:10 +08:00
|
|
|
auto rs = pProxyCommitData->keyResolvers.modify(it.range);
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto r = rs.begin(); r != rs.end(); ++r)
|
2019-04-23 05:03:48 +08:00
|
|
|
r->value().emplace_back(versionReply.resolverChangesVersion, it.dest);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
//TraceEvent("ProxyGotVer", pProxyContext->dbgid).detail("Commit", commitVersion).detail("Prev", prevVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
if (debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent("CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.GotCommitVersion");
|
2020-07-26 12:44:10 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> getResolution(CommitBatchContext* self) {
|
2023-06-08 10:09:23 +08:00
|
|
|
state double resolutionStart = g_network->timer_monotonic();
|
2020-08-04 12:19:14 +08:00
|
|
|
// Sending these requests is the fuzzy border between phase 1 and phase 2; it could conceivably overlap with
|
|
|
|
|
// resolution processing but is still using CPU
|
2022-08-03 01:51:41 +08:00
|
|
|
state ProxyCommitData* pProxyCommitData = self->pProxyCommitData;
|
2020-07-26 12:44:10 +08:00
|
|
|
std::vector<CommitTransactionRequest>& trs = self->trs;
|
2020-08-29 03:02:51 +08:00
|
|
|
state Span span("MP:getResolution"_loc, self->span.context);
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2025-03-12 01:19:57 +08:00
|
|
|
ResolutionRequestBuilder requests(pProxyCommitData,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
self->prevVersion,
|
|
|
|
|
pProxyCommitData->version.get(),
|
|
|
|
|
self->lastShardMove,
|
|
|
|
|
span);
|
2017-05-26 04:48:44 +08:00
|
|
|
int conflictRangeCount = 0;
|
2020-07-26 12:44:10 +08:00
|
|
|
self->maxTransactionBytes = 0;
|
|
|
|
|
for (int t = 0; t < trs.size(); t++) {
|
2021-10-09 09:03:01 +08:00
|
|
|
requests.addTransaction(trs[t], self->commitVersion, t);
|
2020-08-04 12:19:14 +08:00
|
|
|
conflictRangeCount +=
|
|
|
|
|
trs[t].transaction.read_conflict_ranges.size() + trs[t].transaction.write_conflict_ranges.size();
|
2017-05-26 04:48:44 +08:00
|
|
|
//TraceEvent("MPTransactionDump", self->dbgid).detail("Snapshot", trs[t].transaction.read_snapshot);
|
|
|
|
|
// for(auto& m : trs[t].transaction.mutations)
|
2020-07-26 12:44:10 +08:00
|
|
|
self->maxTransactionBytes = std::max<int64_t>(self->maxTransactionBytes, trs[t].transaction.expectedSize());
|
2017-05-26 04:48:44 +08:00
|
|
|
// TraceEvent("MPTransactionsDump", self->dbgid).detail("Mutation", m.toString());
|
|
|
|
|
}
|
2020-07-26 12:44:10 +08:00
|
|
|
pProxyCommitData->stats.conflictRanges += conflictRangeCount;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
for (int r = 1; r < pProxyCommitData->resolvers.size(); r++)
|
|
|
|
|
ASSERT(requests.requests[r].txnStateTransactions.size() == requests.requests[0].txnStateTransactions.size());
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
pProxyCommitData->stats.txnCommitResolving += trs.size();
|
|
|
|
|
std::vector<Future<ResolveTransactionBatchReply>> replies;
|
|
|
|
|
for (int r = 0; r < pProxyCommitData->resolvers.size(); r++) {
|
|
|
|
|
requests.requests[r].debugID = self->debugID;
|
2021-10-16 04:05:18 +08:00
|
|
|
requests.requests[r].writtenTags = self->writtenTagsPreResolution;
|
2021-08-06 00:17:37 +08:00
|
|
|
replies.push_back(trackResolutionMetrics(pProxyCommitData->stats.resolverDist[r],
|
|
|
|
|
brokenPromiseToNever(pProxyCommitData->resolvers[r].resolve.getReply(
|
|
|
|
|
requests.requests[r], TaskPriority::ProxyResolverReply))));
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
self->transactionResolverMap.swap(requests.transactionResolverMap);
|
|
|
|
|
// Used to report conflicting keys
|
|
|
|
|
self->txReadConflictRangeIndexMap.swap(requests.txReadConflictRangeIndexMap);
|
2022-06-30 05:21:05 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
self->releaseFuture = releaseResolvingAfter(pProxyCommitData, self->releaseDelay, self->localBatchNumber);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-10-20 13:51:56 +08:00
|
|
|
if (self->localBatchNumber - self->pProxyCommitData->latestLocalCommitBatchLogging.get() >
|
|
|
|
|
SERVER_KNOBS->RESET_RESOLVER_BATCHES &&
|
|
|
|
|
now() - self->pProxyCommitData->lastResolverReset > SERVER_KNOBS->RESET_RESOLVER_DELAY) {
|
|
|
|
|
for (int r = 0; r < self->pProxyCommitData->resolvers.size(); r++) {
|
2021-03-17 05:00:11 +08:00
|
|
|
TraceEvent(SevWarnAlways, "ResetResolverNetwork", self->pProxyCommitData->dbgid)
|
|
|
|
|
.detail("PeerAddr", self->pProxyCommitData->resolvers[r].address())
|
2024-06-11 06:45:43 +08:00
|
|
|
.detail("PeerAddress", self->pProxyCommitData->resolvers[r].address())
|
2021-03-17 05:00:11 +08:00
|
|
|
.detail("CurrentBatch", self->localBatchNumber)
|
|
|
|
|
.detail("InProcessBatch", self->pProxyCommitData->latestLocalCommitBatchLogging.get());
|
2020-10-20 13:51:56 +08:00
|
|
|
FlowTransport::transport().resetConnection(self->pProxyCommitData->resolvers[r].address());
|
|
|
|
|
}
|
|
|
|
|
self->pProxyCommitData->lastResolverReset = now();
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
// Wait for the final resolution
|
|
|
|
|
std::vector<ResolveTransactionBatchReply> resolutionResp = wait(getAll(replies));
|
|
|
|
|
self->resolution.swap(*const_cast<std::vector<ResolveTransactionBatchReply>*>(&resolutionResp));
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2023-06-08 10:09:23 +08:00
|
|
|
self->pProxyCommitData->stats.resolutionDist->sampleSeconds(g_network->timer_monotonic() - resolutionStart);
|
2020-07-26 12:44:10 +08:00
|
|
|
if (self->debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", self->debugID.get().first(), "CommitProxyServer.commitBatch.AfterResolution");
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2022-06-30 05:21:05 +08:00
|
|
|
|
2020-07-26 12:44:10 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
void assertResolutionStateMutationsSizeConsistent(const std::vector<ResolveTransactionBatchReply>& resolution) {
|
|
|
|
|
for (int r = 1; r < resolution.size(); r++) {
|
|
|
|
|
ASSERT(resolution[r].stateMutations.size() == resolution[0].stateMutations.size());
|
|
|
|
|
for (int s = 0; s < resolution[r].stateMutations.size(); s++) {
|
|
|
|
|
ASSERT(resolution[r].stateMutations[s].size() == resolution[0].stateMutations[s].size());
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2023-02-11 04:51:13 +08:00
|
|
|
// If the splitMutations is not empty, which means some clear range in mutations are split into multiple clear range
|
|
|
|
|
// ops. Modify mutations by replace the old clear range with the split clear ranges
|
2023-02-03 03:56:41 +08:00
|
|
|
void replaceRawClearRanges(Arena& arena,
|
|
|
|
|
VectorRef<MutationRef>& mutations,
|
2023-02-04 02:36:57 +08:00
|
|
|
std::vector<std::pair<int, std::vector<MutationRef>>>& splitMutations,
|
2023-02-08 05:21:18 +08:00
|
|
|
size_t totalSize,
|
|
|
|
|
Optional<UID> debugId = Optional<UID>()) {
|
2023-02-03 03:56:41 +08:00
|
|
|
if (splitMutations.empty())
|
|
|
|
|
return;
|
2023-02-04 02:36:57 +08:00
|
|
|
|
|
|
|
|
int i = mutations.size() - 1;
|
2023-02-03 03:56:41 +08:00
|
|
|
mutations.resize(arena, totalSize);
|
|
|
|
|
// place from back
|
|
|
|
|
int curr = totalSize - 1;
|
2023-02-04 02:36:57 +08:00
|
|
|
for (; i >= 0; --i) {
|
2023-02-03 03:56:41 +08:00
|
|
|
if (splitMutations.empty()) {
|
|
|
|
|
ASSERT_EQ(curr, i);
|
2023-02-04 02:36:57 +08:00
|
|
|
break;
|
2023-02-03 03:56:41 +08:00
|
|
|
}
|
|
|
|
|
|
2023-02-04 02:36:57 +08:00
|
|
|
if (splitMutations.back().first == i) {
|
|
|
|
|
ASSERT_EQ(mutations[i].type, MutationRef::ClearRange);
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
// TODO(gglass): legacy comment below references tenant. Possibly some
|
|
|
|
|
// opportunity for simplification here. Legacy comment:
|
2023-02-03 03:56:41 +08:00
|
|
|
// replace with tenant aligned mutations
|
2023-02-04 02:36:57 +08:00
|
|
|
auto& currMutations = splitMutations.back().second;
|
2023-02-03 03:56:41 +08:00
|
|
|
while (!currMutations.empty()) {
|
|
|
|
|
mutations[curr] = currMutations.back();
|
|
|
|
|
currMutations.pop_back();
|
|
|
|
|
curr--;
|
|
|
|
|
}
|
|
|
|
|
splitMutations.pop_back();
|
|
|
|
|
} else {
|
2023-02-04 02:36:57 +08:00
|
|
|
ASSERT_GT(curr, i);
|
|
|
|
|
mutations[curr] = mutations[i];
|
2023-02-03 03:56:41 +08:00
|
|
|
curr--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(splitMutations.size(), 0);
|
|
|
|
|
}
|
2025-10-10 12:38:28 +08:00
|
|
|
// Acknowledge transaction state store commits.
|
|
|
|
|
// Note: This acknowledgement will cause the transaction state store's popped version ("poppedUpTo", that's
|
|
|
|
|
// maintained in LogSystemDiskQueueAdapter) to get updated.
|
|
|
|
|
void acknowledgeTransactionStateStoreCommits(CommitBatchContext* self) {
|
|
|
|
|
for (auto& p : self->storeCommits) {
|
|
|
|
|
ASSERT(!p.second.isReady());
|
|
|
|
|
p.first.get().acknowledge.send(Void());
|
|
|
|
|
ASSERT(p.second.isReady());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
// Compute and apply "metadata" effects of each other proxy's most recent batch
|
2020-08-06 05:11:43 +08:00
|
|
|
void applyMetadataEffect(CommitBatchContext* self) {
|
2020-07-26 12:55:22 +08:00
|
|
|
bool initialState = self->isMyFirstBatch;
|
|
|
|
|
self->firstStateMutations = self->isMyFirstBatch;
|
|
|
|
|
for (int versionIndex = 0; versionIndex < self->resolution[0].stateMutations.size(); versionIndex++) {
|
|
|
|
|
// pProxyCommitData->logAdapter->setNextVersion( ??? ); << Ideally we would be telling the log adapter that the
|
|
|
|
|
// pushes in this commit will be in the version at which these state mutations were committed by another proxy,
|
|
|
|
|
// but at present we don't have that information here. So the disk queue may be unnecessarily conservative
|
|
|
|
|
// about popping.
|
2021-03-11 02:06:03 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
for (int transactionIndex = 0;
|
|
|
|
|
transactionIndex < self->resolution[0].stateMutations[versionIndex].size() && !self->forceRecovery;
|
|
|
|
|
transactionIndex++) {
|
2017-05-26 04:48:44 +08:00
|
|
|
bool committed = true;
|
2023-01-19 02:21:03 +08:00
|
|
|
for (int resolver = 0; resolver < self->resolution.size(); resolver++) {
|
2020-07-26 12:55:22 +08:00
|
|
|
committed =
|
|
|
|
|
committed && self->resolution[resolver].stateMutations[versionIndex][transactionIndex].committed;
|
2023-01-19 02:21:03 +08:00
|
|
|
}
|
|
|
|
|
|
2020-08-04 12:43:16 +08:00
|
|
|
if (committed) {
|
2022-05-03 03:56:51 +08:00
|
|
|
applyMetadataMutations(SpanContext(),
|
2020-08-28 07:16:05 +08:00
|
|
|
*self->pProxyCommitData,
|
|
|
|
|
self->arena,
|
|
|
|
|
self->pProxyCommitData->logSystem,
|
2020-08-04 12:43:16 +08:00
|
|
|
self->resolution[0].stateMutations[versionIndex][transactionIndex].mutations,
|
|
|
|
|
/* pToCommit= */ nullptr,
|
|
|
|
|
self->forceRecovery,
|
2022-02-19 13:22:31 +08:00
|
|
|
/* version= */ self->commitVersion,
|
2020-08-04 12:43:16 +08:00
|
|
|
/* popVersion= */ 0,
|
2023-01-19 07:11:58 +08:00
|
|
|
/* initialCommit */ false,
|
|
|
|
|
/* provisionalCommitProxy */ self->pProxyCommitData->provisional);
|
2020-08-04 12:43:16 +08:00
|
|
|
}
|
2023-01-19 02:21:03 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (self->resolution[0].stateMutations[versionIndex][transactionIndex].mutations.size() &&
|
|
|
|
|
self->firstStateMutations) {
|
2017-05-26 04:48:44 +08:00
|
|
|
ASSERT(committed);
|
2020-07-26 12:55:22 +08:00
|
|
|
self->firstStateMutations = false;
|
|
|
|
|
self->forceRecovery = false;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// These changes to txnStateStore will be committed by the other proxy, so we simply discard the commit message
|
2020-07-29 15:42:52 +08:00
|
|
|
auto fcm = self->pProxyCommitData->logAdapter->getCommitMessage();
|
|
|
|
|
self->storeCommits.emplace_back(fcm, self->pProxyCommitData->txnStateStore->commit());
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
if (initialState) {
|
|
|
|
|
initialState = false;
|
2020-07-26 12:55:22 +08:00
|
|
|
self->forceRecovery = false;
|
2020-07-29 15:42:52 +08:00
|
|
|
self->pProxyCommitData->txnStateStore->resyncLog();
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2025-10-10 12:38:28 +08:00
|
|
|
acknowledgeTransactionStateStoreCommits(self);
|
2020-07-26 12:55:22 +08:00
|
|
|
self->storeCommits.clear();
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
/// Determine which transactions actually committed (conservatively) by combining results from the resolvers
|
2020-08-06 05:11:43 +08:00
|
|
|
void determineCommittedTransactions(CommitBatchContext* self) {
|
2020-07-29 15:42:52 +08:00
|
|
|
auto pProxyCommitData = self->pProxyCommitData;
|
|
|
|
|
const auto& trs = self->trs;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
ASSERT(self->transactionResolverMap.size() == self->committed.size());
|
2020-03-25 00:48:03 +08:00
|
|
|
// For each commitTransactionRef, it is only sent to resolvers specified in transactionResolverMap
|
|
|
|
|
// Thus, we use this nextTr to track the correct transaction index on each resolver.
|
2020-07-26 12:55:22 +08:00
|
|
|
self->nextTr.resize(self->resolution.size());
|
|
|
|
|
for (int t = 0; t < trs.size(); t++) {
|
2026-03-16 08:42:43 +08:00
|
|
|
uint8_t commit = ConflictBatchStatus::TransactionCommitted;
|
2020-07-29 15:42:52 +08:00
|
|
|
for (int r : self->transactionResolverMap[t]) {
|
2020-07-26 12:55:22 +08:00
|
|
|
commit = std::min(self->resolution[r].committed[self->nextTr[r]++], commit);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-07-26 12:55:22 +08:00
|
|
|
self->committed[t] = commit;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-07-26 12:55:22 +08:00
|
|
|
for (int r = 0; r < self->resolution.size(); r++)
|
|
|
|
|
ASSERT(self->nextTr[r] == self->resolution[r].committed.size());
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
pProxyCommitData->logAdapter->setNextVersion(self->commitVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
self->lockedKey = pProxyCommitData->txnStateStore->readValue(databaseLockedKey).get();
|
|
|
|
|
self->locked = self->lockedKey.present() && self->lockedKey.get().size();
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-08-21 02:12:59 +08:00
|
|
|
const Optional<Value> mustContainSystemKey =
|
|
|
|
|
pProxyCommitData->txnStateStore->readValue(mustContainSystemMutationsKey).get();
|
2020-07-26 12:55:22 +08:00
|
|
|
if (mustContainSystemKey.present() && mustContainSystemKey.get().size()) {
|
|
|
|
|
for (int t = 0; t < trs.size(); t++) {
|
2026-03-16 08:42:43 +08:00
|
|
|
if (self->committed[t] == ConflictBatchStatus::TransactionCommitted) {
|
2018-08-22 12:09:50 +08:00
|
|
|
bool foundSystem = false;
|
|
|
|
|
for (auto& m : trs[t].transaction.mutations) {
|
|
|
|
|
if ((m.type == MutationRef::ClearRange ? m.param2 : m.param1) >= nonMetadataSystemKeys.end) {
|
|
|
|
|
foundSystem = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!foundSystem) {
|
2026-03-16 08:42:43 +08:00
|
|
|
self->committed[t] = ConflictBatchStatus::TransactionConflict;
|
2018-08-22 12:09:50 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
2018-08-22 12:09:50 +08:00
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
// This first pass through committed transactions deals with "metadata" effects (modifications of txnStateStore, changes
|
|
|
|
|
// to storage servers' responsibilities)
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> applyMetadataToCommittedTransactions(CommitBatchContext* self) {
|
2023-02-15 05:05:51 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
2023-02-02 08:40:58 +08:00
|
|
|
auto& trs = self->trs;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
int t;
|
2020-07-29 15:42:52 +08:00
|
|
|
for (t = 0; t < trs.size() && !self->forceRecovery; t++) {
|
2026-03-16 08:42:43 +08:00
|
|
|
if (self->committed[t] == ConflictBatchStatus::TransactionCommitted && (!self->locked || trs[t].isLockAware())) {
|
2023-03-01 07:47:00 +08:00
|
|
|
self->commitCount++;
|
|
|
|
|
applyMetadataMutations(trs[t].spanContext,
|
|
|
|
|
*pProxyCommitData,
|
|
|
|
|
self->arena,
|
|
|
|
|
pProxyCommitData->logSystem,
|
|
|
|
|
trs[t].transaction.mutations,
|
|
|
|
|
SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS ? nullptr : &self->toCommit,
|
|
|
|
|
self->forceRecovery,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
self->commitVersion + 1,
|
|
|
|
|
/* initialCommit= */ false,
|
|
|
|
|
/* provisionalCommitProxy */ self->pProxyCommitData->provisional);
|
|
|
|
|
}
|
2022-12-16 04:30:43 +08:00
|
|
|
|
2023-03-01 07:47:00 +08:00
|
|
|
if (self->firstStateMutations) {
|
2026-03-16 08:42:43 +08:00
|
|
|
ASSERT(self->committed[t] == ConflictBatchStatus::TransactionCommitted);
|
2023-03-01 07:47:00 +08:00
|
|
|
self->firstStateMutations = false;
|
|
|
|
|
self->forceRecovery = false;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-01-13 04:29:03 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (self->forceRecovery) {
|
2020-07-29 15:42:52 +08:00
|
|
|
for (; t < trs.size(); t++)
|
2026-03-16 08:42:43 +08:00
|
|
|
self->committed[t] = ConflictBatchStatus::TransactionConflict;
|
2020-07-26 12:55:22 +08:00
|
|
|
TraceEvent(SevWarn, "RestartingTxnSubsystem", pProxyCommitData->dbgid).detail("Stage", "AwaitCommit");
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2021-10-10 13:12:00 +08:00
|
|
|
if (SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS) {
|
|
|
|
|
// Resolver also calculates forceRecovery and only applies metadata mutations
|
|
|
|
|
// in the same set of transactions as this proxy.
|
2021-10-09 09:03:01 +08:00
|
|
|
ResolveTransactionBatchReply& reply = self->resolution[0];
|
|
|
|
|
self->toCommit.setMutations(reply.privateMutationCount, reply.privateMutations);
|
2021-10-16 04:05:18 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
|
|
|
|
// TraceEvent("ResolverReturn").detail("ReturnTags",reply.writtenTags).detail("TPCVsize",reply.tpcvMap.size()).detail("ReqTags",self->writtenTagsPreResolution);
|
|
|
|
|
self->tpcvMap = reply.tpcvMap;
|
2025-03-12 01:19:57 +08:00
|
|
|
self->pProxyCommitData->lastShardMove = reply.lastShardMove;
|
2025-03-05 06:09:06 +08:00
|
|
|
|
|
|
|
|
// extract push locations from tpcv
|
|
|
|
|
std::vector<int> fromLocations;
|
|
|
|
|
fromLocations.reserve(reply.tpcvMap.size());
|
|
|
|
|
for (const auto& pair : self->tpcvMap) {
|
|
|
|
|
fromLocations.push_back(pair.first);
|
|
|
|
|
}
|
|
|
|
|
// save push locations for each tag
|
|
|
|
|
self->toCommit.setPushLocationsForTags(fromLocations);
|
2021-10-16 04:05:18 +08:00
|
|
|
}
|
2021-11-12 02:03:30 +08:00
|
|
|
self->toCommit.addWrittenTags(reply.writtenTags);
|
2021-10-09 09:03:01 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
self->lockedKey = pProxyCommitData->txnStateStore->readValue(databaseLockedKey).get();
|
|
|
|
|
self->lockedAfter = self->lockedKey.present() && self->lockedKey.get().size();
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
self->metadataVersionAfter = pProxyCommitData->txnStateStore->readValue(metadataVersionKey).get();
|
2019-03-01 09:45:00 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
auto fcm = pProxyCommitData->logAdapter->getCommitMessage();
|
|
|
|
|
self->storeCommits.emplace_back(fcm, pProxyCommitData->txnStateStore->commit());
|
2022-02-26 03:18:42 +08:00
|
|
|
pProxyCommitData->version.set(self->commitVersion);
|
2020-07-26 12:55:22 +08:00
|
|
|
if (!pProxyCommitData->validState.isSet())
|
|
|
|
|
pProxyCommitData->validState.send(Void());
|
|
|
|
|
ASSERT(self->commitVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (!self->isMyFirstBatch &&
|
2022-06-08 05:49:02 +08:00
|
|
|
pProxyCommitData->txnStateStore->readValue(coordinatorsKey).get().get() != self->previousCoordinators.get()) {
|
2022-01-07 04:15:51 +08:00
|
|
|
wait(brokenPromiseToNever(pProxyCommitData->db->get().clusterInterface.changeCoordinators.getReply(
|
2022-06-21 01:11:37 +08:00
|
|
|
ChangeCoordinatorsRequest(pProxyCommitData->txnStateStore->readValue(coordinatorsKey).get().get(),
|
|
|
|
|
self->pProxyCommitData->master.id()))));
|
2017-05-26 04:48:44 +08:00
|
|
|
ASSERT(false); // ChangeCoordinatorsRequest should always throw
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
WriteMutationRefVar writeMutation(CommitBatchContext* self, const MutationRef* mutation) {
|
|
|
|
|
self->toCommit.writeTypedMessage(*mutation);
|
|
|
|
|
return std::variant<MutationRef, VectorRef<MutationRef>>{ *mutation };
|
2022-06-30 05:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
void pushToBackupMutations(CommitBatchContext* self,
|
|
|
|
|
ProxyCommitData* const pProxyCommitData,
|
|
|
|
|
Arena& arena,
|
|
|
|
|
MutationRef const& m,
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
MutationRef const& writtenMutation) {
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
if (m.type != MutationRef::Type::ClearRange) {
|
2023-02-09 06:35:35 +08:00
|
|
|
// Add the mutation to the relevant backup tag
|
|
|
|
|
for (auto backupName : pProxyCommitData->vecBackupKeys[m.param1]) {
|
|
|
|
|
self->logRangeMutations[backupName].push_back_deep(self->logRangeMutationsArena, writtenMutation);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
KeyRangeRef mutationRange(m.param1, m.param2);
|
|
|
|
|
KeyRangeRef intersectionRange;
|
|
|
|
|
|
|
|
|
|
// Identify and add the intersecting ranges of the mutation to the array of mutations to serialize
|
|
|
|
|
for (auto backupRange : pProxyCommitData->vecBackupKeys.intersectingRanges(mutationRange)) {
|
|
|
|
|
// Get the backup sub range
|
|
|
|
|
const auto& backupSubrange = backupRange.range();
|
|
|
|
|
|
|
|
|
|
// Determine the intersecting range
|
|
|
|
|
intersectionRange = mutationRange & backupSubrange;
|
|
|
|
|
|
|
|
|
|
// Create the custom mutation for the specific backup tag
|
|
|
|
|
MutationRef backupMutation(MutationRef::Type::ClearRange, intersectionRange.begin, intersectionRange.end);
|
|
|
|
|
|
|
|
|
|
// Add the mutation to the relevant backup tag
|
|
|
|
|
for (auto backupName : backupRange.value()) {
|
|
|
|
|
self->logRangeMutations[backupName].push_back_deep(self->logRangeMutationsArena, backupMutation);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-05 06:03:44 +08:00
|
|
|
void addAccumulativeChecksumMutations(CommitBatchContext* self) {
|
|
|
|
|
ASSERT(self->pProxyCommitData->acsBuilder != nullptr);
|
|
|
|
|
const uint16_t acsIndex = getCommitProxyAccumulativeChecksumIndex(self->pProxyCommitData->commitProxyIndex);
|
|
|
|
|
for (const auto& [tag, acsState] : self->pProxyCommitData->acsBuilder->getAcsTable()) {
|
|
|
|
|
ASSERT(tagSupportAccumulativeChecksum(tag));
|
|
|
|
|
ASSERT(acsState.version <= self->commitVersion);
|
|
|
|
|
if (acsState.version < self->commitVersion) {
|
|
|
|
|
// Have not updated in the current commit batch
|
|
|
|
|
// So, need not send acs mutation for this tag
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
ASSERT(acsState.epoch == self->pProxyCommitData->epoch);
|
|
|
|
|
MutationRef acsMutation;
|
|
|
|
|
acsMutation.type = MutationRef::SetValue;
|
|
|
|
|
acsMutation.param1 = accumulativeChecksumKey; // private mutation
|
2024-11-05 05:15:26 +08:00
|
|
|
AccumulativeChecksumState acsToSend(acsIndex, acsState.acs, self->commitVersion, self->pProxyCommitData->epoch);
|
|
|
|
|
Value acsValue = accumulativeChecksumValue(acsToSend);
|
2024-04-20 16:31:55 +08:00
|
|
|
acsMutation.param2 = acsValue;
|
2024-04-05 06:03:44 +08:00
|
|
|
acsMutation.setAccumulativeChecksumIndex(acsIndex);
|
|
|
|
|
if (CLIENT_KNOBS->ENABLE_ACCUMULATIVE_CHECKSUM_LOGGING) {
|
|
|
|
|
TraceEvent(SevInfo, "AcsBuilderIssueAccumulativeChecksumMutation", self->pProxyCommitData->dbgid)
|
|
|
|
|
.detail("AcsTag", tag)
|
|
|
|
|
.detail("AcsIndex", acsIndex)
|
2024-11-05 05:15:26 +08:00
|
|
|
.detail("AcsToSend", acsToSend.toString())
|
2024-04-05 06:03:44 +08:00
|
|
|
.detail("Mutation", acsMutation)
|
2025-03-10 02:37:46 +08:00
|
|
|
.detail("Version", self->commitVersion)
|
2024-04-05 06:03:44 +08:00
|
|
|
.detail("CommitProxyIndex", self->pProxyCommitData->commitProxyIndex);
|
|
|
|
|
}
|
2025-03-10 02:37:46 +08:00
|
|
|
DEBUG_MUTATION("ProxyCommit", self->commitVersion, acsMutation, self->pProxyCommitData->dbgid);
|
2024-04-05 06:03:44 +08:00
|
|
|
self->toCommit.addTag(tag);
|
|
|
|
|
self->toCommit.writeTypedMessage(acsMutation);
|
|
|
|
|
}
|
|
|
|
|
}
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
void rejectMutationsForReadLockOnRange(CommitBatchContext* self) {
|
2024-11-02 00:48:25 +08:00
|
|
|
ASSERT(self->rangeLockEnabled());
|
2024-10-24 07:25:56 +08:00
|
|
|
ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
|
|
|
|
ASSERT(pProxyCommitData->rangeLock != nullptr);
|
|
|
|
|
std::vector<CommitTransactionRequest>& trs = self->trs;
|
|
|
|
|
for (int i = self->transactionNum; i < trs.size(); i++) {
|
2026-03-16 08:42:43 +08:00
|
|
|
if (self->committed[i] != ConflictBatchStatus::TransactionCommitted) {
|
2024-10-24 07:25:56 +08:00
|
|
|
continue;
|
2024-11-02 00:48:25 +08:00
|
|
|
} else if (trs[i].isLockAware()) {
|
|
|
|
|
continue; // rangeLock is transparent to lock-aware transactions
|
2024-10-24 07:25:56 +08:00
|
|
|
}
|
|
|
|
|
VectorRef<MutationRef>* pMutations = &trs[i].transaction.mutations;
|
|
|
|
|
for (int j = 0; j < pMutations->size(); j++) {
|
|
|
|
|
MutationRef m = (*pMutations)[j];
|
|
|
|
|
KeyRange rangeToCheck;
|
|
|
|
|
if (isSingleKeyMutation((MutationRef::Type)m.type)) {
|
|
|
|
|
rangeToCheck = singleKeyRange(m.param1);
|
|
|
|
|
} else if (m.type == MutationRef::ClearRange) {
|
|
|
|
|
rangeToCheck = KeyRangeRef(m.param1, m.param2);
|
|
|
|
|
}
|
|
|
|
|
bool shouldReject = pProxyCommitData->rangeLock->isLocked(rangeToCheck);
|
|
|
|
|
if (shouldReject) {
|
2026-03-16 08:42:43 +08:00
|
|
|
self->committed[i] = ConflictBatchStatus::TransactionLockReject;
|
2024-10-24 07:25:56 +08:00
|
|
|
trs[i].reply.sendError(transaction_rejected_range_locked());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
/// This second pass through committed transactions assigns the actual mutations to the appropriate storage servers'
|
|
|
|
|
/// tags
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> assignMutationsToStorageServers(CommitBatchContext* self) {
|
2020-07-29 15:42:52 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
|
|
|
|
state std::vector<CommitTransactionRequest>& trs = self->trs;
|
2019-08-09 06:00:33 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
for (; self->transactionNum < trs.size(); self->transactionNum++) {
|
2026-03-16 08:42:43 +08:00
|
|
|
if (!(self->committed[self->transactionNum] == ConflictBatchStatus::TransactionCommitted &&
|
2020-07-29 15:42:52 +08:00
|
|
|
(!self->locked || trs[self->transactionNum].isLockAware()))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-10-19 06:26:00 +08:00
|
|
|
|
2020-08-19 12:23:23 +08:00
|
|
|
state bool checkSample = trs[self->transactionNum].commitCostEstimation.present();
|
2020-08-11 08:14:55 +08:00
|
|
|
state Optional<ClientTrCommitCostEstimation>* trCost = &trs[self->transactionNum].commitCostEstimation;
|
2020-07-29 15:42:52 +08:00
|
|
|
state int mutationNum = 0;
|
|
|
|
|
state VectorRef<MutationRef>* pMutations = &trs[self->transactionNum].transaction.mutations;
|
2023-02-09 05:25:46 +08:00
|
|
|
|
2020-08-28 07:16:05 +08:00
|
|
|
self->toCommit.addTransactionInfo(trs[self->transactionNum].spanContext);
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
for (; mutationNum < pMutations->size(); mutationNum++) {
|
|
|
|
|
if (self->yieldBytes > SERVER_KNOBS->DESIRED_TOTAL_BYTES) {
|
|
|
|
|
self->yieldBytes = 0;
|
|
|
|
|
if (g_network->check_yield(TaskPriority::ProxyCommitYield1)) {
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeDuration += g_network->timer_monotonic() - self->computeStart;
|
2020-07-29 15:42:52 +08:00
|
|
|
wait(delay(0, TaskPriority::ProxyCommitYield1));
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeStart = g_network->timer_monotonic();
|
2018-10-19 06:26:00 +08:00
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2022-09-21 06:43:39 +08:00
|
|
|
state MutationRef m = (*pMutations)[mutationNum];
|
|
|
|
|
state Arena arena;
|
|
|
|
|
state MutationRef writtenMutation;
|
2020-07-29 15:42:52 +08:00
|
|
|
self->mutationCount++;
|
|
|
|
|
self->mutationBytes += m.expectedSize();
|
|
|
|
|
self->yieldBytes += m.expectedSize();
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
// Determine the set of tags (responsible storage servers) for the mutation, splitting it
|
|
|
|
|
// if necessary. Serialize (splits of) the mutation into the message buffer and add the tags.
|
|
|
|
|
if (isSingleKeyMutation((MutationRef::Type)m.type)) {
|
|
|
|
|
auto& tags = pProxyCommitData->tagsForKey(m.param1);
|
|
|
|
|
|
2020-08-21 07:00:45 +08:00
|
|
|
// sample single key mutation based on cost
|
2020-08-11 08:14:55 +08:00
|
|
|
// the expectation of sampling is every COMMIT_SAMPLE_COST sample once
|
|
|
|
|
if (checkSample) {
|
|
|
|
|
double totalCosts = trCost->get().writeCosts;
|
2020-08-18 04:01:19 +08:00
|
|
|
double cost = getWriteOperationCost(m.expectedSize());
|
2020-08-11 08:14:55 +08:00
|
|
|
double mul = std::max(1.0, totalCosts / std::max(1.0, (double)CLIENT_KNOBS->COMMIT_SAMPLE_COST));
|
|
|
|
|
ASSERT(totalCosts > 0);
|
|
|
|
|
double prob = mul * cost / totalCosts;
|
2020-08-15 02:18:54 +08:00
|
|
|
|
2020-08-30 03:35:31 +08:00
|
|
|
if (deterministicRandom()->random01() < prob) {
|
2022-11-09 15:17:26 +08:00
|
|
|
const auto& storageServers = pProxyCommitData->keyInfo[m.param1].src_info;
|
|
|
|
|
for (const auto& ssInfo : storageServers) {
|
2020-08-11 08:14:55 +08:00
|
|
|
auto id = ssInfo->interf.id();
|
2020-08-20 00:52:50 +08:00
|
|
|
// scale cost
|
|
|
|
|
cost = cost < CLIENT_KNOBS->COMMIT_SAMPLE_COST ? CLIENT_KNOBS->COMMIT_SAMPLE_COST : cost;
|
2022-11-09 15:17:26 +08:00
|
|
|
pProxyCommitData->updateSSTagCost(
|
|
|
|
|
id, trs[self->transactionNum].tagSet.get(), m, cost / storageServers.size());
|
2020-08-01 14:14:52 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-11 08:14:55 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-08-10 16:52:36 +08:00
|
|
|
DEBUG_MUTATION("ProxyCommit", self->commitVersion, m, pProxyCommitData->dbgid).detail("To", tags);
|
2020-07-29 15:42:52 +08:00
|
|
|
self->toCommit.addTags(tags);
|
2023-07-15 02:30:16 +08:00
|
|
|
|
2024-04-05 06:03:44 +08:00
|
|
|
if (pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
pProxyCommitData->acsBuilder,
|
|
|
|
|
m,
|
|
|
|
|
tags,
|
|
|
|
|
getCommitProxyAccumulativeChecksumIndex(pProxyCommitData->commitProxyIndex),
|
|
|
|
|
pProxyCommitData->epoch,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->dbgid);
|
|
|
|
|
}
|
|
|
|
|
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
WriteMutationRefVar var = writeMutation(self, &m);
|
2022-11-04 22:40:41 +08:00
|
|
|
// FIXME: Remove assert once ClearRange RAW_ACCESS usecase handling is done
|
|
|
|
|
ASSERT(std::holds_alternative<MutationRef>(var));
|
|
|
|
|
writtenMutation = std::get<MutationRef>(var);
|
2020-07-29 15:42:52 +08:00
|
|
|
} else if (m.type == MutationRef::ClearRange) {
|
2025-04-27 01:45:46 +08:00
|
|
|
auto range = pProxyCommitData->keyInfo.rangeContaining(m.param1);
|
|
|
|
|
if (range.end() >= m.param2) {
|
2020-07-29 15:42:52 +08:00
|
|
|
// Fast path
|
2021-08-10 16:52:36 +08:00
|
|
|
DEBUG_MUTATION("ProxyCommit", self->commitVersion, m, pProxyCommitData->dbgid)
|
2025-04-27 01:45:46 +08:00
|
|
|
.detail("To", range.value().tags);
|
|
|
|
|
range.value().populateTags();
|
|
|
|
|
self->toCommit.addTags(range.value().tags);
|
2020-08-15 02:18:54 +08:00
|
|
|
|
2024-04-05 06:03:44 +08:00
|
|
|
if (pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
pProxyCommitData->acsBuilder,
|
|
|
|
|
m,
|
2025-04-27 01:45:46 +08:00
|
|
|
range.value().tags,
|
2024-04-05 06:03:44 +08:00
|
|
|
getCommitProxyAccumulativeChecksumIndex(pProxyCommitData->commitProxyIndex),
|
|
|
|
|
pProxyCommitData->epoch,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->dbgid);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 08:14:55 +08:00
|
|
|
// check whether clear is sampled
|
2020-08-30 03:35:31 +08:00
|
|
|
if (checkSample && !trCost->get().clearIdxCosts.empty() &&
|
|
|
|
|
trCost->get().clearIdxCosts[0].first == mutationNum) {
|
2025-04-27 01:45:46 +08:00
|
|
|
auto const& ssInfos = range.value().src_info;
|
2023-08-23 06:29:28 +08:00
|
|
|
for (auto const& ssInfo : ssInfos) {
|
2020-08-11 08:14:55 +08:00
|
|
|
auto id = ssInfo->interf.id();
|
2023-08-23 06:29:28 +08:00
|
|
|
pProxyCommitData->updateSSTagCost(id,
|
|
|
|
|
trs[self->transactionNum].tagSet.get(),
|
|
|
|
|
m,
|
|
|
|
|
trCost->get().clearIdxCosts[0].second / ssInfos.size());
|
2020-08-11 08:14:55 +08:00
|
|
|
}
|
2020-08-15 02:18:54 +08:00
|
|
|
trCost->get().clearIdxCosts.pop_front();
|
2019-11-13 05:01:29 +08:00
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
} else {
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(true, "A clear range extends past a shard boundary");
|
2020-07-29 15:42:52 +08:00
|
|
|
std::set<Tag> allSources;
|
2025-04-27 01:45:46 +08:00
|
|
|
while (range.begin() < m.param2) {
|
|
|
|
|
range.value().populateTags();
|
|
|
|
|
allSources.insert(range.value().tags.begin(), range.value().tags.end());
|
2020-08-15 02:18:54 +08:00
|
|
|
|
2020-08-01 14:14:52 +08:00
|
|
|
// check whether clear is sampled
|
2020-08-30 03:35:31 +08:00
|
|
|
if (checkSample && !trCost->get().clearIdxCosts.empty() &&
|
|
|
|
|
trCost->get().clearIdxCosts[0].first == mutationNum) {
|
2025-04-27 01:45:46 +08:00
|
|
|
auto const& ssInfos = range.value().src_info;
|
2023-08-23 06:29:28 +08:00
|
|
|
for (auto const& ssInfo : ssInfos) {
|
2020-08-01 14:48:40 +08:00
|
|
|
auto id = ssInfo->interf.id();
|
2020-08-30 03:35:31 +08:00
|
|
|
pProxyCommitData->updateSSTagCost(id,
|
|
|
|
|
trs[self->transactionNum].tagSet.get(),
|
|
|
|
|
m,
|
2023-08-23 06:29:28 +08:00
|
|
|
trCost->get().clearIdxCosts[0].second /
|
|
|
|
|
ssInfos.size());
|
2020-08-01 14:48:40 +08:00
|
|
|
}
|
2020-08-15 02:18:54 +08:00
|
|
|
trCost->get().clearIdxCosts.pop_front();
|
2020-08-01 14:48:40 +08:00
|
|
|
}
|
2025-04-27 01:45:46 +08:00
|
|
|
++range;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2019-11-13 05:01:29 +08:00
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
DEBUG_MUTATION("ProxyCommit", self->commitVersion, m)
|
|
|
|
|
.detail("Dbgid", pProxyCommitData->dbgid)
|
2021-10-22 14:14:31 +08:00
|
|
|
.detail("To", allSources);
|
2020-07-29 15:42:52 +08:00
|
|
|
self->toCommit.addTags(allSources);
|
2024-04-05 06:03:44 +08:00
|
|
|
|
|
|
|
|
if (self->pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
pProxyCommitData->acsBuilder,
|
|
|
|
|
m,
|
|
|
|
|
allSources,
|
|
|
|
|
getCommitProxyAccumulativeChecksumIndex(pProxyCommitData->commitProxyIndex),
|
|
|
|
|
pProxyCommitData->epoch,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->dbgid);
|
|
|
|
|
}
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2025-04-27 01:45:46 +08:00
|
|
|
KeyRangeRef clearRange(KeyRangeRef(m.param1, m.param2));
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
WriteMutationRefVar var = writeMutation(self, &m);
|
2022-11-04 22:40:41 +08:00
|
|
|
// FIXME: Remove assert once ClearRange RAW_ACCESS usecase handling is done
|
|
|
|
|
ASSERT(std::holds_alternative<MutationRef>(var));
|
|
|
|
|
writtenMutation = std::get<MutationRef>(var);
|
2023-02-10 14:28:18 +08:00
|
|
|
} else if (m.type == MutationRef::NoOp) {
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
// TODO(gglass): what is the deal with MutationRef::NoOp? Is it needed?
|
|
|
|
|
// This used to be the following:
|
|
|
|
|
// ASSERT_EQ(pProxyCommitData->getTenantMode(), TenantMode::REQUIRED);
|
|
|
|
|
ASSERT(false);
|
2023-02-10 14:28:18 +08:00
|
|
|
continue;
|
2020-07-29 15:42:52 +08:00
|
|
|
} else {
|
|
|
|
|
UNREACHABLE();
|
|
|
|
|
}
|
2019-03-01 09:45:00 +08:00
|
|
|
|
2023-02-10 14:28:18 +08:00
|
|
|
DisabledTraceEvent(SevDebug, "BeforeBackup", pProxyCommitData->dbgid)
|
|
|
|
|
.detail("M1", m.param1)
|
|
|
|
|
.detail("M2", m.param2)
|
|
|
|
|
.detail("MT", getTypeString(m.type))
|
|
|
|
|
.detail("VecBackupKeys", pProxyCommitData->vecBackupKeys.size())
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
.detail("ShouldBackup", shouldBackup(m));
|
2022-09-28 06:25:30 +08:00
|
|
|
|
2023-02-09 05:25:46 +08:00
|
|
|
if (pProxyCommitData->vecBackupKeys.size() <= 1 || !shouldBackup(m)) {
|
2020-07-29 15:42:52 +08:00
|
|
|
continue;
|
|
|
|
|
}
|
2022-09-21 06:43:39 +08:00
|
|
|
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
pushToBackupMutations(self, pProxyCommitData, arena, m, writtenMutation);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2020-08-21 07:00:45 +08:00
|
|
|
|
2020-08-30 03:35:31 +08:00
|
|
|
if (checkSample) {
|
2020-08-21 07:00:45 +08:00
|
|
|
self->pProxyCommitData->stats.txnExpensiveClearCostEstCount +=
|
|
|
|
|
trs[self->transactionNum].commitCostEstimation.get().expensiveCostEstCount;
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> postResolution(CommitBatchContext* self) {
|
2023-06-08 10:09:23 +08:00
|
|
|
state double postResolutionStart = g_network->timer_monotonic();
|
2020-07-29 15:42:52 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
|
|
|
|
state std::vector<CommitTransactionRequest>& trs = self->trs;
|
|
|
|
|
state const int64_t localBatchNumber = self->localBatchNumber;
|
|
|
|
|
state const Optional<UID>& debugID = self->debugID;
|
2020-08-29 03:02:51 +08:00
|
|
|
state Span span("MP:postResolution"_loc, self->span.context);
|
2020-07-29 15:42:52 +08:00
|
|
|
|
2021-04-14 01:48:52 +08:00
|
|
|
bool queuedCommits = pProxyCommitData->latestLocalCommitBatchLogging.get() < localBatchNumber - 1;
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(queuedCommits, "Queuing post-resolution commit processing");
|
2020-07-29 15:42:52 +08:00
|
|
|
wait(pProxyCommitData->latestLocalCommitBatchLogging.whenAtLeast(localBatchNumber - 1));
|
2023-06-08 10:09:23 +08:00
|
|
|
state double postResolutionQueuing = g_network->timer_monotonic();
|
2021-08-06 00:17:37 +08:00
|
|
|
pProxyCommitData->stats.postResolutionDist->sampleSeconds(postResolutionQueuing - postResolutionStart);
|
2020-07-29 15:42:52 +08:00
|
|
|
wait(yield(TaskPriority::ProxyCommitYield1));
|
|
|
|
|
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeStart = g_network->timer_monotonic();
|
2020-07-29 15:42:52 +08:00
|
|
|
|
|
|
|
|
pProxyCommitData->stats.txnCommitResolved += trs.size();
|
|
|
|
|
|
|
|
|
|
if (debugID.present()) {
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.ProcessingMutations");
|
2020-07-29 15:42:52 +08:00
|
|
|
}
|
|
|
|
|
|
2022-02-26 03:18:42 +08:00
|
|
|
self->isMyFirstBatch = !pProxyCommitData->version.get();
|
2022-06-08 05:49:02 +08:00
|
|
|
self->previousCoordinators = pProxyCommitData->txnStateStore->readValue(coordinatorsKey).get();
|
2020-07-29 15:42:52 +08:00
|
|
|
|
|
|
|
|
assertResolutionStateMutationsSizeConsistent(self->resolution);
|
|
|
|
|
|
|
|
|
|
applyMetadataEffect(self);
|
|
|
|
|
|
2022-01-07 04:15:51 +08:00
|
|
|
if (debugID.present()) {
|
2023-01-21 09:23:08 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.ApplyMetadataEffect");
|
2022-01-07 04:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
determineCommittedTransactions(self);
|
|
|
|
|
|
2022-01-07 04:15:51 +08:00
|
|
|
if (debugID.present()) {
|
2023-01-21 09:23:08 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.DetermineCommittedTransactions");
|
2022-01-07 04:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
if (self->forceRecovery) {
|
|
|
|
|
wait(Future<Void>(Never()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// First pass
|
|
|
|
|
wait(applyMetadataToCommittedTransactions(self));
|
|
|
|
|
|
2022-01-07 04:15:51 +08:00
|
|
|
if (debugID.present()) {
|
|
|
|
|
g_traceBatch.addEvent(
|
2023-01-21 09:23:08 +08:00
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.ApplyMetadataToCommittedTxn");
|
2022-01-07 04:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
// After applyed metadata change, this commit proxy has the latest view of locked ranges.
|
|
|
|
|
// If a transaction has any mutation accessing to the locked range, reject the transaction with
|
|
|
|
|
// error_code_transaction_rejected_range_locked
|
2024-11-02 00:48:25 +08:00
|
|
|
if (self->rangeLockEnabled()) {
|
2024-10-24 07:25:56 +08:00
|
|
|
rejectMutationsForReadLockOnRange(self);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-29 15:42:52 +08:00
|
|
|
// Second pass
|
|
|
|
|
wait(assignMutationsToStorageServers(self));
|
|
|
|
|
|
2022-01-07 04:15:51 +08:00
|
|
|
if (debugID.present()) {
|
|
|
|
|
g_traceBatch.addEvent("CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.AssignMutationToSS");
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
// Serialize and backup the mutations as a single mutation
|
2020-07-26 12:55:22 +08:00
|
|
|
if ((pProxyCommitData->vecBackupKeys.size() > 1) && self->logRangeMutations.size()) {
|
|
|
|
|
wait(addBackupMutations(pProxyCommitData,
|
|
|
|
|
&self->logRangeMutations,
|
|
|
|
|
&self->toCommit,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
&self->computeDuration,
|
|
|
|
|
&self->computeStart));
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2025-03-22 06:30:06 +08:00
|
|
|
// When version vector is enabled, idempotency entries should only be created or cleared
|
|
|
|
|
// if the operation was detected at pre resolution time. This ensures that the
|
|
|
|
|
// operation is broadcast to all logs, and does not lead to logs being included
|
|
|
|
|
// that are not part of the expected tag set (tpcv).
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
buildIdempotencyIdMutations(self->trs,
|
|
|
|
|
self->idempotencyKVBuilder,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
self->committed,
|
2026-03-16 08:42:43 +08:00
|
|
|
ConflictBatchStatus::TransactionCommitted,
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
self->locked,
|
|
|
|
|
[&](const KeyValue& kv) {
|
|
|
|
|
MutationRef idempotencyIdSet;
|
|
|
|
|
idempotencyIdSet.type = MutationRef::Type::SetValue;
|
|
|
|
|
idempotencyIdSet.param1 = kv.key;
|
|
|
|
|
idempotencyIdSet.param2 = kv.value;
|
|
|
|
|
auto& tags = pProxyCommitData->tagsForKey(kv.key);
|
|
|
|
|
ASSERT(!SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST ||
|
|
|
|
|
pProxyCommitData->db->get().logSystemConfig.numLogs() ==
|
|
|
|
|
self->tpcvMap.size());
|
|
|
|
|
self->toCommit.addTags(tags);
|
|
|
|
|
if (pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
pProxyCommitData->acsBuilder,
|
|
|
|
|
idempotencyIdSet,
|
|
|
|
|
tags,
|
|
|
|
|
getCommitProxyAccumulativeChecksumIndex(pProxyCommitData->commitProxyIndex),
|
|
|
|
|
pProxyCommitData->epoch,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->dbgid);
|
|
|
|
|
}
|
|
|
|
|
self->toCommit.writeTypedMessage(idempotencyIdSet);
|
|
|
|
|
});
|
2025-03-22 06:30:06 +08:00
|
|
|
|
|
|
|
|
if (!SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST ||
|
|
|
|
|
pProxyCommitData->db->get().logSystemConfig.numLogs() == self->tpcvMap.size()) {
|
|
|
|
|
state int i = 0;
|
|
|
|
|
for (i = 0; i < pProxyCommitData->idempotencyClears.size(); i++) {
|
|
|
|
|
auto& tags = pProxyCommitData->tagsForKey(pProxyCommitData->idempotencyClears[i].param1);
|
|
|
|
|
self->toCommit.addTags(tags);
|
|
|
|
|
if (pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
updateMutationWithAcsAndAddMutationToAcsBuilder(
|
|
|
|
|
pProxyCommitData->acsBuilder,
|
|
|
|
|
pProxyCommitData->idempotencyClears[i],
|
|
|
|
|
tags,
|
|
|
|
|
getCommitProxyAccumulativeChecksumIndex(pProxyCommitData->commitProxyIndex),
|
|
|
|
|
pProxyCommitData->epoch,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->dbgid);
|
|
|
|
|
}
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
WriteMutationRefVar var = writeMutation(self, &pProxyCommitData->idempotencyClears[i]);
|
2025-03-22 06:30:06 +08:00
|
|
|
ASSERT(std::holds_alternative<MutationRef>(var));
|
|
|
|
|
}
|
|
|
|
|
pProxyCommitData->idempotencyClears = Standalone<VectorRef<MutationRef>>();
|
|
|
|
|
}
|
2022-10-05 02:07:41 +08:00
|
|
|
|
2021-10-22 14:14:31 +08:00
|
|
|
self->toCommit.saveTags(self->writtenTags);
|
|
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
pProxyCommitData->stats.mutations += self->mutationCount;
|
|
|
|
|
pProxyCommitData->stats.mutationBytes += self->mutationBytes;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2022-09-22 00:59:09 +08:00
|
|
|
// Storage servers mustn't make durable versions which are not fully committed (because then they are impossible
|
|
|
|
|
// to roll back) We prevent this by limiting the number of versions which are semi-committed but not fully
|
|
|
|
|
// committed to be less than the MVCC window
|
2020-07-26 12:55:22 +08:00
|
|
|
if (pProxyCommitData->committedVersion.get() <
|
|
|
|
|
self->commitVersion - SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS) {
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeDuration += g_network->timer_monotonic() - self->computeStart;
|
2020-07-08 00:06:13 +08:00
|
|
|
state Span waitVersionSpan;
|
2020-07-26 12:55:22 +08:00
|
|
|
while (pProxyCommitData->committedVersion.get() <
|
|
|
|
|
self->commitVersion - SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS) {
|
2020-01-27 11:47:12 +08:00
|
|
|
// This should be *extremely* rare in the real world, but knob buggification should make it happen in
|
|
|
|
|
// simulation
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(true, "Semi-committed pipeline limited by MVCC window");
|
2020-07-26 12:55:22 +08:00
|
|
|
//TraceEvent("ProxyWaitingForCommitted", pProxyCommitData->dbgid).detail("CommittedVersion", pProxyCommitData->committedVersion.get()).detail("NeedToCommit", commitVersion);
|
2022-05-03 03:56:51 +08:00
|
|
|
waitVersionSpan = Span("MP:overMaxReadTransactionLifeVersions"_loc, span.context);
|
2020-01-27 11:47:12 +08:00
|
|
|
choose {
|
2020-07-26 12:55:22 +08:00
|
|
|
when(wait(pProxyCommitData->committedVersion.whenAtLeast(
|
|
|
|
|
self->commitVersion - SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS))) {
|
2020-01-27 11:47:12 +08:00
|
|
|
wait(yield());
|
2020-07-26 12:44:10 +08:00
|
|
|
break;
|
2020-01-27 11:47:12 +08:00
|
|
|
}
|
2020-08-12 10:22:10 +08:00
|
|
|
when(wait(pProxyCommitData->cx->onProxiesChanged())) {}
|
2021-07-20 00:56:02 +08:00
|
|
|
// @todo probably there is no need to get the (entire) version vector from the sequencer
|
|
|
|
|
// in this case, and if so, consider adding a flag to the request to tell the sequencer
|
|
|
|
|
// to not send the version vector information.
|
2020-08-12 10:22:10 +08:00
|
|
|
when(GetRawCommittedVersionReply v = wait(pProxyCommitData->master.getLiveCommittedVersion.getReply(
|
2021-07-15 03:31:01 +08:00
|
|
|
GetRawCommittedVersionRequest(waitVersionSpan.context, debugID, invalidVersion),
|
2020-07-29 22:26:55 +08:00
|
|
|
TaskPriority::GetLiveCommittedVersionReply))) {
|
2020-07-26 12:55:22 +08:00
|
|
|
if (v.version > pProxyCommitData->committedVersion.get()) {
|
|
|
|
|
pProxyCommitData->locked = v.locked;
|
|
|
|
|
pProxyCommitData->metadataVersion = v.metadataVersion;
|
|
|
|
|
pProxyCommitData->committedVersion.set(v.version);
|
2020-01-27 11:47:12 +08:00
|
|
|
}
|
2020-06-09 07:09:37 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (pProxyCommitData->committedVersion.get() <
|
|
|
|
|
self->commitVersion - SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS)
|
2020-01-27 11:47:12 +08:00
|
|
|
wait(delay(SERVER_KNOBS->PROXY_SPIN_DELAY));
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-08 00:06:13 +08:00
|
|
|
waitVersionSpan = Span{};
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeStart = g_network->timer_monotonic();
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
self->msg = self->storeCommits.back().first.get();
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (self->debugID.present())
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", self->debugID.get().first(), "CommitProxyServer.commitBatch.AfterStoreCommits");
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
// txnState (transaction subsystem state) tag: message extracted from log adapter
|
|
|
|
|
bool firstMessage = true;
|
2020-07-26 12:55:22 +08:00
|
|
|
for (auto m : self->msg.messages) {
|
2017-07-16 06:15:03 +08:00
|
|
|
if (firstMessage) {
|
2024-04-02 03:20:32 +08:00
|
|
|
ASSERT(!SERVER_KNOBS->ENABLE_VERSION_VECTOR ||
|
|
|
|
|
pProxyCommitData->db->get().logSystemConfig.numLogs() == self->tpcvMap.size());
|
2020-07-26 12:55:22 +08:00
|
|
|
self->toCommit.addTxsTag();
|
2017-07-16 06:15:03 +08:00
|
|
|
}
|
2020-08-28 07:16:05 +08:00
|
|
|
self->toCommit.writeMessage(StringRef(m.begin(), m.size()), !firstMessage);
|
2017-05-26 04:48:44 +08:00
|
|
|
firstMessage = false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (self->prevVersion && self->commitVersion - self->prevVersion < SERVER_KNOBS->MAX_VERSIONS_IN_FLIGHT / 2)
|
|
|
|
|
debug_advanceMaxCommittedVersion(UID(), self->commitVersion); //< Is this valid?
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-07-14 08:39:42 +08:00
|
|
|
// TraceEvent("ProxyPush", pProxyCommitData->dbgid)
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
// .detail("PrevVersion", self->prevVersion)
|
|
|
|
|
// .detail("Version", self->commitVersion)
|
|
|
|
|
// .detail("TransactionsSubmitted", trs.size())
|
|
|
|
|
// .detail("TransactionsCommitted", self->commitCount)
|
|
|
|
|
// .detail("TxsPopTo", self->msg.popTo);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (self->prevVersion && self->commitVersion - self->prevVersion < SERVER_KNOBS->MAX_VERSIONS_IN_FLIGHT / 2)
|
|
|
|
|
debug_advanceMaxCommittedVersion(UID(), self->commitVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
self->commitStartTime = now();
|
|
|
|
|
pProxyCommitData->lastStartCommit = self->commitStartTime;
|
2021-07-16 21:14:34 +08:00
|
|
|
Optional<std::unordered_map<uint16_t, Version>> tpcvMap = Optional<std::unordered_map<uint16_t, Version>>();
|
2021-07-14 09:36:29 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
|
|
|
|
|
tpcvMap = self->tpcvMap;
|
|
|
|
|
}
|
2024-04-05 06:03:44 +08:00
|
|
|
if (self->pProxyCommitData->acsBuilder != nullptr) {
|
|
|
|
|
// Issue acs mutation at the end of this commit batch
|
|
|
|
|
addAccumulativeChecksumMutations(self);
|
|
|
|
|
}
|
2024-07-24 08:26:11 +08:00
|
|
|
const auto versionSet = ILogSystem::PushVersionSet{ self->prevVersion,
|
|
|
|
|
self->commitVersion,
|
|
|
|
|
pProxyCommitData->committedVersion.get(),
|
|
|
|
|
pProxyCommitData->minKnownCommittedVersion };
|
|
|
|
|
self->loggingComplete =
|
|
|
|
|
pProxyCommitData->logSystem->push(versionSet, self->toCommit, span.context, self->debugID, tpcvMap);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-06-29 02:08:20 +08:00
|
|
|
float ratio = self->toCommit.getEmptyMessageRatio();
|
2021-06-25 12:20:21 +08:00
|
|
|
pProxyCommitData->stats.commitBatchingEmptyMessageRatio.addMeasurement(ratio);
|
|
|
|
|
|
2020-07-26 12:55:22 +08:00
|
|
|
if (!self->forceRecovery) {
|
|
|
|
|
ASSERT(pProxyCommitData->latestLocalCommitBatchLogging.get() == self->localBatchNumber - 1);
|
|
|
|
|
pProxyCommitData->latestLocalCommitBatchLogging.set(self->localBatchNumber);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-08 10:09:23 +08:00
|
|
|
self->computeDuration += g_network->timer_monotonic() - self->computeStart;
|
2020-10-20 13:51:56 +08:00
|
|
|
if (self->batchOperations > 0) {
|
2022-04-21 06:46:41 +08:00
|
|
|
double estimatedDelay = computeReleaseDelay(self, self->latencyBucket);
|
2020-10-20 13:51:56 +08:00
|
|
|
double computePerOperation =
|
|
|
|
|
std::min(SERVER_KNOBS->MAX_COMPUTE_PER_OPERATION, self->computeDuration / self->batchOperations);
|
2022-04-21 06:02:08 +08:00
|
|
|
|
2020-10-20 13:51:56 +08:00
|
|
|
if (computePerOperation <= pProxyCommitData->commitComputePerOperation[self->latencyBucket]) {
|
|
|
|
|
pProxyCommitData->commitComputePerOperation[self->latencyBucket] = computePerOperation;
|
|
|
|
|
} else {
|
|
|
|
|
pProxyCommitData->commitComputePerOperation[self->latencyBucket] =
|
|
|
|
|
SERVER_KNOBS->PROXY_COMPUTE_GROWTH_RATE * computePerOperation +
|
|
|
|
|
((1.0 - SERVER_KNOBS->PROXY_COMPUTE_GROWTH_RATE) *
|
|
|
|
|
pProxyCommitData->commitComputePerOperation[self->latencyBucket]);
|
|
|
|
|
}
|
|
|
|
|
pProxyCommitData->stats.maxComputeNS =
|
|
|
|
|
std::max<int64_t>(pProxyCommitData->stats.maxComputeNS,
|
|
|
|
|
1e9 * pProxyCommitData->commitComputePerOperation[self->latencyBucket]);
|
|
|
|
|
pProxyCommitData->stats.minComputeNS =
|
|
|
|
|
std::min<int64_t>(pProxyCommitData->stats.minComputeNS,
|
|
|
|
|
1e9 * pProxyCommitData->commitComputePerOperation[self->latencyBucket]);
|
2022-04-21 06:46:41 +08:00
|
|
|
|
|
|
|
|
if (estimatedDelay >= SERVER_KNOBS->MAX_COMPUTE_DURATION_LOG_CUTOFF ||
|
|
|
|
|
self->computeDuration >= SERVER_KNOBS->MAX_COMPUTE_DURATION_LOG_CUTOFF) {
|
2022-04-27 22:31:04 +08:00
|
|
|
TraceEvent(SevInfo, "LongComputeDuration", pProxyCommitData->dbgid)
|
2022-04-21 06:46:41 +08:00
|
|
|
.suppressFor(10.0)
|
|
|
|
|
.detail("EstimatedComputeDuration", estimatedDelay)
|
|
|
|
|
.detail("ComputeDuration", self->computeDuration)
|
|
|
|
|
.detail("ComputePerOperation", computePerOperation)
|
|
|
|
|
.detail("LatencyBucket", self->latencyBucket)
|
|
|
|
|
.detail("UpdatedComputePerOperationEstimate",
|
|
|
|
|
pProxyCommitData->commitComputePerOperation[self->latencyBucket])
|
|
|
|
|
.detail("BatchBytes", self->batchBytes)
|
|
|
|
|
.detail("BatchOperations", self->batchOperations);
|
|
|
|
|
}
|
2020-10-20 13:51:56 +08:00
|
|
|
}
|
2020-01-27 11:47:12 +08:00
|
|
|
|
2023-06-08 10:09:23 +08:00
|
|
|
pProxyCommitData->stats.processingMutationDist->sampleSeconds(g_network->timer_monotonic() - postResolutionQueuing);
|
2020-07-26 12:55:22 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> transactionLogging(CommitBatchContext* self) {
|
2023-06-08 10:09:23 +08:00
|
|
|
state double tLoggingStart = g_network->timer_monotonic();
|
2020-07-26 09:11:25 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
2020-08-29 03:02:51 +08:00
|
|
|
state Span span("MP:transactionLogging"_loc, self->span.context);
|
2018-06-22 06:29:46 +08:00
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
choose {
|
2020-07-26 09:11:25 +08:00
|
|
|
when(Version ver = wait(self->loggingComplete)) {
|
2024-07-19 02:41:40 +08:00
|
|
|
if (!SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
|
|
|
|
pProxyCommitData->minKnownCommittedVersion =
|
|
|
|
|
std::max(pProxyCommitData->minKnownCommittedVersion, ver);
|
|
|
|
|
}
|
2018-06-22 06:29:46 +08:00
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
when(wait(pProxyCommitData->committedVersion.whenAtLeast(self->commitVersion + 1))) {}
|
2018-06-22 06:29:46 +08:00
|
|
|
}
|
|
|
|
|
} catch (Error& e) {
|
|
|
|
|
if (e.code() == error_code_broken_promise) {
|
2022-01-07 04:15:51 +08:00
|
|
|
throw tlog_failed();
|
2018-06-22 06:29:46 +08:00
|
|
|
}
|
|
|
|
|
throw;
|
|
|
|
|
}
|
2020-07-02 10:39:32 +08:00
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->lastCommitLatency = now() - self->commitStartTime;
|
|
|
|
|
pProxyCommitData->lastCommitTime = std::max(pProxyCommitData->lastCommitTime.get(), self->commitStartTime);
|
2020-07-26 12:44:10 +08:00
|
|
|
|
2020-01-27 11:47:12 +08:00
|
|
|
wait(yield(TaskPriority::ProxyCommitYield2));
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
if (pProxyCommitData->popRemoteTxs &&
|
|
|
|
|
self->msg.popTo > (pProxyCommitData->txsPopVersions.size() ? pProxyCommitData->txsPopVersions.back().second
|
|
|
|
|
: pProxyCommitData->lastTxsPop)) {
|
|
|
|
|
if (pProxyCommitData->txsPopVersions.size() >= SERVER_KNOBS->MAX_TXS_POP_VERSION_HISTORY) {
|
2018-09-18 09:32:39 +08:00
|
|
|
TraceEvent(SevWarnAlways, "DiscardingTxsPopHistory").suppressFor(1.0);
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->txsPopVersions.pop_front();
|
2018-09-18 09:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->txsPopVersions.emplace_back(self->commitVersion, self->msg.popTo);
|
2018-09-18 09:32:39 +08:00
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->logSystem->popTxs(self->msg.popTo);
|
2023-06-08 10:09:23 +08:00
|
|
|
pProxyCommitData->stats.tlogLoggingDist->sampleSeconds(g_network->timer_monotonic() - tLoggingStart);
|
2020-07-26 09:11:25 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 05:11:43 +08:00
|
|
|
ACTOR Future<Void> reply(CommitBatchContext* self) {
|
2023-06-08 10:09:23 +08:00
|
|
|
state double replyStart = g_network->timer_monotonic();
|
2020-07-26 09:11:25 +08:00
|
|
|
state ProxyCommitData* const pProxyCommitData = self->pProxyCommitData;
|
2020-08-29 03:02:51 +08:00
|
|
|
state Span span("MP:reply"_loc, self->span.context);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2022-07-22 06:00:00 +08:00
|
|
|
state const Optional<UID>& debugID = self->debugID;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2024-12-06 08:20:33 +08:00
|
|
|
if (!SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
2025-10-10 12:38:28 +08:00
|
|
|
// Version vector/unicast is disabled: Logging completed, so the current version (and all versions prior to
|
|
|
|
|
// the current versions) can be treated as commited.
|
|
|
|
|
|
|
|
|
|
// Advance min committed version.
|
2024-12-06 08:20:33 +08:00
|
|
|
if (self->prevVersion && self->commitVersion - self->prevVersion < SERVER_KNOBS->MAX_VERSIONS_IN_FLIGHT / 2) {
|
|
|
|
|
//TraceEvent("CPAdvanceMinVersion", self->pProxyCommitData->dbgid).detail("PrvVersion", self->prevVersion).detail("CommitVersion", self->commitVersion).detail("Master", self->pProxyCommitData->master.id().toString()).detail("TxSize", self->trs.size());
|
|
|
|
|
debug_advanceMinCommittedVersion(UID(), self->commitVersion);
|
|
|
|
|
}
|
2025-10-10 12:38:28 +08:00
|
|
|
|
|
|
|
|
// Acknowledge transaction state store commits.
|
|
|
|
|
acknowledgeTransactionStateStoreCommits(self);
|
2022-01-07 04:15:51 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-07-14 08:39:42 +08:00
|
|
|
// TraceEvent("ProxyPushed", pProxyCommitData->dbgid)
|
|
|
|
|
// .detail("PrevVersion", self->prevVersion)
|
|
|
|
|
// .detail("Version", self->commitVersion);
|
2017-05-26 04:48:44 +08:00
|
|
|
if (debugID.present())
|
2020-09-11 08:44:15 +08:00
|
|
|
g_traceBatch.addEvent("CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.AfterLogPush");
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-03 07:14:50 +08:00
|
|
|
// After logging finishes, we report the commit version to master so that every other proxy can get the most
|
2020-07-07 03:34:15 +08:00
|
|
|
// up-to-date live committed version. We also maintain the invariant that master's committed version >=
|
|
|
|
|
// self->committedVersion by reporting commit version first before updating self->committedVersion. Otherwise, a
|
2022-09-22 00:59:09 +08:00
|
|
|
// client may get a commit version that the master is not aware of, and next GRV request may get a version less
|
|
|
|
|
// than self->committedVersion.
|
2021-09-24 04:05:41 +08:00
|
|
|
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(pProxyCommitData->committedVersion.get() > self->commitVersion,
|
|
|
|
|
"later version was reported committed first");
|
2021-09-24 04:05:41 +08:00
|
|
|
|
2020-08-13 01:34:07 +08:00
|
|
|
if (self->commitVersion >= pProxyCommitData->committedVersion.get()) {
|
2021-07-09 03:59:07 +08:00
|
|
|
state Optional<std::set<Tag>> writtenTags;
|
2021-10-19 00:31:31 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
|
2021-07-09 03:59:07 +08:00
|
|
|
writtenTags = self->writtenTags;
|
2021-06-30 04:41:08 +08:00
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
wait(pProxyCommitData->master.reportLiveCommittedVersion.getReply(
|
2020-08-13 01:34:07 +08:00
|
|
|
ReportRawCommittedVersionRequest(self->commitVersion,
|
|
|
|
|
self->lockedAfter,
|
|
|
|
|
self->metadataVersionAfter,
|
2021-06-30 04:41:08 +08:00
|
|
|
pProxyCommitData->minKnownCommittedVersion,
|
2021-07-14 08:39:42 +08:00
|
|
|
self->prevVersion,
|
2021-07-09 03:59:07 +08:00
|
|
|
writtenTags),
|
2020-08-13 01:34:07 +08:00
|
|
|
TaskPriority::ProxyMasterVersionReply));
|
2020-07-03 07:14:50 +08:00
|
|
|
}
|
2022-07-22 06:00:00 +08:00
|
|
|
|
|
|
|
|
if (debugID.present()) {
|
|
|
|
|
g_traceBatch.addEvent(
|
|
|
|
|
"CommitDebug", debugID.get().first(), "CommitProxyServer.commitBatch.AfterReportRawCommittedVersion");
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 08:20:33 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
2025-10-10 12:38:28 +08:00
|
|
|
// Version vector/unicast is enabled: Received a reply from the sequencer, so we can treat the
|
|
|
|
|
// current version (and all versions prior to the current version) as committed.
|
|
|
|
|
|
|
|
|
|
// Advance min committed version now.
|
2024-12-06 08:20:33 +08:00
|
|
|
if (self->prevVersion && self->commitVersion - self->prevVersion < SERVER_KNOBS->MAX_VERSIONS_IN_FLIGHT / 2) {
|
|
|
|
|
//TraceEvent("CPAdvanceMinVersion", self->pProxyCommitData->dbgid).detail("PrvVersion", self->prevVersion).detail("CommitVersion", self->commitVersion).detail("Master", self->pProxyCommitData->master.id().toString()).detail("TxSize", self->trs.size());
|
|
|
|
|
debug_advanceMinCommittedVersion(UID(), self->commitVersion);
|
|
|
|
|
}
|
2025-10-10 12:38:28 +08:00
|
|
|
|
|
|
|
|
// Acknowledge transaction state store commits.
|
|
|
|
|
acknowledgeTransactionStateStoreCommits(self);
|
2024-12-06 08:20:33 +08:00
|
|
|
}
|
|
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
if (self->commitVersion > pProxyCommitData->committedVersion.get()) {
|
|
|
|
|
pProxyCommitData->locked = self->lockedAfter;
|
|
|
|
|
pProxyCommitData->metadataVersion = self->metadataVersionAfter;
|
|
|
|
|
pProxyCommitData->committedVersion.set(self->commitVersion);
|
2024-07-19 02:41:40 +08:00
|
|
|
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR_TLOG_UNICAST) {
|
|
|
|
|
ASSERT(self->loggingComplete.isReady());
|
|
|
|
|
pProxyCommitData->minKnownCommittedVersion =
|
|
|
|
|
std::max(pProxyCommitData->minKnownCommittedVersion, self->loggingComplete.get());
|
|
|
|
|
}
|
2020-07-03 07:14:50 +08:00
|
|
|
}
|
2020-07-29 22:26:55 +08:00
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
if (self->forceRecovery) {
|
|
|
|
|
TraceEvent(SevWarn, "RestartingTxnSubsystem", pProxyCommitData->dbgid).detail("Stage", "ProxyShutdown");
|
2017-05-26 04:48:44 +08:00
|
|
|
throw worker_removed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Send replies to clients
|
2023-06-08 10:09:23 +08:00
|
|
|
// TODO: should be timer_monotonic(), but gets compared to request time, which uses g_network->timer().
|
2020-01-27 11:47:12 +08:00
|
|
|
double endTime = g_network->timer();
|
2020-03-25 00:48:03 +08:00
|
|
|
// Reset all to zero, used to track the correct index of each commitTransacitonRef on each resolver
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
std::fill(self->nextTr.begin(), self->nextTr.end(), 0);
|
2022-10-29 00:07:54 +08:00
|
|
|
std::unordered_map<uint8_t, int16_t> idCountsForKey;
|
2020-07-26 09:11:25 +08:00
|
|
|
for (int t = 0; t < self->trs.size(); t++) {
|
|
|
|
|
auto& tr = self->trs[t];
|
2026-03-16 08:42:43 +08:00
|
|
|
if (self->committed[t] == ConflictBatchStatus::TransactionCommitted && (!self->locked || tr.isLockAware())) {
|
2020-07-26 09:11:25 +08:00
|
|
|
ASSERT_WE_THINK(self->commitVersion != invalidVersion);
|
2022-10-29 00:07:54 +08:00
|
|
|
if (self->trs[t].idempotencyId.valid()) {
|
|
|
|
|
idCountsForKey[uint8_t(t >> 8)] += 1;
|
|
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
tr.reply.send(CommitID(self->commitVersion, t, self->metadataVersionAfter));
|
2026-03-16 08:42:43 +08:00
|
|
|
} else if (self->committed[t] == ConflictBatchStatus::TransactionTooOld) {
|
2020-07-26 09:11:25 +08:00
|
|
|
tr.reply.sendError(transaction_too_old());
|
2026-03-16 08:42:43 +08:00
|
|
|
} else if (self->committed[t] == ConflictBatchStatus::TransactionLockReject) {
|
2022-02-19 13:22:31 +08:00
|
|
|
// We already sent the error
|
|
|
|
|
ASSERT(tr.reply.isSet());
|
2019-07-23 06:44:49 +08:00
|
|
|
} else {
|
2020-03-27 06:52:30 +08:00
|
|
|
// If enable the option to report conflicting keys from resolvers, we send back all keyranges' indices
|
|
|
|
|
// through CommitID
|
2020-07-26 09:11:25 +08:00
|
|
|
if (tr.transaction.report_conflicting_keys) {
|
2020-03-25 00:48:03 +08:00
|
|
|
Standalone<VectorRef<int>> conflictingKRIndices;
|
2020-07-26 09:11:25 +08:00
|
|
|
for (int resolverInd : self->transactionResolverMap[t]) {
|
2020-05-22 20:24:15 +08:00
|
|
|
auto const& cKRs =
|
2020-07-26 09:11:25 +08:00
|
|
|
self->resolution[resolverInd]
|
2022-09-22 00:59:09 +08:00
|
|
|
.conflictingKeyRangeMap[self->nextTr[resolverInd]]; // nextTr[resolverInd] -> index of
|
|
|
|
|
// this trs[t] on the resolver
|
2020-03-27 06:52:30 +08:00
|
|
|
for (auto const& rCRIndex : cKRs)
|
2022-09-22 00:59:09 +08:00
|
|
|
// read_conflict_range can change when sent to resolvers, mapping the index from
|
|
|
|
|
// resolver-side to original index in commitTransactionRef
|
2020-05-22 20:24:15 +08:00
|
|
|
conflictingKRIndices.push_back(conflictingKRIndices.arena(),
|
2020-07-26 09:11:25 +08:00
|
|
|
self->txReadConflictRangeIndexMap[t][resolverInd][rCRIndex]);
|
2020-03-25 00:48:03 +08:00
|
|
|
}
|
|
|
|
|
// At least one keyRange index should be returned
|
|
|
|
|
ASSERT(conflictingKRIndices.size());
|
2020-07-26 09:11:25 +08:00
|
|
|
tr.reply.send(CommitID(
|
2020-03-27 06:52:30 +08:00
|
|
|
invalidVersion, t, Optional<Value>(), Optional<Standalone<VectorRef<int>>>(conflictingKRIndices)));
|
2020-03-25 00:48:03 +08:00
|
|
|
} else {
|
2020-07-26 09:11:25 +08:00
|
|
|
tr.reply.sendError(not_committed());
|
2020-03-25 00:48:03 +08:00
|
|
|
}
|
2018-12-01 02:46:04 +08:00
|
|
|
}
|
|
|
|
|
|
2020-03-25 00:48:03 +08:00
|
|
|
// Update corresponding transaction indices on each resolver
|
2020-07-26 09:11:25 +08:00
|
|
|
for (int resolverInd : self->transactionResolverMap[t])
|
|
|
|
|
self->nextTr[resolverInd]++;
|
2020-03-25 00:48:03 +08:00
|
|
|
|
2018-12-01 02:46:04 +08:00
|
|
|
// TODO: filter if pipelined with large commit
|
2020-08-04 12:19:14 +08:00
|
|
|
const double duration = endTime - tr.requestTime();
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->stats.commitLatencySample.addMeasurement(duration);
|
|
|
|
|
if (pProxyCommitData->latencyBandConfig.present()) {
|
|
|
|
|
bool filter = self->maxTransactionBytes >
|
|
|
|
|
pProxyCommitData->latencyBandConfig.get().commitConfig.maxCommitBytes.orDefault(
|
|
|
|
|
std::numeric_limits<int>::max());
|
2022-10-26 08:10:59 +08:00
|
|
|
pProxyCommitData->stats.commitLatencyBands.addMeasurement(duration, 1, Filtered(filter));
|
2019-01-19 08:18:34 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
2022-10-29 00:07:54 +08:00
|
|
|
for (auto [highOrderBatchIndex, count] : idCountsForKey) {
|
|
|
|
|
pProxyCommitData->expectedIdempotencyIdCountForKey.send(
|
|
|
|
|
ExpectedIdempotencyIdCountForKey{ self->commitVersion, count, highOrderBatchIndex });
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
++pProxyCommitData->stats.commitBatchOut;
|
|
|
|
|
pProxyCommitData->stats.txnCommitOut += self->trs.size();
|
|
|
|
|
pProxyCommitData->stats.txnConflicts += self->trs.size() - self->commitCount;
|
|
|
|
|
pProxyCommitData->stats.txnCommitOutSuccess += self->commitCount;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-26 09:11:25 +08:00
|
|
|
if (now() - pProxyCommitData->lastCoalesceTime > SERVER_KNOBS->RESOLVER_COALESCE_TIME) {
|
|
|
|
|
pProxyCommitData->lastCoalesceTime = now();
|
|
|
|
|
int lastSize = pProxyCommitData->keyResolvers.size();
|
|
|
|
|
auto rs = pProxyCommitData->keyResolvers.ranges();
|
|
|
|
|
Version oldestVersion = self->prevVersion - SERVER_KNOBS->MAX_WRITE_TRANSACTION_LIFE_VERSIONS;
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto r = rs.begin(); r != rs.end(); ++r) {
|
|
|
|
|
while (r->value().size() > 1 && r->value()[1].first < oldestVersion)
|
|
|
|
|
r->value().pop_front();
|
|
|
|
|
if (r->value().size() && r->value().front().first < oldestVersion)
|
|
|
|
|
r->value().front().first = 0;
|
|
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
if (SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS) {
|
2021-10-14 05:51:08 +08:00
|
|
|
// Only normal key space, because \xff key space is processed by all resolvers.
|
2021-10-09 09:03:01 +08:00
|
|
|
pProxyCommitData->keyResolvers.coalesce(normalKeys);
|
|
|
|
|
auto& versions = pProxyCommitData->systemKeyVersions;
|
|
|
|
|
while (versions.size() > 1 && versions[1] < oldestVersion) {
|
|
|
|
|
versions.pop_front();
|
|
|
|
|
}
|
|
|
|
|
if (!versions.empty() && versions[0] < oldestVersion) {
|
|
|
|
|
versions[0] = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pProxyCommitData->keyResolvers.coalesce(allKeys);
|
|
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
if (pProxyCommitData->keyResolvers.size() != lastSize)
|
|
|
|
|
TraceEvent("KeyResolverSize", pProxyCommitData->dbgid)
|
|
|
|
|
.detail("Size", pProxyCommitData->keyResolvers.size());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dynamic batching for commits
|
2020-07-26 09:11:25 +08:00
|
|
|
double target_latency =
|
|
|
|
|
(now() - self->startTime) * SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_LATENCY_FRACTION;
|
|
|
|
|
pProxyCommitData->commitBatchInterval =
|
2019-08-09 06:00:33 +08:00
|
|
|
std::max(SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_MIN,
|
|
|
|
|
std::min(SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_MAX,
|
|
|
|
|
target_latency * SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA +
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->commitBatchInterval *
|
|
|
|
|
(1 - SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA)));
|
2021-03-18 00:28:12 +08:00
|
|
|
pProxyCommitData->stats.commitBatchingWindowSize.addMeasurement(pProxyCommitData->commitBatchInterval);
|
2020-07-26 09:11:25 +08:00
|
|
|
pProxyCommitData->commitBatchesMemBytesCount -= self->currentBatchMemBytesCount;
|
|
|
|
|
ASSERT_ABORT(pProxyCommitData->commitBatchesMemBytesCount >= 0);
|
|
|
|
|
wait(self->releaseFuture);
|
2023-06-08 10:09:23 +08:00
|
|
|
pProxyCommitData->stats.replyCommitDist->sampleSeconds(g_network->timer_monotonic() - replyStart);
|
2020-07-26 09:11:25 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Commit one batch of transactions trs
|
2024-07-24 08:26:11 +08:00
|
|
|
ACTOR Future<Void> commitBatchImpl(CommitBatchContext* pContext) {
|
2020-07-26 09:11:25 +08:00
|
|
|
// WARNING: this code is run at a high priority (until the first delay(0)), so it needs to do as little work as
|
|
|
|
|
// possible
|
2024-07-24 08:26:11 +08:00
|
|
|
|
|
|
|
|
pContext->stage = INITIALIZE;
|
2021-05-28 02:25:00 +08:00
|
|
|
getCurrentLineage()->modify(&TransactionLineage::operation) = TransactionLineage::Operation::Commit;
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
// Active load balancing runs at a very high priority (to obtain accurate estimate of memory used by commit batches)
|
|
|
|
|
// so we need to downgrade here
|
|
|
|
|
wait(delay(0, TaskPriority::ProxyCommit));
|
|
|
|
|
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->pProxyCommitData->lastVersionTime = pContext->startTime;
|
|
|
|
|
++pContext->pProxyCommitData->stats.commitBatchIn;
|
|
|
|
|
pContext->setupTraceBatch();
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
/////// Phase 1: Pre-resolution processing (CPU bound except waiting for a version # which is separately pipelined
|
|
|
|
|
/// and *should* be available by now (unless empty commit); ordered; currently atomic but could yield)
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->stage = PRE_RESOLUTION;
|
|
|
|
|
wait(CommitBatch::preresolutionProcessing(pContext));
|
|
|
|
|
if (pContext->rejected) {
|
|
|
|
|
pContext->pProxyCommitData->commitBatchesMemBytesCount -= pContext->currentBatchMemBytesCount;
|
2021-01-22 06:10:48 +08:00
|
|
|
return Void();
|
2021-03-20 02:30:50 +08:00
|
|
|
}
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
/////// Phase 2: Resolution (waiting on the network; pipelined)
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->stage = RESOLUTION;
|
|
|
|
|
wait(CommitBatch::getResolution(pContext));
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
////// Phase 3: Post-resolution processing (CPU bound except for very rare situations; ordered; currently atomic but
|
|
|
|
|
/// doesn't need to be)
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->stage = POST_RESOLUTION;
|
|
|
|
|
wait(CommitBatch::postResolution(pContext));
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
/////// Phase 4: Logging (network bound; pipelined up to MAX_READ_TRANSACTION_LIFE_VERSIONS (limited by loop above))
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->stage = TRANSACTION_LOGGING;
|
|
|
|
|
wait(CommitBatch::transactionLogging(pContext));
|
2020-07-26 09:11:25 +08:00
|
|
|
|
|
|
|
|
/////// Phase 5: Replies (CPU bound; no particular order required, though ordered execution would be best for
|
|
|
|
|
/// latency)
|
2024-07-24 08:26:11 +08:00
|
|
|
pContext->stage = REPLY;
|
|
|
|
|
wait(CommitBatch::reply(pContext));
|
|
|
|
|
|
|
|
|
|
pContext->stage = COMPLETE;
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace CommitBatch
|
|
|
|
|
|
|
|
|
|
ACTOR Future<Void> commitBatch(ProxyCommitData* pCommitData,
|
|
|
|
|
std::vector<CommitTransactionRequest>* trs,
|
|
|
|
|
int currentBatchMemBytesCount) {
|
|
|
|
|
|
|
|
|
|
state CommitBatch::CommitBatchContext context(pCommitData, trs, currentBatchMemBytesCount);
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
state Future<Void> commit = CommitBatch::commitBatchImpl(&context);
|
2024-07-24 08:26:11 +08:00
|
|
|
|
|
|
|
|
try {
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
wait(timeoutError(commit, SERVER_KNOBS->COMMIT_PROXY_LIVENESS_TIMEOUT));
|
2024-07-24 08:26:11 +08:00
|
|
|
} catch (Error& err) {
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
TraceEvent(SevInfo, "CommitBatchFailed", pCommitData->dbgid)
|
|
|
|
|
.detail("Stage", context.stage)
|
|
|
|
|
.detail("ErrorCode", err.code());
|
2024-07-24 08:26:11 +08:00
|
|
|
throw failed_to_progress();
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-03 23:31:16 +08:00
|
|
|
// Add tss mapping data to the reply, if any of the included storage servers have a TSS pair
|
2021-05-29 02:15:52 +08:00
|
|
|
void maybeAddTssMapping(GetKeyServerLocationsReply& reply,
|
|
|
|
|
ProxyCommitData* commitData,
|
|
|
|
|
std::unordered_set<UID>& included,
|
|
|
|
|
UID ssId) {
|
2024-10-16 02:40:02 +08:00
|
|
|
if (!included.contains(ssId)) {
|
2021-05-29 02:15:52 +08:00
|
|
|
auto mappingItr = commitData->tssMapping.find(ssId);
|
|
|
|
|
if (mappingItr != commitData->tssMapping.end()) {
|
|
|
|
|
reply.resultsTssMapping.push_back(*mappingItr);
|
|
|
|
|
}
|
2021-06-08 03:54:24 +08:00
|
|
|
included.insert(ssId);
|
2021-05-29 02:15:52 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-13 03:44:59 +08:00
|
|
|
void addTagMapping(GetKeyServerLocationsReply& reply, ProxyCommitData* commitData) {
|
|
|
|
|
for (const auto& [_, shard] : reply.results) {
|
|
|
|
|
for (auto& ssi : shard) {
|
|
|
|
|
auto iter = commitData->storageCache.find(ssi.id());
|
2021-07-15 03:31:01 +08:00
|
|
|
ASSERT_WE_THINK(iter != commitData->storageCache.end());
|
|
|
|
|
reply.resultsTagMapping.emplace_back(ssi.id(), iter->second->tag);
|
2021-07-13 03:44:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-21 08:30:59 +08:00
|
|
|
ACTOR static Future<Void> doKeyServerLocationRequest(GetKeyServerLocationsRequest req, ProxyCommitData* commitData) {
|
|
|
|
|
// We can't respond to these requests until we have valid txnStateStore
|
|
|
|
|
getCurrentLineage()->modify(&TransactionLineage::operation) = TransactionLineage::Operation::GetKeyServersLocations;
|
|
|
|
|
getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.traceID;
|
|
|
|
|
|
|
|
|
|
wait(commitData->validState.getFuture());
|
|
|
|
|
|
|
|
|
|
wait(delay(0, TaskPriority::DefaultEndpoint));
|
|
|
|
|
|
2021-05-29 02:15:52 +08:00
|
|
|
std::unordered_set<UID> tssMappingsIncluded;
|
2020-03-14 01:17:49 +08:00
|
|
|
GetKeyServerLocationsReply rep;
|
2022-02-26 03:18:42 +08:00
|
|
|
|
2020-03-14 01:17:49 +08:00
|
|
|
if (!req.end.present()) {
|
|
|
|
|
auto r = req.reverse ? commitData->keyInfo.rangeContainingKeyBefore(req.begin)
|
|
|
|
|
: commitData->keyInfo.rangeContaining(req.begin);
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<StorageServerInterface> ssis;
|
2020-03-14 01:17:49 +08:00
|
|
|
ssis.reserve(r.value().src_info.size());
|
|
|
|
|
for (auto& it : r.value().src_info) {
|
|
|
|
|
ssis.push_back(it->interf);
|
2021-05-29 02:15:52 +08:00
|
|
|
maybeAddTssMapping(rep, commitData, tssMappingsIncluded, it->interf.id());
|
2020-03-14 01:17:49 +08:00
|
|
|
}
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
rep.results.emplace_back(r.range(), ssis);
|
2020-03-14 01:17:49 +08:00
|
|
|
} else if (!req.reverse) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (auto r = commitData->keyInfo.rangeContaining(req.begin);
|
|
|
|
|
r != commitData->keyInfo.ranges().end() && count < req.limit && r.begin() < req.end.get();
|
|
|
|
|
++r) {
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<StorageServerInterface> ssis;
|
2019-04-26 08:07:35 +08:00
|
|
|
ssis.reserve(r.value().src_info.size());
|
|
|
|
|
for (auto& it : r.value().src_info) {
|
|
|
|
|
ssis.push_back(it->interf);
|
2021-05-29 02:15:52 +08:00
|
|
|
maybeAddTssMapping(rep, commitData, tssMappingsIncluded, it->interf.id());
|
2019-04-26 08:07:35 +08:00
|
|
|
}
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
rep.results.emplace_back(r.range(), ssis);
|
2020-03-14 01:17:49 +08:00
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
int count = 0;
|
|
|
|
|
auto r = commitData->keyInfo.rangeContainingKeyBefore(req.end.get());
|
|
|
|
|
while (count < req.limit && req.begin < r.end()) {
|
2021-09-17 08:42:34 +08:00
|
|
|
std::vector<StorageServerInterface> ssis;
|
2020-03-14 01:17:49 +08:00
|
|
|
ssis.reserve(r.value().src_info.size());
|
|
|
|
|
for (auto& it : r.value().src_info) {
|
|
|
|
|
ssis.push_back(it->interf);
|
2021-05-29 02:15:52 +08:00
|
|
|
maybeAddTssMapping(rep, commitData, tssMappingsIncluded, it->interf.id());
|
2019-04-26 08:07:35 +08:00
|
|
|
}
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
rep.results.emplace_back(r.range(), ssis);
|
2020-03-14 01:17:49 +08:00
|
|
|
if (r == commitData->keyInfo.ranges().begin()) {
|
|
|
|
|
break;
|
2019-04-26 08:07:35 +08:00
|
|
|
}
|
2020-03-14 01:17:49 +08:00
|
|
|
count++;
|
|
|
|
|
--r;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-13 03:44:59 +08:00
|
|
|
addTagMapping(rep, commitData);
|
2020-03-14 01:17:49 +08:00
|
|
|
req.reply.send(rep);
|
|
|
|
|
++commitData->stats.keyServerLocationOut;
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
ACTOR static Future<Void> readRequestServer(CommitProxyInterface proxy,
|
|
|
|
|
PromiseStream<Future<Void>> addActor,
|
|
|
|
|
ProxyCommitData* commitData) {
|
2020-03-14 01:17:49 +08:00
|
|
|
loop {
|
|
|
|
|
GetKeyServerLocationsRequest req = waitNext(proxy.getKeyServersLocations.getFuture());
|
2020-03-14 09:31:22 +08:00
|
|
|
// WARNING: this code is run at a high priority, so it needs to do as little work as possible
|
2020-03-14 01:17:49 +08:00
|
|
|
if (req.limit != CLIENT_KNOBS->STORAGE_METRICS_SHARD_LIMIT && // Always do data distribution requests
|
2023-04-19 06:13:29 +08:00
|
|
|
(commitData->stats.keyServerLocationIn.getValue() - commitData->stats.keyServerLocationOut.getValue() >
|
|
|
|
|
SERVER_KNOBS->KEY_LOCATION_MAX_QUEUE_SIZE ||
|
|
|
|
|
(g_network->isSimulated() && BUGGIFY_WITH_PROB(0.001)))) {
|
2020-03-14 01:17:49 +08:00
|
|
|
++commitData->stats.keyServerLocationErrors;
|
2022-08-12 11:16:33 +08:00
|
|
|
req.reply.sendError(commit_proxy_memory_limit_exceeded());
|
2020-03-14 09:31:22 +08:00
|
|
|
TraceEvent(SevWarnAlways, "ProxyLocationRequestThresholdExceeded").suppressFor(60);
|
2020-03-14 01:17:49 +08:00
|
|
|
} else {
|
|
|
|
|
++commitData->stats.keyServerLocationIn;
|
|
|
|
|
addActor.send(doKeyServerLocationRequest(req, commitData));
|
2019-04-26 08:07:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
ACTOR static Future<Void> rejoinServer(CommitProxyInterface proxy, ProxyCommitData* commitData) {
|
2019-04-26 08:07:35 +08:00
|
|
|
// We can't respond to these requests until we have valid txnStateStore
|
|
|
|
|
wait(commitData->validState.getFuture());
|
|
|
|
|
|
2021-08-10 16:52:36 +08:00
|
|
|
TraceEvent("ProxyReadyForReads", proxy.id()).log();
|
2020-03-14 01:17:49 +08:00
|
|
|
|
2019-04-26 08:07:35 +08:00
|
|
|
loop {
|
|
|
|
|
GetStorageServerRejoinInfoRequest req = waitNext(proxy.getStorageServerRejoinInfo.getFuture());
|
|
|
|
|
if (commitData->txnStateStore->readValue(serverListKeyFor(req.id)).get().present()) {
|
|
|
|
|
GetStorageServerRejoinInfoReply rep;
|
2022-02-26 03:18:42 +08:00
|
|
|
rep.version = commitData->version.get();
|
2019-04-26 08:07:35 +08:00
|
|
|
rep.tag = decodeServerTagValue(commitData->txnStateStore->readValue(serverTagKeyFor(req.id)).get().get());
|
2021-05-04 04:14:16 +08:00
|
|
|
RangeResult history = commitData->txnStateStore->readRange(serverTagHistoryRangeFor(req.id)).get();
|
2019-04-26 08:07:35 +08:00
|
|
|
for (int i = history.size() - 1; i >= 0; i--) {
|
|
|
|
|
rep.history.push_back(
|
|
|
|
|
std::make_pair(decodeServerTagHistoryKey(history[i].key), decodeServerTagValue(history[i].value)));
|
|
|
|
|
}
|
|
|
|
|
auto localityKey = commitData->txnStateStore->readValue(tagLocalityListKeyFor(req.dcId)).get();
|
2020-05-09 07:17:10 +08:00
|
|
|
rep.newLocality = false;
|
2019-04-26 08:07:35 +08:00
|
|
|
if (localityKey.present()) {
|
|
|
|
|
int8_t locality = decodeTagLocalityListValue(localityKey.get());
|
2024-09-19 00:11:51 +08:00
|
|
|
if (locality != rep.tag.locality) {
|
2020-05-09 07:17:10 +08:00
|
|
|
TraceEvent(SevWarnAlways, "SSRejoinedWithChangedLocality")
|
|
|
|
|
.detail("Tag", rep.tag.toString())
|
|
|
|
|
.detail("DcId", req.dcId)
|
|
|
|
|
.detail("NewLocality", locality);
|
|
|
|
|
} else if (locality != rep.tag.locality) {
|
2019-04-26 08:07:35 +08:00
|
|
|
uint16_t tagId = 0;
|
|
|
|
|
std::vector<uint16_t> usedTags;
|
|
|
|
|
auto tagKeys = commitData->txnStateStore->readRange(serverTagKeys).get();
|
|
|
|
|
for (auto& kv : tagKeys) {
|
|
|
|
|
Tag t = decodeServerTagValue(kv.value);
|
|
|
|
|
if (t.locality == locality) {
|
|
|
|
|
usedTags.push_back(t.id);
|
2017-12-16 12:13:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-26 08:07:35 +08:00
|
|
|
auto historyKeys = commitData->txnStateStore->readRange(serverTagHistoryKeys).get();
|
|
|
|
|
for (auto& kv : historyKeys) {
|
|
|
|
|
Tag t = decodeServerTagValue(kv.value);
|
|
|
|
|
if (t.locality == locality) {
|
|
|
|
|
usedTags.push_back(t.id);
|
2017-12-16 12:13:44 +08:00
|
|
|
}
|
2019-04-26 08:07:35 +08:00
|
|
|
}
|
|
|
|
|
std::sort(usedTags.begin(), usedTags.end());
|
|
|
|
|
|
|
|
|
|
int usedIdx = 0;
|
|
|
|
|
for (; usedTags.size() > 0 && tagId <= usedTags.end()[-1]; tagId++) {
|
|
|
|
|
if (tagId < usedTags[usedIdx]) {
|
2017-12-16 12:13:44 +08:00
|
|
|
break;
|
2019-04-26 08:07:35 +08:00
|
|
|
} else {
|
|
|
|
|
usedIdx++;
|
2017-12-16 12:13:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-26 08:07:35 +08:00
|
|
|
rep.newTag = Tag(locality, tagId);
|
2017-07-27 04:45:11 +08:00
|
|
|
}
|
2024-09-19 01:08:32 +08:00
|
|
|
} else {
|
|
|
|
|
ASSERT_WE_THINK(rep.tag.locality != tagLocalityUpgraded);
|
2020-05-09 07:17:10 +08:00
|
|
|
TraceEvent(SevWarnAlways, "SSRejoinedWithUnknownLocality")
|
|
|
|
|
.detail("Tag", rep.tag.toString())
|
|
|
|
|
.detail("DcId", req.dcId);
|
2017-08-04 07:16:36 +08:00
|
|
|
}
|
2019-04-26 08:07:35 +08:00
|
|
|
req.reply.send(rep);
|
|
|
|
|
} else {
|
|
|
|
|
req.reply.sendError(worker_removed());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-12 13:17:09 +08:00
|
|
|
ACTOR Future<Void> ddMetricsRequestServer(CommitProxyInterface proxy, Reference<AsyncVar<ServerDBInfo> const> db) {
|
2019-05-17 07:46:33 +08:00
|
|
|
loop {
|
|
|
|
|
choose {
|
|
|
|
|
when(state GetDDMetricsRequest req = waitNext(proxy.getDDMetrics.getFuture())) {
|
2020-08-30 03:35:31 +08:00
|
|
|
if (!db->get().distributor.present()) {
|
2020-08-15 00:40:16 +08:00
|
|
|
req.reply.sendError(dd_not_found());
|
2020-08-03 08:11:31 +08:00
|
|
|
continue;
|
|
|
|
|
}
|
2020-08-01 02:13:05 +08:00
|
|
|
ErrorOr<GetDataDistributorMetricsReply> reply =
|
|
|
|
|
wait(errorOr(db->get().distributor.get().dataDistributorMetrics.getReply(
|
2020-08-10 14:42:30 +08:00
|
|
|
GetDataDistributorMetricsRequest(req.keys, req.shardLimit))));
|
2020-08-01 02:13:05 +08:00
|
|
|
if (reply.isError()) {
|
2019-05-18 07:11:50 +08:00
|
|
|
req.reply.sendError(reply.getError());
|
|
|
|
|
} else {
|
|
|
|
|
GetDDMetricsReply newReply;
|
|
|
|
|
newReply.storageMetricsList = reply.get().storageMetricsList;
|
|
|
|
|
req.reply.send(newReply);
|
|
|
|
|
}
|
2019-05-17 07:46:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-13 04:23:02 +08:00
|
|
|
ACTOR Future<Void> monitorRemoteCommitted(ProxyCommitData* self) {
|
2018-09-18 09:32:39 +08:00
|
|
|
loop {
|
2018-10-04 07:57:18 +08:00
|
|
|
wait(delay(0)); // allow this actor to be cancelled if we are removed after db changes.
|
2018-09-18 09:32:39 +08:00
|
|
|
state Optional<std::vector<OptionalInterface<TLogInterface>>> remoteLogs;
|
2019-04-13 04:23:02 +08:00
|
|
|
if (self->db->get().recoveryState >= RecoveryState::ALL_LOGS_RECRUITED) {
|
|
|
|
|
for (auto& logSet : self->db->get().logSystemConfig.tLogs) {
|
2018-09-18 09:32:39 +08:00
|
|
|
if (!logSet.isLocal) {
|
|
|
|
|
remoteLogs = logSet.tLogs;
|
|
|
|
|
for (auto& tLog : logSet.tLogs) {
|
|
|
|
|
if (!tLog.present()) {
|
|
|
|
|
remoteLogs = Optional<std::vector<OptionalInterface<TLogInterface>>>();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!remoteLogs.present()) {
|
2019-04-13 04:23:02 +08:00
|
|
|
wait(self->db->onChange());
|
2018-09-18 09:32:39 +08:00
|
|
|
continue;
|
|
|
|
|
}
|
2018-11-27 07:17:17 +08:00
|
|
|
self->popRemoteTxs = true;
|
2018-09-18 09:32:39 +08:00
|
|
|
|
2019-04-13 04:23:02 +08:00
|
|
|
state Future<Void> onChange = self->db->onChange();
|
2018-09-18 09:32:39 +08:00
|
|
|
loop {
|
|
|
|
|
state std::vector<Future<TLogQueuingMetricsReply>> replies;
|
|
|
|
|
for (auto& it : remoteLogs.get()) {
|
|
|
|
|
replies.push_back(
|
|
|
|
|
brokenPromiseToNever(it.interf().getQueuingMetrics.getReply(TLogQueuingMetricsRequest())));
|
|
|
|
|
}
|
2018-10-16 09:38:51 +08:00
|
|
|
wait(waitForAll(replies) || onChange);
|
2018-09-18 09:32:39 +08:00
|
|
|
|
|
|
|
|
if (onChange.isReady()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME: use the configuration to calculate a more precise minimum recovery version.
|
|
|
|
|
Version minVersion = std::numeric_limits<Version>::max();
|
|
|
|
|
for (auto& it : replies) {
|
|
|
|
|
minVersion = std::min(minVersion, it.get().v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (self->txsPopVersions.size() && self->txsPopVersions.front().first <= minVersion) {
|
|
|
|
|
self->lastTxsPop = self->txsPopVersions.front().second;
|
2019-06-20 09:15:09 +08:00
|
|
|
self->logSystem->popTxs(self->txsPopVersions.front().second, tagLocalityRemoteLog);
|
2018-09-18 09:32:39 +08:00
|
|
|
self->txsPopVersions.pop_front();
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 07:57:18 +08:00
|
|
|
wait(delay(SERVER_KNOBS->UPDATE_REMOTE_LOG_VERSION_INTERVAL) || onChange);
|
2018-09-18 09:32:39 +08:00
|
|
|
if (onChange.isReady()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-28 06:08:13 +08:00
|
|
|
ACTOR Future<Void> proxySnapCreate(ProxySnapRequest snapReq, ProxyCommitData* commitData) {
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SnapCommitProxy_SnapReqEnter")
|
|
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
|
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-06-20 02:11:50 +08:00
|
|
|
try {
|
|
|
|
|
// whitelist check
|
2019-07-13 01:56:27 +08:00
|
|
|
ExecCmdValueString execArg(snapReq.snapPayload);
|
|
|
|
|
StringRef binPath = execArg.getBinaryPath();
|
2019-06-20 02:11:50 +08:00
|
|
|
if (!isWhitelisted(commitData->whitelistedBinPathVec, binPath)) {
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SnapCommitProxy_WhiteListCheckFailed")
|
|
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
|
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-08-24 02:56:06 +08:00
|
|
|
throw snap_path_not_whitelisted();
|
2019-06-20 02:11:50 +08:00
|
|
|
}
|
|
|
|
|
// db fully recovered check
|
|
|
|
|
if (commitData->db->get().recoveryState != RecoveryState::FULLY_RECOVERED) {
|
|
|
|
|
// Cluster is not fully recovered and needs TLogs
|
|
|
|
|
// from previous generation for full recovery.
|
|
|
|
|
// Currently, snapshot of old tlog generation is not
|
|
|
|
|
// supported and hence failing the snapshot request until
|
|
|
|
|
// cluster is fully_recovered.
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SnapCommitProxy_ClusterNotFullyRecovered")
|
|
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
|
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-08-24 02:56:06 +08:00
|
|
|
throw snap_not_fully_recovered_unsupported();
|
2019-06-20 02:11:50 +08:00
|
|
|
}
|
2019-07-21 16:00:29 +08:00
|
|
|
|
2022-09-20 02:35:58 +08:00
|
|
|
auto result = commitData->txnStateStore->readValue("log_anti_quorum"_sr.withPrefix(configKeysPrefix)).get();
|
2019-06-20 02:11:50 +08:00
|
|
|
int logAntiQuorum = 0;
|
|
|
|
|
if (result.present()) {
|
|
|
|
|
logAntiQuorum = atoi(result.get().toString().c_str());
|
|
|
|
|
}
|
|
|
|
|
// FIXME: logAntiQuorum not supported, remove it later,
|
2024-02-05 05:59:37 +08:00
|
|
|
// In version2, we probably don't need this limitation, but this needs to be tested.
|
2019-06-20 02:11:50 +08:00
|
|
|
if (logAntiQuorum > 0) {
|
2021-11-15 08:12:28 +08:00
|
|
|
TraceEvent("SnapCommitProxy_LogAntiQuorumNotSupported")
|
2020-09-11 08:44:15 +08:00
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
|
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-08-24 02:56:06 +08:00
|
|
|
throw snap_log_anti_quorum_unsupported();
|
2019-06-20 02:11:50 +08:00
|
|
|
}
|
|
|
|
|
|
2022-06-30 02:23:07 +08:00
|
|
|
state int snapReqRetry = 0;
|
|
|
|
|
state double snapRetryBackoff = FLOW_KNOBS->PREVENT_FAST_SPIN_DELAY;
|
|
|
|
|
loop {
|
|
|
|
|
// send a snap request to DD
|
|
|
|
|
if (!commitData->db->get().distributor.present()) {
|
|
|
|
|
TraceEvent(SevWarnAlways, "DataDistributorNotPresent").detail("Operation", "SnapRequest");
|
|
|
|
|
throw dd_not_found();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Future<ErrorOr<Void>> ddSnapReq =
|
|
|
|
|
commitData->db->get().distributor.get().distributorSnapReq.tryGetReply(
|
|
|
|
|
DistributorSnapRequest(snapReq.snapPayload, snapReq.snapUID));
|
|
|
|
|
wait(throwErrorOr(ddSnapReq));
|
|
|
|
|
break;
|
|
|
|
|
} catch (Error& e) {
|
|
|
|
|
TraceEvent("SnapCommitProxy_DDSnapResponseError")
|
|
|
|
|
.errorUnsuppressed(e)
|
|
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
2022-08-13 15:10:20 +08:00
|
|
|
.detail("SnapUID", snapReq.snapUID)
|
|
|
|
|
.detail("Retry", snapReqRetry);
|
2022-06-30 02:23:07 +08:00
|
|
|
// Retry if we have network issues
|
|
|
|
|
if (e.code() != error_code_request_maybe_delivered ||
|
|
|
|
|
++snapReqRetry > SERVER_KNOBS->SNAP_NETWORK_FAILURE_RETRY_LIMIT)
|
|
|
|
|
throw e;
|
|
|
|
|
wait(delay(snapRetryBackoff));
|
|
|
|
|
snapRetryBackoff = snapRetryBackoff * 2; // exponential backoff
|
|
|
|
|
}
|
2019-06-20 02:11:50 +08:00
|
|
|
}
|
|
|
|
|
snapReq.reply.send(Void());
|
|
|
|
|
} catch (Error& e) {
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SnapCommitProxy_SnapReqError")
|
2022-02-25 04:25:52 +08:00
|
|
|
.errorUnsuppressed(e)
|
2020-09-11 08:44:15 +08:00
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
2022-02-25 04:25:52 +08:00
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-07-21 16:00:29 +08:00
|
|
|
if (e.code() != error_code_operation_cancelled) {
|
2019-06-20 02:11:50 +08:00
|
|
|
snapReq.reply.sendError(e);
|
2019-07-21 16:00:29 +08:00
|
|
|
} else {
|
|
|
|
|
throw e;
|
2019-06-20 02:11:50 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SnapCommitProxy_SnapReqExit")
|
|
|
|
|
.detail("SnapPayload", snapReq.snapPayload)
|
|
|
|
|
.detail("SnapUID", snapReq.snapUID);
|
2019-06-20 02:11:50 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-12 13:17:09 +08:00
|
|
|
ACTOR Future<Void> proxyCheckSafeExclusion(Reference<AsyncVar<ServerDBInfo> const> db,
|
|
|
|
|
ExclusionSafetyCheckRequest req) {
|
2021-07-27 10:55:10 +08:00
|
|
|
TraceEvent("SafetyCheckCommitProxyBegin").log();
|
2019-09-19 04:40:18 +08:00
|
|
|
state ExclusionSafetyCheckReply reply(false);
|
2019-08-17 06:13:53 +08:00
|
|
|
if (!db->get().distributor.present()) {
|
|
|
|
|
TraceEvent(SevWarnAlways, "DataDistributorNotPresent").detail("Operation", "ExclusionSafetyCheck");
|
2019-09-19 04:40:18 +08:00
|
|
|
req.reply.send(reply);
|
2019-08-17 06:13:53 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
2019-08-17 06:42:04 +08:00
|
|
|
try {
|
2022-02-26 01:30:21 +08:00
|
|
|
state Future<ErrorOr<DistributorExclusionSafetyCheckReply>> ddSafeFuture =
|
2019-09-19 04:40:18 +08:00
|
|
|
db->get().distributor.get().distributorExclCheckReq.tryGetReply(
|
|
|
|
|
DistributorExclusionSafetyCheckRequest(req.exclusions));
|
2022-02-26 01:30:21 +08:00
|
|
|
DistributorExclusionSafetyCheckReply _reply = wait(throwErrorOr(ddSafeFuture));
|
2019-09-19 04:40:18 +08:00
|
|
|
reply.safe = _reply.safe;
|
2019-08-17 06:42:04 +08:00
|
|
|
} catch (Error& e) {
|
2020-09-11 08:44:15 +08:00
|
|
|
TraceEvent("SafetyCheckCommitProxyResponseError").error(e);
|
2019-08-17 06:42:04 +08:00
|
|
|
if (e.code() != error_code_operation_cancelled) {
|
|
|
|
|
req.reply.sendError(e);
|
|
|
|
|
return Void();
|
|
|
|
|
} else {
|
|
|
|
|
throw e;
|
2019-08-17 06:13:53 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-07-27 10:55:10 +08:00
|
|
|
TraceEvent("SafetyCheckCommitProxyFinish").log();
|
2019-09-19 04:40:18 +08:00
|
|
|
req.reply.send(reply);
|
2019-08-09 07:30:05 +08:00
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-30 03:35:31 +08:00
|
|
|
ACTOR Future<Void> reportTxnTagCommitCost(UID myID,
|
2021-07-12 13:17:09 +08:00
|
|
|
Reference<AsyncVar<ServerDBInfo> const> db,
|
2020-08-30 03:35:31 +08:00
|
|
|
UIDTransactionTagMap<TransactionCommitCostEstimation>* ssTrTagCommitCost) {
|
|
|
|
|
state Future<Void> nextRequestTimer = Never();
|
|
|
|
|
state Future<Void> nextReply = Never();
|
|
|
|
|
if (db->get().ratekeeper.present())
|
|
|
|
|
nextRequestTimer = Void();
|
|
|
|
|
loop choose {
|
|
|
|
|
when(wait(db->onChange())) {
|
|
|
|
|
if (db->get().ratekeeper.present()) {
|
|
|
|
|
TraceEvent("ProxyRatekeeperChanged", myID).detail("RKID", db->get().ratekeeper.get().id());
|
|
|
|
|
nextRequestTimer = Void();
|
|
|
|
|
} else {
|
2021-07-27 10:55:10 +08:00
|
|
|
TraceEvent("ProxyRatekeeperDied", myID).log();
|
2020-08-30 03:35:31 +08:00
|
|
|
nextRequestTimer = Never();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
when(wait(nextRequestTimer)) {
|
|
|
|
|
nextRequestTimer = Never();
|
|
|
|
|
if (db->get().ratekeeper.present()) {
|
|
|
|
|
nextReply = brokenPromiseToNever(db->get().ratekeeper.get().reportCommitCostEstimation.getReply(
|
2022-11-16 05:47:29 +08:00
|
|
|
ReportCommitCostEstimationRequest(std::move(*ssTrTagCommitCost))));
|
|
|
|
|
ssTrTagCommitCost->clear();
|
2020-08-30 03:35:31 +08:00
|
|
|
} else {
|
|
|
|
|
nextReply = Never();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
when(wait(nextReply)) {
|
|
|
|
|
nextReply = Never();
|
|
|
|
|
nextRequestTimer = delay(SERVER_KNOBS->REPORT_TRANSACTION_COST_ESTIMATION_DELAY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-29 00:07:54 +08:00
|
|
|
namespace {
|
|
|
|
|
struct ExpireServerEntry {
|
|
|
|
|
int64_t timeReceived;
|
|
|
|
|
int expectedCount = 0;
|
|
|
|
|
int receivedCount = 0;
|
|
|
|
|
bool initialized = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct IdempotencyKey {
|
|
|
|
|
Version version;
|
|
|
|
|
uint8_t highOrderBatchIndex;
|
|
|
|
|
bool operator==(const IdempotencyKey& other) const {
|
|
|
|
|
return version == other.version && highOrderBatchIndex == other.highOrderBatchIndex;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
template <>
|
|
|
|
|
struct hash<IdempotencyKey> {
|
|
|
|
|
std::size_t operator()(const IdempotencyKey& key) const {
|
|
|
|
|
std::size_t seed = 0;
|
|
|
|
|
boost::hash_combine(seed, std::hash<Version>{}(key.version));
|
|
|
|
|
boost::hash_combine(seed, std::hash<uint8_t>{}(key.highOrderBatchIndex));
|
|
|
|
|
return seed;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
|
|
ACTOR static Future<Void> idempotencyIdsExpireServer(
|
|
|
|
|
Database db,
|
|
|
|
|
PublicRequestStream<ExpireIdempotencyIdRequest> expireIdempotencyId,
|
|
|
|
|
PromiseStream<ExpectedIdempotencyIdCountForKey> expectedIdempotencyIdCountForKey,
|
|
|
|
|
Standalone<VectorRef<MutationRef>>* idempotencyClears) {
|
|
|
|
|
state std::unordered_map<IdempotencyKey, ExpireServerEntry> idStatus;
|
|
|
|
|
state std::unordered_map<IdempotencyKey, ExpireServerEntry>::iterator iter;
|
|
|
|
|
state int64_t purgeBefore;
|
|
|
|
|
state IdempotencyKey key;
|
|
|
|
|
state ExpireServerEntry* status = nullptr;
|
|
|
|
|
state Future<Void> purgeOld = Void();
|
|
|
|
|
loop {
|
|
|
|
|
choose {
|
|
|
|
|
when(ExpireIdempotencyIdRequest req = waitNext(expireIdempotencyId.getFuture())) {
|
|
|
|
|
key = IdempotencyKey{ req.commitVersion, req.batchIndexHighByte };
|
|
|
|
|
status = &idStatus[key];
|
|
|
|
|
status->receivedCount += 1;
|
|
|
|
|
CODE_PROBE(status->expectedCount == 0, "ExpireIdempotencyIdRequest received before count is known");
|
|
|
|
|
if (status->expectedCount > 0) {
|
|
|
|
|
ASSERT_LE(status->receivedCount, status->expectedCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
when(ExpectedIdempotencyIdCountForKey req = waitNext(expectedIdempotencyIdCountForKey.getFuture())) {
|
|
|
|
|
key = IdempotencyKey{ req.commitVersion, req.batchIndexHighByte };
|
|
|
|
|
status = &idStatus[key];
|
|
|
|
|
ASSERT_EQ(status->expectedCount, 0);
|
|
|
|
|
status->expectedCount = req.idempotencyIdCount;
|
|
|
|
|
}
|
|
|
|
|
when(wait(purgeOld)) {
|
|
|
|
|
purgeOld = delay(SERVER_KNOBS->IDEMPOTENCY_ID_IN_MEMORY_LIFETIME);
|
|
|
|
|
purgeBefore = now() - SERVER_KNOBS->IDEMPOTENCY_ID_IN_MEMORY_LIFETIME;
|
|
|
|
|
for (iter = idStatus.begin(); iter != idStatus.end();) {
|
|
|
|
|
// We have exclusive access to idStatus in this when block, so iter will still be valid after the
|
|
|
|
|
// wait
|
|
|
|
|
wait(yield());
|
|
|
|
|
if (iter->second.timeReceived < purgeBefore) {
|
|
|
|
|
iter = idStatus.erase(iter);
|
|
|
|
|
} else {
|
|
|
|
|
++iter;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (status->initialized) {
|
|
|
|
|
if (status->receivedCount == status->expectedCount) {
|
|
|
|
|
auto keyRange =
|
|
|
|
|
makeIdempotencySingleKeyRange(idempotencyClears->arena(), key.version, key.highOrderBatchIndex);
|
|
|
|
|
idempotencyClears->push_back(idempotencyClears->arena(),
|
|
|
|
|
MutationRef(MutationRef::ClearRange, keyRange.begin, keyRange.end));
|
|
|
|
|
idStatus.erase(key);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
status->timeReceived = now();
|
|
|
|
|
status->initialized = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-28 14:38:34 +08:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
struct TransactionStateResolveContext {
|
|
|
|
|
// Maximum sequence for txnStateRequest, this is defined when the request last flag is set.
|
|
|
|
|
Sequence maxSequence = std::numeric_limits<Sequence>::max();
|
|
|
|
|
|
|
|
|
|
// Flags marks received transaction state requests, we only process the transaction request when *all* requests are
|
|
|
|
|
// received.
|
|
|
|
|
std::unordered_set<Sequence> receivedSequences;
|
|
|
|
|
|
|
|
|
|
ProxyCommitData* pCommitData = nullptr;
|
|
|
|
|
|
|
|
|
|
// Pointer to transaction state store, shortcut for commitData.txnStateStore
|
|
|
|
|
IKeyValueStore* pTxnStateStore = nullptr;
|
|
|
|
|
|
2022-03-19 06:24:31 +08:00
|
|
|
Future<Void> txnRecovery;
|
|
|
|
|
|
2021-08-28 14:38:34 +08:00
|
|
|
// Actor streams
|
|
|
|
|
PromiseStream<Future<Void>>* pActors = nullptr;
|
|
|
|
|
|
|
|
|
|
// Flag reports if the transaction state request is complete. This request should only happen during recover, i.e.
|
|
|
|
|
// once per commit proxy.
|
|
|
|
|
bool processed = false;
|
|
|
|
|
|
|
|
|
|
TransactionStateResolveContext() = default;
|
|
|
|
|
|
|
|
|
|
TransactionStateResolveContext(ProxyCommitData* pCommitData_, PromiseStream<Future<Void>>* pActors_)
|
|
|
|
|
: pCommitData(pCommitData_), pTxnStateStore(pCommitData_->txnStateStore), pActors(pActors_) {
|
|
|
|
|
ASSERT(pTxnStateStore != nullptr);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ACTOR Future<Void> processCompleteTransactionStateRequest(TransactionStateResolveContext* pContext) {
|
|
|
|
|
state KeyRange txnKeys = allKeys;
|
|
|
|
|
state std::map<Tag, UID> tag_uid;
|
|
|
|
|
|
|
|
|
|
RangeResult UIDtoTagMap = pContext->pTxnStateStore->readRange(serverTagKeys).get();
|
|
|
|
|
for (const KeyValueRef& kv : UIDtoTagMap) {
|
|
|
|
|
tag_uid[decodeServerTagValue(kv.value)] = decodeServerTagKey(kv.key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
|
wait(yield());
|
|
|
|
|
|
|
|
|
|
RangeResult data =
|
|
|
|
|
pContext->pTxnStateStore
|
|
|
|
|
->readRange(txnKeys, SERVER_KNOBS->BUGGIFIED_ROW_LIMIT, SERVER_KNOBS->APPLY_MUTATION_BYTES)
|
|
|
|
|
.get();
|
|
|
|
|
if (!data.size())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
((KeyRangeRef&)txnKeys) = KeyRangeRef(keyAfter(data.back().key, txnKeys.arena()), txnKeys.end);
|
|
|
|
|
|
|
|
|
|
MutationsVec mutations;
|
|
|
|
|
std::vector<std::pair<MapPair<Key, ServerCacheInfo>, int>> keyInfoData;
|
|
|
|
|
std::vector<UID> src, dest;
|
|
|
|
|
ServerCacheInfo info;
|
|
|
|
|
// NOTE: An ACTOR will be compiled into several classes, the this pointer is from one of them.
|
2022-10-05 07:01:02 +08:00
|
|
|
auto updateTagInfo = [pContext = pContext](const std::vector<UID>& uids,
|
|
|
|
|
std::vector<Tag>& tags,
|
|
|
|
|
std::vector<Reference<StorageInfo>>& storageInfoItems) {
|
2021-08-28 14:38:34 +08:00
|
|
|
for (const auto& id : uids) {
|
|
|
|
|
auto storageInfo = getStorageInfo(id, &pContext->pCommitData->storageCache, pContext->pTxnStateStore);
|
|
|
|
|
ASSERT(storageInfo->tag != invalidTag);
|
|
|
|
|
tags.push_back(storageInfo->tag);
|
|
|
|
|
storageInfoItems.push_back(storageInfo);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
for (auto& kv : data) {
|
2024-10-24 07:25:56 +08:00
|
|
|
if (kv.key.startsWith(keyServersPrefix)) {
|
|
|
|
|
KeyRef k = kv.key.removePrefix(keyServersPrefix);
|
|
|
|
|
if (k == allKeys.end) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
decodeKeyServersValue(tag_uid, kv.value, src, dest);
|
2021-08-28 14:38:34 +08:00
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
info.tags.clear();
|
2021-08-28 14:38:34 +08:00
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
info.src_info.clear();
|
|
|
|
|
updateTagInfo(src, info.tags, info.src_info);
|
2021-08-28 14:38:34 +08:00
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
info.dest_info.clear();
|
|
|
|
|
updateTagInfo(dest, info.tags, info.dest_info);
|
2021-08-28 14:38:34 +08:00
|
|
|
|
2024-10-24 07:25:56 +08:00
|
|
|
uniquify(info.tags);
|
|
|
|
|
keyInfoData.emplace_back(MapPair<Key, ServerCacheInfo>(k, info), 1);
|
|
|
|
|
} else if (kv.key.startsWith(rangeLockPrefix)) {
|
2024-11-02 00:48:25 +08:00
|
|
|
if (pContext->pCommitData->rangeLockEnabled()) {
|
|
|
|
|
ASSERT(pContext->pCommitData->rangeLock != nullptr);
|
|
|
|
|
Key keyInsert = kv.key.removePrefix(rangeLockPrefix);
|
|
|
|
|
pContext->pCommitData->rangeLock->initKeyPoint(keyInsert, kv.value);
|
|
|
|
|
}
|
2024-10-24 07:25:56 +08:00
|
|
|
} else {
|
|
|
|
|
mutations.emplace_back(mutations.arena(), MutationRef::SetValue, kv.key, kv.value);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2021-08-28 14:38:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// insert keyTag data separately from metadata mutations so that we can do one bulk insert which
|
|
|
|
|
// avoids a lot of map lookups.
|
|
|
|
|
pContext->pCommitData->keyInfo.rawInsert(keyInfoData);
|
|
|
|
|
|
|
|
|
|
Arena arena;
|
|
|
|
|
bool confChanges;
|
2022-05-03 03:56:51 +08:00
|
|
|
applyMetadataMutations(SpanContext(),
|
2021-08-28 14:38:34 +08:00
|
|
|
*pContext->pCommitData,
|
|
|
|
|
arena,
|
|
|
|
|
Reference<ILogSystem>(),
|
|
|
|
|
mutations,
|
|
|
|
|
/* pToCommit= */ nullptr,
|
|
|
|
|
confChanges,
|
2022-02-19 13:22:31 +08:00
|
|
|
/* version= */ 0,
|
2021-08-28 14:38:34 +08:00
|
|
|
/* popVersion= */ 0,
|
2023-01-19 07:11:58 +08:00
|
|
|
/* initialCommit= */ true,
|
|
|
|
|
/* provisionalCommitProxy */ pContext->pCommitData->provisional);
|
2021-08-28 14:38:34 +08:00
|
|
|
} // loop
|
|
|
|
|
|
|
|
|
|
auto lockedKey = pContext->pTxnStateStore->readValue(databaseLockedKey).get();
|
|
|
|
|
pContext->pCommitData->locked = lockedKey.present() && lockedKey.get().size();
|
|
|
|
|
pContext->pCommitData->metadataVersion = pContext->pTxnStateStore->readValue(metadataVersionKey).get();
|
|
|
|
|
|
|
|
|
|
pContext->pTxnStateStore->enableSnapshot();
|
|
|
|
|
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ACTOR Future<Void> processTransactionStateRequestPart(TransactionStateResolveContext* pContext,
|
|
|
|
|
TxnStateRequest request) {
|
|
|
|
|
ASSERT(pContext->pCommitData != nullptr);
|
|
|
|
|
ASSERT(pContext->pActors != nullptr);
|
|
|
|
|
|
2024-10-16 02:40:02 +08:00
|
|
|
if (pContext->receivedSequences.contains(request.sequence)) {
|
2022-03-19 06:24:31 +08:00
|
|
|
if (pContext->receivedSequences.size() == pContext->maxSequence) {
|
|
|
|
|
wait(pContext->txnRecovery);
|
|
|
|
|
}
|
2021-08-28 14:38:34 +08:00
|
|
|
// This part is already received. Still we will re-broadcast it to other CommitProxies
|
|
|
|
|
pContext->pActors->send(broadcastTxnRequest(request, SERVER_KNOBS->TXN_STATE_SEND_AMOUNT, true));
|
|
|
|
|
wait(yield());
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (request.last) {
|
|
|
|
|
// This is the last piece of subsequence, yet other pieces might still on the way.
|
|
|
|
|
pContext->maxSequence = request.sequence + 1;
|
|
|
|
|
}
|
|
|
|
|
pContext->receivedSequences.insert(request.sequence);
|
|
|
|
|
|
|
|
|
|
// Although we may receive the CommitTransactionRequest for the recovery transaction before all of the
|
|
|
|
|
// TxnStateRequest, we will not get a resolution result from any resolver until the master has submitted its initial
|
|
|
|
|
// (sequence 0) resolution request, which it doesn't do until we have acknowledged all TxnStateRequests
|
|
|
|
|
ASSERT(!pContext->pCommitData->validState.isSet());
|
|
|
|
|
|
|
|
|
|
for (auto& kv : request.data) {
|
|
|
|
|
pContext->pTxnStateStore->set(kv, &request.arena);
|
|
|
|
|
}
|
|
|
|
|
pContext->pTxnStateStore->commit(true);
|
|
|
|
|
|
|
|
|
|
if (pContext->receivedSequences.size() == pContext->maxSequence) {
|
|
|
|
|
// Received all components of the txnStateRequest
|
|
|
|
|
ASSERT(!pContext->processed);
|
2022-03-19 06:24:31 +08:00
|
|
|
pContext->txnRecovery = processCompleteTransactionStateRequest(pContext);
|
|
|
|
|
wait(pContext->txnRecovery);
|
2021-08-28 14:38:34 +08:00
|
|
|
pContext->processed = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pContext->pActors->send(broadcastTxnRequest(request, SERVER_KNOBS->TXN_STATE_SEND_AMOUNT, true));
|
|
|
|
|
wait(yield());
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
Adds more detailed mutation logging to commit proxy
The commit proxy writes a `ProxyMetrics` trace every 5 seconds. This
event contains a lot of useful information, such as the number of commit
batches that arrived and exited, the number of mutations processed, the
number of bytes those mutations made up, etc.. However, it is difficult
to tell what the workload pattern looks like within these 5 second
intervals when the metrics are being calculated.
This PR adds a new trace, `ProxyDetailedMetrics`, which logs itself
every 100ms. It currently only writes the number of mutations and the
number of mutation bytes that arrived during the 100ms time period. But
it should be easy to add more metrics in the future.
It's possible this increased logging could cause issues. Based off a
simulation run of the `WriteDuringRead` test, I got the following
results:
```
$ rg ProxyDetailedMetrics trace.json | wc -l
6877
$ rg "Roles\": \".*CP.*\"" trace.json | wc -l
11402
$ wc -l trace.json
96147 trace.json
```
So on processes running as a commit proxy, this approximately doubled
the number of lines logged. But relative to the cluster overall, it only
added about 5% overhead.
If we want to reduce this number, one possibility would be to not write
a trace if all the values being written are 0. I'm not sure if this
would help much in production, but in simulation the large majority of
the traces (99%+) consist of zero values.
2023-02-17 08:31:27 +08:00
|
|
|
//
|
|
|
|
|
// Metrics related to the commit proxy are logged on a five second interval in
|
|
|
|
|
// the `ProxyMetrics` trace. However, it can be hard to determine workload
|
|
|
|
|
// burstiness when looking at such a large time range. This function adds much
|
|
|
|
|
// more frequent logging for certain metrics to provide fine-grained insight
|
|
|
|
|
// into workload patterns. The metrics logged by this function break down into
|
|
|
|
|
// two categories:
|
|
|
|
|
//
|
|
|
|
|
// * existing counters reported by `ProxyMetrics`
|
|
|
|
|
// * new counters that are only reported by this function
|
|
|
|
|
//
|
|
|
|
|
// Neither is implemented optimally, but the data collected should be helpful
|
|
|
|
|
// in identifying workload patterns on the server.
|
|
|
|
|
//
|
|
|
|
|
// Metrics reporting by this function can be disabled by setting the
|
|
|
|
|
// `BURSTINESS_METRICS_ENABLED` knob to false. The reporting interval can be
|
|
|
|
|
// adjusted by modifying the knob `BURSTINESS_METRICS_LOG_INTERVAL`.
|
|
|
|
|
//
|
|
|
|
|
ACTOR Future<Void> logDetailedMetrics(ProxyCommitData* commitData) {
|
|
|
|
|
state double startTime = 0;
|
|
|
|
|
state int64_t commitBatchInBaseline = 0;
|
|
|
|
|
state int64_t txnCommitInBaseline = 0;
|
|
|
|
|
state int64_t mutationsBaseline = 0;
|
|
|
|
|
state int64_t mutationBytesBaseline = 0;
|
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
|
if (!SERVER_KNOBS->BURSTINESS_METRICS_ENABLED) {
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startTime = now();
|
|
|
|
|
commitBatchInBaseline = commitData->stats.commitBatchIn.getValue();
|
|
|
|
|
txnCommitInBaseline = commitData->stats.txnCommitIn.getValue();
|
|
|
|
|
mutationsBaseline = commitData->stats.mutations.getValue();
|
|
|
|
|
mutationBytesBaseline = commitData->stats.mutationBytes.getValue();
|
|
|
|
|
|
|
|
|
|
wait(delay(SERVER_KNOBS->BURSTINESS_METRICS_LOG_INTERVAL));
|
|
|
|
|
|
|
|
|
|
int64_t commitBatchInReal = commitData->stats.commitBatchIn.getValue();
|
|
|
|
|
int64_t txnCommitInReal = commitData->stats.txnCommitIn.getValue();
|
|
|
|
|
int64_t mutationsReal = commitData->stats.mutations.getValue();
|
|
|
|
|
int64_t mutationBytesReal = commitData->stats.mutationBytes.getValue();
|
|
|
|
|
|
|
|
|
|
// Don't log anything if any of the counters got reset during the wait
|
|
|
|
|
// interval. Assume that typically all the counters get reset at once.
|
|
|
|
|
if (commitBatchInReal < commitBatchInBaseline || txnCommitInReal < txnCommitInBaseline ||
|
|
|
|
|
mutationsReal < mutationsBaseline || mutationBytesReal < mutationBytesBaseline) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceEvent("ProxyDetailedMetrics")
|
|
|
|
|
.detail("Elapsed", now() - startTime)
|
|
|
|
|
.detail("CommitBatchIn", commitBatchInReal - commitBatchInBaseline)
|
|
|
|
|
.detail("TxnCommitIn", txnCommitInReal - txnCommitInBaseline)
|
|
|
|
|
.detail("Mutations", mutationsReal - mutationsBaseline)
|
|
|
|
|
.detail("MutationBytes", mutationBytesReal - mutationBytesBaseline)
|
|
|
|
|
.detail("UniqueClients", commitData->stats.getSizeAndResetUniqueClients());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
ACTOR Future<Void> commitProxyServerCore(CommitProxyInterface proxy,
|
|
|
|
|
MasterInterface master,
|
2022-01-07 04:15:51 +08:00
|
|
|
LifetimeToken masterLifetime,
|
2021-07-12 13:17:09 +08:00
|
|
|
Reference<AsyncVar<ServerDBInfo> const> db,
|
2020-09-11 08:44:15 +08:00
|
|
|
LogEpoch epoch,
|
|
|
|
|
Version recoveryTransactionVersion,
|
|
|
|
|
bool firstProxy,
|
2022-12-13 13:23:55 +08:00
|
|
|
std::string whitelistBinPaths,
|
2024-03-12 00:51:31 +08:00
|
|
|
bool provisional,
|
|
|
|
|
uint16_t commitProxyIndex) {
|
2022-12-13 13:23:55 +08:00
|
|
|
state ProxyCommitData commitData(proxy.id(),
|
|
|
|
|
master,
|
|
|
|
|
proxy.getConsistentReadVersion,
|
|
|
|
|
recoveryTransactionVersion,
|
|
|
|
|
proxy.commit,
|
|
|
|
|
db,
|
|
|
|
|
firstProxy,
|
2024-03-12 00:51:31 +08:00
|
|
|
provisional,
|
2024-04-05 06:03:44 +08:00
|
|
|
commitProxyIndex,
|
|
|
|
|
epoch);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
state Future<Sequence> sequenceFuture = (Sequence)0;
|
2021-09-17 08:42:34 +08:00
|
|
|
state PromiseStream<std::pair<std::vector<CommitTransactionRequest>, int>> batchedCommits;
|
2018-11-10 06:19:18 +08:00
|
|
|
state Future<Void> commitBatcherActor;
|
2017-05-26 04:48:44 +08:00
|
|
|
state Future<Void> lastCommitComplete = Void();
|
|
|
|
|
|
|
|
|
|
state PromiseStream<Future<Void>> addActor;
|
2022-01-07 04:15:51 +08:00
|
|
|
state Future<Void> onError = transformError(actorCollection(addActor.getFuture()), broken_promise(), tlog_failed());
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
addActor.send(waitFailureServer(proxy.waitFailure.getFuture()));
|
2020-09-11 08:44:15 +08:00
|
|
|
addActor.send(traceRole(Role::COMMIT_PROXY, proxy.id()));
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
//TraceEvent("CommitProxyInit1", proxy.id());
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
|
// Wait until we can load the "real" logsystem, since we don't support switching them currently
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
while (!(masterLifetime.isEqual(commitData.db->get().masterLifetime) &&
|
|
|
|
|
commitData.db->get().recoveryState >= RecoveryState::RECOVERY_TRANSACTION)) {
|
2017-05-26 04:48:44 +08:00
|
|
|
//TraceEvent("ProxyInit2", proxy.id()).detail("LSEpoch", db->get().logSystemConfig.epoch).detail("Need", epoch);
|
2019-03-21 00:29:09 +08:00
|
|
|
wait(commitData.db->onChange());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2019-03-21 00:29:09 +08:00
|
|
|
state Future<Void> dbInfoChange = commitData.db->onChange();
|
2017-05-26 04:48:44 +08:00
|
|
|
//TraceEvent("ProxyInit3", proxy.id());
|
|
|
|
|
|
2019-03-21 00:29:09 +08:00
|
|
|
commitData.resolvers = commitData.db->get().resolvers;
|
2022-05-07 02:19:37 +08:00
|
|
|
commitData.localTLogCount = commitData.db->get().logSystemConfig.numLogs();
|
2017-05-26 04:48:44 +08:00
|
|
|
ASSERT(commitData.resolvers.size() != 0);
|
2021-08-06 00:17:37 +08:00
|
|
|
for (int i = 0; i < commitData.resolvers.size(); ++i) {
|
2022-09-20 02:35:58 +08:00
|
|
|
commitData.stats.resolverDist.push_back(Histogram::getHistogram(
|
2022-11-14 12:11:05 +08:00
|
|
|
"CommitProxy"_sr, "ToResolver_" + commitData.resolvers[i].id().toString(), Histogram::Unit::milliseconds));
|
2021-08-06 00:17:37 +08:00
|
|
|
}
|
2021-10-09 09:03:01 +08:00
|
|
|
|
|
|
|
|
// Initialize keyResolvers map
|
|
|
|
|
auto rs = commitData.keyResolvers.modify(SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS ? normalKeys : allKeys);
|
2017-05-26 04:48:44 +08:00
|
|
|
for (auto r = rs.begin(); r != rs.end(); ++r)
|
2019-04-23 05:03:48 +08:00
|
|
|
r->value().emplace_back(0, 0);
|
2021-10-09 09:03:01 +08:00
|
|
|
commitData.systemKeyVersions.push_back(0);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-03-21 00:29:09 +08:00
|
|
|
commitData.logSystem = ILogSystem::fromServerDBInfo(proxy.id(), commitData.db->get(), false, addActor);
|
2019-08-06 08:01:48 +08:00
|
|
|
commitData.logAdapter =
|
|
|
|
|
new LogSystemDiskQueueAdapter(commitData.logSystem, Reference<AsyncVar<PeekTxsInfo>>(), 1, false);
|
2023-01-10 01:17:36 +08:00
|
|
|
commitData.txnStateStore = keyValueStoreLogSystem(
|
Delete encryption at rest (#12667)
Delete encryption at rest in accordance with plans circulated in PR #12400.
Development of this PR was mostly straightforward. Several issues of note:
Upgrade tests which use Redwood want to use the old "encrypt by 0xFF XOR" test-only encoding/encryption algorithm. I wanted to delete that in main and did so. Upgrade tests have been modified not to use Redwood (storage engine 3, mentioned in various storageEngineExcludeTypes test options updates). 7.1 did not define storageEngineExcludeTypes. After some discussion we have decided to delete 7.1-based upgrade tests. 7.3- and 7.4-based upgrade tests remain in place.
Cross-version compatibility (such as it is, I assume in client library startup) remains super easy to break when deleting code. Tips: (A) removing unnecessary arguments to functions is bread and butter code editing when removing code, but if you find yourself removing arguments from a serializer() invocation, you might be breaking a protocol. (B) run ctest -R upgrade early and often.
An implication of these changes is that we are going to rely on the community to make us aware of any {upgrade+Redwood}-specific bugs. In other words, we are declining to continue to go out of our way to test functionality that we have no plans to use.
On the plus side this reclaims 15,000 more lines of code that we don't have to look at or think about, including in common areas such as commit proxy, backups, and generic storage server code.
Testing:
20260129-230241-gglass-15694f5f80af6932 compressed=True data_size=34905446 duration=4335357 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=6:21:47 sanity=False started=100000 stopped=20260130-052428 submitted=20260129-230241 timeout=5400 username=gglass
20260202-214159-gglass-69b90c779cf8ec68 compressed=True data_size=35007141 duration=4612639 ended=100000 fail_fast=1000 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=3:00:25 sanity=False started=100000 stopped=20260203-004224 submitted=20260202-214159 timeout=5400 username=gglass
* Checkpoint file removals and code edits for removing encryption at rest. Have not tried to compile this yet.
* Checkpoint some improvements. Still does not compile.
* Merging with upstream changes in copyright updates resurrected previously deleted files, so delete them again
* Checkpoint incremental progress towards getting this to compile
* Checkpoint more intermediate changes getting encryption at rest deleted. Still doesnt compile but getting closer.
* Changes sufficient to get things to compile with removal of encryption at rest. NOT TESTED.
* Delete encryptModes from toml files run by current fdbserver binaries; restarting tests using <= 7.4 binaries do need encryptModes to say disabled
* Avoid using MAX_ENCODING_VALUE for random purposes for which other solutions are more clear and generally better
* Stop using XOREncryption_TestOnly because that no longer works. Also I see no need to support it as it requires unneeded interfaces and test fixtures in order to actually work.
* Remove more page encryption stuff, and address some TODO(gglass) comments.
* debugging redwood failures
* Fix some misc simulation failures. Notably, disable storage engine type 3 (redwood) on upgrade tests, as it writes databases with encoding type 1 which is no longer supported
* Add a comment discussion deprecation options for fields in persistent metadata, and explain why we are merely renaming the member as deprecated and nothing anything else.
* Remove 7.1 upgrade tests. These tests enable Redwood and write databases with "0xFF XOR encryption" style encoding (encoding 1), which is removed in main.
* Improve comments
* Obligatory f3f commit. Format The Effin Source Files
* Delete more unneeded encryption stuff
* Put back about 1% of deleted code in a desperate attempt to unbreak broken protocol compatibility
* formatting
* Remove mentions of encryption at rest in backup related APIs
* Address misc review comments. Remove --encrypt-files backup option.
2026-02-05 08:02:06 +08:00
|
|
|
commitData.logAdapter, commitData.db, proxy.id(), 2e9, /*doc=*/true, /*ument=*/true, /*constants=*/true);
|
2019-04-13 04:23:02 +08:00
|
|
|
createWhitelistBinPathVec(whitelistBinPaths, commitData.whitelistedBinPathVec);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-11-21 03:44:18 +08:00
|
|
|
commitData.updateLatencyBandConfig(commitData.db->get().latencyBandConfig);
|
|
|
|
|
|
2018-06-02 06:21:40 +08:00
|
|
|
// ((SERVER_MEM_LIMIT * COMMIT_BATCHES_MEM_FRACTION_OF_TOTAL) / COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR) is
|
|
|
|
|
// only a approximate formula for limiting the memory used. COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR is an
|
|
|
|
|
// estimate based on experiments and not an accurate one.
|
2022-04-07 11:06:24 +08:00
|
|
|
state int64_t commitBatchesMemoryLimit = SERVER_KNOBS->COMMIT_BATCHES_MEM_BYTES_HARD_LIMIT;
|
|
|
|
|
if (SERVER_KNOBS->SERVER_MEM_LIMIT > 0) {
|
|
|
|
|
commitBatchesMemoryLimit = std::min(
|
|
|
|
|
commitBatchesMemoryLimit,
|
|
|
|
|
static_cast<int64_t>((SERVER_KNOBS->SERVER_MEM_LIMIT * SERVER_KNOBS->COMMIT_BATCHES_MEM_FRACTION_OF_TOTAL) /
|
|
|
|
|
SERVER_KNOBS->COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR));
|
|
|
|
|
}
|
2018-06-09 02:11:08 +08:00
|
|
|
TraceEvent(SevInfo, "CommitBatchesMemoryLimit").detail("BytesLimit", commitBatchesMemoryLimit);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2024-11-02 00:48:25 +08:00
|
|
|
// Initialize RangeLock
|
|
|
|
|
if (commitData.rangeLockEnabled()) {
|
|
|
|
|
commitData.rangeLock = std::make_shared<RangeLock>(&commitData);
|
|
|
|
|
TraceEvent(SevInfo, "CommitProxyRangeLockEnabled", commitData.dbgid);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-13 04:23:02 +08:00
|
|
|
addActor.send(monitorRemoteCommitted(&commitData));
|
2020-03-14 01:17:49 +08:00
|
|
|
addActor.send(readRequestServer(proxy, addActor, &commitData));
|
2019-04-26 08:07:35 +08:00
|
|
|
addActor.send(rejoinServer(proxy, &commitData));
|
2019-05-17 07:46:33 +08:00
|
|
|
addActor.send(ddMetricsRequestServer(proxy, db));
|
2020-08-30 03:35:31 +08:00
|
|
|
addActor.send(reportTxnTagCommitCost(proxy.id(), db, &commitData.ssTrTagCommitCost));
|
Adds more detailed mutation logging to commit proxy
The commit proxy writes a `ProxyMetrics` trace every 5 seconds. This
event contains a lot of useful information, such as the number of commit
batches that arrived and exited, the number of mutations processed, the
number of bytes those mutations made up, etc.. However, it is difficult
to tell what the workload pattern looks like within these 5 second
intervals when the metrics are being calculated.
This PR adds a new trace, `ProxyDetailedMetrics`, which logs itself
every 100ms. It currently only writes the number of mutations and the
number of mutation bytes that arrived during the 100ms time period. But
it should be easy to add more metrics in the future.
It's possible this increased logging could cause issues. Based off a
simulation run of the `WriteDuringRead` test, I got the following
results:
```
$ rg ProxyDetailedMetrics trace.json | wc -l
6877
$ rg "Roles\": \".*CP.*\"" trace.json | wc -l
11402
$ wc -l trace.json
96147 trace.json
```
So on processes running as a commit proxy, this approximately doubled
the number of lines logged. But relative to the cluster overall, it only
added about 5% overhead.
If we want to reduce this number, one possibility would be to not write
a trace if all the values being written are 0. I'm not sure if this
would help much in production, but in simulation the large majority of
the traces (99%+) consist of zero values.
2023-02-17 08:31:27 +08:00
|
|
|
addActor.send(logDetailedMetrics(&commitData));
|
2022-12-15 06:24:24 +08:00
|
|
|
|
|
|
|
|
auto openDb = openDBOnServer(db);
|
|
|
|
|
|
|
|
|
|
if (firstProxy) {
|
|
|
|
|
addActor.send(recurringAsync(
|
|
|
|
|
[openDb = openDb]() { return cleanIdempotencyIds(openDb, SERVER_KNOBS->IDEMPOTENCY_IDS_MIN_AGE_SECONDS); },
|
|
|
|
|
SERVER_KNOBS->IDEMPOTENCY_IDS_CLEANER_POLLING_INTERVAL,
|
|
|
|
|
true,
|
|
|
|
|
SERVER_KNOBS->IDEMPOTENCY_IDS_CLEANER_POLLING_INTERVAL));
|
|
|
|
|
}
|
|
|
|
|
addActor.send(idempotencyIdsExpireServer(
|
|
|
|
|
openDb, proxy.expireIdempotencyId, commitData.expectedIdempotencyIdCountForKey, &commitData.idempotencyClears));
|
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
// wait for txnStateStore recovery
|
2019-02-13 08:07:17 +08:00
|
|
|
wait(success(commitData.txnStateStore->readValue(StringRef())));
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-08-09 06:00:33 +08:00
|
|
|
int commitBatchByteLimit =
|
|
|
|
|
(int)std::min<double>(SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_BYTES_MAX,
|
|
|
|
|
std::max<double>(SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_BYTES_MIN,
|
|
|
|
|
SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_BYTES_SCALE_BASE *
|
2020-09-11 08:44:15 +08:00
|
|
|
pow(commitData.db->get().client.commitProxies.size(),
|
2019-08-09 06:00:33 +08:00
|
|
|
SERVER_KNOBS->COMMIT_TRANSACTION_BATCH_BYTES_SCALE_POWER)));
|
2018-11-10 06:19:18 +08:00
|
|
|
|
|
|
|
|
commitBatcherActor = commitBatcher(
|
|
|
|
|
&commitData, batchedCommits, proxy.commit.getFuture(), commitBatchByteLimit, commitBatchesMemoryLimit);
|
2021-08-28 14:38:34 +08:00
|
|
|
|
|
|
|
|
// This has to be declared after the commitData.txnStateStore get initialized
|
|
|
|
|
state TransactionStateResolveContext transactionStateResolveContext(&commitData, &addActor);
|
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
loop choose {
|
2018-08-11 04:57:10 +08:00
|
|
|
when(wait(dbInfoChange)) {
|
2019-03-21 00:29:09 +08:00
|
|
|
dbInfoChange = commitData.db->onChange();
|
2022-01-07 04:15:51 +08:00
|
|
|
if (masterLifetime.isEqual(commitData.db->get().masterLifetime) &&
|
2019-03-21 00:29:09 +08:00
|
|
|
commitData.db->get().recoveryState >= RecoveryState::RECOVERY_TRANSACTION) {
|
|
|
|
|
commitData.logSystem = ILogSystem::fromServerDBInfo(proxy.id(), commitData.db->get(), false, addActor);
|
2018-04-26 06:38:34 +08:00
|
|
|
for (auto it : commitData.tag_popped) {
|
|
|
|
|
commitData.logSystem->pop(it.second, it.first);
|
|
|
|
|
}
|
2019-06-20 09:15:09 +08:00
|
|
|
commitData.logSystem->popTxs(commitData.lastTxsPop, tagLocalityRemoteLog);
|
2019-01-19 08:18:34 +08:00
|
|
|
}
|
|
|
|
|
|
2019-11-21 03:44:18 +08:00
|
|
|
commitData.updateLatencyBandConfig(commitData.db->get().latencyBandConfig);
|
2018-04-26 01:16:31 +08:00
|
|
|
}
|
2018-08-11 04:57:10 +08:00
|
|
|
when(wait(onError)) {}
|
2021-09-17 08:42:34 +08:00
|
|
|
when(std::pair<std::vector<CommitTransactionRequest>, int> batchedRequests =
|
|
|
|
|
waitNext(batchedCommits.getFuture())) {
|
2020-03-14 09:31:22 +08:00
|
|
|
// WARNING: this code is run at a high priority, so it needs to do as little work as possible
|
2024-07-24 08:26:11 +08:00
|
|
|
/*
|
|
|
|
|
TraceEvent("CommitProxyCTR", proxy.id())
|
|
|
|
|
.detail("CommitTransactions", trs.size())
|
|
|
|
|
.detail("TransactionRate", transactionRate)
|
|
|
|
|
.detail("TransactionQueue", transactionQueue.size())
|
|
|
|
|
.detail("ReleasedTransactionCount", transactionCount);
|
|
|
|
|
TraceEvent("CommitProxyCore", commitData.dbgid)
|
|
|
|
|
.detail("TxSize", trs.size())
|
|
|
|
|
.detail("MasterLifetime", masterLifetime.toString())
|
|
|
|
|
.detail("DbMasterLifetime", commitData.db->get().masterLifetime.toString())
|
|
|
|
|
.detail("RecoveryState", commitData.db->get().recoveryState)
|
|
|
|
|
.detail("CCInf", commitData.db->get().clusterInterface.id().toString());
|
|
|
|
|
*/
|
2021-09-17 08:42:34 +08:00
|
|
|
const std::vector<CommitTransactionRequest>& trs = batchedRequests.first;
|
2024-07-24 08:26:11 +08:00
|
|
|
const int batchBytes = batchedRequests.second;
|
|
|
|
|
if (trs.size() ||
|
|
|
|
|
(commitData.db->get().recoveryState >= RecoveryState::ACCEPTING_COMMITS &&
|
|
|
|
|
masterLifetime.isEqual(commitData.db->get().masterLifetime) && lastCommitComplete.isReady())) {
|
|
|
|
|
|
|
|
|
|
lastCommitComplete =
|
|
|
|
|
commitBatch(&commitData,
|
|
|
|
|
const_cast<std::vector<CommitTransactionRequest>*>(&batchedRequests.first),
|
|
|
|
|
batchBytes);
|
|
|
|
|
|
|
|
|
|
addActor.send(lastCommitComplete);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-20 02:11:50 +08:00
|
|
|
when(ProxySnapRequest snapReq = waitNext(proxy.proxySnapReq.getFuture())) {
|
2021-07-27 10:55:10 +08:00
|
|
|
TraceEvent(SevDebug, "SnapMasterEnqueue").log();
|
2019-06-20 02:11:50 +08:00
|
|
|
addActor.send(proxySnapCreate(snapReq, &commitData));
|
2019-02-28 07:40:33 +08:00
|
|
|
}
|
2019-08-09 07:30:05 +08:00
|
|
|
when(ExclusionSafetyCheckRequest exclCheckReq = waitNext(proxy.exclusionSafetyCheckReq.getFuture())) {
|
|
|
|
|
addActor.send(proxyCheckSafeExclusion(db, exclCheckReq));
|
2019-02-28 07:40:33 +08:00
|
|
|
}
|
2021-08-28 14:38:34 +08:00
|
|
|
when(TxnStateRequest request = waitNext(proxy.txnState.getFuture())) {
|
2021-08-29 12:10:10 +08:00
|
|
|
addActor.send(processTransactionStateRequestPart(&transactionStateResolveContext, request));
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2023-11-01 00:01:34 +08:00
|
|
|
when(SetThrottledShardRequest request = waitNext(proxy.setThrottledShard.getFuture())) {
|
|
|
|
|
for (auto& shard : request.throttledShards) {
|
|
|
|
|
auto it = commitData.hotShards.begin();
|
|
|
|
|
for (; it != commitData.hotShards.end(); ++it) {
|
|
|
|
|
if (it->first == shard) {
|
|
|
|
|
it->second = request.expirationTime;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (it == commitData.hotShards.end()) {
|
|
|
|
|
commitData.hotShards.emplace_back(std::make_pair(shard, request.expirationTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TraceEvent(SevDebug, "ReceivedSetThrottledShards").detail("NumHotShards", commitData.hotShards.size());
|
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-28 03:54:09 +08:00
|
|
|
// only update the local Db info if the CP is not removed
|
|
|
|
|
ACTOR Future<Void> updateLocalDbInfo(Reference<AsyncVar<ServerDBInfo> const> in,
|
|
|
|
|
Reference<AsyncVar<ServerDBInfo>> out,
|
|
|
|
|
uint64_t recoveryCount,
|
|
|
|
|
CommitProxyInterface myInterface) {
|
|
|
|
|
// whether this CP already receive the db info including itself
|
|
|
|
|
state bool firstValidDbInfo = false;
|
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
loop {
|
2023-01-28 03:54:09 +08:00
|
|
|
bool isIncluded =
|
|
|
|
|
std::count(in->get().client.commitProxies.begin(), in->get().client.commitProxies.end(), myInterface);
|
|
|
|
|
if (in->get().recoveryCount >= recoveryCount && !isIncluded) {
|
2019-07-09 03:53:40 +08:00
|
|
|
throw worker_removed();
|
|
|
|
|
}
|
2023-01-28 03:54:09 +08:00
|
|
|
|
|
|
|
|
if (isIncluded) {
|
|
|
|
|
firstValidDbInfo = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// only update the db info if this is the current CP, or before we received first one including current CP.
|
|
|
|
|
// Several db infos at the beginning just contain the provisional CP
|
|
|
|
|
if (isIncluded || !firstValidDbInfo) {
|
2023-02-06 10:37:46 +08:00
|
|
|
DisabledTraceEvent("UpdateLocalDbInfo", myInterface.id())
|
|
|
|
|
.detail("Provisional", myInterface.provisional)
|
|
|
|
|
.detail("Included", isIncluded)
|
|
|
|
|
.detail("FirstValid", firstValidDbInfo)
|
|
|
|
|
.detail("ReceivedRC", in->get().recoveryCount)
|
Delete multitenant and metacluster features (#12583)
These features have been previously marked for deletion per PR #12400.
This change necessarily affects a lot of files. In general I found it preferable to cut along the FDB <-> tenant boundary, rather than try to cut tenant into multiple pieces, stitch the Frankenstein tenant implementation back together with FDB, and generally remove the limbs one by one. So it is a single big deletion.
Note that some tenant-related metadata has been written in a non-flag-controlled manner by prior releases and probably must be ignored indefinitely. Fortunately this is isolated to include/fdbclient/ClientLogEvents.h. (Details: deleting an Optional from a serialized struct results in deserialization of garbage in upgrade tests. The serialized nullopt to indicate "no Tenant" is formally part of FDB persistent metadata even in FDB clusters that never would have enabled the tenant feature.)
During the course of testing these changes, many interesting bugs were encountered. I won't discuss details of them here. Causes range from flat out damage (by me) to production code in the course of removing tenant related bits (mainly in NativeAPI.actor.cpp and CommitProxy.actor.cpp), damage to various workload files (particularly FuzzApiCorrectness.actor.cpp, which is very sensitive to changes), and many toml files needing updated test flags/options.
More testing details: https://quip-apple.com/Zr6VAycxoli9
20251209-012852-gglass-8ff850b772d868f2 compressed=True data_size=35311687 duration=21671404 ended=500000 fail_fast=1000 max_runs=500000 pass=500000 priority=100 remaining=0 runtime=2:31:30 sanity=False started=500000 stopped=20251209-040022 submitted=20251209-012852 timeout=5400 username=gglass
* remove some unneeded tests, and remove mentions of deleted tests from tests/CmakeLists.txt
* Initiate removal of metacluster. NOTE: this seems to also want removal of tenant. Consider removing them together.
* work on removing metacluster
* delete files with `Tenant` in the name, having reviewed them to ensure that they basically contain what the name implies
* fdb_c.h: remove prototypes for C API methods which have been deleted (blob granule) or which are so long deprecated that they are outside any reasonable/documented support window
* Surgical removal of tenant references from files in bindings/ top level directory. Compilation not yet attempted.
* Surgical removal of tenant related stuff from fdbcli/ top level directory. Compilation not yet attempted.
* Misc tenant code removal, and other stuff which I think may not be needed. Compilation still not attempted.
* Remove more tenant or tenant-adjacent or blob-granule-adjacent stuff. Or at least stuff that looks adjacent to that stuff. Not compiled or tested.
* Start removing Tenant stuff from fdbclient/. Far from complete. Compilation not attempted.
* Remove tenant references from many source files. There are still about 7 principal fdbclient/ and fdbserver/ files with a lot of tenant logic left to delete. Also, all of fdbserver/workloads needs to be looked at. Still have not attempted compilation.
* Remove tenant entanglement from watch functionality
* Remove tenant stuff from fdbserver/tester.actor.cpp
* Delete metacluster workloads
* Remove tenant related stuff from workloads. Also taken the liberty of removing some functionality that appears unused or untestable by Apple.
* Checkpoint tenant removal from FuzzApiCorrectness.actor.cpp
* NativeAPI.actor.cpp: `Tenant` has left the building.
* SimulatedCluster.actor.cpp: `Tenant` has left the building
* DDShardTracker.actor.cpp: Tenant evicted
* storageserver.actor.cpp: `tenant` has left the building.
* fdbserver/workloads/FuzzApiCorrectness.actor.cpp: remove tenant references, but some lingering cleanup needed in `loadAndRun`
* FileBackupAgent.actor.cpp: tenant has left the building
* CommitProxyServer.actor.cpp: remove tenant
* Remove more tenant references from misc files such as bindings tests, documentation, and some fdbserver headers I left earlier
* Fix missing-file errors in CMakeLists.txt files. This is the first attempt to compile this stuff.
* checkpoint misc changes to fix compile errors
* checkpoint more compile fixes
* StorageServerInterface.h: put back more verify() calls
* More misc compile fixes
* whole bunch of misc fixups including some code put-backs to address compile errors
* More compile fixes
* More compile fixes. Still does not compile.
* incremental compile fixing
* ...
* ...
* Checkpoint a bunch of compile fixes. Not quite there but getting closer
* More compile fixes. There seem to be about 10 files left, mainly CommitProxyServer.actor.cpp and storageserver.actor.cpp
* IT COMPILES NOW. THIS IS STILL ALL UNTESTED. Unsurprisingly, CommitProxyServer.actor.cpp and storageserver.actor.cpp took the most tweaking.
The updates in CMakeLists.txt and workloads/UnitTests.actor.cpp are basically trivial and mainly reflect
the ordering of dependencies -- that stuff didn't get attempted until all of fdbserver compiled.
* Put back one block relating to encryption at rest mode. Simplify some TODO(gglass) instances.
* Put back some encryption related knobs
* remove `enable_tenants` from local_cluster.py to maybe fix some ctests
* Remove tenant related options from toml files.
* feature-status.md: add a line for encryption at rest, which seems to have been added for multi-tenant; status is now in doubt
* Fix a pretty bad bug introduced in tenant deletion; ensure we dont attempt to construct a std::string of negative length
* workloads/FuzzApiCorrectness.actor.cpp: avoid division by zero
* flow/Platform.actor.cpp: add a try/catch wrapper around side threads; emit a better addr2line type command
* NativeAPI.actor.cpp: fix a bug introduced in tenant removal relating to reporting conflicting keys under conflictingKeysRange
* ReportConflictingKeys.actor.cpp: separate an ANDed assert into two asserts
* SpecialKeySPaceCorrectness.actor.cpp: put back some logic removed with tenant removal. This test was failing due to a bug with conflict key range reporting. Fixed separately in NativeAPI.actor.cpp.
* remove QuotaCommand.actor.cpp
* Force disable tenant and encryption on disk in upgrade tests
* Add back file I guess I deleted? who knows
* put back another file
* design/feature-status.md: update the new row for encryption at rest to firm up the claim that it is experimental, unowned, and scheduled for deletion
* Remove EncryptKeyProxyTest since we do not use it
* new file tests/slow/BulkDumpingS3WithChaos.toml: remove tenantModes setting
* Undo damage to pushToBackupMutations() from removing tenant feature. This caused inverted_range errors and failed commits in backup related simulations.
* tests/restarting/from_7.4.0/Snap*-1: ensure that tenantModes = disabled
* Try again on workloads/FuzzApiCorrectness.actor.cpp
* simplify tenant-free (mostly) FuzzApiCorrectness workload code
* try harder to remove lingering tenant-related brokenness from FuzzApiCorrectness.actor.cpp
* Explicitly specify tenantModes = ['disabled'] in all the -1 restart files
* Remove tenantModes from 7.1-based upgrade tests as its an unknown option. Hopefully the code doesnt actually turn on tenant stuff
* do not specify tenantModes in downgrade tests
* Downgrade test to_7.4.5: dont say tenantModes
* more tenantModes updates
* Remove a legacy allowDefaultTenant that no longer is meaningful in downgrade to 8.0
* Put back empty Optional<TenantName> turdlets into serialized log events to avoid breaking ClientTransactionProfilingCorrectness upgrade tests (even with tenantMode = disabled)
* disable encryption on a few more upgrade related test cases. That feature is slated for removal anyway
* Remove unneeded workload files that have been subject to #if 0 for a while. Remove commented out block in ClusterRecovery
* disable encryption in more upgrade tests
* Remove choice four-letter words from commentary
* Format 42 files
* Try to fix a doc bug failing the CI build
* More doc compilation error fixes
* Delete more tenant junk from documentation
* fix spelling mistake in comment
* Remove deleted cross-references from documentation. This necessitated editing release 3.0.0 release notes, which is insane.
* Remove more tenant stuff from bindings tests
* Remove more tenant bits from design/ files
* Remove more tenant related stuff
* Delete more tenant references. Put back ten-ant spellings as tenant now that grep output is substantially reduced.
* Put back some tenant stuff into apitester; its deletion seems to have introduced bugs. Also whine about comments some more, because, really, the comments deserve it.
* Updates to workload files and one other thing based on review comments
* de-actorify decodeKVPairs
* format one source file
* Restore transaction tagging doc
* Restore throttle doc details in administration.rst
* Restore fdbserver/workloads/GetEstimatedRangeSize.actor.cpp and associated toml file, minus tenant stuff
* bindings/c/test/{shim related}: update comments and disable functionality that no longer works post-tenant
* put the cli-throttle tag back in
* bindingtester: fix python syntax errors
* remove useless comment
* Remove comment about useless comments, and remove the useless comments
2025-12-10 04:39:41 +08:00
|
|
|
.detail("RecoveryCount", recoveryCount);
|
2023-02-06 10:37:46 +08:00
|
|
|
if (in->get().recoveryCount >= out->get().recoveryCount) {
|
|
|
|
|
out->set(in->get());
|
|
|
|
|
}
|
2023-01-28 03:54:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wait(in->onChange());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
ACTOR Future<Void> commitProxyServer(CommitProxyInterface proxy,
|
|
|
|
|
InitializeCommitProxyRequest req,
|
2021-07-12 13:17:09 +08:00
|
|
|
Reference<AsyncVar<ServerDBInfo> const> db,
|
2020-09-11 08:44:15 +08:00
|
|
|
std::string whitelistBinPaths) {
|
2017-05-26 04:48:44 +08:00
|
|
|
try {
|
2023-01-28 03:54:09 +08:00
|
|
|
state Reference<AsyncVar<ServerDBInfo>> localDb = makeReference<AsyncVar<ServerDBInfo>>();
|
2020-09-11 08:44:15 +08:00
|
|
|
state Future<Void> core = commitProxyServerCore(proxy,
|
|
|
|
|
req.master,
|
2022-01-07 04:15:51 +08:00
|
|
|
req.masterLifetime,
|
2023-01-28 03:54:09 +08:00
|
|
|
localDb,
|
2020-09-11 08:44:15 +08:00
|
|
|
req.recoveryCount,
|
|
|
|
|
req.recoveryTransactionVersion,
|
|
|
|
|
req.firstProxy,
|
2022-12-13 13:23:55 +08:00
|
|
|
whitelistBinPaths,
|
2024-03-12 00:51:31 +08:00
|
|
|
proxy.provisional,
|
|
|
|
|
req.commitProxyIndex);
|
2023-01-28 03:54:09 +08:00
|
|
|
wait(core || updateLocalDbInfo(db, localDb, req.recoveryCount, proxy));
|
2017-05-26 04:48:44 +08:00
|
|
|
} catch (Error& e) {
|
2024-04-18 05:49:48 +08:00
|
|
|
Severity sev = e.code() == error_code_failed_to_progress ? SevWarnAlways : SevInfo;
|
|
|
|
|
TraceEvent(sev, "CommitProxyTerminated", proxy.id()).errorUnsuppressed(e);
|
2019-07-09 03:53:40 +08:00
|
|
|
|
|
|
|
|
if (e.code() != error_code_worker_removed && e.code() != error_code_tlog_stopped &&
|
2022-01-07 04:15:51 +08:00
|
|
|
e.code() != error_code_tlog_failed && e.code() != error_code_coordinators_changed &&
|
2021-07-20 12:00:28 +08:00
|
|
|
e.code() != error_code_coordinated_state_conflict && e.code() != error_code_new_coordinators_timed_out &&
|
|
|
|
|
e.code() != error_code_failed_to_progress) {
|
2019-07-09 03:53:40 +08:00
|
|
|
throw;
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2022-07-20 04:15:51 +08:00
|
|
|
CODE_PROBE(e.code() == error_code_failed_to_progress, "Commit proxy failed to progress");
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2019-07-28 07:46:22 +08:00
|
|
|
return Void();
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2023-02-09 06:35:35 +08:00
|
|
|
|
|
|
|
|
void forceLinkCommitProxyTests() {}
|