Skip to content

Commit 42cfb1f

Browse files
authored
FairShare over-limit allowed in scheduler (#25997)
1 parent 6806a43 commit 42cfb1f

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

ydb/core/kqp/runtime/scheduler/kqp_compute_scheduler_service.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ void TComputeScheduler::UpdateFairShare() {
268268
}
269269

270270
snapshot->UpdateBottomUp(Root->TotalLimit);
271-
snapshot->UpdateTopDown();
271+
// We want to allow FairShare to be over Limit.
272+
// If you need to change this behaviour change variable's default value
273+
snapshot->UpdateTopDown(true);
272274

273275
{
274276
TWriteGuard lock(Mutex);

ydb/core/kqp/runtime/scheduler/tree/snapshot.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void TTreeElement::UpdateBottomUp(ui64 totalLimit) {
3636
Guarantee = Min<ui64>(GetGuarantee(), Demand);
3737
}
3838

39-
void TTreeElement::UpdateTopDown() {
39+
void TTreeElement::UpdateTopDown(bool allowFairShareOverlimit) {
4040
if (IsRoot()) {
4141
FairShare = Demand;
4242
}
@@ -69,7 +69,7 @@ void TTreeElement::UpdateTopDown() {
6969
child->FairShare = 0;
7070
}
7171

72-
child->UpdateTopDown();
72+
child->UpdateTopDown(allowFairShareOverlimit);
7373
});
7474
}
7575
// FIFO variant (when children are queries)
@@ -80,13 +80,15 @@ void TTreeElement::UpdateTopDown() {
8080

8181
// Give at least 1 fair-share for each demanding child
8282
ForEachChild<TTreeElement>([&](TTreeElement* child, size_t) -> bool {
83-
if (leftFairShare == 0) {
83+
if (!allowFairShareOverlimit && leftFairShare == 0) {
8484
return true;
8585
}
8686

8787
if (child->Demand > 0) {
8888
child->FairShare = 1;
89-
--leftFairShare;
89+
if (!allowFairShareOverlimit || leftFairShare > 0) {
90+
--leftFairShare;
91+
}
9092
}
9193

9294
return false;

ydb/core/kqp/runtime/scheduler/tree/snapshot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace NKikimr::NKqp::NScheduler::NHdrf::NSnapshot {
2222

2323
virtual void AccountSnapshotDuration(const TDuration& period);
2424
virtual void UpdateBottomUp(ui64 totalLimit);
25-
void UpdateTopDown();
25+
void UpdateTopDown(bool allowFairShareOverlimit);
2626
};
2727

2828
class TQuery : public TTreeElement, public NHdrf::TQuery<ETreeType::SNAPSHOT>, public std::enable_shared_from_this<TQuery> {

ydb/tests/functional/tpc/medium/test_workload_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def setup_class(cls) -> None:
3636
super().setup_class()
3737

3838

39-
# class TestClickbenchWMScheduler(wm.TestWorkloadMangerClickbenchComputeScheduler, FunctionalTestBase):
39+
# class TestClickbenchWMScheduler(wm.TestWorkloadManagerClickbenchComputeScheduler, FunctionalTestBase):
4040
# iterations: int = 1
4141
# verify_data: bool = False
4242
# timeout = 100
43-
#
43+
4444
# @classmethod
4545
# def setup_class(cls) -> None:
4646
# cls.setup_cluster()

0 commit comments

Comments
 (0)