Repository navigation
Add system.s3(azure)_queue_metadata - #108522
Conversation
Add stateless system tables that show, for each registered ObjectStorageQueue metadata object, the current number of `processed`, `processing` and `failed` nodes in Keeper. The counts are read cheaply from Keeper via `stat.numChildren` (one `exists` call per folder). The tables also expose the contents of these folders (node name -> node data) via `Map(String, String)` columns `processed`, `processing` and `failed`. To avoid listing and fetching node data unnecessarily, the contents are fetched only when the corresponding column is explicitly selected: the table enables `supportsColumnsMask` and consults the column mask in `fillData`, so a folder is touched in Keeper only when one of its columns is queried. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
In ordered mode there are no per-file `processed` nodes - the metadata keeps a compact "last processed" pointer instead (a single node, one per bucket, or one per partition). So make `processed_nodes` a `Nullable(UInt64)` that is only populated for unordered mode and `NULL` for ordered mode, and add a `processed_path` `Map(String, String)` column that exposes the last processed file path for each pointer (relative pointer path -> last processed file path), covering the single, per-bucket and per-partition layouts. `processing_nodes` and `failed_nodes` remain populated for both modes, since those folders are per-file directories regardless of mode. Like the contents columns, `processed_path` is read from keeper only when the column is explicitly selected. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address review feedback on system.s3_queue_metadata: - Batch the keeper multiread when fetching node contents (`processed`, `processing`, `failed` maps) and the ordered-mode processed pointers, chunking by `keeper_multiread_batch_size` like `cleanupTrackedNodes`, so a folder with many nodes does not build a single oversized request that could exceed keeper limits. Add `getKeeperMultireadBatchSize` to `ObjectStorageQueueMetadata` to expose the batch size. - Add integration tests for the two previously uncovered ordered layouts: per-bucket pointers (`buckets/<n>/processed`) and per-partition pointers (`processed/<partition>`), and pin `use_persistent_processing_nodes` in the ordered tests so the counts are deterministic. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [da345ca] Summary: ❌
AI ReviewSummaryThis PR adds PR Metadata
Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 60/225 (26.67%) · Uncovered code |
… partitions
Address review feedback and the integration test failures in
test_storage_s3_queue/test_3.py for the new system.s3_queue_metadata /
system.azure_queue_metadata tables.
* Set the Keeper component for the scope of `fillData`. Without it,
`Coordination::ZooKeeper::pushRequest` raises a logical error
("Current component is empty"), which aborted the server on the first
query and cascaded into "Connection refused" failures in the
following tests.
* Use `metadata->getPath` (the raw Keeper path) for Keeper reads instead
of the factory key. For auxiliary Keepers the factory key is built as
"<keeper>:<path>", so deriving read paths from it sent paths like
`aux:/clickhouse/.../processing` to Keeper and made the metadata empty
or failing. The factory key is now used only for the displayed
`zookeeper_path` column.
* In ordered mode, read partition pointers as raw last-processed file
paths. Partition child nodes under `processed/<partition>` are written
directly as the file path, not as `NodeMetadata` JSON, so parsing them
with `NodeMetadata::fromString` threw for partitioned ordered queues.
Only the root/bucket pointers are parsed as `NodeMetadata`.
Add `test_system_queue_metadata_auxiliary_keeper` covering the auxiliary
Keeper path.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108522&sha=latest&name_0=PR
PR: #108522
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Address review feedback: in `batched_get` only `ZOK` responses were stored and every other per-node error was treated like a missing node, so a real Keeper failure (authorization, session, runtime error) would make `system.s3_queue_metadata` / `system.azure_queue_metadata` silently report incomplete or empty metadata. Only `ZNONODE` is benign here - a node can disappear between listing it with `tryGetChildren` and reading it. For any other non-`ZOK` error, throw `zkutil::KeeperException::fromPath` so the failure propagates instead of being hidden. Also assert the multiread response size matches the request. Verified by running the five `test_system_queue_metadata*` integration tests in `test_storage_s3_queue/test_3.py` (all pass). Review comment: #108522 (comment) Co-Authored-By: Claude Opus 4.8 <[email protected]>
In ordered partitioned queues the root `processed` (or `buckets/<n>/processed`) node itself holds a `NodeMetadata` pointer, while only its children store raw per-partition file paths. The `processed_path` column of `system.s3_queue_metadata` walked only the children, dropping the root pointer - e.g. a table created with `partitioning_mode != none` and `last_processed_path` showed an empty `processed_path` before any partition child existed. #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
Cover the regression from the previous fix directly: an ordered partitioned queue created with `s3queue_last_processed_path` persists a `NodeMetadata` pointer on the root `processed` node before any `processed/<partition>` child exists, and `system.s3_queue_metadata` must return it. #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
Run `test_system_queue_metadata` for both `S3Queue` and `AzureQueue` so the separately registered `system.azure_queue_metadata` table is exercised too. #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
Take the factory mutex in `ObjectStorageQueueMetadataFactory::getAll` so a concurrent `SELECT` from `system.s3_queue_metadata` / `system.s3queue_metadata_cache` no longer races with `getOrCreate`/`remove` mutating `metadata_by_path`. Add the missing English docs for the new keeper-backed introspection tables `system.s3_queue_metadata` and `system.azure_queue_metadata`, and update the `S3Queue` / `AzureQueue` introspection sections to explain when to use them. Addresses: #108522 (comment) #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
…ystem-s3-queue-metadata
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
The `check_autogenerated_regions` docs guard rejects any PR that introduces content inside `<!--AUTOGENERATED_START-->`/`<!--AUTOGENERATED_END-->` markers unless the PR carries the `pr-autogenerated-docs` label (used only by the nightly docs-generation bot). The bot's generator does not cover system-table pages, so `system.s3_queue_metadata` / `system.azure_queue_metadata` must be hand-written. Drop the markers so the pages are plain docs and the guard has no region to police. Co-Authored-By: Claude Fable 5 <[email protected]>
Add `test_system_queue_metadata_ordered_partitioned_buckets`, which exercises the `useBucketsForProcessing() && partitioned` branch of `read_processed_pointers` that the existing cases missed: `test_system_queue_metadata_ordered_buckets` covers per-bucket roots without partition children, and `test_system_queue_metadata_ordered_partitioned` covers partition children without buckets, but nothing queried `system.s3_queue_metadata` for the real `buckets/<n>/processed/<partition>` layout. The new test asserts `processed_path` returns both the bucket root pointers and the per-partition children, covering every processed partition. Also drop the `use_persistent_processing_nodes = false` table setting (and the comments claiming it makes the counts deterministic) from the metadata tests: the value is ignored - `StorageObjectStorageQueue` hardcodes persistent processing nodes - so it is a no-op. The counts are already made deterministic by polling for the terminal state. Verified locally: all 7 `test_system_queue_metadata*` cases pass. Co-Authored-By: Claude Fable 5 <[email protected]>
The test asserted that every `buckets/<n>/processed` root pointer is returned
(`root_keys == {buckets/0..N/processed}`), but files are linked to buckets by
the hash of their path, and the path carries a random per-test prefix, so the
spread of partitions across buckets varies between runs. When only a subset of
buckets processed a file, the assertion failed - it passed locally but failed
in CI (asan_ubsan flaky / msan / llvm_coverage) with, e.g.,
`root_keys == {buckets/2/processed, buckets/3/processed}`.
Assert only distribution-independent invariants instead: every bucket that has
per-partition children also exposes its root pointer (`child_buckets <=
root_buckets`), the root buckets are a subset of the configured buckets, and
every processed partition is exposed as a child. This still proves the reader
returns both the bucket root pointers and the `buckets/<n>/processed/<partition>`
children.
Verified locally: 5 consecutive runs pass across different random distributions.
CI report: #108522 (comment)
Co-Authored-By: Claude Fable 5 <[email protected]>
…metadata
`processing`, `failed`, and the unordered-mode `processed` folders are created
up front by `ObjectStorageQueueUnorderedFileMetadata::getMetadataPaths` and
`ObjectStorageQueueOrderedFileMetadata::getMetadataPaths`. If one of them is
missing, the queue metadata layout in Keeper is broken and the queue will start
failing its own updates.
`readFolder` treated `ZNONODE` as an empty folder, so
`SELECT failed_nodes_count, failed_nodes FROM system.s3_queue_metadata` reported
`0` / `{}` after `<zk>/failed` was deleted, making a broken queue look healthy.
Report the error instead, on both the count-only (stat) and the contents (list)
path.
`ZNONODE` stays benign where it is expected: the ordered-mode `processed`
pointers, which `ObjectStorageQueueOrderedFileMetadata::getMetadataPaths`
deliberately does not create in advance, and per-file nodes that disappear
between the child listing and the read.
Co-Authored-By: Claude Opus 5 <[email protected]>
…adata # Conflicts: # docs/en/engines/table-engines/integrations/azure-queue.md # docs/en/engines/table-engines/integrations/s3queue.md
The legacy Docusaurus tree docs/en/ was removed on master; system-table reference pages under docs/reference/system-tables/ are now generated by the nightly docs-autogen job from the table comments and the column comments embedded in the source. Drop the hand-written pages added by this pull request and fold their extra prose into the `system.s3_queue_metadata` and `system.azure_queue_metadata` table descriptions in `attachSystemTables.cpp`. Co-Authored-By: Claude Fable 5 <[email protected]>
The keeper commit (writing the processed pointer and removing the processing node) runs after the inserted rows become visible in the destination table (`executor.execute()` completes before `commit(...)` in `StorageObjectStorageQueue`), so asserting the persisted keeper state right after the destination row count settles is racy - the ordered-mode tests could observe missing pointers or non-zero processing counts, especially under the test cluster's keeper fault injection. Add `wait_for_keeper_commit`, which polls until the `processing` folder is drained (the commit is atomic, so an empty `processing` folder implies every finished file has had its processed pointer written), and call it after the row-count wait in the six ordered/auxiliary-keeper metadata tests. The unordered `test_system_queue_metadata` already polled its keeper assertions. Also fix a stale reference to the old `read_processed_pointers` lambda name in a comment (now `readProcessedPointers`). Co-Authored-By: Claude Fable 5 <[email protected]>
`zookeeper_path` is the factory key, which for a queue on an auxiliary zookeeper is `<zookeeper_name>:<path>` rather than the raw keeper path - a `WHERE zookeeper_path = '/path'` on such a queue would otherwise silently return nothing. Document this in the column description and both reference pages. Also refresh the stale class comment in the header: the table exposes the folder contents and (in ordered mode) the last-processed pointers, not just the node counts. Co-Authored-By: Claude Fable 5 <[email protected]>
…ystem-s3-queue-metadata # Conflicts: # docs/en/operations/system-tables/azure_queue_metadata.md # docs/en/operations/system-tables/s3_queue_metadata.md
…ptions Address review nit: use `directory` for the keeper node groups in the column descriptions and the surrounding comments, matching the terminology preferred in review. Related: #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
| } | ||
|
|
||
| template <ObjectStorageType type> | ||
| void StorageSystemObjectStorageQueueMetadata<type>::fillData( |
There was a problem hiding this comment.
One small observation here.
A query against this system table can fail if an S3Queue/AzureQueue table is dropped at the same time. fillData copies the list of queues, but a queue can be dropped before its Keeper data is read. In that case, readFolder treats the missing Keeper folder as broken metadata and throws an exception, even though the queue was removed normally.
Could we check whether the queue is still registered when a required folder is missing? If it has been removed, skip the row. If it is still registered, continue reporting the exception because the missing folder indicates broken metadata.
There was a problem hiding this comment.
But in the greater spirit of this, this might probably be just fine as such an occurrence might be quite rare.
bharatnc
left a comment
There was a problem hiding this comment.
Looks good to me, just one point (might consider if it's possible at all).
Skip the row when the queue is no longer registered; keep throwing for a still-registered (broken) one. Related: #108522 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
Build profile diff (arm_release)Comparing Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/Storages/System/CMakeFiles/clickhouse_storages_system.dir/StorageSystemObjectStorageQueueMetada… |
new | 491.95 KiB | +491.95 KiB |
src/Storages/System/CMakeFiles/clickhouse_storages_system.dir/attachSystemTables.cpp.o |
1.66 MiB | 1.68 MiB | +20.48 KiB (+1.21%) |
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
24 translation units recompiled, 265 s compile time in total, 23 of them have a recent master baseline.
Translation units without a recent master baseline:
src/Storages/System/StorageSystemObjectStorageQueueMetadata.cpp: 11.6 s
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add system.s3(azure)_queue_metadata.
Version info
26.8.1.1316(included in26.8and later)