Skip to content

Commit 68afa86

Browse files
committed
Add forsake shortcut call to forcibly drop existing shortcut
commit_hash:5f1b87013c927f79e74d39da431010617d816f2d
1 parent 562c17d commit 68afa86

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

yt/yt/client/api/internal_client.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ struct TForsakeChaosCoordinatorOptions
139139

140140
////////////////////////////////////////////////////////////////////////////////
141141

142+
struct TForsakeChaosShortcutOptions
143+
: public TTimeoutOptions
144+
{ };
145+
146+
////////////////////////////////////////////////////////////////////////////////
147+
142148
struct TRemoveChaosCellMailboxOptions
143149
: public TTimeoutOptions
144150
{ };
@@ -240,6 +246,11 @@ struct IInternalClient
240246
NHydra::TCellId coordinatorCellId,
241247
const TForsakeChaosCoordinatorOptions& options = {}) = 0;
242248

249+
virtual TFuture<void> ForsakeChaosShortcut(
250+
NHydra::TCellId coordinatorCellId,
251+
NChaosClient::TChaosObjectId chaosObjectId,
252+
const TForsakeChaosShortcutOptions& options = {}) = 0;
253+
243254
virtual TFuture<void> RemoveChaosCellMailbox(
244255
NHydra::TCellId chaosCellId,
245256
NHydra::TCellId destinationCellId,

yt/yt/client/driver/driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ class TDriver
443443
REGISTER_ALL(TReferenceLeaseCommand, "reference_lease", Null, Structured, true, false);
444444
REGISTER_ALL(TUnreferenceLeaseCommand, "unreference_lease", Null, Structured, true, false);
445445
REGISTER_ALL(TForsakeChaosCoordinator, "forsake_chaos_coordinator", Null, Null, true, true );
446+
REGISTER_ALL(TForsakeChaosShortcut, "forsake_chaos_shortcut", Null, Null, true, true );
446447
REGISTER_ALL(TRemoveChaosCellMailbox, "remove_chaos_cell_mailbox", Null, Null, true, true );
447448
REGISTER_ALL(TGetOrderedTabletSafeTrimRowCount, "get_ordered_tablet_safe_trim_row_count", Null, Structured, false, false);
448449
REGISTER_ALL(TGetConnectionOrchidValue, "get_connection_orchid_value", Null, Structured, false, false);

yt/yt/client/driver/internal_commands.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,20 @@ void TForsakeChaosCoordinator::DoExecute(ICommandContextPtr context)
238238

239239
////////////////////////////////////////////////////////////////////////////////
240240

241+
void TForsakeChaosShortcut::Register(TRegistrar registrar)
242+
{
243+
registrar.Parameter("coordinator_cell_id", &TThis::CoordinatorCellId_);
244+
registrar.Parameter("chaos_object_id", &TThis::ChaosObjectId_);
245+
}
246+
247+
void TForsakeChaosShortcut::DoExecute(ICommandContextPtr context)
248+
{
249+
WaitFor(context->GetInternalClientOrThrow()->ForsakeChaosShortcut(CoordinatorCellId_, ChaosObjectId_))
250+
.ThrowOnError();
251+
}
252+
253+
////////////////////////////////////////////////////////////////////////////////
254+
241255
void TRemoveChaosCellMailbox::Register(TRegistrar registrar)
242256
{
243257
registrar.Parameter("chaos_cell_id", &TThis::ChaosCellId_);

yt/yt/client/driver/internal_commands.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ class TForsakeChaosCoordinator
192192

193193
////////////////////////////////////////////////////////////////////////////////
194194

195+
class TForsakeChaosShortcut
196+
: public TTypedCommand<NApi::TForsakeChaosShortcutOptions>
197+
{
198+
public:
199+
REGISTER_YSON_STRUCT_LITE(TForsakeChaosShortcut);
200+
201+
static void Register(TRegistrar registrar);
202+
203+
private:
204+
NHydra::TCellId CoordinatorCellId_;
205+
NChaosClient::TChaosObjectId ChaosObjectId_;
206+
207+
void DoExecute(ICommandContextPtr context) override;
208+
};
209+
210+
////////////////////////////////////////////////////////////////////////////////
211+
195212
class TRemoveChaosCellMailbox
196213
: public TTypedCommand<NApi::TRemoveChaosCellMailboxOptions>
197214
{

0 commit comments

Comments
 (0)