2019-01-25 03:43:26 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
/*
|
2020-09-11 08:44:15 +08:00
|
|
|
* CommitProxyInterface.h
|
2017-05-26 04:48:44 +08:00
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2018 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-09-11 08:44:15 +08:00
|
|
|
#ifndef FDBCLIENT_COMMITPROXYINTERFACE_H
|
|
|
|
#define FDBCLIENT_COMMITPROXYINTERFACE_H
|
2017-05-26 04:48:44 +08:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-17 04:54:06 +08:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-10-20 01:30:13 +08:00
|
|
|
#include "fdbclient/FDBTypes.h"
|
|
|
|
#include "fdbclient/StorageServerInterface.h"
|
|
|
|
#include "fdbclient/CommitTransaction.h"
|
2020-04-17 23:07:01 +08:00
|
|
|
#include "fdbserver/RatekeeperInterface.h"
|
2020-04-10 07:55:56 +08:00
|
|
|
#include "fdbclient/TagThrottle.h"
|
2021-03-16 09:03:54 +08:00
|
|
|
#include "fdbclient/GlobalConfig.h"
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-07-10 07:39:15 +08:00
|
|
|
#include "fdbrpc/Stats.h"
|
2019-08-01 23:39:52 +08:00
|
|
|
#include "fdbrpc/TimedRequest.h"
|
2020-07-15 15:37:41 +08:00
|
|
|
#include "GrvProxyInterface.h"
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-09-11 08:44:15 +08:00
|
|
|
struct CommitProxyInterface {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 8954922;
|
2017-05-26 04:48:44 +08:00
|
|
|
enum { LocationAwareLoadBalance = 1 };
|
2018-11-03 04:15:09 +08:00
|
|
|
enum { AlwaysFresh = 1 };
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-05-02 05:30:50 +08:00
|
|
|
Optional<Key> processId;
|
2019-03-20 04:37:50 +08:00
|
|
|
bool provisional;
|
2021-03-11 02:06:03 +08:00
|
|
|
RequestStream<struct CommitTransactionRequest> commit;
|
|
|
|
RequestStream<struct GetReadVersionRequest>
|
|
|
|
getConsistentReadVersion; // Returns a version which (1) is committed, and (2) is >= the latest version reported
|
|
|
|
// committed (by a commit response) when this request was sent
|
|
|
|
// (at some point between when this request is sent and when its response is
|
|
|
|
// received, the latest version reported committed)
|
|
|
|
RequestStream<struct GetKeyServerLocationsRequest> getKeyServersLocations;
|
|
|
|
RequestStream<struct GetStorageServerRejoinInfoRequest> getStorageServerRejoinInfo;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
RequestStream<ReplyPromise<Void>> waitFailure;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
RequestStream<struct TxnStateRequest> txnState;
|
|
|
|
RequestStream<struct GetHealthMetricsRequest> getHealthMetrics;
|
|
|
|
RequestStream<struct ProxySnapRequest> proxySnapReq;
|
|
|
|
RequestStream<struct ExclusionSafetyCheckRequest> exclusionSafetyCheckReq;
|
|
|
|
RequestStream<struct GetDDMetricsRequest> getDDMetrics;
|
2019-02-02 02:58:42 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
UID id() const { return commit.getEndpoint().token; }
|
|
|
|
std::string toString() const { return id().shortString(); }
|
2020-09-11 08:44:15 +08:00
|
|
|
bool operator==(CommitProxyInterface const& r) const { return id() == r.id(); }
|
|
|
|
bool operator!=(CommitProxyInterface const& r) const { return id() != r.id(); }
|
2018-10-31 04:44:37 +08:00
|
|
|
NetworkAddress address() const { return commit.getEndpoint().getPrimaryAddress(); }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <class Archive>
|
|
|
|
void serialize(Archive& ar) {
|
2020-05-23 00:25:32 +08:00
|
|
|
serializer(ar, processId, provisional, commit);
|
2021-03-11 02:06:03 +08:00
|
|
|
if (Archive::isDeserializing) {
|
|
|
|
getConsistentReadVersion =
|
|
|
|
RequestStream<struct GetReadVersionRequest>(commit.getEndpoint().getAdjustedEndpoint(1));
|
|
|
|
getKeyServersLocations =
|
|
|
|
RequestStream<struct GetKeyServerLocationsRequest>(commit.getEndpoint().getAdjustedEndpoint(2));
|
|
|
|
getStorageServerRejoinInfo =
|
|
|
|
RequestStream<struct GetStorageServerRejoinInfoRequest>(commit.getEndpoint().getAdjustedEndpoint(3));
|
|
|
|
waitFailure = RequestStream<ReplyPromise<Void>>(commit.getEndpoint().getAdjustedEndpoint(4));
|
|
|
|
txnState = RequestStream<struct TxnStateRequest>(commit.getEndpoint().getAdjustedEndpoint(5));
|
|
|
|
getHealthMetrics =
|
|
|
|
RequestStream<struct GetHealthMetricsRequest>(commit.getEndpoint().getAdjustedEndpoint(6));
|
|
|
|
proxySnapReq = RequestStream<struct ProxySnapRequest>(commit.getEndpoint().getAdjustedEndpoint(7));
|
|
|
|
exclusionSafetyCheckReq =
|
|
|
|
RequestStream<struct ExclusionSafetyCheckRequest>(commit.getEndpoint().getAdjustedEndpoint(8));
|
|
|
|
getDDMetrics = RequestStream<struct GetDDMetricsRequest>(commit.getEndpoint().getAdjustedEndpoint(9));
|
2020-05-02 07:41:20 +08:00
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void initEndpoints() {
|
2020-05-02 07:41:20 +08:00
|
|
|
std::vector<std::pair<FlowReceiver*, TaskPriority>> streams;
|
|
|
|
streams.push_back(commit.getReceiver(TaskPriority::ReadSocket));
|
|
|
|
streams.push_back(getConsistentReadVersion.getReceiver(TaskPriority::ReadSocket));
|
2021-03-11 02:06:03 +08:00
|
|
|
streams.push_back(getKeyServersLocations.getReceiver(
|
|
|
|
TaskPriority::ReadSocket)); // priority lowered to TaskPriority::DefaultEndpoint on the proxy
|
2020-05-02 07:41:20 +08:00
|
|
|
streams.push_back(getStorageServerRejoinInfo.getReceiver(TaskPriority::ProxyStorageRejoin));
|
|
|
|
streams.push_back(waitFailure.getReceiver());
|
|
|
|
streams.push_back(txnState.getReceiver());
|
|
|
|
streams.push_back(getHealthMetrics.getReceiver());
|
|
|
|
streams.push_back(proxySnapReq.getReceiver());
|
|
|
|
streams.push_back(exclusionSafetyCheckReq.getReceiver());
|
2020-05-23 00:25:32 +08:00
|
|
|
streams.push_back(getDDMetrics.getReceiver());
|
|
|
|
FlowTransport::transport().addEndpoints(streams);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-09 03:53:40 +08:00
|
|
|
// ClientDBInfo is all the information needed by a database client to access the database
|
|
|
|
// It is returned (and kept up to date) by the OpenDatabaseRequest interface of ClusterInterface
|
|
|
|
struct ClientDBInfo {
|
|
|
|
constexpr static FileIdentifier file_identifier = 5355080;
|
2021-03-11 02:06:03 +08:00
|
|
|
UID id; // Changes each time anything else changes
|
2020-09-16 13:29:49 +08:00
|
|
|
vector<GrvProxyInterface> grvProxies;
|
2020-09-11 08:44:15 +08:00
|
|
|
vector<CommitProxyInterface> commitProxies;
|
|
|
|
Optional<CommitProxyInterface>
|
2020-09-16 13:29:49 +08:00
|
|
|
firstCommitProxy; // not serialized, used for commitOnFirstProxy when the commit proxies vector has been shrunk
|
2019-07-24 10:22:44 +08:00
|
|
|
Optional<Value> forward;
|
2021-03-16 09:03:54 +08:00
|
|
|
vector<VersionHistory> history;
|
2020-04-10 07:55:56 +08:00
|
|
|
|
2021-02-24 08:17:05 +08:00
|
|
|
ClientDBInfo() {}
|
2019-07-09 03:53:40 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
bool operator==(ClientDBInfo const& r) const { return id == r.id; }
|
|
|
|
bool operator!=(ClientDBInfo const& r) const { return id != r.id; }
|
2019-07-09 03:53:40 +08:00
|
|
|
|
|
|
|
template <class Archive>
|
|
|
|
void serialize(Archive& ar) {
|
|
|
|
if constexpr (!is_fb_function<Archive>) {
|
|
|
|
ASSERT(ar.protocolVersion().isValid());
|
|
|
|
}
|
2021-02-24 08:17:05 +08:00
|
|
|
serializer(ar, grvProxies, commitProxies, id, forward, history);
|
2019-07-09 03:53:40 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-28 07:46:22 +08:00
|
|
|
struct CommitID {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 14254927;
|
2021-03-11 02:06:03 +08:00
|
|
|
Version version; // returns invalidVersion if transaction conflicts
|
2017-05-26 04:48:44 +08:00
|
|
|
uint16_t txnBatchId;
|
2019-03-05 08:48:34 +08:00
|
|
|
Optional<Value> metadataVersion;
|
2020-03-25 00:48:03 +08:00
|
|
|
Optional<Standalone<VectorRef<int>>> conflictingKRIndices;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2020-03-25 00:48:03 +08:00
|
|
|
serializer(ar, version, txnBatchId, metadataVersion, conflictingKRIndices);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CommitID() : version(invalidVersion), txnBatchId(0) {}
|
2021-03-11 02:06:03 +08:00
|
|
|
CommitID(Version version,
|
|
|
|
uint16_t txnBatchId,
|
|
|
|
const Optional<Value>& metadataVersion,
|
2020-03-27 06:52:30 +08:00
|
|
|
const Optional<Standalone<VectorRef<int>>>& conflictingKRIndices = Optional<Standalone<VectorRef<int>>>())
|
|
|
|
: version(version), txnBatchId(txnBatchId), metadataVersion(metadataVersion),
|
|
|
|
conflictingKRIndices(conflictingKRIndices) {}
|
2017-05-26 04:48:44 +08:00
|
|
|
};
|
|
|
|
|
2018-12-01 02:46:04 +08:00
|
|
|
struct CommitTransactionRequest : TimedRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 93948;
|
2021-03-11 02:06:03 +08:00
|
|
|
enum { FLAG_IS_LOCK_AWARE = 0x1, FLAG_FIRST_IN_BATCH = 0x2 };
|
2018-02-10 10:21:29 +08:00
|
|
|
|
2019-03-16 01:34:57 +08:00
|
|
|
bool isLockAware() const { return (flags & FLAG_IS_LOCK_AWARE) != 0; }
|
|
|
|
bool firstInBatch() const { return (flags & FLAG_FIRST_IN_BATCH) != 0; }
|
2021-03-11 02:06:03 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
Arena arena;
|
2020-07-08 00:06:13 +08:00
|
|
|
SpanID spanContext;
|
2017-05-26 04:48:44 +08:00
|
|
|
CommitTransactionRef transaction;
|
2018-02-10 10:21:29 +08:00
|
|
|
ReplyPromise<CommitID> reply;
|
|
|
|
uint32_t flags;
|
2017-05-26 04:48:44 +08:00
|
|
|
Optional<UID> debugID;
|
2020-08-01 14:14:52 +08:00
|
|
|
Optional<ClientTrCommitCostEstimation> commitCostEstimation;
|
2020-07-15 07:07:21 +08:00
|
|
|
Optional<TagSet> tagSet;
|
2018-02-10 10:21:29 +08:00
|
|
|
|
2020-08-28 06:11:16 +08:00
|
|
|
CommitTransactionRequest() : CommitTransactionRequest(SpanID()) {}
|
|
|
|
CommitTransactionRequest(SpanID const& context) : spanContext(context), flags(0) {}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2020-07-14 01:22:37 +08:00
|
|
|
serializer(ar, transaction, reply, arena, flags, debugID, commitCostEstimation, tagSet, spanContext);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
static inline int getBytes(CommitTransactionRequest const& r) {
|
2017-05-26 04:48:44 +08:00
|
|
|
// SOMEDAY: Optimize
|
2021-03-11 02:06:03 +08:00
|
|
|
// return r.arena.getSize(); // NOT correct because arena can be shared!
|
2017-05-26 04:48:44 +08:00
|
|
|
int total = sizeof(r);
|
2021-03-11 02:06:03 +08:00
|
|
|
for (auto m = r.transaction.mutations.begin(); m != r.transaction.mutations.end(); ++m)
|
2018-11-03 03:52:34 +08:00
|
|
|
total += m->expectedSize() + CLIENT_KNOBS->PROXY_COMMIT_OVERHEAD_BYTES;
|
2021-03-11 02:06:03 +08:00
|
|
|
for (auto i = r.transaction.read_conflict_ranges.begin(); i != r.transaction.read_conflict_ranges.end(); ++i)
|
2017-05-26 04:48:44 +08:00
|
|
|
total += i->expectedSize();
|
2021-03-11 02:06:03 +08:00
|
|
|
for (auto i = r.transaction.write_conflict_ranges.begin(); i != r.transaction.write_conflict_ranges.end(); ++i)
|
2017-05-26 04:48:44 +08:00
|
|
|
total += i->expectedSize();
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2020-01-08 17:59:01 +08:00
|
|
|
struct GetReadVersionReply : public BasicLoadBalancedReply {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 15709388;
|
2017-05-26 04:48:44 +08:00
|
|
|
Version version;
|
|
|
|
bool locked;
|
2019-03-01 09:45:00 +08:00
|
|
|
Optional<Value> metadataVersion;
|
2020-08-13 01:49:12 +08:00
|
|
|
int64_t midShardSize = 0;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-04-18 00:06:45 +08:00
|
|
|
TransactionTagMap<ClientTagThrottleLimits> tagThrottleInfo;
|
2020-04-08 07:28:09 +08:00
|
|
|
|
Initialize in default constructor for GetReadVersionReply
==10473== Uninitialised byte(s) found during client check request
==10473== at 0x1BA9ACE: sendPacket(TransportData*, ISerializeSource const&, Endpoint const&, bool, bool) (FlowTransport.actor.cpp:1252)
==10473== by 0x877C05: (anonymous namespace)::NetworkSenderActorState<GetReadVersionReply, (anonymous namespace)::NetworkSenderActor<GetReadVersionReply> >::a_body1cont2(GetReadVersionReply const&, int) [clone .isra.0] (networksender.actor
.h:40)
==10473== by 0x877CC6: a_body1when1 (networksender.actor.g.h:147)
==10473== by 0x877CC6: a_callback_fire (networksender.actor.g.h:161)
==10473== by 0x877CC6: ActorCallback<(anonymous namespace)::NetworkSenderActor<GetReadVersionReply>, 0, GetReadVersionReply>::fire(GetReadVersionReply const&) (flow.h:894)
==10473== by 0xC343A7: send<GetReadVersionReply&> (flow.h:343)
==10473== by 0xC343A7: send<GetReadVersionReply&> (fdbrpc.h:124)
==10473== by 0xC343A7: (anonymous namespace)::ForwardProxyActorState<(anonymous namespace)::ForwardProxyActor>::a_body1loopBody1when2(ReplyPromise<GetReadVersionReply> const&, int) (MasterProxyServer.actor.cpp:1814)
==10473== by 0xC33C10: (anonymous namespace)::ForwardProxyActorState<(anonymous namespace)::ForwardProxyActor>::a_body1loopBody1(int) (MasterProxyServer.actor.g.cpp:8167)
==10473== by 0xC35434: a_body1loopHead1 (MasterProxyServer.actor.g.cpp:8152)
==10473== by 0xC35434: a_body1loopBody1cont2 (MasterProxyServer.actor.g.cpp:8327)
==10473== by 0xC35434: a_body1loopBody1cont1when1 (MasterProxyServer.actor.g.cpp:8333)
==10473== by 0xC35434: a_body1loopBody1cont1when1 (MasterProxyServer.actor.g.cpp:8331)
==10473== by 0xC35434: a_callback_fire (MasterProxyServer.actor.g.cpp:8347)
==10473== by 0xC35434: ActorCallback<(anonymous namespace)::ForwardProxyActor, 3, Void>::fire(Void const&) (flow.h:894)
==10473== by 0x7E7BE7: SAV<Void>::finishSendAndDelPromiseRef() (flow.h:375)
==10473== by 0x8319FD: a_body1when1 (genericactors.actor.g.h:10892)
==10473== by 0x8319FD: a_callback_fire (genericactors.actor.g.h:10920)
==10473== by 0x8319FD: ActorCallback<(anonymous namespace)::ChooseActorActor<Void>, 0, Void>::fire(Void const&) (flow.h:894)
==10473== by 0x891917: void SAV<Void>::send<Void>(Void&&) (flow.h:343)
==10473== by 0x1C47ADC: send<Void> (flow.h:674)
==10473== by 0x1C47ADC: execTask (sim2.actor.cpp:1632)
==10473== by 0x1C47ADC: Sim2::RunLoopActorState<Sim2::RunLoopActor>::a_body1loopBody1cont1(Void const&, int) (sim2.actor.cpp:975)
==10473== by 0x1C47FF2: a_body1loopBody1when1 (sim2.actor.g.cpp:5092)
==10473== by 0x1C47FF2: Sim2::RunLoopActorState<Sim2::RunLoopActor>::a_body1loopBody1(int) (sim2.actor.g.cpp:5037)
==10473== by 0x1C47A6C: a_body1loopHead1 (sim2.actor.g.cpp:5020)
==10473== by 0x1C47A6C: Sim2::RunLoopActorState<Sim2::RunLoopActor>::a_body1loopBody1cont1(Void const&, int) (sim2.actor.g.cpp:5086)
==10473== Address 0x12db1ba1 is 2,977 bytes inside a recently re-allocated block of size 4,096 alloc'd
==10473== at 0x1CC5D7F: FastAllocator<4096>::allocate() (FastAlloc.cpp:290)
==10473== by 0x1CFAA68: operator new (FastAlloc.h:193)
==10473== by 0x1CFAA68: PacketWriter::nextBuffer() (Net2Packet.cpp:59)
==10473== by 0x1CFABD6: PacketWriter::writeAhead(int, SplitBuffer*) (Net2Packet.cpp:81)
==10473== by 0x1BA97EB: sendPacket(TransportData*, ISerializeSource const&, Endpoint const&, bool, bool) (FlowTransport.actor.cpp:1199)
==10473== by 0x7DEAD1: a_body1cont2 (networksender.actor.h:40)
==10473== by 0x7DEAD1: a_body1when1 (networksender.actor.g.h:147)
==10473== by 0x7DEAD1: a_callback_fire (networksender.actor.g.h:161)
==10473== by 0x7DEAD1: ActorCallback<(anonymous namespace)::NetworkSenderActor<GetValueReply>, 0, GetValueReply>::fire(GetValueReply const&) (flow.h:894)
==10473== by 0xF22767: send<GetValueReply&> (flow.h:343)
==10473== by 0xF22767: send<GetValueReply&> (fdbrpc.h:124)
==10473== by 0xF22767: (anonymous namespace)::GetValueQActorState<(anonymous namespace)::GetValueQActor>::a_body1cont5(int) [clone .isra.0] (storageserver.actor.cpp:890)
==10473== by 0xF2305C: (anonymous namespace)::GetValueQActorState<(anonymous namespace)::GetValueQActor>::a_body1cont3(int) [clone .isra.0] (storageserver.actor.g.cpp:1592)
==10473== by 0xF23447: a_body1cont2when1 (storageserver.actor.g.cpp:1627)
==10473== by 0xF23447: (anonymous namespace)::GetValueQActorState<(anonymous namespace)::GetValueQActor>::a_body1cont2(Void const&, int) [clone .isra.0] (storageserver.actor.g.cpp:1512)
==10473== by 0xF23507: a_body1when1 (storageserver.actor.g.cpp:1523)
==10473== by 0xF23507: a_callback_fire (storageserver.actor.g.cpp:1537)
==10473== by 0xF23507: ActorCallback<(anonymous namespace)::GetValueQActor, 0, Void>::fire(Void const&) (flow.h:894)
==10473== by 0x891917: void SAV<Void>::send<Void>(Void&&) (flow.h:343)
==10473== by 0x1C47ADC: send<Void> (flow.h:674)
==10473== by 0x1C47ADC: execTask (sim2.actor.cpp:1632)
==10473== by 0x1C47ADC: Sim2::RunLoopActorState<Sim2::RunLoopActor>::a_body1loopBody1cont1(Void const&, int) (sim2.actor.cpp:975)
==10473== by 0x1C47FF2: a_body1loopBody1when1 (sim2.actor.g.cpp:5092)
==10473== by 0x1C47FF2: Sim2::RunLoopActorState<Sim2::RunLoopActor>::a_body1loopBody1(int) (sim2.actor.g.cpp:5037)
==10473== Uninitialised value was created by a stack allocation
==10473== at 0xC342D0: (anonymous namespace)::ForwardProxyActorState<(anonymous namespace)::ForwardProxyActor>::a_body1loopBody1when2(ReplyPromise<GetReadVersionReply> const&, int) (MasterProxyServer.actor.g.cpp:8213)
2019-07-20 03:53:48 +08:00
|
|
|
GetReadVersionReply() : version(invalidVersion), locked(false) {}
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2021-03-11 02:06:03 +08:00
|
|
|
serializer(ar,
|
|
|
|
BasicLoadBalancedReply::processBusyTime,
|
|
|
|
version,
|
|
|
|
locked,
|
|
|
|
metadataVersion,
|
|
|
|
tagThrottleInfo,
|
|
|
|
midShardSize);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-01 02:46:04 +08:00
|
|
|
struct GetReadVersionRequest : TimedRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 838566;
|
2021-03-11 02:06:03 +08:00
|
|
|
enum {
|
|
|
|
PRIORITY_SYSTEM_IMMEDIATE =
|
|
|
|
15 << 24, // Highest possible priority, always executed even if writes are otherwise blocked
|
2017-05-26 04:48:44 +08:00
|
|
|
PRIORITY_DEFAULT = 8 << 24,
|
|
|
|
PRIORITY_BATCH = 1 << 24
|
|
|
|
};
|
2019-03-20 09:44:37 +08:00
|
|
|
enum {
|
2020-01-08 06:15:29 +08:00
|
|
|
FLAG_USE_MIN_KNOWN_COMMITTED_VERSION = 4,
|
2019-03-20 09:44:37 +08:00
|
|
|
FLAG_USE_PROVISIONAL_PROXIES = 2,
|
2017-05-26 04:48:44 +08:00
|
|
|
FLAG_CAUSAL_READ_RISKY = 1,
|
|
|
|
FLAG_PRIORITY_MASK = PRIORITY_SYSTEM_IMMEDIATE,
|
|
|
|
};
|
|
|
|
|
2020-07-08 00:06:13 +08:00
|
|
|
SpanID spanContext;
|
2017-05-26 04:48:44 +08:00
|
|
|
uint32_t transactionCount;
|
|
|
|
uint32_t flags;
|
2020-04-25 02:31:16 +08:00
|
|
|
TransactionPriority priority;
|
2020-04-17 05:43:22 +08:00
|
|
|
|
2020-04-24 11:50:40 +08:00
|
|
|
TransactionTagMap<uint32_t> tags;
|
2020-04-17 05:43:22 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
Optional<UID> debugID;
|
|
|
|
ReplyPromise<GetReadVersionReply> reply;
|
|
|
|
|
2020-04-25 02:31:16 +08:00
|
|
|
GetReadVersionRequest() : transactionCount(1), flags(0) {}
|
2021-03-11 02:06:03 +08:00
|
|
|
GetReadVersionRequest(SpanID spanContext,
|
|
|
|
uint32_t transactionCount,
|
|
|
|
TransactionPriority priority,
|
|
|
|
uint32_t flags = 0,
|
|
|
|
TransactionTagMap<uint32_t> tags = TransactionTagMap<uint32_t>(),
|
2020-07-08 00:06:13 +08:00
|
|
|
Optional<UID> debugID = Optional<UID>())
|
|
|
|
: spanContext(spanContext), transactionCount(transactionCount), priority(priority), flags(flags), tags(tags),
|
|
|
|
debugID(debugID) {
|
2020-04-25 02:31:16 +08:00
|
|
|
flags = flags & ~FLAG_PRIORITY_MASK;
|
2021-03-11 02:06:03 +08:00
|
|
|
switch (priority) {
|
|
|
|
case TransactionPriority::BATCH:
|
|
|
|
flags |= PRIORITY_BATCH;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::DEFAULT:
|
|
|
|
flags |= PRIORITY_DEFAULT;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::IMMEDIATE:
|
|
|
|
flags |= PRIORITY_SYSTEM_IMMEDIATE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
2020-04-25 02:31:16 +08:00
|
|
|
}
|
|
|
|
}
|
2020-07-08 00:06:13 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
bool operator<(GetReadVersionRequest const& rhs) const { return priority < rhs.priority; }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2020-07-08 00:06:13 +08:00
|
|
|
serializer(ar, transactionCount, flags, tags, debugID, reply, spanContext);
|
2020-04-25 02:31:16 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
if (ar.isDeserializing) {
|
|
|
|
if ((flags & PRIORITY_SYSTEM_IMMEDIATE) == PRIORITY_SYSTEM_IMMEDIATE) {
|
2020-04-25 02:31:16 +08:00
|
|
|
priority = TransactionPriority::IMMEDIATE;
|
2021-03-11 02:06:03 +08:00
|
|
|
} else if ((flags & PRIORITY_DEFAULT) == PRIORITY_DEFAULT) {
|
2020-04-25 02:31:16 +08:00
|
|
|
priority = TransactionPriority::DEFAULT;
|
2021-03-11 02:06:03 +08:00
|
|
|
} else if ((flags & PRIORITY_BATCH) == PRIORITY_BATCH) {
|
2020-04-25 02:31:16 +08:00
|
|
|
priority = TransactionPriority::BATCH;
|
2021-03-11 02:06:03 +08:00
|
|
|
} else {
|
2020-04-25 02:31:16 +08:00
|
|
|
priority = TransactionPriority::DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-28 07:46:22 +08:00
|
|
|
struct GetKeyServerLocationsReply {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 10636023;
|
2017-12-16 12:13:44 +08:00
|
|
|
Arena arena;
|
2019-05-17 04:54:06 +08:00
|
|
|
std::vector<std::pair<KeyRangeRef, vector<StorageServerInterface>>> results;
|
2017-12-10 08:10:22 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2019-07-28 07:46:22 +08:00
|
|
|
serializer(ar, results, arena);
|
2017-12-10 08:10:22 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GetKeyServerLocationsRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 9144680;
|
2017-12-10 08:10:22 +08:00
|
|
|
Arena arena;
|
2020-07-08 00:06:13 +08:00
|
|
|
SpanID spanContext;
|
2017-12-16 12:13:44 +08:00
|
|
|
KeyRef begin;
|
|
|
|
Optional<KeyRef> end;
|
2017-12-10 08:10:22 +08:00
|
|
|
int limit;
|
2017-12-16 12:13:44 +08:00
|
|
|
bool reverse;
|
2017-12-10 08:10:22 +08:00
|
|
|
ReplyPromise<GetKeyServerLocationsReply> reply;
|
|
|
|
|
2017-12-16 12:13:44 +08:00
|
|
|
GetKeyServerLocationsRequest() : limit(0), reverse(false) {}
|
2021-03-11 02:06:03 +08:00
|
|
|
GetKeyServerLocationsRequest(SpanID spanContext,
|
|
|
|
KeyRef const& begin,
|
|
|
|
Optional<KeyRef> const& end,
|
|
|
|
int limit,
|
|
|
|
bool reverse,
|
|
|
|
Arena const& arena)
|
2020-07-08 00:06:13 +08:00
|
|
|
: spanContext(spanContext), begin(begin), end(end), limit(limit), reverse(reverse), arena(arena) {}
|
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2020-07-08 00:06:13 +08:00
|
|
|
serializer(ar, begin, end, limit, reverse, reply, spanContext, arena);
|
2017-12-10 08:10:22 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-15 15:37:41 +08:00
|
|
|
struct GetRawCommittedVersionReply {
|
2020-07-23 14:35:46 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 1314732;
|
2020-07-15 15:37:41 +08:00
|
|
|
Optional<UID> debugID;
|
|
|
|
Version version;
|
|
|
|
bool locked;
|
|
|
|
Optional<Value> metadataVersion;
|
|
|
|
Version minKnownCommittedVersion;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
GetRawCommittedVersionReply()
|
|
|
|
: debugID(Optional<UID>()), version(invalidVersion), locked(false), metadataVersion(Optional<Value>()),
|
|
|
|
minKnownCommittedVersion(invalidVersion) {}
|
2020-07-15 15:37:41 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2020-07-15 15:37:41 +08:00
|
|
|
serializer(ar, debugID, version, locked, metadataVersion, minKnownCommittedVersion);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
struct GetRawCommittedVersionRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 12954034;
|
2020-07-08 00:06:13 +08:00
|
|
|
SpanID spanContext;
|
2017-05-26 04:48:44 +08:00
|
|
|
Optional<UID> debugID;
|
2020-07-15 15:37:41 +08:00
|
|
|
ReplyPromise<GetRawCommittedVersionReply> reply;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
explicit GetRawCommittedVersionRequest(SpanID spanContext, Optional<UID> const& debugID = Optional<UID>())
|
|
|
|
: spanContext(spanContext), debugID(debugID) {}
|
2020-07-08 00:06:13 +08:00
|
|
|
explicit GetRawCommittedVersionRequest() : spanContext(), debugID() {}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2020-07-08 00:06:13 +08:00
|
|
|
serializer(ar, debugID, reply, spanContext);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GetStorageServerRejoinInfoReply {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 9469225;
|
2017-05-26 04:48:44 +08:00
|
|
|
Version version;
|
|
|
|
Tag tag;
|
2018-01-29 03:52:54 +08:00
|
|
|
Optional<Tag> newTag;
|
|
|
|
bool newLocality;
|
2019-05-17 04:54:06 +08:00
|
|
|
std::vector<std::pair<Version, Tag>> history;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2018-12-29 02:49:26 +08:00
|
|
|
serializer(ar, version, tag, newTag, newLocality, history);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GetStorageServerRejoinInfoRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 994279;
|
2017-05-26 04:48:44 +08:00
|
|
|
UID id;
|
2017-08-04 07:16:36 +08:00
|
|
|
Optional<Value> dcId;
|
2021-03-11 02:06:03 +08:00
|
|
|
ReplyPromise<GetStorageServerRejoinInfoReply> reply;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
GetStorageServerRejoinInfoRequest() {}
|
2021-03-11 02:06:03 +08:00
|
|
|
explicit GetStorageServerRejoinInfoRequest(UID const& id, Optional<Value> const& dcId) : id(id), dcId(dcId) {}
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2018-12-29 02:49:26 +08:00
|
|
|
serializer(ar, id, dcId, reply);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TxnStateRequest {
|
2019-01-31 05:53:23 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 15250781;
|
2017-05-26 04:48:44 +08:00
|
|
|
Arena arena;
|
|
|
|
VectorRef<KeyValueRef> data;
|
|
|
|
Sequence sequence;
|
|
|
|
bool last;
|
2020-04-07 11:58:43 +08:00
|
|
|
std::vector<Endpoint> broadcastInfo;
|
2017-05-26 04:48:44 +08:00
|
|
|
ReplyPromise<Void> reply;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2020-04-06 14:09:36 +08:00
|
|
|
serializer(ar, data, sequence, last, broadcastInfo, reply, arena);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct GetHealthMetricsReply {
|
2019-04-10 05:29:21 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 11544290;
|
2019-02-24 02:13:43 +08:00
|
|
|
Standalone<StringRef> serialized;
|
2019-02-01 05:25:57 +08:00
|
|
|
HealthMetrics healthMetrics;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
explicit GetHealthMetricsReply(const HealthMetrics& healthMetrics = HealthMetrics())
|
|
|
|
: healthMetrics(healthMetrics) {
|
2019-02-24 02:13:43 +08:00
|
|
|
update(healthMetrics, true, true);
|
2019-02-01 05:25:57 +08:00
|
|
|
}
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
void update(const HealthMetrics& healthMetrics, bool detailedInput, bool detailedOutput) {
|
2019-02-24 02:13:43 +08:00
|
|
|
this->healthMetrics.update(healthMetrics, detailedInput, detailedOutput);
|
2019-02-02 03:45:47 +08:00
|
|
|
BinaryWriter bw(IncludeVersion());
|
2019-02-24 02:13:43 +08:00
|
|
|
bw << this->healthMetrics;
|
2019-03-29 02:52:50 +08:00
|
|
|
serialized = bw.toValue();
|
2019-02-01 05:25:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Ar>
|
2019-02-24 02:13:43 +08:00
|
|
|
void serialize(Ar& ar) {
|
2019-02-01 05:25:57 +08:00
|
|
|
serializer(ar, serialized);
|
2019-02-24 02:13:43 +08:00
|
|
|
if (ar.isDeserializing) {
|
|
|
|
BinaryReader br(serialized, IncludeVersion());
|
|
|
|
br >> healthMetrics;
|
|
|
|
}
|
2019-02-01 05:25:57 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct GetHealthMetricsRequest {
|
2019-04-17 06:00:12 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 11403900;
|
|
|
|
ReplyPromise<struct GetHealthMetricsReply> reply;
|
|
|
|
bool detailed;
|
|
|
|
|
|
|
|
explicit GetHealthMetricsRequest(bool detailed = false) : detailed(detailed) {}
|
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2019-04-17 06:00:12 +08:00
|
|
|
serializer(ar, reply, detailed);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct GetDDMetricsReply {
|
2020-05-23 00:25:32 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 7277713;
|
|
|
|
Standalone<VectorRef<DDMetricsRef>> storageMetricsList;
|
|
|
|
|
|
|
|
GetDDMetricsReply() {}
|
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
|
|
|
serializer(ar, storageMetricsList);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GetDDMetricsRequest {
|
|
|
|
constexpr static FileIdentifier file_identifier = 14536812;
|
|
|
|
KeyRange keys;
|
|
|
|
int shardLimit;
|
|
|
|
ReplyPromise<struct GetDDMetricsReply> reply;
|
|
|
|
|
|
|
|
GetDDMetricsRequest() {}
|
|
|
|
explicit GetDDMetricsRequest(KeyRange const& keys, const int shardLimit) : keys(keys), shardLimit(shardLimit) {}
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
template <class Ar>
|
2020-05-23 00:25:32 +08:00
|
|
|
void serialize(Ar& ar) {
|
|
|
|
serializer(ar, keys, shardLimit, reply);
|
2021-03-11 02:06:03 +08:00
|
|
|
}
|
2020-05-23 00:25:32 +08:00
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct ProxySnapRequest {
|
2020-07-15 07:26:16 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 5427684;
|
2019-02-28 07:40:33 +08:00
|
|
|
Arena arena;
|
2020-07-26 10:12:25 +08:00
|
|
|
StringRef snapPayload; // command used to snapshot the data folder
|
2019-06-20 02:11:50 +08:00
|
|
|
UID snapUID;
|
2019-02-28 07:40:33 +08:00
|
|
|
ReplyPromise<Void> reply;
|
|
|
|
Optional<UID> debugID;
|
|
|
|
|
2019-06-20 02:11:50 +08:00
|
|
|
explicit ProxySnapRequest(Optional<UID> const& debugID = Optional<UID>()) : debugID(debugID) {}
|
2021-03-11 02:06:03 +08:00
|
|
|
explicit ProxySnapRequest(StringRef snap, UID snapUID, Optional<UID> debugID = Optional<UID>())
|
|
|
|
: snapPayload(snap), snapUID(snapUID), debugID(debugID) {}
|
2019-02-28 07:40:33 +08:00
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
2019-06-20 02:11:50 +08:00
|
|
|
serializer(ar, snapPayload, snapUID, reply, arena, debugID);
|
2019-02-28 07:40:33 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct ExclusionSafetyCheckReply {
|
2019-10-17 02:30:20 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 11;
|
2019-09-19 04:40:18 +08:00
|
|
|
bool safe;
|
|
|
|
|
|
|
|
ExclusionSafetyCheckReply() : safe(false) {}
|
|
|
|
explicit ExclusionSafetyCheckReply(bool safe) : safe(safe) {}
|
|
|
|
|
|
|
|
template <class Ar>
|
|
|
|
void serialize(Ar& ar) {
|
|
|
|
serializer(ar, safe);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
struct ExclusionSafetyCheckRequest {
|
2019-08-09 07:30:05 +08:00
|
|
|
constexpr static FileIdentifier file_identifier = 13852702;
|
|
|
|
vector<AddressExclusion> exclusions;
|
2019-09-19 04:40:18 +08:00
|
|
|
ReplyPromise<ExclusionSafetyCheckReply> reply;
|
2019-08-09 07:30:05 +08:00
|
|
|
|
|
|
|
ExclusionSafetyCheckRequest() {}
|
|
|
|
explicit ExclusionSafetyCheckRequest(vector<AddressExclusion> exclusions) : exclusions(exclusions) {}
|
|
|
|
|
|
|
|
template <class Ar>
|
2021-03-11 02:06:03 +08:00
|
|
|
void serialize(Ar& ar) {
|
2019-08-09 07:30:05 +08:00
|
|
|
serializer(ar, exclusions, reply);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
#endif
|