Skip to content

Commit a547ff3

Browse files
authored
Move MaxTxInFly to ICB (#27635)
1 parent e5e29c2 commit a547ff3

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

ydb/core/protos/config.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,12 @@ message TImmediateControlsConfig {
17531753
MinValue: 8,
17541754
MaxValue: 4096,
17551755
DefaultValue: 256 }];
1756+
1757+
optional uint64 MaxTxInFly = 2 [(ControlOptions) = {
1758+
Description: "Maximum tx queue size for all tablets",
1759+
MinValue: 0,
1760+
MaxValue: 1000000,
1761+
DefaultValue: 10000 }];
17561762
}
17571763

17581764
message TDSProxyControls {

ydb/core/protos/memory_controller_config.proto

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,4 @@ message TMemoryControllerConfig {
2828

2929
optional float CompactionLimitPercent = 130 [default = 10];
3030
optional uint64 CompactionLimitBytes = 131;
31-
32-
optional uint64 MaxTxInFly = 132 [default = 10000];
3331
}

ydb/core/tablet_flat/flat_executor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ TExecutor::TExecutor(
133133
, Time(TAppData::TimeProvider)
134134
, Owner(owner)
135135
, OwnerActorId(ownerActorId)
136-
, MaxTxInFly(AppData()->MemoryControllerConfig.GetMaxTxInFly())
137136
, Emitter(new TIdEmitter)
138137
, CounterEventsInFlight(new TEvTabletCounters::TInFlightCookie)
139138
, Stats(new TExecutorStatsImpl())
140139
, LogFlushDelayOverrideUsec(-1, -1, 60*1000*1000)
141140
, MaxCommitRedoMB(256, 1, 4096)
141+
, MaxTxInFly(10000, 0, 1000000)
142142
{}
143143

144144
TExecutor::~TExecutor() {
@@ -183,6 +183,7 @@ void TExecutor::Registered(TActorSystem *sys, const TActorId&)
183183
TControlBoard::RegisterSharedControl(LogFlushDelayOverrideUsec, icb.LogFlushDelayOverrideUsec[static_cast<size_t>(Owner->TabletType())]);
184184
}
185185
TControlBoard::RegisterSharedControl(MaxCommitRedoMB, icb.TabletControls.MaxCommitRedoMB);
186+
TControlBoard::RegisterSharedControl(MaxTxInFly, icb.TabletControls.MaxTxInFly);
186187

187188
// instantiate alert counters so even never reported alerts are created
188189
GetServiceCounters(AppData()->Counters, "tablets")->GetCounter("alerts_pending_nodata", true);
@@ -4076,8 +4077,7 @@ void TExecutor::ForceSendCounters() {
40764077

40774078
float TExecutor::GetRejectProbability() const {
40784079
// Limit number of in-flight TXs
4079-
// TODO: make configurable
4080-
if (Stats->TxInFly > MaxTxInFly) {
4080+
if (Stats->TxInFly > ui64(MaxTxInFly)) {
40814081
HadRejectProbabilityByTxInFly = true;
40824082
return 1.0;
40834083
}
@@ -4113,7 +4113,7 @@ float TExecutor::GetRejectProbability() const {
41134113
}
41144114

41154115
void TExecutor::MaybeRelaxRejectProbability() {
4116-
if (HadRejectProbabilityByTxInFly && Stats->TxInFly <= MaxTxInFly ||
4116+
if (HadRejectProbabilityByTxInFly && Stats->TxInFly <= ui64(MaxTxInFly) ||
41174117
HadRejectProbabilityByOverload)
41184118
{
41194119
HadRejectProbabilityByTxInFly = false;

ydb/core/tablet_flat/flat_executor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,6 @@ class TExecutor
386386
// Counts the number of times LeaseDuration was increased
387387
size_t LeaseDurationIncreases = 0;
388388

389-
const ui64 MaxTxInFly;
390-
391389
struct TLeaseCommit : public TIntrusiveListItem<TLeaseCommit> {
392390
using TByEndMap = std::multimap<TMonotonic, TLeaseCommit*>;
393391

@@ -502,6 +500,7 @@ class TExecutor
502500

503501
TControlWrapper LogFlushDelayOverrideUsec;
504502
TControlWrapper MaxCommitRedoMB;
503+
TControlWrapper MaxTxInFly;
505504

506505
ui64 Stamp() const noexcept;
507506
void Registered(TActorSystem*, const TActorId&) override;

ydb/tests/olap/test_overloads.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import yatest.common
66
import ydb
77
import random
8+
import requests
89

910
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
1011
from ydb.tests.library.harness.kikimr_runner import KiKiMR
@@ -110,13 +111,13 @@ def _setup_ydb_rp(cls):
110111
logger.info(yatest.common.execute([ydb_path, "-V"], wait=True).stdout.decode("utf-8"))
111112
config = KikimrConfigGenerator(
112113
extra_feature_flags={"enable_olap_reject_probability": True},
113-
memory_controller_config={"max_tx_in_fly": 0},
114114
)
115115
cls.cluster = KiKiMR(config)
116116
cls.cluster.start()
117117
node = cls.cluster.nodes[1]
118118
cls.ydb_client = YdbClient(endpoint=f"grpc://{node.host}:{node.port}", database=f"/{config.domain_name}")
119119
cls.ydb_client.wait_connection(timeout=60)
120+
cls.mon_url = f"http://{node.host}:{node.mon_port}"
120121

121122
def get_row_count(self) -> int:
122123
return self.ydb_client.query(f"select count(*) as Rows from `{self.table_name}`")[0].rows[0]["Rows"]
@@ -208,8 +209,16 @@ def test_overloads_workload(self, writing_in_flight_requests_count_limit, writin
208209
logging.info(f"Count rows after insert {self.get_row_count()}")
209210
assert self.get_row_count() != 0
210211

212+
def tune_icb(self):
213+
response = requests.post(
214+
self.mon_url + "/actors/icb",
215+
data="TabletControls.MaxTxInFly=0"
216+
)
217+
response.raise_for_status()
218+
211219
def test_overloads_reject_probability(self):
212220
self._setup_ydb_rp()
221+
self.tune_icb()
213222

214223
table_path = f"{self.ydb_client.database}/table_for_test_overloads_reject_probability"
215224
self.ydb_client.query(

0 commit comments

Comments
 (0)