Skip to content

Store plain_rewritable disk metadata in the separate '__meta' layout; add flat object storage directory structure - #65751

Merged
jkartseva merged 21 commits into
ClickHouse:masterfrom
jkartseva:store-plain-rw-metadata-separately
Aug 2, 2024
Merged

jkartseva merged 21 commits into
ClickHouse:masterfrom
jkartseva:store-plain-rw-metadata-separately

Conversation

@jkartseva

@jkartseva jkartseva commented Jun 27, 2024 •

Copy link
Copy Markdown
Member

An example of object_storage layout after the change:

./__meta/ekqksqmqjootkiisofrgxanqigdzlfbz/prefix.path/xl.meta
./__meta/llhxeztcwqqfrwzjzqebtxnqpcortgor/prefix.path/xl.meta
./__meta/zaflawfkpuswindcdoocfqdglaplgcut/prefix.path/xl.meta
./__meta/fblzzufsqilwkhgovbkhzjaceevpcwql/prefix.path/xl.meta
./__meta/wxbhorxekhnmgqbvhhxexecjletwwpes/prefix.path/xl.meta
./__meta/cjznxqrydozehsabrzboqqtxpcaiyepw/prefix.path/xl.meta
./__meta/pmazlwpxffbtyozzpiabbloylpmiqlet/prefix.path/xl.meta
./__meta/sxpcgyzjzgwzwwsmjvufgsgigjkfmbec/prefix.path/xl.meta
./__meta/rvwbziebhbxqbixduvewyqrjlanylkel/prefix.path/xl.meta
./__meta/mmrsmwpdcxirjagpygfpdcpebnepzgdm/prefix.path/xl.meta
./__meta/rphturfvrvvycmrggucaqypenfqlzazn/prefix.path/xl.meta
./__meta/edtkygitaarrxizdsigsaatvhtvuctyc/prefix.path/xl.meta
./__meta/gtfiqveyrtdhxkmwltiswtyvnhovpntq/prefix.path/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/serialization.json/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/data.bin/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/primary.cidx/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/columns.txt/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/checksums.txt/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/data.cmrk3/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/metadata_version.txt/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/default_compression_codec.txt/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/partition.dat/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/count.txt/xl.meta
./ekqksqmqjootkiisofrgxanqigdzlfbz/minmax_a.idx/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/serialization.json/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/data.bin/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/primary.cidx/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/columns.txt/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/checksums.txt/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/data.cmrk3/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/metadata_version.txt/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/default_compression_codec.txt/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/partition.dat/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/count.txt/xl.meta
./llhxeztcwqqfrwzjzqebtxnqpcortgor/minmax_a.idx/xl.meta

Changelog category (leave one):

  • Performance Improvement

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

Store the plain_rewritable disk directory metadata in __meta layout, separately from the merge tree data in the object storage. Move the plain_rewritable disk to a flat directory structure.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

CI Settings (Only check the boxes if you know what you are doing):

  • Allow: All Required Checks
  • Allow: Stateless tests
  • Allow: Stateful tests
  • Allow: Integration Tests
  • Allow: Performance tests
  • Allow: All Builds
  • Allow: batch 1, 2 for multi-batch jobs
  • Allow: batch 3, 4, 5, 6 for multi-batch jobs

  • Exclude: Style check
  • Exclude: Fast test
  • Exclude: All with ASAN
  • Exclude: All with TSAN, MSAN, UBSAN, Coverage
  • Exclude: All with aarch64, release, debug

  • Do not test
  • Woolen Wolfdog
  • Upload binaries for special builds
  • Disable merge-commit
  • Disable CI cache

@jkartseva jkartseva added the can be tested Allows running workflows for external contributors label Jun 27, 2024
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-improvement Pull request with some product improvements label Jun 27, 2024
@jkartseva jkartseva changed the title Store plain_rewritable metadata in a separate layout Store plain_rewritable disk metadata in the separate __meta layout Jun 27, 2024
@jkartseva jkartseva changed the title Store plain_rewritable disk metadata in the separate __meta layout Store plain_rewritable disk metadata in the separate '__meta' layout Jun 27, 2024
@robot-ch-test-poll1 robot-ch-test-poll1 added pr-performance Pull request with some performance improvements and removed pr-improvement Pull request with some product improvements labels Jun 27, 2024
@robot-clickhouse-ci-2

