aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanilalexeev <danilalexeev@yandex-team.com>2023-10-03 14:05:16 +0300
committerdanilalexeev <danilalexeev@yandex-team.com>2023-10-03 15:24:40 +0300
commit5a2244f16299be6d4b9fd016bc4e5547e5ee909d (patch)
tree483849220b6c0500a68e331b9db2807ce2acc38d
parent39eeb40ad161d9506bf9e893a3ff0a5838566301 (diff)
downloadydb-5a2244f16299be6d4b9fd016bc4e5547e5ee909d.tar.gz
YT-19762: Discombobulate observers command
-rw-r--r--yt/yt/client/api/admin_client.h8
-rw-r--r--yt/yt/client/api/delegating_client.cpp7
-rw-r--r--yt/yt/client/api/delegating_client.h4
-rw-r--r--yt/yt/client/api/rpc_proxy/api_service_proxy.h1
-rw-r--r--yt/yt/client/api/rpc_proxy/client_impl.cpp12
-rw-r--r--yt/yt/client/api/rpc_proxy/client_impl.h4
-rw-r--r--yt/yt/client/driver/admin_commands.cpp15
-rw-r--r--yt/yt/client/driver/admin_commands.h14
-rw-r--r--yt/yt/client/driver/driver.cpp1
-rw-r--r--yt/yt/client/federated/client.cpp1
-rw-r--r--yt/yt/client/hedging/hedging.cpp1
-rw-r--r--yt/yt/client/security_client/access_control.h1
-rw-r--r--yt/yt/client/security_client/public.h1
-rw-r--r--yt/yt/client/unittests/mock/client.h4
-rw-r--r--yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto11
15 files changed, 85 insertions, 0 deletions
diff --git a/yt/yt/client/api/admin_client.h b/yt/yt/client/api/admin_client.h
index 22ee9efb880..2a4b08c0e33 100644
--- a/yt/yt/client/api/admin_client.h
+++ b/yt/yt/client/api/admin_client.h
@@ -38,6 +38,10 @@ struct TMasterExitReadOnlyOptions
bool Retry = true;
};
+struct TDiscombobulateNonvotingPeersOptions
+ : public TTimeoutOptions
+{ };
+
struct TSwitchLeaderOptions
: public TTimeoutOptions
{ };
@@ -201,6 +205,10 @@ struct IAdminClient
virtual TFuture<void> MasterExitReadOnly(
const TMasterExitReadOnlyOptions& options = {}) = 0;
+ virtual TFuture<void> DiscombobulateNonvotingPeers(
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& options = {}) = 0;
+
virtual TFuture<void> SwitchLeader(
NHydra::TCellId cellId,
const TString& newLeaderAddress,
diff --git a/yt/yt/client/api/delegating_client.cpp b/yt/yt/client/api/delegating_client.cpp
index ac82f15a53f..b534b66737c 100644
--- a/yt/yt/client/api/delegating_client.cpp
+++ b/yt/yt/client/api/delegating_client.cpp
@@ -744,6 +744,13 @@ TFuture<void> TDelegatingClient::MasterExitReadOnly(
return Underlying_->MasterExitReadOnly(options);
}
+TFuture<void> TDelegatingClient::DiscombobulateNonvotingPeers(
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& options)
+{
+ return Underlying_->DiscombobulateNonvotingPeers(cellId, options);
+}
+
TFuture<void> TDelegatingClient::SwitchLeader(
NHydra::TCellId cellId,
const TString& newLeaderAddress,
diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h
index 3574d6ca9ae..65317f5aa62 100644
--- a/yt/yt/client/api/delegating_client.h
+++ b/yt/yt/client/api/delegating_client.h
@@ -469,6 +469,10 @@ public:
TFuture<void> MasterExitReadOnly(
const TMasterExitReadOnlyOptions& options = {}) override;
+ TFuture<void> DiscombobulateNonvotingPeers(
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& options) override;
+
TFuture<void> SwitchLeader(
NHydra::TCellId cellId,
const TString& newLeaderAddress,
diff --git a/yt/yt/client/api/rpc_proxy/api_service_proxy.h b/yt/yt/client/api/rpc_proxy/api_service_proxy.h
index 4d0dc4e09ca..d7597992cf3 100644
--- a/yt/yt/client/api/rpc_proxy/api_service_proxy.h
+++ b/yt/yt/client/api/rpc_proxy/api_service_proxy.h
@@ -146,6 +146,7 @@ public:
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, BuildSnapshot);
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, ExitReadOnly);
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, MasterExitReadOnly);
+ DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, DiscombobulateNonvotingPeers);
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, GCCollect);
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, SuspendCoordinator);
DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, ResumeCoordinator);
diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp
index 5c4831a1eac..3886b399103 100644
--- a/yt/yt/client/api/rpc_proxy/client_impl.cpp
+++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp
@@ -1638,6 +1638,18 @@ TFuture<void> TClient::MasterExitReadOnly(const TMasterExitReadOnlyOptions& opti
return req->Invoke().As<void>();
}
+TFuture<void> TClient::DiscombobulateNonvotingPeers(
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& /*options*/)
+{
+ auto proxy = CreateApiServiceProxy();
+
+ auto req = proxy.DiscombobulateNonvotingPeers();
+ ToProto(req->mutable_cell_id(), cellId);
+
+ return req->Invoke().As<void>();
+}
+
TFuture<void> TClient::SwitchLeader(
NHydra::TCellId /*cellId*/,
const TString& /*newLeaderAddress*/,
diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h
index 459d917eafd..ca31c75cae6 100644
--- a/yt/yt/client/api/rpc_proxy/client_impl.h
+++ b/yt/yt/client/api/rpc_proxy/client_impl.h
@@ -330,6 +330,10 @@ public:
TFuture<void> MasterExitReadOnly(
const TMasterExitReadOnlyOptions& options) override;
+ TFuture<void> DiscombobulateNonvotingPeers(
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& options) override;
+
TFuture<void> SwitchLeader(
NHydra::TCellId cellId,
const TString& newLeaderAddress,
diff --git a/yt/yt/client/driver/admin_commands.cpp b/yt/yt/client/driver/admin_commands.cpp
index f4af9e029d8..67e755fdd64 100644
--- a/yt/yt/client/driver/admin_commands.cpp
+++ b/yt/yt/client/driver/admin_commands.cpp
@@ -100,6 +100,21 @@ void TMasterExitReadOnlyCommand::DoExecute(ICommandContextPtr context)
////////////////////////////////////////////////////////////////////////////////
+TDiscombobulateNonvotingPeersCommand::TDiscombobulateNonvotingPeersCommand()
+{
+ RegisterParameter("cell_id", CellId_);
+}
+
+void TDiscombobulateNonvotingPeersCommand::DoExecute(ICommandContextPtr context)
+{
+ WaitFor(context->GetClient()->DiscombobulateNonvotingPeers(CellId_, Options))
+ .ThrowOnError();
+
+ ProduceEmptyOutput(context);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
TSwitchLeaderCommand::TSwitchLeaderCommand()
{
RegisterParameter("cell_id", CellId_);
diff --git a/yt/yt/client/driver/admin_commands.h b/yt/yt/client/driver/admin_commands.h
index 957826eea82..878b28a8ec7 100644
--- a/yt/yt/client/driver/admin_commands.h
+++ b/yt/yt/client/driver/admin_commands.h
@@ -56,6 +56,20 @@ private:
////////////////////////////////////////////////////////////////////////////////
+class TDiscombobulateNonvotingPeersCommand
+ : public TTypedCommand<NApi::TDiscombobulateNonvotingPeersOptions>
+{
+public:
+ TDiscombobulateNonvotingPeersCommand();
+
+private:
+ NHydra::TCellId CellId_;
+
+ void DoExecute(ICommandContextPtr context) override;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
class TSwitchLeaderCommand
: public TTypedCommand<NApi::TSwitchLeaderOptions>
{
diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp
index 011f1dbd67e..25a9e4e3425 100644
--- a/yt/yt/client/driver/driver.cpp
+++ b/yt/yt/client/driver/driver.cpp
@@ -316,6 +316,7 @@ public:
REGISTER_ALL(TBuildMasterSnapshotsCommand, "build_master_snapshots", Null, Structured, true, false);
REGISTER_ALL(TExitReadOnlyCommand, "exit_read_only", Null, Structured, true, false);
REGISTER_ALL(TMasterExitReadOnlyCommand, "master_exit_read_only", Null, Structured, true, false);
+ REGISTER_ALL(TDiscombobulateNonvotingPeersCommand, "discombobulate_nonvoting_peers", Null, Structured, true, false);
REGISTER_ALL(TSwitchLeaderCommand, "switch_leader", Null, Structured, true, false);
REGISTER_ALL(TResetStateHashCommand, "reset_state_hash", Null, Structured, true, false);
REGISTER_ALL(THealExecNodeCommand, "heal_exec_node", Null, Structured, true, false);
diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp
index 56a91722c13..0bb95300a71 100644
--- a/yt/yt/client/federated/client.cpp
+++ b/yt/yt/client/federated/client.cpp
@@ -374,6 +374,7 @@ public:
UNIMPLEMENTED_METHOD(TFuture<TCellIdToSnapshotIdMap>, BuildMasterSnapshots, (const TBuildMasterSnapshotsOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, ExitReadOnly, (NObjectClient::TCellId, const TExitReadOnlyOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, MasterExitReadOnly, (const TMasterExitReadOnlyOptions&));
+ UNIMPLEMENTED_METHOD(TFuture<void>, DiscombobulateNonvotingPeers, (NObjectClient::TCellId, const TDiscombobulateNonvotingPeersOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, SwitchLeader, (NObjectClient::TCellId, const TString&, const TSwitchLeaderOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, ResetStateHash, (NObjectClient::TCellId, const TResetStateHashOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, GCCollect, (const TGCCollectOptions&));
diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp
index 8c7dcc09099..c30bdee3901 100644
--- a/yt/yt/client/hedging/hedging.cpp
+++ b/yt/yt/client/hedging/hedging.cpp
@@ -174,6 +174,7 @@ public:
UNSUPPORTED_METHOD(TFuture<TCellIdToSnapshotIdMap>, BuildMasterSnapshots, (const TBuildMasterSnapshotsOptions&));
UNSUPPORTED_METHOD(TFuture<void>, ExitReadOnly, (NObjectClient::TCellId, const TExitReadOnlyOptions&));
UNSUPPORTED_METHOD(TFuture<void>, MasterExitReadOnly, (const TMasterExitReadOnlyOptions&));
+ UNSUPPORTED_METHOD(TFuture<void>, DiscombobulateNonvotingPeers, (NObjectClient::TCellId, const TDiscombobulateNonvotingPeersOptions&));
UNSUPPORTED_METHOD(TFuture<void>, SwitchLeader, (NObjectClient::TCellId, const TString&, const TSwitchLeaderOptions&));
UNSUPPORTED_METHOD(TFuture<void>, ResetStateHash, (NObjectClient::TCellId, const TResetStateHashOptions&));
UNSUPPORTED_METHOD(TFuture<void>, GCCollect, (const TGCCollectOptions&));
diff --git a/yt/yt/client/security_client/access_control.h b/yt/yt/client/security_client/access_control.h
index 3d3583cd35f..009492b1897 100644
--- a/yt/yt/client/security_client/access_control.h
+++ b/yt/yt/client/security_client/access_control.h
@@ -44,6 +44,7 @@ const THashMap<EAccessControlObject, TAccessControlObjectDescriptor> AccessContr
ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::BuildMasterSnapshot),
ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::ExitReadOnly),
ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::MasterExitReadOnly),
+ ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::DiscombobulateNonvotingPeers),
ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::SwitchLeader),
ACCESS_CONTROL_ENTRY(EAccessControlObjectNamespace::AdminCommands, EAccessControlObject::RequestRestart)
};
diff --git a/yt/yt/client/security_client/public.h b/yt/yt/client/security_client/public.h
index 51a38ff8edc..9d6e84df55b 100644
--- a/yt/yt/client/security_client/public.h
+++ b/yt/yt/client/security_client/public.h
@@ -92,6 +92,7 @@ DEFINE_ENUM(EAccessControlObject,
(BuildMasterSnapshot)
(ExitReadOnly)
(MasterExitReadOnly)
+ (DiscombobulateNonvotingPeers)
(SwitchLeader)
(RequestRestart)
);
diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h
index bc6bf72e0dd..1963c5d910b 100644
--- a/yt/yt/client/unittests/mock/client.h
+++ b/yt/yt/client/unittests/mock/client.h
@@ -203,6 +203,10 @@ public:
MOCK_METHOD(TFuture<void>, MasterExitReadOnly, (
const TMasterExitReadOnlyOptions& options), (override));
+ MOCK_METHOD(TFuture<void>, DiscombobulateNonvotingPeers, (
+ NHydra::TCellId cellId,
+ const TDiscombobulateNonvotingPeersOptions& options), (override));
+
MOCK_METHOD(TFuture<void>, SwitchLeader, (
NHydra::TCellId cellId,
const TString& newLeaderAddress,
diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
index a9dcc70d294..85dabf4943e 100644
--- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
+++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
@@ -924,6 +924,17 @@ message TRspMasterExitReadOnly
////////////////////////////////////////////////////////////////////////////////
+message TReqDiscombobulateNonvotingPeers
+{
+ required NYT.NProto.TGuid cell_id = 1;
+}
+
+message TRspDiscombobulateNonvotingPeers
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
message TReqGCCollect
{
optional NYT.NProto.TGuid cell_id = 1;