Skip to content

Multiple read file log storage in mv - #58877

Merged
kssenii merged 7 commits into
masterfrom
multiple-read-file-log-storage-in-mv
Jan 22, 2024
Merged

kssenii merged 7 commits into
masterfrom
multiple-read-file-log-storage-in-mv

Conversation

@antaljanosbenjamin

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix reading multiple times from FileLog engine in materialized views.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Jan 16, 2024
@robot-clickhouse

robot-clickhouse commented Jan 16, 2024 •

Copy link
Copy Markdown
Member

This is an automated comment for commit f34d1ae with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
Bugfix validate checkChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker image for serversThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style CheckRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure

@kssenii

kssenii commented Jan 22, 2024

Copy link
Copy Markdown
Member

Stateless tests (release, analyzer)

02968_full_sorting_join_fuzz
02891_array_shingles
not related to changes

@kssenii
kssenii merged commit aec76d6 into master Jan 22, 2024
@kssenii
kssenii deleted the multiple-read-file-log-storage-in-mv branch January 22, 2024 11:02
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created-cloud deprecated label, NOOP label Jan 22, 2024
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jan 29, 2024
robot-ch-test-poll3 added a commit that referenced this pull request Jan 29, 2024
Backport #58877 to 23.12: Multiple read file log storage in mv
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Apr 28, 2026
The deeper-fix attempt (commit 8cd5a2f) capped
`poll_directory_watch_events_backoff_max` at 1s, but CI flaky-check still
showed 1/50 failures on `Stateless tests (amd_asan_ubsan, flaky check)` at
the 120s wait timeout. Local 100/100 with `-j 8` did not reproduce the issue;
local `-j 50` with the ASan binary mirrors CI load and is enough to expose
the root cause:

  - Each `FileLog` table occupies two `BackgroundSchedulePool` tasks
    (`DirectoryWatcherBase::watchFunc` looping on inotify and
    `StorageFileLog::threadFunc` blocked on `cv.wait`).
  - With 50 concurrent test instances, the pool sees 100+ resident tasks
    competing with all other test workloads on the shared schedule pool.
  - Under that contention the wake-up path
    (`watchFunc` -> `wakeUp` -> `cv.notify_one` -> `threadFunc` resumes ->
    `streamToViews`) can take well over 120s in tail cases, even though the
    polling backoff is bounded to 1s.

`no-parallel` removes the contention entirely. Sequential execution gives a
consistent 9.7-11.5s per run with the ASan binary (50/50 local, 25/25 in a
local `--flaky-check` simulation with `--test-runs 25`).

This matches the precedent set by other `FileLog` tests that share the same
timing-sensitive streaming path: `02026_storage_filelog_largefile.sh` and
`04031_filelog_drop_mv_no_exception.sh`. The bounded backoff added in the
previous commit is preserved as defense-in-depth and the comment in
`wait_for_row_count` is updated to reflect the new rationale. No changes to
test logic or coverage of PR ClickHouse#58877's "multiple read in MV" fix.

Verified locally:
  - `--test-runs 50 -j 1` on ASan: 50/50 pass, 9.70 - 11.46s per run.
  - `--test-runs 25 --flaky-check` on ASan: 25/25 pass, 9.60 - 11.56s.

CI report on previous commit (1/50 fail @ 132.57s):
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103602&sha=8cd5a2ff591de07613831b87db0795a766e88ee8&name_0=PR&name_1=Stateless%20tests%20(amd_asan_ubsan%2C%20flaky%20check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-backports-created-cloud deprecated label, NOOP pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants