Skip to content

Allow cache disk for datalake table engines. - #102017

Merged
alexey-milovidov merged 18 commits into
ClickHouse:masterfrom
RinChanNOWWW:fix-from-disk
Jun 6, 2026
Merged

alexey-milovidov merged 18 commits into
ClickHouse:masterfrom
RinChanNOWWW:fix-from-disk

Conversation

@RinChanNOWWW

@RinChanNOWWW RinChanNOWWW commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

We cannot configure a cache disk for datalake table engines, this PR fix this.

Changelog category (leave one):

  • Improvement

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

Allow cache disk for datalake table engines.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Note

Medium Risk
Touches disk/cache configuration parsing and broadens supported cache-disk configs; misclassification of config keys could cause cache init failures or silently ignore settings in production deployments.

Overview
Enables using type=cache disks with datalake table engines by teaching FileCacheSettings to ignore the disk-layer skip_access_check key when loading cache settings (avoiding UNKNOWN_SETTING).

Integration tests for DeltaLake and Iceberg are extended to run against both base object-storage disks and new cache-wrapped disks (S3/Azure), including updated generated configs/allowed disks and a small refactor to consistently compute disk names; local-disk cache cases are explicitly skipped.

Reviewed by Cursor Bugbot for commit 38d2e9e. Bugbot is set up for automated code reviews on this repo. Configure here.

Version info

  • Merged into: 26.6.1.465

@RinChanNOWWW

Copy link
Copy Markdown
Contributor Author

cc @scanhex12

@RinChanNOWWW
RinChanNOWWW force-pushed the fix-from-disk branch 3 times, most recently from 02ccd04 to 7f59019 Compare April 8, 2026 03:34
@scanhex12 scanhex12 added the can be tested Allows running workflows for external contributors label Apr 8, 2026
@scanhex12 scanhex12 self-assigned this Apr 8, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d3183ec]

Summary: ✅


AI Review

Summary

This PR lets cache-disk configs containing skip_access_check parse and extends DeltaLake / Iceberg disk tests, but the main user-facing contract is still not met: SETTINGS disk = '<cache disk>' is accepted for datalake engines while reads continue through the underlying object storage without the cache layer.

Findings

❌ Blockers

  • [src/Interpreters/FileCache/FileCacheSettings.cpp:23; src/Storages/ObjectStorage/StorageObjectStorageSource.cpp:1038] Existing inline thread: the PR promises cache-disk support for datalake engines, but the datalake read path bypasses the cache wrapper. DataLakeConfiguration::fromDisk stores disk->getObjectStorage, then StorageObjectStorageSource builds the read with pipeline.setSource instead of calling IObjectStorage::prepareRead; CachedObjectStorage::readObject explicitly delegates to the wrapped storage, and CachedObjectStorage::prepareRead is the path that adds needFilesystemCache. With no explicit filesystem_cache_name, a query using a cache disk can silently behave like the non-cache disk. Route these reads through IObjectStorage::prepareRead, or otherwise add the CachedObjectStorage filesystem-cache stage for cache disks.
Tests
  • ⚠️ The new integration coverage proves that cache-disk names are accepted and return correct rows, but it does not prove the cache is used. Add a focused assertion that the configured cache receives entries or hits after a datalake read, for example via system.filesystem_cache, cache logs, or cache-directory state.
Final Verdict

Status: ❌ Block

Minimum required action: make datalake reads actually use the selected cache disk, and add a regression test that would fail if the read path falls back to uncached object-storage reads.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Apr 8, 2026
@RinChanNOWWW

RinChanNOWWW commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor Author

No idea why the CI failed. The test cases work fine on my local machine.

In the CI environment, ClickHouse nodes couldn't connect to the Azure Storage service.

2026.04.08 13:57:09.495792 [ 10 ] {} <Error> Application: Caught exception while loading metadata: std::exception. Code: 1001, type: Azure::Storage::StorageException, e.what() = 500 Poco::Exception. Code: 1000, e.code() = 111, Connection refused, Stack trace (when copying this message, always include the lines below):

