Skip to content

Store minio audit/server log tables on local disk, not S3 - #110333

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-minio-log-tables-local-storage
Jul 14, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-minio-log-tables-local-storage

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

The Scraping system tables step of stateless jobs fails on amd_tsan + s3 storage runs with:

Failed to dump system table: minio_audit_logs
Error: timed out after 600s

system.minio_audit_logs and system.minio_server_logs capture the MinIO audit/server webhook stream, but they are plain ENGINE = MergeTree tables, so on s3 storage runs they inherit the overridden default merge_tree policy (s3_storage_policy_for_merge_tree_by_default.xml sets <merge_tree><storage_policy>s3</storage_policy>) and live on S3. That is doubly bad for tables that record S3 activity:

  • every audit-event insert writes parts to S3, which itself generates more audit events — a feedback loop that inflates the table, and
  • the post-run select * ... into outfile dump in dump_system_tables reads it all back from S3. On amd_tsan the JSON-typed audit table grew to ~700k rows / ~1.5 GB and the dump blew past the DUMP_SYSTEM_TABLE_TIMEOUT (600s) cap, so the bounded dump was killed and Scraping system tables went red.

On master this only ever fired on runs that already had another failing test (the failure-reproduction/minimization storm hammers S3, tipping the table over the cap), so it never turned a green run red — but it added a confusing extra FAIL and wasted up to ~20 min per affected run.

Fix: pin both tables to the local default storage policy with an explicit SETTINGS storage_policy = 'default'. The dump then reads locally and the audit insert path no longer feeds itself over S3. These are diagnostics about S3 activity; there is no reason to store them on S3. default is a local policy on every stateless config (nothing remaps it), so this is a no-op on non-s3 runs.

Verified with clickhouse local: with the default merge_tree policy overridden to a non-default policy, a plain CREATE lands on the override while SETTINGS storage_policy = 'default' lands on local storage. A guard test (ci/tests/test_minio_log_tables_local_storage.py) prevents a future edit from silently putting the tables back on S3.

CI report (one of several; amd_tsan s3 storage sequential 2/2 on master):
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=961ded3e6c262b07d1b0b33e74ce60b9fad99682&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20sequential%2C%202%2F2%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Not for changelog.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

The `Scraping system tables` step of stateless jobs fails on amd_tsan + s3
storage runs with `Failed to dump system table: minio_audit_logs / timed out
after 600s`. `system.minio_audit_logs` and `system.minio_server_logs` capture
the MinIO audit/server webhook stream, but they are plain `ENGINE = MergeTree`
tables, so on s3 storage runs they inherit the overridden default merge_tree
policy (`s3_storage_policy_for_merge_tree_by_default.xml` sets
`<merge_tree><storage_policy>s3</storage_policy>`) and live on S3.

That is doubly bad for tables that record S3 activity:

  * every audit-event insert writes parts to S3, which itself generates more
    audit events - a feedback loop that inflates the table, and
  * the post-run `select * ... into outfile` dump in `dump_system_tables` reads
    it all back from S3. On amd_tsan the `JSON`-typed audit table grew to ~700k
    rows / ~1.5 GB and the dump blew past the `DUMP_SYSTEM_TABLE_TIMEOUT` (600s)
    cap, so the bounded dump was killed and `Scraping system tables` went red.

On master this only ever fired on runs that already had another failing test
(the failure-reproduction/minimization storm hammers S3, tipping the table over
the cap), so it never turned a green run red - but it added a confusing extra
`FAIL` and wasted up to ~20 min per affected run.

Pin both tables to the local `default` storage policy with an explicit
`SETTINGS storage_policy = 'default'`. The dump then reads locally and the audit
insert path no longer feeds itself over S3. These are diagnostics about S3
activity; there is no reason to store them on S3. `default` is a local policy on
every stateless config (nothing remaps it), so this is a no-op on non-s3 runs.
Verified with `clickhouse local`: with the default merge_tree policy overridden,
a plain CREATE lands on the override while `storage_policy = 'default'` lands on
local storage.

CI report (one of several, amd_tsan s3 storage sequential 2/2 on master):
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=961ded3e6c262b07d1b0b33e74ce60b9fad99682&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20sequential%2C%202%2F2%29

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e512951]

Summary: ✅


AI Review

Summary

This PR pins system.minio_audit_logs and system.minio_server_logs to the local default storage policy so stateless S3 runs stop writing those diagnostic tables back to S3 and stop dumping them back from S3 during log collection. The change is narrowly scoped, covers both the initial setup and the bugfix-validation reprepare path through the shared create_minio_log_tables helper, and the added guard test is sufficient for this CI-harness fix.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 14, 2026
(
"create system.minio_audit_logs table",
'clickhouse-client --enable_json_type=1 --query "CREATE TABLE system.minio_audit_logs (log JSON(time DateTime64(9))) ENGINE = MergeTree ORDER BY tuple()"',
'clickhouse-client --enable_json_type=1 --query "CREATE TABLE system.minio_audit_logs (log JSON(time DateTime64(9))) ENGINE = MergeTree ORDER BY tuple() SETTINGS storage_policy = \'default\'"',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not enough. In private default is cloud based and it's an issue there too

@Algunenano Algunenano self-assigned this Jul 14, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Let's merge this, and then do a follow-up applicable for the private repo.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 14, 2026
Merged via the queue into master with commit 9d57cc4 Jul 14, 2026
177 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-minio-log-tables-local-storage branch July 14, 2026 17:08
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 14, 2026
alexey-milovidov added a commit to groeneai/ClickHouse that referenced this pull request Jul 15, 2026
Master's ClickHouse#110333 added ci/tests/test_minio_log_tables_local_storage.py, which
asserts that both `system.minio_audit_logs` and `system.minio_server_logs` are
created with `storage_policy = 'default'`. This PR drops the audit table
entirely, so the guard now expects a single CREATE statement, verifies it is
`system.minio_server_logs`, and still requires the local storage pin.

Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov added a commit to raimannma/ClickHouse that referenced this pull request Jul 17, 2026
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.

ClickHouse#110333 (comment)

Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…bles-local-storage

Store minio audit/server log tables on local disk, not S3
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
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.

ClickHouse#110333 (comment)

Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Master's ClickHouse#110333 added ci/tests/test_minio_log_tables_local_storage.py, which
asserts that both `system.minio_audit_logs` and `system.minio_server_logs` are
created with `storage_policy = 'default'`. This PR drops the audit table
entirely, so the guard now expects a single CREATE statement, verifies it is
`system.minio_server_logs`, and still requires the local storage pin.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci 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.

3 participants