Skip to content

Remove obsolete CustomResourceManager in favor of WorkloadResourceManager - #108286

Merged
serxa merged 9 commits into
masterfrom
remove-custom-resmanager
Jul 10, 2026
Merged

serxa merged 9 commits into
masterfrom
remove-custom-resmanager

Conversation

@serxa

@serxa serxa commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

Removes the obsolete config-XML-based CustomResourceManager in favor of the SQL-based WorkloadResourceManager.

CustomResourceManager described scheduling hierarchies through the server config (resources and workload_classifiers sections). WorkloadResourceManager builds the same hierarchies from CREATE RESOURCE / CREATE WORKLOAD entities, so the config-based path is redundant. This removes the manager, the legacy config-string node-construction machinery that only existed to support it (SchedulerNodeFactory, registerSchedulerNodes, the per-node register* functions, every (config, prefix) constructor down through SchedulerNodeInfo/ISchedulerNode/the time-shared bases, and emptyConfig), the now-dead equals(ISchedulerNode *) config-diff virtual, the unused IResourceManager::updateConfiguration, and the CUSTOM_RESOURCE_MANAGER thread name. The scheduler node classes themselves are unchanged and are still created programmatically by WorkloadNode.

The resources and workload_classifiers config sections are now obsolete: the server logs a warning and ignores them on startup/reload. Node-level unit tests now construct nodes via SchedulerNodeInfo instead of XML snippets. The test_scheduler integration suite is renamed to test_scheduler_io (it is IO-specific) and its config-based tests are reworked to define resources/workloads via SQL (those already covered by existing SQL-based tests were dropped, not duplicated). The config-based resources hierarchy and deprecated workload classifiers sections are removed from the documentation.

Related: #82414

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Removed the config-based workload scheduling configuration (the resources and workload_classifiers server config sections). Use CREATE RESOURCE and CREATE WORKLOAD queries instead. The obsolete config sections are ignored with a warning.

Version info

  • Merged into: 26.7.1.776 (included in 26.7 and later)

…ager

CustomResourceManager was the original config-XML-based resource scheduler:
scheduling hierarchies were described in the server config via the `resources`
and `workload_classifiers` sections. It has been superseded by
WorkloadResourceManager, which builds the same hierarchies from SQL
`CREATE RESOURCE` / `CREATE WORKLOAD` entities, so the config-based path is
redundant.

This removes:
- `CustomResourceManager` and `ClassifiersConfig`, and the dispatcher entry in
  `createResourceManager`.
- The legacy config-string node-construction machinery that only existed to
  support it: `SchedulerNodeFactory`, `registerSchedulerNodes`, the per-node
  `register*` functions, every `(config, prefix)` constructor (down through
  `SchedulerNodeInfo`, `ISchedulerNode` and the `ITimeSharedNode` /
  `ISchedulerConstraint` / `ISchedulerQueue` / `ISpaceSharedNode` bases), and
  `emptyConfig`. The scheduler node classes themselves are unchanged and are
  still created programmatically by `WorkloadNode`.
- The now-dead `equals(ISchedulerNode *)` configuration-diff virtual (used only
  by `CustomResourceManager`) and its overrides, plus the unused
  `IResourceManager::updateConfiguration`.
- The `CUSTOM_RESOURCE_MANAGER` thread name.

The `resources` and `workload_classifiers` config sections are now obsolete;
the server logs a warning and ignores them on startup/reload.

Unit tests (`ResourceTest` helper and the time-shared node gtests) now build
nodes via `SchedulerNodeInfo` constructors instead of XML snippets.

The `test_scheduler` integration suite is renamed to `test_scheduler_io` (it is
IO-specific, exercising `READ DISK` / `WRITE DISK` resources, matching the
`test_scheduler_*` naming). Its config-based tests are reworked to define
resources and workloads via SQL; tests already covered by existing SQL-based
tests were dropped rather than duplicated.

Documentation: the config-based `resources` hierarchy and the deprecated
workload classifiers sections are removed from workload-scheduling.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@serxa

serxa commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

For now, this is based on the workload-memory-scheduling branch, so CI will ignore it until we merge #82414.

…e/disk names

- `createResourceManager` now returns `WorkloadResourceManager` directly instead
  of wrapping it in `ResourceManagerDispatcher`, since it is the only
  `IResourceManager` implementation left. `WorkloadResourceManager::Classifier`
  already implements the full classifier interface; its unknown-workload branch
  now throws `RESOURCE_ACCESS_DENIED` (as the dispatcher did) instead of the
  previously dead `RESOURCE_NOT_FOUND`, preserving the user-visible error.
- Integration tests: keep the original resource names (`network_read` /
  `network_write`) and disk / storage-policy names (`s3`, `s3_no_fake_tx`, ...)
  instead of renaming them when moving from XML to SQL configuration. The disks
  simply no longer carry `read_resource` / `write_resource` bindings; resources
  are attached via `CREATE RESOURCE ... (READ/WRITE DISK ...)`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Base automatically changed from workload-memory-scheduling to master June 24, 2026 00:51