0. ./contrib/llvm-project/libcxx/include/__exception/exception.h:113:14: Poco::Exception::Exception(String const&, int) @ 0x000000005a7e10c0
1. ./ci/tmp/build/./base/poco/Foundation/src/Exception.cpp:174:1: Poco::IOException::IOException(String const&, int) @ 0x000000005a7ef21b
2. ./ci/tmp/build/./base/poco/Net/src/NetException.cpp:26:1: Poco::Net::ConnectionRefusedException::ConnectionRefusedException(String const&, int) @ 0x000000005a98955b
3. ./ci/tmp/build/./base/poco/Net/src/SocketImpl.cpp:1095:9: Poco::Net::SocketImpl::error(int, String const&) @ 0x000000005a9adc09
4. ./ci/tmp/build/./base/poco/Net/src/SocketImpl.cpp:1021:2: Poco::Net::SocketImpl::connect(Poco::Net::SocketAddress const&, Poco::Timespan const&) @ 0x000000005a9b013e
5. ./ci/tmp/build/./base/poco/Net/src/HTTPSession.cpp:239:10: Poco::Net::HTTPSession::connect(Poco::Net::SocketAddress const&) @ 0x000000005a95a071
6. ./ci/tmp/build/./base/poco/Net/src/HTTPClientSession.cpp:474:13: Poco::Net::HTTPClientSession::reconnect(unsigned long*) @ 0x000000005a92bb13
7. ./ci/tmp/build/./src/Common/HTTPConnectionPool.cpp:529:22: DB::EndpointConnectionPool<Poco::Net::HTTPClientSession>::prepareNewConnection(DB::ConnectionTimeouts const&, unsigned long*) @ 0x000000002f35a484
8. ./ci/tmp/build/./src/Common/HTTPConnectionPool.cpp:630:16: DB::EndpointConnectionPool<Poco::Net::HTTPClientSession>::getConnection(DB::ConnectionTimeouts const&, unsigned long*) @ 0x000000002f357d48
9. ./ci/tmp/build/./src/IO/HTTPCommon.cpp:58:29: DB::makeHTTPSession(DB::HTTPConnectionGroupType, Poco::URI const&, DB::ConnectionTimeouts const&, DB::ProxyConfiguration const&, unsigned long*) @ 0x000000002f337991
10. ./ci/tmp/build/./src/IO/AzureBlobStorage/PocoHTTPClient.cpp:364:24: DB::PocoAzureHTTPClient::makeRequestInternalImpl(Azure::Core::Http::Request&, Azure::Core::Context const&, unsigned long) @ 0x0000000035f01789
11. ./ci/tmp/build/./src/IO/AzureBlobStorage/PocoHTTPClient.cpp:141:12: DB::PocoAzureHTTPClient::Send(Azure::Core::Http::Request&, Azure::Core::Context const&) @ 0x0000000035f003da
12. ./ci/tmp/build/./contrib/azure/sdk/core/azure-core/src/http/transport_policy.cpp:120:40: Azure::Core::Http::Policies::_internal::TransportPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c24b636
13. ./ci/tmp/build/./contrib/azure/sdk/core/azure-core/src/http/log_policy.cpp:118:23: Azure::Core::Http::Policies::_internal::LogPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c1ce137
14. ./ci/tmp/build/./contrib/azure/sdk/core/azure-core/src/http/request_activity_policy.cpp:107:23: Azure::Core::Http::Policies::_internal::RequestActivityPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c24588e
15. ./contrib/azure/sdk/storage/azure-storage-common/inc/azure/storage/common/internal/shared_key_policy.hpp:36:25: Azure::Storage::_internal::SharedKeyPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c2b5a22
16. ./ci/tmp/build/./contrib/azure/sdk/storage/azure-storage-common/src/storage_per_retry_policy.cpp:57:23: Azure::Storage::_internal::StoragePerRetryPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c385207
17. ./ci/tmp/build/./contrib/azure/sdk/storage/azure-storage-common/src/storage_switch_to_secondary_policy.cpp:36:32: Azure::Storage::_internal::StorageSwitchToSecondaryPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c385e5d
18. ./ci/tmp/build/./contrib/azure/sdk/core/azure-core/src/http/retry_policy.cpp:146:34: Azure::Core::Http::Policies::_internal::RetryPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c1d93b3
19. ./ci/tmp/build/./contrib/azure/sdk/core/azure-core/src/http/telemetry_policy.cpp:23:21: Azure::Core::Http::Policies::_internal::TelemetryPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c2825cf
20. ./contrib/azure/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp:480:27: Azure::Core::Http::Policies::_internal::RequestIdPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c20c368
21. ./contrib/azure/sdk/storage/azure-storage-common/inc/azure/storage/common/internal/storage_service_version_policy.hpp:34:25: Azure::Storage::_internal::StorageServiceVersionPolicy::Send(Azure::Core::Http::Request&, Azure::Core::Http::Policies::NextHttpPolicy, Azure::Core::Context const&) const @ 0x000000005c2b65a6
22. ./contrib/azure/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp:230:29: Azure::Storage::Blobs::_detail::BlobContainerClient::GetProperties(Azure::Core::Http::_internal::HttpPipeline&, Azure::Core::Url const&, Azure::Storage::Blobs::_detail::BlobContainerClient::GetBlobContainerPropertiesOptions const&, Azure::Core::Context const&) @ 0x000000005c2f9c29
23. ./ci/tmp/build/./contrib/azure/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp:324:12: Azure::Storage::Blobs::BlobContainerClient::GetProperties(Azure::Storage::Blobs::GetBlobContainerPropertiesOptions const&, Azure::Core::Context const&) const @ 0x000000005c2cf8c1
24. ./ci/tmp/build/./src/Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage/AzureBlobStorageCommon.cpp:158:19: DB::AzureBlobStorage::ContainerClientWrapper::GetProperties() const @ 0x0000000035ee2296
25. ./ci/tmp/build/./src/Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage/AzureBlobStorageCommon.cpp:279:16: DB::AzureBlobStorage::getContainerClient(DB::AzureBlobStorage::ConnectionParams const&, bool) @ 0x0000000035ee5347
26. ./ci/tmp/build/./src/Disks/DiskObjectStorage/ObjectStorages/ObjectStorageFactory.cpp:198:33: std::shared_ptr<DB::IObjectStorage> std::__function::__policy_func<std::shared_ptr<DB::IObjectStorage> (String const&, Poco::Util::AbstractConfiguration const&, String const&, std::shared_ptr<DB::Context const> const&, bool)>::__call_func[abi:fe210105]<DB::registerAzureObjectStorage(DB::ObjectStorageFactory&)::$_0>(std::__function::__policy_storage const*, String const&, Poco::Util::AbstractConfiguration const&, String const&, std::shared_ptr<DB::Context const> const&, bool) @ 0x000000003dcad683
27. ./contrib/llvm-project/libcxx/include/__functional/function.h:508:12: ? @ 0x000000003dca8d44
28. ./ci/tmp/build/./src/Disks/DiskObjectStorage/RegisterDiskObjectStorage.cpp:53:86: DB::registerDiskObjectStorage(DB::DiskFactory&, bool)::$_0::operator()(String const&, Poco::Util::AbstractConfiguration const&, String const&, std::shared_ptr<DB::Context const>, std::map<String, std::shared_ptr<DB::IDisk>, std::less<void>, std::allocator<std::pair<String const, std::shared_ptr<DB::IDisk>>>> const&, bool, bool) const @ 0x000000003dc9cbbd
29. ./contrib/llvm-project/libcxx/include/__functional/function.h:508:12: ? @ 0x000000003db1f103
30. ./ci/tmp/build/./src/Disks/DiskFactory.cpp:48:12: DB::DiskFactory::create(String const&, Poco::Util::AbstractConfiguration const&, String const&, std::shared_ptr<DB::Context const>, std::map<String, std::shared_ptr<DB::IDisk>, std::less<void>, std::allocator<std::pair<String const, std::shared_ptr<DB::IDisk>>>> const&, bool, bool, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>> const&) const @ 0x000000003db1ebbe
31. ./ci/tmp/build/./src/Disks/DiskSelector.cpp:120:23: DB::DiskSelector::initialize(Poco::Util::AbstractConfiguration const&, String const&, std::shared_ptr<DB::Context const>, std::function<bool (Poco::Util::AbstractConfiguration const&, String const&, String const&)>) @ 0x000000003db6e165
 (version 26.4.1.652)

