Skip to content

Commit b0f9318

Browse files
authored
Support pausing TestShard writes through ICB (#15299)
1 parent 1f56c1e commit b0f9318

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ydb/core/protos/config.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,15 @@ message TImmediateControlsConfig {
15731573
DefaultValue: 0 }];
15741574
}
15751575

1576+
message TTestShardControls {
1577+
optional uint64 DisableWrites = 1 [(ControlOptions) = {
1578+
Description: "Disable write load in all node TestShard tablets",
1579+
MinValue: 0,
1580+
MaxValue: 1,
1581+
DefaultValue: 0
1582+
}];
1583+
}
1584+
15761585
optional TDataShardControls DataShardControls = 1;
15771586
optional TTxLimitControls TxLimitControls = 2;
15781587
optional TCoordinatorControls CoordinatorControls = 3;
@@ -1585,6 +1594,7 @@ message TImmediateControlsConfig {
15851594
optional TPDiskControls PDiskControls = 10;
15861595
optional TBlobStorageControllerControls BlobStorageControllerControls = 11;
15871596
optional TTableServiceControls TableServiceControls = 12;
1597+
optional TTestShardControls TestShardControls = 13;
15881598
};
15891599

15901600
message TMeteringConfig {

ydb/core/test_tablet/load_actor_impl.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace NKikimr::NTestShard {
2424
} else {
2525
sys->Send(ev.release());
2626
}
27+
28+
auto *appData = AppData();
29+
appData->Icb->RegisterSharedControl(DisableWrites, "TestShardControls.DisableWrites");
2730
}
2831

2932
void TLoadActor::ClearKeys() {
@@ -89,7 +92,7 @@ namespace NKikimr::NTestShard {
8992
const TMonotonic now = TActivationContext::Monotonic();
9093

9194
bool canWriteMore = false;
92-
if (WritesInFlight.size() + PatchesInFlight.size() < Settings.GetMaxInFlight()) {
95+
if (WritesInFlight.size() + PatchesInFlight.size() < Settings.GetMaxInFlight() && !DisableWrites) {
9396
if (NextWriteTimestamp <= now) {
9497
if (Settings.HasPatchRequestsFractionPPM() && !ConfirmedKeys.empty() &&
9598
RandomNumber(1'000'000u) < Settings.GetPatchRequestsFractionPPM()) {
@@ -123,6 +126,12 @@ namespace NKikimr::NTestShard {
123126
TActivationContext::Send(new IEventHandle(EvDoSomeAction, 0, SelfId(), {}, nullptr, 0));
124127
DoSomeActionInFlight = true;
125128
}
129+
130+
if (!DoSomeActionInFlight && ReadsInFlight.empty() && WritesInFlight.empty() && PatchesInFlight.empty() &&
131+
DeletesInFlight.empty() && TransitionInFlight.empty()) {
132+
TActivationContext::Schedule(TDuration::Seconds(1), new IEventHandle(EvDoSomeAction, 0, SelfId(), {}, nullptr, 0));
133+
DoSomeActionInFlight = true;
134+
}
126135
}
127136
}
128137

ydb/core/test_tablet/load_actor_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ namespace NKikimr::NTestShard {
138138
bool WriteOnTimeScheduled = false;
139139
bool DoSomeActionInFlight = false;
140140

141+
TControlWrapper DisableWrites;
142+
141143
void GenerateKeyValue(TString *key, TString *value, bool *isInline);
142144
void IssueWrite();
143145
void IssuePatch();

0 commit comments

Comments
 (0)