@clickhouse-gh

clickhouse-gh Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7bf9825]

Summary: ✅


AI Review

Summary

This PR removes the legacy XML-driven CustomResourceManager path and leaves WorkloadResourceManager plus CREATE RESOURCE / CREATE WORKLOAD or resources_and_workloads as the surviving scheduling surfaces. The scheduler cleanup itself looks coherent, but the migration story is still incomplete: the user-facing warning and changelog overstate what was removed, and the rewritten integration suite no longer proves that the obsolete resources / workload_classifiers sections are safely ignored on startup and reload.

PR Metadata
  • Changelog category is correct: this is a Backward Incompatible Change.
  • Changelog entry is required and mostly specific, but its replacement guidance is incomplete. It currently tells users to switch only to CREATE RESOURCE / CREATE WORKLOAD, even though config-defined scheduling via resources_and_workloads is still documented and implemented.
  • Exact replacement text:
    Removed the legacy workload scheduling config sections \resources` and `workload_classifiers`. Use `CREATE RESOURCE` / `CREATE WORKLOAD`, or the combined `resources_and_workloads` config section, instead. The obsolete sections are ignored with a warning.`
Findings

⚠️ Majors

  • [programs/server/Server.cpp:2750] [dismissed by author -- https://github.com/Remove obsolete CustomResourceManager in favor of WorkloadResourceManager #108286#discussion_r3521602340] The startup/reload warning says config-based resource scheduling was removed and points operators only to CREATE RESOURCE / CREATE WORKLOAD, but the current tree still documents and implements config-defined scheduling through resources_and_workloads. That makes the migration guidance incorrect for users who want workload definitions to remain infrastructure-managed. Suggested fix: either narrow the message to “the legacy resources / workload_classifiers sections were removed” or mention resources_and_workloads explicitly as the supported config replacement.
Tests
  • ⚠️ [tests/integration/test_scheduler_io/test.py:1123] The suite now covers resources_and_workloads, but no test exercises the new contract that legacy resources / workload_classifiers only warn and are ignored on startup/reload. Add a focused integration case that loads those obsolete sections, reloads config, verifies that no scheduler entities are created from them, and checks that the server stays up while logging the warning.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: add focused regression coverage for the ignored legacy sections, and fix the warning/changelog wording so it does not claim that all config-based scheduling is gone while resources_and_workloads remains supported.

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Jun 24, 2026
FifoQueue, SemaphoreConstraint and ThrottlerConstraint have constructors
that are callable with a single argument, which the
google-explicit-constructor clang-tidy check flags as an error under
-warnings-as-errors (Build (arm_tidy)). Mark them explicit, matching the
sibling FairPolicy/PriorityPolicy nodes in the same directory.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
test_merge_workload_change and test_mutation_workload_change queried system.scheduler with "path ilike '%/<workload>'", expecting the fifo node's path to end at the workload node. With CustomResourceManager removed, scheduling runs on the SQL-backed WorkloadResourceManager where the fifo node sits below the workload node, so the predicate matched nothing and int('') raised ValueError. Add the trailing /% to match the fifo node under the workload, consistent with the sibling test_merge_workload / test_mutation_workload tests.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@serxa

serxa commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@groeneai, please investigate two unrelated failures blocking this PR and provide fixes in separate PRs:

  1. Stress test (amd_tsan) — https://github.com/ClickHouse/ClickHouse/actions/runs/28163252983/job/83426338016

  2. Integration tests (amd_asan_ubsan, db disk, old analyzer, 2/6) — https://github.com/ClickHouse/ClickHouse/actions/runs/28163252983/job/83426338079

If fixes are already in progress, please link them here.

@groeneai

Copy link
Copy Markdown
Collaborator

@serxa Confirmed: both failures are unrelated to the scheduling refactor (no type-system or replication-protocol changes in this PR), and fixes are already in progress.

1. Stress test (amd_tsan), STID 1611-447a Unexpected return type from equals. Expected Nullable(UInt8). Got UInt8.

2. Integration (amd_asan_ubsan, db disk, old analyzer), test_parallel_quorum_actually_quorum QueryTimeoutExceedException: Client timed out!

Nothing for you to do here. Will keep both moving.

@serxa

serxa commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

@groeneai, new unrelated failure on head 8bb9269:

Stress test (amd_asan_ubsan) and Upgrade check (amd_release) both fail with STID 1499-22cb — Logical error: Bad cast from type DB::ColumnNullable to DB::ColumnVector<unsigned long> triggered by SELECT * APPLY x -> argMax(x, b) FROM (SELECT number AS a FROM numbers(3)) GROUP BY a, b WITH ROLLUP ORDER BY a ASC, b DESC (test 04067_group_by_use_nulls_apply_aggregate.sql). Unrelated to the CustomResourceManager removal. Please investigate and provide a fix in a separate PR. If the fix is already in progress, link it here.

Jobs: https://github.com/ClickHouse/ClickHouse/actions/runs/28305084057/job/83864745561 and https://github.com/ClickHouse/ClickHouse/actions/runs/28305084057/job/83867191030

@groeneai

Copy link
Copy Markdown
Collaborator

@serxa Confirmed: STID 1499-22cb is the known #91119 family, unrelated to the CustomResourceManager removal.

Mechanism (from the amd_asan_ubsan stack): argMax -> SingleValueDataFixed<UInt64>::set -> assert_cast<ColumnVector<unsigned long>>(IColumn), which fails because the argument column is ColumnNullable, inside Aggregator::executeImplBatch over AggregationDataWithNullKey (the group_by_use_nulls null-key path). Under group_by_use_nulls=1 the ROLLUP super-aggregate rows wrap a GROUP BY key as Nullable while the aggregate state was set up for the non-Nullable type, so reading its argument column does a bad cast. That is exactly issue #91119.

Not caused by this PR: it is a resource-scheduling refactor with no analyzer, type-system, or aggregate changes. The same STID has hit 6+ unrelated PRs over the last month, so it is a pre-existing trunk defect surfaced by the fuzzer over 04067_group_by_use_nulls_apply_aggregate.sql.

In-flight fix: #104350 (open). It stops the analyzer from wrapping the aggregate-argument reference as Nullable across the LAMBDA -> QUERY scope chain; its regression test 04326_91119_apply_lambda_aggregate_rollup.sql covers the * APPLY x -> argMax(x, key) ... WITH ROLLUP shape directly.

…er_io

The suite was renamed test_scheduler -> test_scheduler_io in this PR, but
ci/jobs/scripts/integration_tests_configs.py still keyed its duration under
the old path, making the renamed suite zero-cost and unbalancing test batches.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread programs/server/Server.cpp Resolved
@mintlify

mintlify Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Jul 10, 2026, 1:29 AM

stay_alive=True,
main_configs=[
"configs/storage_configuration.xml",
"configs/resources.xml",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration path removed by this PR is untested now. After the suite stopped loading the legacy resources / workload_classifiers config, the only config coverage left here is resources_and_workloads, so we no longer exercise the new contract that the obsolete sections are only warned about and ignored on startup/reload. Please add a focused integration case for the legacy sections that reloads config, verifies no scheduler entities are created from them, and confirms the server stays up.

@clickhouse-gh

clickhouse-gh Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 81.80% 85.70% +3.90%
Functions 92.30% 92.70% +0.40%
Branches 73.80% 77.90% +4.10%

Changed lines: Changed C/C++ lines covered: 153/161 (95.03%) · Uncovered code

Full report · Diff report

@clickhouse-gh

clickhouse-gh Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

⚠️ AI verdict: not_sure — no significant changes across 37 queries analysed

This PR removes the legacy config-based resource scheduling path (CustomResourceManager, the scheduler-node factory, and workload classifiers) and replaces it with a deprecation warning; the public and private diffs are identical aside from a test rename. None of this runs on the query-execution hot path for a standard ClickBench run with no custom resources configured, so all four flagged deltas are off-path. The Q4 and Q15 ~-20% improvement-looking deltas and the Q30/Q31 +15-20% regression-looking deltas are run-to-run variance, not real PR effects — Q4 was already correctly suppressed to no-change inside master's variance band, and the Q15 improvement is downgraded to not-sure for the same reason. Q30 and Q31 sit on an intrinsically noisy baseline and stay not-sure.

clickbench

⚠️ 3 inconclusive

Flagged queries (3 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 15 not_sure 244 193 -20.9% <0.0001 PR only removes dead scheduler-config code; SELECT hot path untouched, so -20.9% is variance, not a PR gain.
⚠️ 30 not_sure 266 318 +19.6% <0.0001 Baseline noisy/unstable and off-path; PR touches only legacy scheduler config, not query execution.
⚠️ 31 not_sure 349 403 +15.5% <0.0001 Like Q30: noisy baseline, off-path from a scheduler-config-removal PR; +15.47% not attributable to this PR.

q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: cc705aed-aae0-4bb0-9e38-8bc2bad36e65
  • MIRAI run: 44682e8f-ff52-4398-bf1a-543d35668ac8
  • PR check IDs:
    • clickbench_135159_1783650433
    • clickbench_135165_1783650433
    • clickbench_135168_1783650433
    • tpch_adapted_1_official_135178_1783650433
    • tpch_adapted_1_official_135188_1783650433
    • tpch_adapted_1_official_135198_1783650434

@serxa
serxa added this pull request to the merge queue Jul 10, 2026
Merged via the queue into master with commit 3b3f5b6 Jul 10, 2026
346 of 347 checks passed
@serxa
serxa deleted the remove-custom-resmanager branch July 10, 2026 22:18
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 10, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…smanager

Remove obsolete CustomResourceManager in favor of WorkloadResourceManager

This branch was successfully deployed

1 active deployment
staging - docs — 7bf9825e Deployed Jul 10, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants