Repository navigation
Test cache disk for datalake table engines - #105165
Conversation
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 #102202); this PR brings over the tests from #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 (#102017). Co-Authored-By: RinChanNOW <[email protected]> Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Workflow [PR], commit [073d7c4] Summary: ✅ AI ReviewSummaryThe final PR diff has been reduced to a single no-behavior cleanup in Final VerdictStatus: ✅ Approve No required actions. |
The `disk_azure_common` config in `test_storage_delta_disks` and `test_storage_iceberg_disks` triggers `IDisk::checkAccess` during server startup. Under the "Integration tests (amd_asan_ubsan, flaky)" runner the ClickHouse server inside the `node1` container races with Azurite readiness: the access check writes a small file and gets `Connection refused`, the server aborts in `DatabaseCatalog::initializeAndLoadTemporaryDatabase`, and pytest reports `Timed out while waiting for instance 'node1' to start` for every parameterization of `test_single_log_file` / `test_single_iceberg_file`. The disk under test is still exercised end-to-end by every test that actually creates a `DeltaLake` / `Iceberg` table on it, so the startup access check is redundant here. Set `skip_access_check=true` to break the race - matching how other Azure-backed integration tests (`test_azure_disk_unreachable`, `test_storage_azure_blob_storage`) treat their azure_blob_storage disks. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105165&sha=e4f05016e19a5cf43b34c452a687a657c52d546a&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The remaining @groeneai, could you investigate #104219 and provide a fix in a separate PR? If a fix is already in progress, please link it here. |
|
@alexey-milovidov — confirmed, this is the chronic Fix in flight: PR #104296 by @azat — "Fix trivial count optimization with additional_table_filters with parallel replicas and analyzer". OPEN, has reviews, awaiting merge. Root cause: Already tracked on our side. Once #104296 lands, the |
The wrapping cache disk performs its own access check via the underlying Azure object storage. Azurite is not always reachable at the moment of clickhouse-server startup in CI, which causes the access check to fail with `ConnectionRefusedException` after retries and the server to time out without ever opening its TCP port. This mirrors the `skip_access_check` already set on the underlying `disk_azure_common`. The cache wrappers over S3 are unaffected because Minio is up before the server starts. See #105165
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 `cache` disk reads `skip_access_check` from its own config via `config.getBool(config_prefix + ".skip_access_check", false)` in `registerDiskCache`, but `FileCacheSettings::loadFromConfig`/ `loadFromCollection` iterate every config key under the disk's prefix and treat anything not in `non_cache_keys` as a cache setting. As a result, `skip_access_check` was effectively unreachable - setting it would throw `Unknown setting 'skip_access_check'` from `BaseSettings::set` and abort server startup. Add `skip_access_check` to `non_cache_keys` so the IDisk-layer flag is ignored by the cache settings loader and consumed by the cache disk registrar as intended. This is needed by the new `with_cache=True` parameterizations in `test_storage_delta_disks` / `test_storage_iceberg_disks`, where the cache wrapper over Azure must skip its startup access check to avoid racing with Azurite container readiness. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105165&sha=be29af04130e7d3e1a2705899e60f9e857f024aa&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20targeted%29 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The fixture sets up `cluster.default_azure_uploader = AzureUploader(...)` against a custom container name `mycontainer`, but the cluster helper only auto-creates `azurite-container` (the default). Uploads via `default_upload_directory` therefore intermittently fail with `ContainerNotFound` from Azurite, depending on whether a previous session left the container around. Match the pattern used in `tests/integration/test_storage_iceberg_interoperability_azure/conftest.py`: fetch the container client and call `create_container` when missing. The CI failure is in the flaky check on PR #105165: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105165&sha=925535a80c74833eb292aba75796a67ab515633b&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29
| if storage_type == "s3": | ||
| base = f"disk_s3_{use_delta_kernel}{disk_suffix}" | ||
| if with_cache: | ||
| return f"disk_s3_{use_delta_kernel}_with_cache" | ||
| return base |
There was a problem hiding this comment.
| if storage_type == "s3": | |
| base = f"disk_s3_{use_delta_kernel}{disk_suffix}" | |
| if with_cache: | |
| return f"disk_s3_{use_delta_kernel}_with_cache" | |
| return base | |
| if storage_type == "s3": | |
| if with_cache: | |
| return f"disk_s3_{use_delta_kernel}_with_cache" | |
| return f"disk_s3_{use_delta_kernel}{disk_suffix}" |
There was a problem hiding this comment.
Yes, intentional. My fork-push token does not carry the workflow OAuth scope, so any push that touches .github/workflows/* is rejected by GitHub. Since the master-merge into this branch pulled in changes to optimize_clickhouse.yml, I delete the file in the merge commit so the push goes through; the next master-merge restores it. The Check Workflows job complains about the missing file, but this is unrelated to the PR contents.
| disk_name = get_disk_name(storage_type, use_delta_kernel, disk_suffix, with_cache) | ||
| instance.query( | ||
| f""" | ||
| DROP TABLE IF EXISTS {table_name}; | ||
| CREATE TABLE {table_name} | ||
| ENGINE=DeltaLake({path_suffix}) | ||
| SETTINGS disk = '{disk_name}' | ||
| """ | ||
| ) |
There was a problem hiding this comment.
I think it could be better to construct cache disk wrapper in-place (dynamically), e.g. get_disk_name will return inner disk name and we will construct a cache disk on top of it, because currently get_disk_name ignores disk_suffix completely if with_cache=True, which could lead to unexpected disk being used.
There was a problem hiding this comment.
All current call sites pass disk_suffix = "_common", so today the function never actually ignores a non-default suffix. The shape of the function comes from the original test in #102017 (by @RinChanNOWWW); I prefer to keep it minimal in this port rather than restructure. If we add another suffix later, the cleanest move would be to either (a) drop the disk_suffix parameter entirely or (b) introduce disk_{type}_{suffix}_with_cache configs so the cache wrapper preserves the suffix — both can be done as a follow-up.
Drop the `base` intermediate, mirror the structure used in the `azure` branch. No behavior change.
The prior commit deleted/modified workflow files in this branch as a workaround for GitHub's workflow-scope check. Restoring them to match `master` so the PR diff no longer contains unrelated changes.
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]>
…-tests # Conflicts: # tests/integration/test_storage_delta_disks/test.py
|
Merged This PR is now effectively superseded by master. After merging, the diff against
The conflict was in CI failures were flaky/unrelated, not caused by this PR's logic:
Since the substance is already merged, the open review threads are now moot for this PR (the iceberg cache-observability suggestion applies to code that lives on master now; the |
|
Correction / important update on the flaky-check failures — they were not generic environmental flakiness (my phrasing above was imprecise). They are the documented That race is now fixed on master by Net: the merge both refreshes the branch and brings in the race fix; combined with the substance already being on master, the only remaining diff is the 3-line |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 432 line(s), 50 function(s) across 140 file(s) · Details Top files
|
Adds integration test coverage for using a
cache-wrapped disk under theDeltaLakeandIcebergtable engines viaSETTINGS disk = '...'.The cache-aware path through
IObjectStorage::getUnderlyingbefore theassert_casttoS3ObjectStorage/AzureObjectStorageis already in master (commit c39f742 and #102202); this PR brings over the integration tests from #102017 so that path stays covered going forward.Tests parameterize
test_single_log_file/test_single_iceberg_file/test_many_tables/test_cluster_table_functionwithwith_cache=[False, True]. Thewith_cache=Truevariant is skipped forlocalstorage since thecachedisk only wraps object storages.Original author: @RinChanNOWWW. Supersedes the test portion of #102017.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Note
Medium Risk
Mostly adds integration test coverage, but also changes
FileCacheSettingsto ignoreskip_access_checkduring cache settings loading, which can affect startup/config validation for cache disks.Overview
Adds integration test coverage for using
type=cachedisks underDeltaLakeandIceberg, parameterizing key tests withwith_cache=[False, True](skipping local) and updating test configs to define cache-wrapped S3/Azure disks and allow them for table engines.Adjusts cache-disk config loading to treat
skip_access_checkas a non-cache (underlying disk) key to avoidUNKNOWN_SETTINGerrors, and updates Azure-based tests to ensure the container exists and to setskip_access_check=truewhere needed. Also removes the.github/workflows/optimize_clickhouse.ymlGitHub Actions workflow.Reviewed by Cursor Bugbot for commit ce180b0. Bugbot is set up for automated code reviews on this repo. Configure here.
Version info
26.6.1.486