summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorifsmirnov <[email protected]>2025-02-04 11:50:25 +0300
committerifsmirnov <[email protected]>2025-02-04 12:32:39 +0300
commit5da7eb9cf2bf96348578e3a042036f720eeb5d14 (patch)
tree0e81d2cbc3de656b3f1790ed3a7e27439df8b499
parent3e2bf2ba5a4a356710264ede3515bab0cc8d7a42 (diff)
YT-23083: Add cancel_tablet_transition method
* Changelog entry Type: feature Component: dynamic-tables Add a method to return freezing or unmounting tables back to mounted state. commit_hash:fa361976a2319df147e851eb4c2ae572ba66e8be
-rw-r--r--yt/yt/client/api/delegating_client.h5
-rw-r--r--yt/yt/client/api/rpc_proxy/client_impl.cpp7
-rw-r--r--yt/yt/client/api/rpc_proxy/client_impl.h4
-rw-r--r--yt/yt/client/api/table_client.h9
-rw-r--r--yt/yt/client/driver/driver.cpp1
-rw-r--r--yt/yt/client/driver/table_commands.cpp13
-rw-r--r--yt/yt/client/driver/table_commands.h18
-rw-r--r--yt/yt/client/federated/client.cpp1
-rw-r--r--yt/yt/client/hedging/hedging.cpp1
-rw-r--r--yt/yt/client/unittests/mock/client.h5
10 files changed, 64 insertions, 0 deletions
diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h
index ecb92de39e3..f2c3c903616 100644
--- a/yt/yt/client/api/delegating_client.h
+++ b/yt/yt/client/api/delegating_client.h
@@ -282,6 +282,11 @@ public:
const TUnfreezeTableOptions& options),
(path, options))
+ DELEGATE_METHOD(TFuture<void>, CancelTabletTransition, (
+ NTabletClient::TTabletId tabletId,
+ const TCancelTabletTransitionOptions& options),
+ (tabletId, options))
+
DELEGATE_METHOD(TFuture<void>, ReshardTable, (
const NYPath::TYPath& path,
const std::vector<NTableClient::TLegacyOwningKey>& pivotKeys,
diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp
index ebd61803194..09b7f158795 100644
--- a/yt/yt/client/api/rpc_proxy/client_impl.cpp
+++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp
@@ -319,6 +319,13 @@ TFuture<void> TClient::UnfreezeTable(
return req->Invoke().As<void>();
}
+TFuture<void> TClient::CancelTabletTransition(
+ NTabletClient::TTabletId /*tabletId*/,
+ const TCancelTabletTransitionOptions& /*options*/)
+{
+ ThrowUnimplemented("CancelTabletTransition");
+}
+
TFuture<void> TClient::ReshardTable(
const TYPath& path,
const std::vector<TLegacyOwningKey>& pivotKeys,
diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h
index 906b141c73e..db95372369f 100644
--- a/yt/yt/client/api/rpc_proxy/client_impl.h
+++ b/yt/yt/client/api/rpc_proxy/client_impl.h
@@ -53,6 +53,10 @@ public:
const NYPath::TYPath& path,
const NApi::TUnfreezeTableOptions& options) override;
+ TFuture<void> CancelTabletTransition(
+ NTabletClient::TTabletId tabletId,
+ const NApi::TCancelTabletTransitionOptions& options) override;
+
TFuture<void> ReshardTable(
const NYPath::TYPath& path,
const std::vector<NTableClient::TLegacyOwningKey>& pivotKeys,
diff --git a/yt/yt/client/api/table_client.h b/yt/yt/client/api/table_client.h
index a1eb9b31525..076ad62b74a 100644
--- a/yt/yt/client/api/table_client.h
+++ b/yt/yt/client/api/table_client.h
@@ -90,6 +90,11 @@ struct TUnfreezeTableOptions
, public TTabletRangeOptions
{ };
+struct TCancelTabletTransitionOptions
+ : public TTimeoutOptions
+ , public TMutatingOptions
+{ };
+
struct TReshardTableOptions
: public TTimeoutOptions
, public TMutatingOptions
@@ -377,6 +382,10 @@ struct ITableClient
const NYPath::TYPath& path,
const TUnfreezeTableOptions& options = {}) = 0;
+ virtual TFuture<void> CancelTabletTransition(
+ NTabletClient::TTabletId tabletId,
+ const TCancelTabletTransitionOptions& options = {}) = 0;
+
virtual TFuture<void> ReshardTable(
const NYPath::TYPath& path,
const std::vector<NTableClient::TLegacyOwningKey>& pivotKeys,
diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp
index 2141e3eff5d..a77f6d2c33a 100644
--- a/yt/yt/client/driver/driver.cpp
+++ b/yt/yt/client/driver/driver.cpp
@@ -230,6 +230,7 @@ public:
REGISTER (TRemountTableCommand, "remount_table", Null, Structured, true, false, ApiVersion4);
REGISTER (TFreezeTableCommand, "freeze_table", Null, Structured, true, false, ApiVersion4);
REGISTER (TUnfreezeTableCommand, "unfreeze_table", Null, Structured, true, false, ApiVersion4);
+ REGISTER (TCancelTabletTransitionCommand, "cancel_tablet_transition", Null, Structured, true, false, ApiVersion4);
REGISTER (TReshardTableCommand, "reshard_table", Null, Structured, true, false, ApiVersion4);
REGISTER (TAlterTableCommand, "alter_table", Null, Structured, true, false, ApiVersion4);
diff --git a/yt/yt/client/driver/table_commands.cpp b/yt/yt/client/driver/table_commands.cpp
index c05964a50ff..3cef7004d1e 100644
--- a/yt/yt/client/driver/table_commands.cpp
+++ b/yt/yt/client/driver/table_commands.cpp
@@ -575,6 +575,19 @@ void TUnfreezeTableCommand::DoExecute(ICommandContextPtr context)
////////////////////////////////////////////////////////////////////////////////
+void TCancelTabletTransitionCommand::DoExecute(ICommandContextPtr context)
+{
+ auto asyncResult = context->GetClient()->CancelTabletTransition(
+ TabletId,
+ Options);
+ WaitFor(asyncResult)
+ .ThrowOnError();
+
+ ProduceEmptyOutput(context);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
void TReshardTableCommand::Register(TRegistrar registrar)
{
registrar.Parameter("pivot_keys", &TThis::PivotKeys)
diff --git a/yt/yt/client/driver/table_commands.h b/yt/yt/client/driver/table_commands.h
index 97f52e44fd3..26dacebf7e6 100644
--- a/yt/yt/client/driver/table_commands.h
+++ b/yt/yt/client/driver/table_commands.h
@@ -247,6 +247,24 @@ public:
////////////////////////////////////////////////////////////////////////////////
+class TCancelTabletTransitionCommand
+ : public TTypedCommand<NApi::TCancelTabletTransitionOptions>
+{
+ NTabletClient::TTabletId TabletId;
+
+ REGISTER_YSON_STRUCT_LITE(TCancelTabletTransitionCommand);
+
+ static void Register(TRegistrar registrar)
+ {
+ registrar.Parameter("tablet_id", &TThis::TabletId);
+ }
+
+public:
+ void DoExecute(ICommandContextPtr context) override;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
class TReshardTableCommand
: public TTabletCommandBase<NApi::TReshardTableOptions>
{
diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp
index 86ba307c1a9..092ad1f9301 100644
--- a/yt/yt/client/federated/client.cpp
+++ b/yt/yt/client/federated/client.cpp
@@ -379,6 +379,7 @@ public:
UNIMPLEMENTED_METHOD(TFuture<void>, RemountTable, (const NYPath::TYPath&, const TRemountTableOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, FreezeTable, (const NYPath::TYPath&, const TFreezeTableOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, UnfreezeTable, (const NYPath::TYPath&, const TUnfreezeTableOptions&));
+ UNIMPLEMENTED_METHOD(TFuture<void>, CancelTabletTransition, (NTabletClient::TTabletId, const TCancelTabletTransitionOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, ReshardTable, (const NYPath::TYPath&, const std::vector<NTableClient::TUnversionedOwningRow>&, const TReshardTableOptions&));
UNIMPLEMENTED_METHOD(TFuture<void>, ReshardTable, (const NYPath::TYPath&, int, const TReshardTableOptions&));
UNIMPLEMENTED_METHOD(TFuture<std::vector<NTabletClient::TTabletActionId>>, ReshardTableAutomatic, (const NYPath::TYPath&, const TReshardTableAutomaticOptions&));
diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp
index 7fa807b6f1e..e58a5fd5619 100644
--- a/yt/yt/client/hedging/hedging.cpp
+++ b/yt/yt/client/hedging/hedging.cpp
@@ -125,6 +125,7 @@ public:
UNSUPPORTED_METHOD(TFuture<void>, RemountTable, (const TYPath&, const TRemountTableOptions&));
UNSUPPORTED_METHOD(TFuture<void>, FreezeTable, (const TYPath&, const TFreezeTableOptions&));
UNSUPPORTED_METHOD(TFuture<void>, UnfreezeTable, (const TYPath&, const TUnfreezeTableOptions&));
+ UNSUPPORTED_METHOD(TFuture<void>, CancelTabletTransition, (NTabletClient::TTabletId, const TCancelTabletTransitionOptions&));
UNSUPPORTED_METHOD(TFuture<void>, ReshardTable, (const TYPath&, const std::vector<NTableClient::TUnversionedOwningRow>&, const TReshardTableOptions&));
UNSUPPORTED_METHOD(TFuture<void>, ReshardTable, (const TYPath&, int, const TReshardTableOptions&));
UNSUPPORTED_METHOD(TFuture<std::vector<NTabletClient::TTabletActionId>>, ReshardTableAutomatic, (const TYPath&, const TReshardTableAutomaticOptions&));
diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h
index ea6fed2987f..6885b3c4732 100644
--- a/yt/yt/client/unittests/mock/client.h
+++ b/yt/yt/client/unittests/mock/client.h
@@ -403,6 +403,11 @@ public:
const TUnfreezeTableOptions& options),
(override));
+ MOCK_METHOD(TFuture<void>, CancelTabletTransition, (
+ NTabletClient::TTabletId tabletId,
+ const TCancelTabletTransitionOptions& options),
+ (override));
+
MOCK_METHOD(TFuture<void>, ReshardTable, (
const NYPath::TYPath& path,
const std::vector<NTableClient::TLegacyOwningKey>& pivotKeys,