Skip to content

Fix Paimon background refresh crash on concurrent LATEST hint rewrite - #112010

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
JiaQiTang98:fix-paimon-latest-hint-read
Jul 28, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
JiaQiTang98:fix-paimon-latest-hint-read

Conversation

@JiaQiTang98

@JiaQiTang98 JiaQiTang98 commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Critical Bug Fix (crash, data loss, RBAC)

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

Fixed Paimon table reads that could fail while the mutable snapshot/LATEST hint was being replaced concurrently. Invalid or stale hints now safely fall back to snapshot listing.

Crash provenance: CIDB STID family from Integration tests (amd_msan, 1/6), e.g. report https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106177&sha=39b1915c82cf7e393efb4247e1c8f4f97b5b8e72&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%201%2F6%29 — stack: AsynchronousBoundedReadBuffer::nextImpl -> readStringUntilEOF -> PaimonClient.cpp:178 getLatestTableSnapshotInfo.

Related: #107134

Version info

  • Backported to: 26.7.2.41, 26.6.2.133, 26.5.6.89, 26.3.17.90

@clickhouse-gh

clickhouse-gh Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7490f9a]

Summary: ✅


AI Review

Summary

This PR switches Paimon snapshot/LATEST reads from the generic buffered metadata path to the small-object API, validates the hint strictly, and falls back to snapshot listing when the hint is invalid or stale. I did not find a remaining line-level correctness issue in the current code or an outstanding prior thread, but the PR metadata is mislabeled for an experimental-engine exception fix.

PR Metadata
  • The selected Changelog category is not a match: Critical Bug Fix is reserved for crash, data loss, or RBAC issues, while Paimon is still behind allow_experimental_paimon_storage_engine and this change fixes a read-failure / exception path rather than a server crash. Replace it with:
    - Improvement
  • The Changelog entry is directionally correct but should follow the present-tense, user-facing style from the guidelines. Suggested replacement:
    Fixes Paimon table reads that can fail while the mutable \snapshot/LATEST` hint is replaced concurrently. Invalid or stale hints now fall back safely to snapshot listing.`
Final Verdict
  • Status: ✅ Approve
  • Follow-up: Update the PR changelog metadata above so the changelog matches the actual scope of this experimental-engine fix.

@clickhouse-gh clickhouse-gh Bot added pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! labels Jul 27, 2026
@JiaQiTang98 JiaQiTang98 added the can be tested Allows running workflows for external contributors label Jul 27, 2026
The override inherits its default argument from the base declaration. Remove the duplicate default to satisfy google-default-arguments.

CI: ClickHouse#112010
@JiaQiTang98 JiaQiTang98 changed the title fix paimon hint read Fix paimon hint read Jul 27, 2026
@JiaQiTang98 JiaQiTang98 changed the title Fix paimon hint read Fix Paimon background refresh crash on concurrent LATEST hint rewrite Jul 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.30% 86.20% -0.10%
Functions 92.00% 92.00% +0.00%
Branches 78.40% 78.40% +0.00%

Changed lines: Changed C/C++ lines covered: 108/114 (94.74%) · Uncovered code

Full report · Diff report

@alexey-milovidov alexey-milovidov self-assigned this Jul 28, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 28, 2026
Merged via the queue into ClickHouse:master with commit 059a51c Jul 28, 2026
178 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Jul 28, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 28, 2026
thevar1able added a commit that referenced this pull request Jul 29, 2026
…nt check

The site came in with the master merge, in the latest-hint verification
added by #112010. The parentheses around `PAIMON_SNAPSHOT_PREFIX + ...`
are load-bearing; only the ones around the bare `PAIMON_SNAPSHOT_DIR`
are redundant.

Build log: https://s3.amazonaws.com/clickhouse-test-reports/PRs/108400/5e9528af4066244f8e892f8ce3e78a2741cd41dc/build_arm_tidy/build_clickhouse/build_clickhouse.log
Related: #112010

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
alexey-milovidov added a commit that referenced this pull request Jul 30, 2026
Resolve the cherry-pick of #112010 ("Fix Paimon background refresh crash
on concurrent LATEST hint rewrite") against the `26.3` code base.

`26.3` predates several refactorings of `PaimonTableClient`, so the fix is
re-applied on top of the older API surface instead of being taken verbatim:

* `getPaimonMetadataReadSettings` does not exist in `26.3`; the read
  settings are derived from `getContext()->getReadSettings()` and the
  filesystem cache is disabled explicitly, because `snapshot/LATEST` is
  mutable and rewritten in place by writers.
* `ReadSettings` is still flat in `26.3`, so `local_fs_buffer_size` and
  `remote_fs_buffer_size` are used instead of
  `local_fs_settings.buffer_size` / `remote_fs_settings.buffer_size`.
* `PAIMON_SNAPSHOT_PRIFIX` and `getLastestTableSnapshotInfo` keep their
  `26.3` spelling (the typos were fixed later on `master`).

The behavioral part of the fix is preserved: the hint file is read with a
single bounded `readSmallObjectAndGetObjectMetadata` request instead of
`readStringUntilEOF` over an asynchronous buffer, the parsed version must
consume the whole content and be a positive `Int64`, the snapshot file
referenced by the hint must exist, and any failure falls back to snapshot
listing instead of propagating.

The new `gtest_paimon_latest_hint.cpp` is adapted to the same `26.3` names.
robot-ch-test-poll2 added a commit that referenced this pull request Jul 30, 2026
Cherry pick #112010 to 26.3: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
robot-clickhouse added a commit that referenced this pull request Jul 30, 2026
robot-ch-test-poll2 added a commit that referenced this pull request Jul 30, 2026
Cherry pick #112010 to 26.5: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
robot-clickhouse added a commit that referenced this pull request Jul 30, 2026
robot-ch-test-poll2 added a commit that referenced this pull request Jul 30, 2026
Cherry pick #112010 to 26.6: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
robot-clickhouse added a commit that referenced this pull request Jul 30, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jul 30, 2026
alexey-milovidov added a commit to groeneai/ClickHouse that referenced this pull request Jul 30, 2026
…int-concurrent-read-crash

The minimal LATEST-hint fix landed on master meanwhile (ClickHouse#112010), so the two
conflicts are resolved in favour of what is already merged, keeping only this
branch's additional scope on top:

* `getLatestTableSnapshotInfo` keeps master's `readSmallObjectAndGetObjectMetadata`
  call, its 64-byte cap and its buffer-size floors; the only thing carried over
  from this branch is the ETag pin (`makeEtagPinnedStoredObject`), which the
  merged version does not have.
* `gtest_paimon_latest_hint.cpp` is taken from master verbatim - it now covers
  the hint read and the invalid-hint fallback.  This branch's tests for the
  other mutable metadata objects (`schema-0`, `snapshot-N`) and for the
  incremental-read guards moved to a new `gtest_paimon_mutable_metadata.cpp`,
  since the two files declare different helpers under the same names.  The two
  hint tests that master's file now duplicates were dropped.
clickhouse-gh Bot pushed a commit that referenced this pull request Jul 30, 2026
clickhouse-gh Bot added a commit that referenced this pull request Jul 30, 2026
Backport #112010 to 26.7: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
alexey-milovidov added a commit that referenced this pull request Jul 30, 2026
Backport #112010 to 26.3: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
alexey-milovidov added a commit that referenced this pull request Jul 30, 2026
Backport #112010 to 26.5: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
clickhouse-gh Bot added a commit that referenced this pull request Jul 31, 2026
Backport #112010 to 26.6: Fix Paimon background refresh crash on concurrent LATEST hint rewrite
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 pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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