Skip to content

Make test 03988_cached_read_big_at fast - #125010

Merged
alexey-milovidov merged 4 commits into
masterfrom
optimize-test-03988-cached-read-big-at
Oct 12, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
optimize-test-03988-cached-read-big-at

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The test 03988_cached_read_big_at read whole Title, URL and SearchPhrase columns of test.hits_parquet from the public AWS S3 bucket. It took 344 s median (up to 466 s) in Stateless tests (arm_asan_ubsan, azure, sequential), which hits its 9000 s timeout: 7 of 22 master runs timed out on 2026-10-09.

Now the test writes a small (about 7 MB) Parquet file with 10 row groups to MinIO and reads it through the cache_for_readbigat filesystem cache with a small remote_read_min_bytes_for_seek. The Parquet reader then issues many small concurrent readBigAt calls whose ranges share 1 MiB file segments. That is the scenario of the bug: one call leaves a segment partially downloaded, and another call continues downloading it with the same remote reader. The result is checked against checksums computed from the source data, and query_log confirms that the reads went through the cache.

I checked it against CI master builds:

  • 8c014eb (just before the fix): fails 3 of 3 runs with the exception from the issue, CANNOT_SEEK_THROUGH_FILE raised in ReadBufferFromS3::seek, called from prepareReadFromFileSegmentState, called from readBigAt.
  • ab8ca2b (with the fix) and current master: passes in about 1.2 s.

The stateful, long and no-parallel tags are removed. Each database writes its own file, so the cache key (path + etag) is new and the cache does not need clearing.

Related: #97325
Related: #97890

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/125010]

Version info

  • Merged into: 26.10.1.2208-master (included in 26.10 and later)

The test read whole `Title`, `URL` and `SearchPhrase` columns of `test.hits_parquet`
from the public AWS S3 bucket, which takes 344 s median (up to 466 s) in
`Stateless tests (arm_asan_ubsan, azure, sequential)` and contributes to the job
hitting its 9000 s timeout.

Instead, write a small (about 7 MB) Parquet file with 10 row groups to MinIO and read
it through the `cache_for_readbigat` filesystem cache with a small
`remote_read_min_bytes_for_seek`, so that the Parquet reader issues many small
concurrent `readBigAt` calls whose ranges share 1 MiB file segments. This is the
scenario of the bug: one call leaves a segment partially downloaded and another one
continues downloading it with the same remote reader.

The new test fails 3 of 3 runs with the exact exception from the issue
(`CANNOT_SEEK_THROUGH_FILE` from `ReadBufferFromS3::seek` in
`prepareReadFromFileSegmentState` called by `readBigAt`) on the CI master build
from just before the fix (8c014eb), and passes on the
build with the fix (ab8ca2b) and on current master,
taking about 1.2 s.

The test no longer needs the `stateful`, `long` and `no-parallel` tags: the file has a
unique name per database, so its cache key is fresh and the cache does not need to be
cleared.

Related: #97325
Related: #97890

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [38f7a58]

Summary: ✅


AI Review

Summary

This PR rewrites 03988_cached_read_big_at to generate a small deterministic Parquet object in MinIO, exercise the cache_for_readbigat path twice, and assert the expected cold-cache and warm-cache behavior through system.query_log. The current version also fixes the earlier rerun and parallel-replica attribution problems, and I do not see any remaining correctness or reliability issues in the updated test.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-testing Test content only (no production code). labels Oct 9, 2026
@alexey-milovidov alexey-milovidov added the blocker This issue / pr blocks a new release label Oct 9, 2026
…e parallel replicas

Use a per-run unique id (with `generateUUIDv4`) for the file name and the query ids,
so that a rerun in the same database starts with a cold cache and does not
see `query_log` rows of the previous run.

Disable parallel replicas for the reading queries: in the `ParallelReplicas`
job the `s3` table function was executed on other replicas, so the profile
events of the initial query were zero.
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125010&sha=57ee7e135a7e34d27ce4c65d0a05d3a7e8b1117a&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29
PR: #125010

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The only failure, 05238_pretty_squash_broken_pipe in Fast test (arm_darwin) (https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125010&sha=630b27394c5abd19112fb558e42456900fd574b3&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29), is unrelated to this PR. The fix is in progress in #125102. I merged master to refresh the branch.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The only failure, 00956_join_use_nulls_with_array_column in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel), has nothing to do with this PR. Since the 2026-10-03 change to that test, its ANY LEFT JOIN ... LIMIT 1 query has no ORDER BY, so with parallel replicas it can return any row. The fix is in #125133.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The only CI failure, 00956_join_use_nulls_with_array_column (Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)), is a known flaky test unrelated to this PR; the fix is in progress in #125133. Merged the latest master to refresh CI.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 12, 2026
Merged via the queue into master with commit e18ca0a Oct 12, 2026
173 checks passed
@alexey-milovidov
alexey-milovidov deleted the optimize-test-03988-cached-read-big-at branch October 12, 2026 16:37
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
PedroTadim pushed a commit to groeneai/ClickHouse that referenced this pull request Oct 13, 2026
alexey-milovidov pushed a commit to ei-grad/ClickHouse that referenced this pull request Oct 14, 2026
`MD5` throws `SUPPORT_IS_DISABLED` in OpenSSL FIPS builds. ClickHouse#125010 dropped
the `stateful`/`long` tags and introduced the `MD5` call, so the test now
runs and fails there. `sipHash128` also returns `FixedString(16)`, so
`substring(hex(...), 1, 16)` keeps 16-char values and the same Parquet layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-filesystem-cache Filesystem cache for remote/object storage, page cache, and read caching infrastructure. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This issue / pr blocks a new release comp-filesystem-cache Filesystem cache for remote/object storage, page cache, and read caching infrastructure. pr-not-for-changelog This PR should not be mentioned in the changelog 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.

2 participants