@alexey-milovidov

Copy link
Copy Markdown
Member

The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158

@scanhex12 scanhex12 left a comment

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.

LGTM

@alexey-milovidov

Copy link
Copy Markdown
Member

The flaky check failure is fixed in #102148, let's update the branch.

@alexey-milovidov

Copy link
Copy Markdown
Member

Picked this up via /continue-pr. Status summary:

The C++ changes from this PR are already in master. The same fix — walking past CachedObjectStorage via IObjectStorage::getUnderlying() before the assert_cast to S3ObjectStorage / AzureObjectStorage — was applied independently in c39f742 ("Fix Bad cast on data-lake SETTINGS disk = '...' with wrapped object storage"), plus related infrastructure in #102202 ("Azure delta kernel"). Diffing fix-from-disk (after merging current master) against master shows only the test changes remain unique:

tests/integration/test_storage_delta_disks/test.py    | 90 +++++++++++++---------
tests/integration/test_storage_iceberg_disks/test.py  | 79 ++++++++++++-------

CI failure analysis. The previously-failing tests in test_storage_delta_disks/test.py::test_single_log_file[*] were not real failures of the new code — they were "Azure: Connection refused" at IDisk::startup() because the disk_azure_common access check hit azurite1:{port} before the container's network was reachable. In the flaky-check run, gw2 passed all 8 parameterizations cleanly; gw0 and gw1 failed at the fixture setup, never reaching the cache path. The same disk config in test_storage_iceberg_disks passed on all 3 workers, so this is environment-timing flakiness in the delta-test fixture (which has 4 nodes including a with_zookeeper=True one), not a regression introduced by the cache disks. No master CI runs of this test have failed in 60 days.

