Repository navigation
Store minio audit/server log tables on an explicit local disk, not the default policy - #110430
Merged
alexey-milovidov merged 5 commits intoJul 17, 2026
Merged
Conversation
Follow-up to the review of the initial fix: pinning `system.minio_audit_logs` / `system.minio_server_logs` to `SETTINGS storage_policy = 'default'` is not enough. In the public repo `default` is a local policy, but in the private/cloud repo `default` is cloud-based (object storage), so pinning to it would still put these tables on S3 - the audit-log feedback loop and the slow post-run dump that reads them back from S3 both persist there. Pin each table to a dedicated local disk instead, with an explicit `SETTINGS disk = disk(type = 'local', path = '/var/lib/clickhouse/disks/...')`. That path is inside `custom_local_disks_base_directory` (`/var/lib/clickhouse/disks/`, set by `custom_disks_base_path.xml`, which `install.sh` always installs), so the disk is created locally regardless of what `default` resolves to - correct in both the public and the private/cloud repo. Each table uses its own path so it gets its own disk. Update the guard test to require the explicit local-disk pin and reject a regression back to `storage_policy = 'default'`. Verified with `clickhouse local`: with the default `merge_tree` policy overridden to a non-local policy, a plain `CREATE` lands on the override while the `disk = disk(type = 'local', ...)` pin lands on a dedicated local disk, bypassing the override. #110333 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
Workflow [PR], commit [2f13925] Summary: ✅ AI ReviewSummaryThis PR moves Final VerdictStatus: ✅ Approve |
The explicit local disks at /var/lib/clickhouse/disks/minio_*_logs/ live outside the per-run server data directory (run_path*) that `ClickHouseProc.start` wipes, so a restart destroys the tables' metadata but not their data: every bugfix-validation binary swap re-runs `create_minio_log_tables` and would leak the previous incarnation's parts (~1.5 GB of audit logs on sanitizer s3 runs). Wipe the two disk directories as the first setup step - both call sites run right after a fresh `start`, so no live table references them. Extend the guard test to require the reset step and that it covers exactly the pinned disk paths. Addresses the AI review finding on #110430 Co-Authored-By: Claude Fable 5 <[email protected]>
…s-explicit-local-disk
1 task
alexey-milovidov
added a commit
that referenced
this pull request
Jul 16, 2026
…haredMergeTree
The `min_block`/`max_block` values derived via `splitByChar('_', part_name)`
and a hard `::UInt64` cast were computed in a `WITH` clause and referenced in
the `WHERE` filter, so they got evaluated for every `system.part_log` row of
the table before the `min_block = 1 AND max_block = ...` filter could narrow
them down. Under `SharedMergeTree`, `part_log` for this table can contain
extra rows whose `part_name` is a filesystem path, so the cast threw
`CANNOT_PARSE_TEXT` and failed the test.
Replace the hard cast with `toUInt64OrNull`, so malformed `part_name` values
parse to `NULL` and get filtered out by the `WHERE` clause instead of
throwing, keeping `SharedMergeTree` coverage instead of tagging the test out
via `no-shared-merge-tree` (per review feedback on this change).
Related: #110430
The reset step in `ClickHouseProc.create_minio_log_tables` shelled out to `rm -rf /var/lib/clickhouse/disks/minio_audit_logs/ .../minio_server_logs/`. Those paths live outside `run_path*` and can persist across jobs, so a stale or planted symlink at either path would make `rm -rf .../` follow it and recursively delete whatever it points at instead of just the log tables' own directory. Replace it with `ClickHouseProc._reset_minio_log_disk_dirs`, which refuses to remove a path that is a symlink and only `shutil.rmtree`s a verified real directory. The guard test now requires this symlink check and rejects a regression back to the shell `rm -rf` form. Related: #110430
…s-explicit-local-disk
Algunenano
approved these changes
Jul 16, 2026
1 task
Member
Author
|
The only CI failure, Stress test (amd_asan_ubsan), is unrelated to this Python-only CI-script PR: it is an UndefinedBehaviorSanitizer report in the |
raimannma
pushed a commit
to raimannma/ClickHouse
that referenced
this pull request
Jul 17, 2026
The test verifies local vertical-merge mechanics (compact to wide parts)
by parsing MergeTree part names from `system.part_log` with
`splitByChar('_', part_name)[2]::UInt64`. With `SharedMergeTree`,
`part_log` for the table can contain extra entries whose `part_name` is a
filesystem path, so the cast throws `CANNOT_PARSE_TEXT`:
Cannot parse string 'work/clickhouse-private/clickhouse-private/ci/tmp/run' as UInt64
Observed in the "CH Inc sync" run of
ClickHouse#110430 in "Stateless tests
(amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel,
1/2)". The test is already listed as cloud-incompatible in the private
repo; this tag makes the shared-merge-tree stateless runs skip it too.
Co-Authored-By: Claude Fable 5 <[email protected]>
pull Bot
pushed a commit
to Spencerx/ClickHouse
that referenced
this pull request
Jul 18, 2026
`SZ3::LinearQuantizer::quantize_and_overwrite` cast `fabs(data - pred) * error_bound_reciprocal` straight to `int64_t`. For NaN or infinite input (or a finite value out of int64 range) that cast is undefined behavior, reported by UBSan in stress tests as `LinearQuantizer.hpp:45:49: runtime error: nan is outside the range of representable values of type 'long'`. Such values can never be quantized - the error-bound recheck sends them to the unpredictable (lossless) path anyway - so the fix routes them there before the cast, in the `ClickHouse/SZ3` fork (commit dda0caee243719d1dad10a9f05bc18eeedc2ab6b on `ClickHouse/v3.3.2`). Behavior for in-range values is unchanged. The new test `04603_sz3_codec_non_finite` checks that NaN and infinities round-trip exactly through `SZ3` (they are stored losslessly), both on insert and after a merge, and would trigger the UBSan report without the fix. Seen in: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110430&sha=2f139250fec65930580e67de7ebd07b87392fd16&name_0=PR&name_1=Stress%20test%20%28amd_asan_ubsan%29 On PR: ClickHouse#110430 Caused by: ClickHouse#108788 Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
The explicit local disks at /var/lib/clickhouse/disks/minio_*_logs/ live outside the per-run server data directory (run_path*) that `ClickHouseProc.start` wipes, so a restart destroys the tables' metadata but not their data: every bugfix-validation binary swap re-runs `create_minio_log_tables` and would leak the previous incarnation's parts (~1.5 GB of audit logs on sanitizer s3 runs). Wipe the two disk directories as the first setup step - both call sites run right after a fresh `start`, so no live table references them. Extend the guard test to require the reset step and that it covers exactly the pinned disk paths. Addresses the AI review finding on ClickHouse#110430 Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
The reset step in `ClickHouseProc.create_minio_log_tables` shelled out to `rm -rf /var/lib/clickhouse/disks/minio_audit_logs/ .../minio_server_logs/`. Those paths live outside `run_path*` and can persist across jobs, so a stale or planted symlink at either path would make `rm -rf .../` follow it and recursively delete whatever it points at instead of just the log tables' own directory. Replace it with `ClickHouseProc._reset_minio_log_disk_dirs`, which refuses to remove a path that is a symlink and only `shutil.rmtree`s a verified real directory. The guard test now requires this symlink check and rejects a regression back to the shell `rm -rf` form. Related: ClickHouse#110430
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…bles-explicit-local-disk Store minio audit/server log tables on an explicit local disk, not the `default` policy
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
The test verifies local vertical-merge mechanics (compact to wide parts)
by parsing MergeTree part names from `system.part_log` with
`splitByChar('_', part_name)[2]::UInt64`. With `SharedMergeTree`,
`part_log` for the table can contain extra entries whose `part_name` is a
filesystem path, so the cast throws `CANNOT_PARSE_TEXT`:
Cannot parse string 'work/clickhouse-private/clickhouse-private/ci/tmp/run' as UInt64
Observed in the "CH Inc sync" run of
ClickHouse#110430 in "Stateless tests
(amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel,
1/2)". The test is already listed as cloud-incompatible in the private
repo; this tag makes the shared-merge-tree stateless runs skip it too.
Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…haredMergeTree
The `min_block`/`max_block` values derived via `splitByChar('_', part_name)`
and a hard `::UInt64` cast were computed in a `WITH` clause and referenced in
the `WHERE` filter, so they got evaluated for every `system.part_log` row of
the table before the `min_block = 1 AND max_block = ...` filter could narrow
them down. Under `SharedMergeTree`, `part_log` for this table can contain
extra rows whose `part_name` is a filesystem path, so the cast threw
`CANNOT_PARSE_TEXT` and failed the test.
Replace the hard cast with `toUInt64OrNull`, so malformed `part_name` values
parse to `NULL` and get filtered out by the `WHERE` clause instead of
throwing, keeping `SharedMergeTree` coverage instead of tagging the test out
via `no-shared-merge-tree` (per review feedback on this change).
Related: ClickHouse#110430
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
`SZ3::LinearQuantizer::quantize_and_overwrite` cast `fabs(data - pred) * error_bound_reciprocal` straight to `int64_t`. For NaN or infinite input (or a finite value out of int64 range) that cast is undefined behavior, reported by UBSan in stress tests as `LinearQuantizer.hpp:45:49: runtime error: nan is outside the range of representable values of type 'long'`. Such values can never be quantized - the error-bound recheck sends them to the unpredictable (lossless) path anyway - so the fix routes them there before the cast, in the `ClickHouse/SZ3` fork (commit dda0caee243719d1dad10a9f05bc18eeedc2ab6b on `ClickHouse/v3.3.2`). Behavior for in-range values is unchanged. The new test `04603_sz3_codec_non_finite` checks that NaN and infinities round-trip exactly through `SZ3` (they are stored losslessly), both on insert and after a merge, and would trigger the UBSan report without the fix. Seen in: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110430&sha=2f139250fec65930580e67de7ebd07b87392fd16&name_0=PR&name_1=Stress%20test%20%28amd_asan_ubsan%29 On PR: ClickHouse#110430 Caused by: ClickHouse#108788 Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #110333 (merged), addressing the review note that pinning
system.minio_audit_logs/system.minio_server_logstoSETTINGS storage_policy = 'default'is not enough for the private repo: theredefaultis cloud-based (object storage), so the tables would still live on S3 - the audit-log feedback loop and the slow post-runINTO OUTFILEdump that reads them back from S3 both persist.These are diagnostics about S3 activity; there is no reason to store them on S3. Instead of relying on what
defaultresolves to, pin each table to a dedicated local disk with an explicitSETTINGS disk = disk(type = 'local', path = '/var/lib/clickhouse/disks/<table>/'). That path is insidecustom_local_disks_base_directory(/var/lib/clickhouse/disks/, set bycustom_disks_base_path.xml, whichinstall.shalways installs), so the disk is created locally regardless of the server's defaultmerge_treepolicy - correct in both the public repo (wheredefaultis local) and the private/cloud repo (wheredefaultis object storage). Each table uses its own path so it gets its own disk. The change lives in the sharedci/jobs/scripts/clickhouse_proc.py, so it flows to the private repo via the sync.The guard test (
ci/tests/test_minio_log_tables_local_storage.py) is updated to require the explicit local-disk pin and to reject a regression back tostorage_policy = 'default'.Lifecycle (addressing the AI review finding): the pinned disk paths live outside the per-run server data directory (
run_path*) thatClickHouseProc.startwipes, so a restart destroys the tables' metadata but not their data - every bugfix-validation binary swap would leak the previous incarnation's parts.create_minio_log_tablestherefore now wipes the two disk directories as its first setup step, before re-creating the tables; both call sites run right after a freshstart, so no live table references them at that point. The guard test also requires this reset step and checks that it covers exactly the pinned disk paths.Verified with
clickhouse local: with the defaultmerge_treepolicy overridden to a non-local policy, a plainCREATElands on the override, while thedisk = disk(type = 'local', ...)pin lands on a dedicated local disk, bypassing the override entirely.Related: #110333
Related: #110333 (comment)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.7.1.1065(included in26.7and later)