diff options
author | osidorkin <[email protected]> | 2024-12-26 13:10:36 +0300 |
---|---|---|
committer | osidorkin <[email protected]> | 2024-12-26 13:28:18 +0300 |
commit | 179a188c92e62f168719f4bb4bb9a8a464fb3d80 (patch) | |
tree | 8db15515e3b6ed7e39431d7634a754c644970443 | |
parent | 0328aa1f62630f14d06076175e2f3750969ac813 (diff) |
YT-23757: Add handle to forcibly remove coordinator cell from repliction card
commit_hash:d6c969536847da1f9139935b23e8a2820c075dc5
-rw-r--r-- | yt/yt/client/api/internal_client.h | 11 | ||||
-rw-r--r-- | yt/yt/client/driver/driver.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/driver/internal_commands.cpp | 14 | ||||
-rw-r--r-- | yt/yt/client/driver/internal_commands.h | 17 |
4 files changed, 43 insertions, 0 deletions
diff --git a/yt/yt/client/api/internal_client.h b/yt/yt/client/api/internal_client.h index 7421b08337e..44dc6b3b868 100644 --- a/yt/yt/client/api/internal_client.h +++ b/yt/yt/client/api/internal_client.h @@ -118,6 +118,12 @@ struct TFetchShuffleChunksOptions //////////////////////////////////////////////////////////////////////////////// +struct TForsakeChaosCoordinatorOptions + : public TTimeoutOptions +{ }; + +//////////////////////////////////////////////////////////////////////////////// + //! Provides a set of private APIs. /*! * Only native clients are expected to implement this. @@ -195,6 +201,11 @@ struct IInternalClient const TShuffleHandlePtr& handle, int partitionIndex, const TFetchShuffleChunksOptions& options = {}) = 0; + + virtual TFuture<void> ForsakeChaosCoordinator( + NHydra::TCellId chaosCellId, + NHydra::TCellId coordiantorCellId, + const TForsakeChaosCoordinatorOptions& options = {}) = 0; }; DEFINE_REFCOUNTED_TYPE(IInternalClient) diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index f5e2da24d37..32568fdc3cb 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -400,6 +400,7 @@ public: REGISTER_ALL(TStartDistributedWriteSessionCommand, "start_distributed_write_session", Null, Structured, true, false); REGISTER_ALL(TFinishDistributedWriteSessionCommand, "finish_distributed_write_session", Null, Null, true, false); REGISTER_ALL(TWriteTableFragmentCommand, "distributed_write_table_partition", Tabular, Structured, true, true ); + REGISTER_ALL(TForsakeChaosCoordinator, "forsake_chaos_coordinator", Null, Null, true, true); } #undef REGISTER diff --git a/yt/yt/client/driver/internal_commands.cpp b/yt/yt/client/driver/internal_commands.cpp index 40ca7a6680f..8365ca1d721 100644 --- a/yt/yt/client/driver/internal_commands.cpp +++ b/yt/yt/client/driver/internal_commands.cpp @@ -224,4 +224,18 @@ void TUnreferenceLeaseCommand::DoExecute(ICommandContextPtr context) //////////////////////////////////////////////////////////////////////////////// +void TForsakeChaosCoordinator::Register(TRegistrar registrar) +{ + registrar.Parameter("chaos_cell_id", &TThis::ChaosCellId_); + registrar.Parameter("coordinator_cell_id", &TThis::CoordinatorCellId_); +} + +void TForsakeChaosCoordinator::DoExecute(ICommandContextPtr context) +{ + WaitFor(context->GetInternalClientOrThrow()->ForsakeChaosCoordinator(ChaosCellId_, CoordinatorCellId_)) + .ThrowOnError(); +} + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NYT::NDriver diff --git a/yt/yt/client/driver/internal_commands.h b/yt/yt/client/driver/internal_commands.h index 4b1a5670740..5209778d3de 100644 --- a/yt/yt/client/driver/internal_commands.h +++ b/yt/yt/client/driver/internal_commands.h @@ -175,4 +175,21 @@ private: //////////////////////////////////////////////////////////////////////////////// +class TForsakeChaosCoordinator + : public TTypedCommand<NApi::TForsakeChaosCoordinatorOptions> +{ +public: + REGISTER_YSON_STRUCT_LITE(TForsakeChaosCoordinator); + + static void Register(TRegistrar registrar); + +private: + NHydra::TCellId ChaosCellId_; + NHydra::TCellId CoordinatorCellId_; + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NYT::NDriver |