robot-clickhouse-ci-2 commented Jun 27, 2024 •

Copy link
Copy Markdown
Contributor

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

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

Check nameDescriptionStatus
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❌ failure
Successful checks
Check nameDescriptionStatus
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
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ 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. Integration 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
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ 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
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

@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch from f06f229 to d821056 Compare June 27, 2024 04:21
@jkartseva
jkartseva marked this pull request as draft June 27, 2024 05:59
@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch 3 times, most recently from 145827c to f3ed773 Compare June 27, 2024 09:13
@kssenii kssenii self-assigned this Jun 27, 2024
@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch 4 times, most recently from 74b2faa to b133b81 Compare June 28, 2024 05:29
@jkartseva
jkartseva marked this pull request as ready for review June 28, 2024 18:08
@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch from c67f8ae to acff253 Compare July 1, 2024 23:04
@alexey-milovidov

Copy link
Copy Markdown
Member

Should we also make the directory structure flat - avoid extracting common prefixes?
Because the prefixes that appear common can be not common later.

@jkartseva

Copy link
Copy Markdown
Member Author

@alexey-milovidov
MergeTree requires traversing direct subdirectories, hence, we'll need to get the information that B is a child of A.

With a flat directory structure, as I understand it, each directory will have a unique pseudo-random name, possibly with a prefix reflecting the depth of the MT path (if #65321 is implemented). Thus, the information that 'B is a child of A' will not be reflected in the flat structure paths.
I mean something like:

001_bbvxygjiwmoapsdeshsggmqcgotsdbon
002_twkwwcncwfoufzuhoalhqszglxmqtcji

We have an in-memory map with the virtual MT paths (e.g., 'store/cbf/cbfff232-0df0-48f2-86b5-5bb39c897173/4_6_6_1/') as keys and the object storage paths as values. If it's okay to use this map as the source of truth for directories' direct children, I can make the structure flat.


Alternatively, S3 paths may be in a form of ([a-z]{16}\/){0,3}[a-z]{16}, i.e. a pseudo-random parent path is a prefix of child's path, an example:

xfyrnptgybuamjjt
xfyrnptgybuamjjt/zxfhacytunbmxtuk
xfyrnptgybuamjjt/zxfhacytunbmxtuk/oalhqszglxmqtcji

But, this is not a 'flat' structure.

@alexey-milovidov

alexey-milovidov commented Jul 2, 2024 •

Copy link
Copy Markdown
Member

If it's okay to use this map as the source of truth for directories' direct children, I can make the structure flat.

Yes, this is what I meant: use a flat structure (where the directories are near each other) and reconstruct the directory hierarchy from the metadata files.

PS. About adding the depth in the name - probably it does not make sense after that.

@jkartseva
jkartseva marked this pull request as draft July 2, 2024 15:04
@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch from acff253 to 8095aa4 Compare July 3, 2024 02:06
@jkartseva

Copy link
Copy Markdown
Member Author

PS. About adding the depth in the name - probably it does not make sense after that.

Since the regular MergeTree file paths won't be stored in the in-memory map, I think it still makes sense.

@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch 4 times, most recently from c6068af to 1025259 Compare July 10, 2024 23:18
@jkartseva
jkartseva force-pushed the store-plain-rw-metadata-separately branch from 821aba5 to 9b4e02e Compare August 2, 2024 04:28
@jkartseva
jkartseva added this pull request to the merge queue Aug 2, 2024
Merged via the queue into ClickHouse:master with commit 5281874 Aug 2, 2024
@jkartseva
jkartseva deleted the store-plain-rw-metadata-separately branch August 2, 2024 12:28
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 2, 2024
baibaichen added a commit to Kyligence/gluten that referenced this pull request Aug 3, 2024
baibaichen added a commit to apache/gluten that referenced this pull request Aug 3, 2024
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240803)

* fix build due to ClickHouse/ClickHouse#65751

* Fix build due to #6558

---------

Co-authored-by: kyligence-git <[email protected]>
Co-authored-by: Chang Chen <[email protected]>
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-performance Pull request with some performance 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.

7 participants