Push status. I merged current master locally (resolved conflicts in src/Storages/ObjectStorage/{Azure,S3}/Configuration.cpp — keeping master's new code since this PR's intent is now in master). The merge can't be pushed to this fork from my session: the merged state pulls in .github/workflows/*.yml updates from master, and the OAuth token available here lacks workflow scope.

Suggested next step. Given the C++ part is already merged via #102202 + c39f742, the cleanest path is probably to close this PR and re-land just the test additions in a new small PR. Happy to defer to @scanhex12 / @RinChanNOWWW.

@alexey-milovidov

Copy link
Copy Markdown
Member

Yes, let's keep only test changes here.



The cache-unwrap fix in `IObjectStorage::getUnderlying` / `assert_cast` is
already in master, so this PR can now be reduced to just the test additions.

See: ClickHouse#102017 (comment)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The integration tests for cache-disk-on-datalake (`test_storage_delta_disks`,
`test_storage_iceberg_disks`) were flaking on `started_cluster` startup: the
clickhouse-server access check on `disk_azure_common` and on the cache
wrapper `disk_azure_with_cache` hangs ~4 min on
`WriteBufferFromAzureBlobStorage` when Azurite is not yet ready, so the TCP
port never opens.

Set `<skip_access_check>true</skip_access_check>` on both the underlying
Azure disk and the cache wrapper. The cache wrapper has its own access
check via `RegisterDiskCache.cpp:125` that writes through to Azure, so the
flag must be present on both. This mirrors the fix from ClickHouse#105165.
The tests added by this PR configure `<skip_access_check>true</skip_access_check>`
on the `cache`-wrapped Azure disk (`disk_azure_with_cache`) to avoid the Azurite
access-check stall during cluster startup. However, `FileCacheSettings::loadFromConfig`
calls `BaseSettings::set` for every key under the disk config and throws
`UNKNOWN_SETTING` for any key not in `FileCacheSettingsTraits`, including
`skip_access_check`.

`type`, `disk`, `name`, `data_background_cleanup`, and `thread_pool_size` are
already excluded via `non_cache_keys`. Add `skip_access_check` to that set so
the per-disk flag is consumed by the `IDisk` layer (via `IDisk::startup`)
rather than rejected by the cache settings loader.

Without this fix, the server fails to start in `test_storage_delta_disks` and
`test_storage_iceberg_disks` with:

    Code: 115. DB::Exception: Unknown setting 'skip_access_check'.
    (UNKNOWN_SETTING)
    at src/Interpreters/FileCache/FileCacheSettings.cpp:179
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label May 20, 2026
alexey-milovidov and others added 3 commits May 23, 2026 22:34
Workflow files in this branch were stale or had been deleted as a
workaround for GitHub's workflow-scope check. Restoring them to match
`master` so the PR diff no longer contains those unrelated changes.
The fixtures in `test_storage_delta_disks` and `test_storage_iceberg_disks`
generate the disk config at a fixed `./_gen/named_collections.xml` path
shared across all `pytest-xdist` workers. Each worker substitutes its own
`{cluster.instances_dir_name}` (which embeds `PYTEST_XDIST_WORKER` like
`_instances-gw0`) into `disk_local_common`'s path. Concurrent fixture
setup in the flaky check races on the shared file: whichever worker
writes the file last wins, and `shutil.copy` into each instance's
`config.d/` may then pick up the wrong `_instances-gwN` path.

