Browse Source

YT-19762: Discombobulate observers command

danilalexeev 1 year ago
parent
commit
5a2244f162

+ 8 - 0
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,

+ 7 - 0
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,

+ 4 - 0
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,

+ 1 - 0
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);

+ 12 - 0
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*/,

+ 4 - 0
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,

+ 15 - 0
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_);

+ 14 - 0
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>
 {

+ 1 - 0
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);

+ 1 - 0
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&));

Some files were not shown because too many files changed in this diff