Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to define volume_priority in storage_configuration #58533

Merged
merged 9 commits into from Feb 26, 2024

Conversation

zvonand
Copy link
Contributor

@zvonand zvonand commented Jan 5, 2024

Allow to manually set volume priorities. Closes #31264.

Changelog category (leave one):

  • Improvement

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

Allow to define volume_priority in storage_configuration.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@zvonand zvonand force-pushed the zvonand-volume-priority branch 3 times, most recently from 29fdfa7 to 8eddc1a Compare January 5, 2024 13:00
@ilejn
Copy link
Contributor

ilejn commented Jan 5, 2024

Consider std::stable_sort instead of std::sort to avoid unpleasant surprises for users.
.. and, may be, to get rid of has_information_about_priority flag.

@zvonand zvonand marked this pull request as ready for review January 5, 2024 14:14
@ilejn
Copy link
Contributor

ilejn commented Jan 5, 2024

The statement in doc "If two or more volumes have the same setting value, order among them is undefined" is not true.

To me it is enough to say that

  • default - 0
  • items with equal priorities are ordered by their position in config.

I am a bit worried that higher value actually means lower priority, it may be contrintuitive.

@zvonand
Copy link
Contributor Author

zvonand commented Jan 5, 2024

The statement in doc "If two or more volumes have the same setting value, order among them is undefined" is not true.

Already fixed

@ilejn
Copy link
Contributor

ilejn commented Jan 5, 2024

Already fixed

Hm ... not pushed yet?

@zvonand
Copy link
Contributor Author

zvonand commented Jan 5, 2024

Hm ... not pushed yet?

A-ha, fixed one line and left another one :) Fixed.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jan 6, 2024
@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Jan 6, 2024
@robot-clickhouse
Copy link
Member

robot-clickhouse commented Jan 6, 2024

This is an automated comment for commit b4e582f with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
A SyncThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure

src/Disks/VolumeJBOD.cpp Outdated Show resolved Hide resolved
src/Disks/StoragePolicy.cpp Outdated Show resolved Hide resolved
@zvonand zvonand force-pushed the zvonand-volume-priority branch 4 times, most recently from f6d6203 to 7a7a6b6 Compare January 8, 2024 22:19
@zvonand zvonand force-pushed the zvonand-volume-priority branch 5 times, most recently from 44a778d to 3929548 Compare January 9, 2024 12:20
@zvonand zvonand force-pushed the zvonand-volume-priority branch 3 times, most recently from d129c89 to 47e75bd Compare January 19, 2024 16:37
@zvonand
Copy link
Contributor Author

zvonand commented Jan 21, 2024

@zvonand
Copy link
Contributor Author

zvonand commented Feb 8, 2024

Could anyone pls take a look at this PR? It's tiny, non-complicated, well-documented and the tests are fine :)

cc @alexey-milovidov (as you are the only one from ClickHouse Inc. in this thread 😃 )

@@ -870,6 +870,11 @@ Tags:
- `load_balancing` - Policy for disk balancing, `round_robin` or `least_used`.
- `least_used_ttl_ms` - Configure timeout (in milliseconds) for the updating available space on all disks (`0` - update always, `-1` - never update, default is `60000`). Note, if the disk can be used by ClickHouse only and is not subject to a online filesystem resize/shrink you can use `-1`, in all other cases it is not recommended, since eventually it will lead to incorrect space distribution.
- `prefer_not_to_merge` — You should not use this setting. Disables merging of data parts on this volume (this is harmful and leads to performance degradation). When this setting is enabled (don't do it), merging data on this volume is not allowed (which is bad). This allows (but you don't need it) controlling (if you want to control something, you're making a mistake) how ClickHouse works with slow disks (but ClickHouse knows better, so please don't use this setting).
- `volume_priority` — Defines the priority (order) in which volumes are filled. Lower value means higher priority. The parameter values should be natural numbers and collectively cover the range from 1 to N (lowest priority given) without skipping any numbers.
Copy link
Member

Choose a reason for hiding this comment

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

It will be much better if:

  • we allow arbitrary unsigned numbers for priorities;
  • we allow identical priorities;
  • if the priority is identical, the order in the configuration matters;
  • omitting the priority value is equivalent to priority zero.

Copy link
Contributor Author

@zvonand zvonand Feb 19, 2024

Choose a reason for hiding this comment

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

we allow arbitrary unsigned numbers for priorities

This is about a mismatch of internal representation vs what user specifies in config. E.g. if we specify priorities 1,3,5,7, they would be stored as 1,2,3,4 internally. Moreover, we will have 1,2,3,4 in output of storage_policies. Wouldn't that be confusing? However, I understand that changing this config may be tough as user will have to reset all priorities. If this internal vs config mismatch is ok, we can do it like this

omitting the priority value is equivalent to priority zero

I think it is a matter of taste. In both ways, it is easy to add a low-priority and high-priority volume.
However, the way it works now we can also easily add a volume in the middle, e.g. 2nd priority volume. With your idea, it would be harder

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically these restrictions were introduced in 47e75bd to avoid confusion
and to guarantee that volume_priority in config and in system.storage_policies are the same.
@alexey-milovidov , if you think that it does not make sense, we can return to initial approach.

@alexey-milovidov alexey-milovidov self-assigned this Feb 19, 2024
Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

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

Ok.

@zvonand
Copy link
Contributor Author

zvonand commented Feb 20, 2024

Investigating fails:

@zvonand
Copy link
Contributor Author

zvonand commented Feb 21, 2024

@alexey-milovidov updated according to your comment.
Also, looks like there are no related fails (plenty of them, but not related to my changes)

@alexey-milovidov
Copy link
Member

Could you please merge with master?

@zvonand

This comment was marked as outdated.

@zvonand

This comment was marked as outdated.

@zvonand
Copy link
Contributor Author

zvonand commented Feb 26, 2024

The only fails now are:

Integration tests (tsan) [3/6]:

CC @alexey-milovidov

@alexey-milovidov alexey-milovidov merged commit 9dff4e8 into ClickHouse:master Feb 26, 2024
234 of 239 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 26, 2024
@zvonand zvonand deleted the zvonand-volume-priority branch February 26, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements 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.

Defining volume_priority expliclty in storage_configuration
4 participants