Result: gw1/gw2 workers' ClickHouse servers boot with gw0's disk path
and fail with `InvalidTableLocationError: Invalid table location: Path
does not exist: ".../_instances-gw0/node1/database/user_files/..."` on
the `False-1-local` variant.

Suffix the generated file with `PYTEST_XDIST_WORKER` so each worker
writes to its own `_gen/named_collections_gwN.xml`. Falls back to the
unsuffixed name when not running under xdist.

CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102017&sha=38d2e9e3a127598f03e6bcf72edaee42a24931b3&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29
PR: ClickHouse#102017

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The fixtures set up `cluster.default_azure_uploader = AzureUploader(...)`
against a custom container name `mycontainer`, but the cluster helper
only auto-creates `azurite-container` (the default).

Before commit `fa5f56f6246` ("Skip Azure access check in datalake disk
tests"), `disk_azure_common` had `<skip_access_check>false</skip_access_check>`,
so ClickHouse's startup access check write-touched the Azurite endpoint
and side-effected the container into existence. Now that the access
check is skipped (to dodge a 4-minute Azurite warm-up hang), the
container is never created, and uploads via `default_upload_directory`
fail with `ContainerNotFound`.

Match the pattern used in
`tests/integration/test_storage_iceberg_interoperability_azure/conftest.py`:
fetch the container client and call `create_container` when missing.

This mirrors the fix landed in PR ClickHouse#105165 (commit `2ca20dbe1c5`).

CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102017&sha=38d2e9e3a127598f03e6bcf72edaee42a24931b3&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29
PR: ClickHouse#102017

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, the 3 failing checks on commit 789607ba (Build (amd_binary), Stateless tests (amd_binary_excluded_from_llvm), Integration tests (amd_binary_excluded_from_llvm)) are infrastructure-only: the Build (amd_binary) job was cancelled at the Checkout code step after 3 seconds (started 13:32:04, completed 13:32:07), and the two downstream jobs were skipped as a result. No build output, no test run, no CIDB row. Could you retrigger this run?

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov I tried the retrigger but both paths return 403 from my account (@groeneai lacks admin/push on ClickHouse/ClickHouse):

  1. gh run rerun 26450452782 [--failed] -> Must have admin rights to Repository
  2. POST /repos/ClickHouse/ClickHouse/actions/runs/26450452782/rerun-failed-jobs -> same 403
  3. POST /repos/ClickHouse/ClickHouse/actions/jobs/78103852984/rerun -> same 403
  4. Removing/adding the can be tested label -> same 403

State on attempt 3 is unchanged: Build (amd_binary) FAILURE (cancelled at Checkout, 3s), Stateless tests (amd_binary_excluded_from_llvm) and Integration tests (amd_binary_excluded_from_llvm) SKIPPED.

Could you (or another maintainer with admin access) rerun the failed jobs on run 26450452782? Alternative path: a fresh push (even an empty commit) on RinChanNOWWW:fix-from-disk would trigger a new run via pull_request: synchronize.

The previous CI run cancelled the `Build (amd_binary)` job at the
`Checkout code` step (runner shutdown signal, 3s), which left the two
`_excluded_from_llvm` downstream test jobs skipped. An empty push
triggers a fresh `pull_request: synchronize` run.
@alexey-milovidov

Copy link
Copy Markdown
Member

Re the CH Inc sync check: the private sync PR #54993 is MERGEABLE (no conflicts) — the red is purely unrelated private-CI flakiness on the latest run, not a regression from this PR:

  • Integration tests (db disk, old analyzer, 3/6): failed on test_system_reload_async_metrics, unrelated to datalake cache disks.
  • Integration tests (db disk, old analyzer, 6/6): session-timeout occurred during test execution / no tests ran — runner timeout, not a test failure.
  • Config Workflow: failed on the older run but already succeeded on the newer one.

The same db disk, old analyzer shards (1/6–6/6) and the PR's own test_storage_delta_disks / test_storage_iceberg_disks all passed on the public PR at this same commit. I've rerun the failed jobs on the sync PR to clear the flakiness.

The only other red on the public side is Stateless tests (arm_asan_ubsan, targeted) / Server died, the known master-wide chronic flake (≈50–60 PRs/day over the last week).

@alexey-milovidov

Copy link
Copy Markdown
Member

Merged master into the branch (it was 725 commits behind and red) to pick up recent fixes and re-trigger CI. The merge was clean — zero conflicts, net diff unchanged (the one-line FileCacheSettings.cpp change plus the two integration test files).

The only CI failure on the previous run was Server died (0s duration, identical in both reports) — a chronic master-wide infra flake unrelated to this change. The code change is sound: skip_access_check is read at the disk layer (RegisterDiskCache.cpp via config.getBool(config_prefix + ".skip_access_check")), so it correctly belongs in non_cache_keys and must be skipped when loading cache settings to avoid UNKNOWN_SETTING.

All review threads are resolved and the PR is approved.

@alexey-milovidov

Copy link
Copy Markdown
Member

Merged the latest master (the branch was 667 commits behind and CI was red); the merge was conflict-free and the one-line skip_access_check addition to non_cache_keys in FileCacheSettings.cpp is intact. Pushed as 88cd92323cf.

The only CI failure was Upgrade check (amd_release) → "Error message in clickhouse-server.log": a DEADLOCK_AVOIDED WRITE locking attempt on "system.metric_log" has timed out during the upgrade. This is unrelated to this PR (a cache-disk config-key change) — the same failure recurs on unrelated PRs on master (e.g. #106425, #104561, #106202 over the last 30 days).

@groeneai, could you take a look at this system.metric_log flush DEADLOCK_AVOIDED during the upgrade check and provide a fix in a separate PR? If a fix is already in progress, please link it here.

/// Keys that belong to the disk configuration layer (IDisk), not to the cache layer.
/// They must be skipped when loading cache settings to avoid UNKNOWN_SETTING errors.
static const std::set<std::string> non_cache_keys = {"type", "disk", "name", "data_background_cleanup", "thread_pool_size"};
static const std::set<std::string> non_cache_keys = {"type", "disk", "name", "data_background_cleanup", "thread_pool_size", "skip_access_check"};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This makes a type=cache disk with skip_access_check parse, but the datalake read path still does not use the disk cache. DataLakeConfiguration::fromDisk keeps disk->getObjectStorage(), then StorageObjectStorageSource calls pipeline.setSource(object_storage, ...); with no filesystem_cache_name, ReadPipeline eventually calls CachedObjectStorage::readObject, and that method explicitly delegates to the wrapped storage without adding a filesystem-cache stage. So SETTINGS disk = 'disk_s3_with_cache' can silently behave like the non-cache disk, and the new tests still pass because they only compare query results.

Please route datalake disk reads through IObjectStorage::prepareRead or otherwise add the CachedObjectStorage cache stage to this pipeline, and extend one of these tests to assert cache usage rather than only successful reads.

@groeneai

groeneai commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

@alexey-milovidov: opened #106616 ("Allowlist system.metric_log flush DEADLOCK_AVOIDED in upgrade-check log scrub") as the separate-PR fix you asked for.

CIDB confirms the signature is benign chronic CI noise, not a code regression — SystemLog<MetricLogElement>::flushImpl losing a 60s table-level write lock to shutdown work (DROP/RENAME/DETACH/mutation/merge) on system.metric_log during the upgrade-test restart sequence and aborting with code 473 (DEADLOCK_AVOIDED). 4 hits / 4 distinct PRs / 30d, 0 master, 100% on Upgrade check (amd_release). PR #106616 mirrors the precedent of #106563 and the older rdk:FAIL filter: require BOTH SystemLog+metric_log AND DEADLOCK_AVOIDED together, so real metric_log regressions and unrelated DEADLOCK_AVOIDED hits on other system_log tables still surface.

The umbrella tracker for this whole Upgrade check (amd_release) "Error message in clickhouse-server.log" family (which also covers the StorageKafka2 broker variant fixed by #106563) lives on our side — sightings logged there.

…rg::alter

PR ClickHouse#106102 (merged 2026-06-05 17:43 UTC) refactored Iceberg::alter to
declare last_version and compression_method outside an if/else that
assigns them in both branches. Clang-tidy cppcoreguidelines-init-variables
flags the bare declarations and Build (arm_tidy) is built with
-warnings-as-errors, so the build fails for every PR whose CI ran on
master after this commit.

CIDB shows 30+ unrelated PRs hitting this in the last 2 days
(e.g. ClickHouse#89360, ClickHouse#103540, ClickHouse#106120, ClickHouse#106386, ClickHouse#106404, ClickHouse#106522, ClickHouse#105102,
ClickHouse#106590).

Initialize both variables to safe defaults at declaration. They are
unconditionally overwritten in both if and else branches before use,
so behavior is unchanged. The new defaults are only relevant if a
future code path skips both assignments, in which case last_version=0
and compression_method=CompressionMethod::None are sane no-op values
(the same defaults the old structured-binding form would produce
through default-construction of the destructured aggregate).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
(cherry picked from commit d72cac5)
@clickhouse-gh

clickhouse-gh Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.50% 84.50% +0.00%
Functions 92.30% 92.30% +0.00%
Branches 77.00% 77.10% +0.10%

Changed lines: Changed C/C++ lines covered by tests: 6/6 (100.00%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

pull Bot pushed a commit to Spencerx/ClickHouse that referenced this pull request Jun 6, 2026
…utdown noise

The upgrade-check post-restart `<Error>` scrub catches a transient lock-timeout
emitted by `SystemLog<MetricLogElement>::flushImpl` when the background `MetricLog`
flush loop races with shutdown work on `system.metric_log` during the upgrade restart
sequence:

```
<Error> void DB::SystemLog<DB::MetricLogElement>::flushImpl(...) [LogElement = DB::MetricLogElement]: Failed to flush system log system.metric_log with N entries up to offset M: Code: 473. DB::Exception: WRITE locking attempt on "system.metric_log" has timed out! (60000ms) Possible deadlock avoided. Client should retry. Owner query ids: . (DEADLOCK_AVOIDED), Stack trace ...
```

Another worker (DROP/RENAME/DETACH on `system.metric_log`, or a parallel
mutation/merge) holds the table-level write lock, the flush blocks for the
60s timeout, and then aborts with code 473 (`DEADLOCK_AVOIDED`). The 473 code is
the engine's own "gave up to avoid a deadlock, not a crash" signal — losing a few
`MetricLogElement` samples during shutdown is harmless; the upgrade-check stage is
not asserting on metric continuity.

CIDB confirms this is chronic CI noise, not a code regression: 4 hits across 4
distinct PRs in the last 30 days, 0 master, 100% on `Upgrade check (amd_release)`.
Reported by @ alexey-milovidov on PR ClickHouse#102017 (cited ClickHouse#106425, ClickHouse#104561, ClickHouse#106202).

The added regex requires BOTH the `SystemLog` flush wrapper for `metric_log` AND
the `DEADLOCK_AVOIDED` error code together, mirroring the narrowing approach of
the existing `rdk:FAIL.*Connect to.*failed: Connection refused` and
`StorageKafka2.*Broker transport failure` filters. Real `metric_log` regressions
(other flush errors) and unrelated `DEADLOCK_AVOIDED` hits on other system_log
tables (`query_log`, `text_log`, etc.) still surface.

Related: ClickHouse#102017
Related: ClickHouse#106563
Related: ClickHouse#101576

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 6, 2026
Merged via the queue into ClickHouse:master with commit 3812ae3 Jun 6, 2026
166 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 7, 2026
@RinChanNOWWW
RinChanNOWWW deleted the fix-from-disk branch June 7, 2026 00:48
pull Bot pushed a commit to Lobinson1/ClickHouse that referenced this pull request Jun 8, 2026
Adds integration test coverage for using a `cache`-wrapped disk under
the `DeltaLake` and `Iceberg` table engines via `SETTINGS disk = '...'`.
The cache-aware path through `IObjectStorage::getUnderlying` before the
`assert_cast` to `S3ObjectStorage` / `AzureObjectStorage` is already in
master (commit c39f742 and ClickHouse#102202); this PR brings over the tests
from ClickHouse#102017 so the path stays covered.

Tests parameterize `test_single_log_file` / `test_single_iceberg_file` /
`test_many_tables` / `test_cluster_table_function` with
`with_cache=[False, True]`. The `with_cache=True` variant is skipped for
`local` storage since the `cache` disk only wraps object storages.

Original author: @RinChanNOWWW (ClickHouse#102017).

Co-Authored-By: RinChanNOW <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[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 manual approve Manual approve required to run CI 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.

5 participants