Repository navigation
Conversation
PaimonTableClient::getLatestTableSnapshotInfo() read the snapshot/LATEST hint file through createReadBuffer(), which under the default remote_fs prefetch settings builds an AsynchronousBoundedReadBuffer. That buffer caches the file size at construction (impl->getFileSize()) and asserts file_offset_of_buffer_end <= getFileSize() in nextImpl(). The LATEST hint is the only mutable object in a Paimon table: an external writer atomically rewrites it on every commit. When the file is rewritten to a longer value (e.g. snapshot id 9 -> 10) between the buffer capturing the size and the prefetch completing, the read passes the stale cached size and the chassert aborts the server. It fires on the background metadata refresh thread (runBackgroundRefresh -> update -> loadLatestState), so the surrounding try/catch does not help: chassert routes through abortOnFailedAssertion, not a C++ exception. This is the chronic test_paimon_incremental_read flake on sanitizer builds (amd_msan / amd_asan_ubsan), where the slower execution widens the race. Read the hint with readSmallObjectAndGetObjectMetadata() instead, a single atomic small-object read with no cached-size invariant. This mirrors how Iceberg reads its version-hint.text file. The other createReadBuffer() uses in PaimonClient read write-once immutable files (snapshot-N, schema-N, manifests) and are unaffected. Adds a unit test (gtest_paimon_latest_hint) that rewrites the hint concurrently while reading; it aborts on the old code and passes on the fix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-18:20260611-014800 |
|
cc @divanik @kssenii — could you review? This fixes the chronic |
|
Workflow [PR], commit [2aba6bd] Summary: ✅
AI ReviewSummaryThis PR hardens Findings
Final VerdictThe implementation looks solid apart from that intentional compatibility tradeoff. I would treat the legacy-watermark replay as a real Major that maintainers may still choose to accept, but I did not find a new inline code bug to post on the diff. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 396/449 (88.20%) · Uncovered code |
The ConcurrentHintRewriteDoesNotCrash test kept the producer as a raw std::thread joined only at end of scope. If an ASSERT_* failed and returned early, or getLatestTableSnapshotInfo threw, the still-joinable writer destructor would call std::terminate, turning a plain test failure into a process abort. That hides the crash-vs-clean distinction this regression test exists to make. Join via SCOPE_EXIT so the writer is stopped and joined on every exit path (early return, exception, normal fall-through) before its destructor runs, and drop the now-redundant end-of-scope join. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
CI finished on HEAD `81203d2dca40`. The only red is `AST fuzzer (amd_msan)` with |
CI summary, covered HEAD
|
| Check | Failure | Classification | Disposition |
|---|---|---|---|
| AST fuzzer (amd_msan) | Logical error: Trying to get name of not a column: ExpressionList (STID 2310-3993) |
Chronic trunk analyzer bug (getColumnName on a non-column, fuzzed multiIf(*, ...)) |
NOT PR-caused (5 hits / 5 distinct unrelated PRs / 30d). Unrelated to a Paimon storage readSmallObject change. Tracked under the STID 2310 "Trying to get name of not a column" family (fix PR #106647 in flight). |
No PR-caused failures. The fix (Paimon background-refresh crash on concurrent LATEST hint rewrite; gtest regression) is unaffected.
…int-concurrent-read-crash # Conflicts: # src/Storages/ObjectStorage/DataLakes/Paimon/PaimonClient.cpp
Clarify why PAIMON_MAX_HINT_FILE_SIZE is 10 MiB: the snapshot LATEST/EARLIEST hint holds a single version integer (a few bytes); the cap only bounds the single-shot read and matches Iceberg's existing version-hint cap. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…int-concurrent-read-crash
The ConcurrentHintRewriteDoesNotCrash regression only reproduces when the hint read goes through createReadBuffer's AsynchronousBoundedReadBuffer, which is selected by remote_filesystem_read_method=threadpool + remote_filesystem_read_prefetch=1. The test previously inherited those from the global defaults, so a future default change could keep it green even if getLatestTableSnapshotInfo were switched back to createReadBuffer. Set both explicitly on a copied Context before constructing PaimonTableClient so the repro stays tied to the failure mode. Co-Authored-By: Claude Opus 4.8 <[email protected]>
CI finish ledger — 6706761Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Not PR-caused: this PR touches only Paimon DataLake code; the failing test is a chronic Replicated-database recovery flake. Session id: cron:our-pr-ci-monitor:20260719-233000 |
…int-concurrent-read-crash
getTableSchemaJSON and getSnapshot read schema-0 / snapshot-N through createReadBuffer, which wraps small objects in AsynchronousBoundedReadBuffer. That buffer caches the file size at open and aborts (chassert file_offset_of_buffer_end <= getFileSize() in nextImpl) if a later read passes that size, on both the async-prefetch and distributed-cache paths. schema-0 and snapshot-N sit at fixed reused paths that a supported external DROP + re-CREATE rewrites in place: validateTableIdentity reads schema-0 on every background refresh to detect exactly that, and loadLatestState reads the snapshot just before it. A recreate that grows either object mid-read could hit the same server abort the LATEST-hint fix already removed. Add readMutableMetadataJSON() and route both reads through it. It uses object_storage->readObject(), which returns the plain per-backend read buffer and is never wrapped in AsynchronousBoundedReadBuffer, so the cached-size chassert is unreachable on every path. ETag pinning is preserved (HEAD to capture the ETag, gated on s3_validate_etag_on_read for S3, so an in-place overwrite mid-read is reported as S3_OBJECT_CHANGED_DURING_READ), and the JSON is streamed uncapped. Manifest reads keep createReadBuffer: their filenames are unique per write, so they are not reused in place across a recreate. Add ConcurrentSchemaZeroRewriteDoesNotCrash and ConcurrentSnapshotRewriteDoesNotCrash covering the concurrent-grow reads.
Internal review trail (schema-0 / snapshot-N fix) — click to expandSecond-model review adjudication for commit
Both directions verified: on an instrumented ASan build the pre-fix Session id: cron:clickhouse-maint-slot-10:20260722-060300 |
The two intentional catch (...) blocks in the schema-0 / snapshot concurrent-rewrite tests swallow the torn-read parse exception on purpose: the tests assert only that the process does not abort. Add an 'Ok' comment inside each block so check_style's catch_all rule does not flag them. Comment-only, test behavior unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The two writer-race catch blocks in gtest_paimon_latest_hint.cpp carry an 'Ok' comment (accepted by check_style) but empty bodies, which clang-tidy bugprone-empty-catch rejects (a comment is not a statement), failing Build (arm_tidy). Add // NOLINT(bugprone-empty-catch) on each catch line, the established house-style annotation for intentional empty catches, so both check_style and clang-tidy pass. The swallow is intentional: a torn read of a concurrently-rewritten schema-0/snapshot yields a normal parse exception; the test only asserts the process does not abort. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The concurrent-rewrite regression tests only aborted the pre-fix binary by winning a TOCTOU race (a writer growing the object between the async buffer's size capture and its read), which is too narrow to fire reliably. Bugfix validation builds the merge-base binary with these tests overlaid and requires at least one to fail there; the race did not, so it reported "failed to reproduce the bug". Assert the deterministic invariant behind the fix instead: a mutable-metadata read must not be wrapped in AsynchronousBoundedReadBuffer, whose file size is cached at open and whose nextImpl chassert aborts when a concurrent recreate grows the object mid-read. ProfileEvents::RemoteFSBuffers is incremented only by that buffer's constructor, so a single clean read adds one before the fix (createReadBuffer selects the async buffer for a small object under threadpool+prefetch) and none with it (readObject/readSmallObjectAndGetObjectMetadata). Read the counter through an isolated ThreadGroup, mirroring gtest_reader_executor_metric.cpp.
The hint is trusted only when snapshot-N is present and snapshot-N+1 is absent, but both halves used IObjectStorage::exists, which answers two states. HDFSObjectStorage::exists is 0 == wrapErr(hdfsExists, ...) and wrapErr inspects errno only to retry a krb5 kinit, so any libhdfs failure (NameNode down, auth, network) collapses to false. For the second probe that reads as "no next snapshot", the stale hint is accepted, and the read serves an older snapshot while newer data exists. Only the second probe is affected: a fail-open false from the first one makes the fast path fall through, which is already safe. tryGetObjectMetadata answers three states: an empty optional only for a definite absence, a throw when the backend could not tell. On HDFS its absence path goes through hdfsGetPathInfo, which does map FileNotFoundException to ENOENT, so the distinction is available there and not in hdfsExists. This is the same primitive the incremental-read probe in PaimonMetadata already uses. An unanswerable probe falls through to the snapshot listing rather than propagating. The listing is authoritative and fails closed on its own errors (HDFSObjectStorage::listObjects throws on anything but ENOENT), and it is the fallback this function already uses when the hint read fails. Propagating instead would turn a probe failure that is harmless today into a failed query. The line predates this pull request and is present on master, but the enclosing function is the one being made robust here, so the sibling probe is fixed with it. The regression test fails only the probe for snapshot-N+1, leaving the hinted snapshot answerable, because that is the single interleaving the two implementations disagree on. Failing every probe makes the first one report the hinted snapshot as absent, which falls through to the listing either way and proves nothing. Reverting to exists() makes it read snapshot 1 instead of 2; letting the throw escape instead of falling through makes it fail differently.
…int-concurrent-read-crash # Conflicts: # src/Storages/ObjectStorage/DataLakes/Paimon/PaimonClient.cpp
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 365/414 (88.16%) · Uncovered code |
CI finish ledger for eb276e6Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link will be posted here when it opens.
174 of 174 check-runs completed, The discriminator for the inconclusive-compile class holds here: every Session id: cron:our-pr-ci-monitor:20260802-010000 |
…int-concurrent-read-crash
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes19 object files changed (+51.91 KiB total), 0 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units78 translation units recompiled, 332 s compile time in total, 38 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.94 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
CI finish ledger - 910881aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
175/175 check-runs completed, 156 success, 18 skipped; Session id: cron:our-pr-ci-monitor:20260803-163000 |
|
Closing the loop on the There will be no harness PR, and the line is better resolved on this PR's own test file. Recording why. The job did not fail a test. It declined to produce a verdict: the overlaid That outcome is deliberate, not a status-encoding oversight. The supported remedy is on the test side, keeping the runtime assertion intact, and it is what maintainers already do here: For this PR that means two accessors need a compile-time-guarded call in the gtest; the assertions themselves do not change. I am not opening a PR against someone else's job to avoid that. |
…int-concurrent-read-crash
… sources The `Bugfix validation (unit tests)` job overlays this PR's changed `src/**/tests/*` files onto the merge-base sources and builds the before-binary from them, so the touched suite can demonstrate at runtime that it catches the bug; the job is inconclusive when that build does not compile. `gtest_paimon_mutable_metadata.cpp` referenced the three `PaimonMetadata` accessors this PR adds (`isSnapshotLoadFailureSkippable`, `readSchemaZeroTimeMillis`, `isCommittedWatermarkFromSameTable`) unconditionally, so the before-binary could not be built. Route those calls through presence-dispatched template helpers, so the test builds against both sources and demonstrates the bug at runtime on the before-binary instead of breaking its build. Each fallback reproduces the merge-base behaviour that the accessor replaces - a failed snapshot load was always skipped, no table-identity probe existed, and a committed watermark was always trusted - so the assertions that pin the fix still fail there. No assertion is removed or weakened. Verified with `-fsyntax-only` against both this branch and current master sources; 11/11 Paimon gtests pass. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Applied the test-side remedy from the comment above in Each fallback reproduces the merge-base behaviour the accessor replaces — a failed snapshot load was always skipped, no table-identity probe existed, and a committed watermark was always trusted — so the assertions that pin the fix still fail on the before-binary; no assertion is removed or weakened. Verified the TU with |
…int-concurrent-read-crash
The AI review asked for an integration test that exercises the real `iterate` -> `setCommittedSnapshot` -> `getCommittedSnapshotId` flow against Keeper instead of only the helper-level gtests: keep a fixed `paimon_keeper_path`, advance the watermark, externally drop and recreate the Paimon table at the same location, and prove the next incremental read consumes the recreated table instead of inheriting the old generation's watermark and returning no rows. ClickHouse#107134
|
🕵 Addressed the AI review Major on
The test passed locally against a real Keeper and the dockerized Paimon writer, and 11/11 Paimon gtests still pass after the master merge. For the record, the only reds on |
The helper's keeper_path is a str.format() substituted VALUE, not template
text, and str.format never re-scans substituted values for braces. Doubling
the braces in the value therefore emits the literal string
'/clickhouse/tables/{{uuid}}' into the DDL, and the server's macro expander
(Macros::expand, reached from expandPaimonKeeperMacrosIfNeeded) reads the
macro name as '{uuid' and rejects it with NO_ELEMENTS_IN_CONFIG.
Only the template needs doubled braces, which is why the sibling literal
'{{replica}}' on the line above is correct and must stay as it is.
The two callers that rely on the default keeper_path failed on the previous
head of this branch:
test_paimon_incremental_read_via_paimon_table_engine
test_paimon_to_mergetree_via_refresh_mv
test_paimon_discards_watermark_after_external_recreate passes an explicit
brace-free path, so it was unaffected and stays unaffected.
Verified by rendering the helper's own template, extracted from the file's
AST rather than retyped, for every keeper_path value the file actually
passes. The rendered SETTINGS clause is now byte-identical to the one
produced by ac4e82a, the last head on which CIDB records this test
passing (4 OK), while the current head renders the doubled form that CIDB
records failing. Reverting the change reinstates the doubled form, so the
probe discriminates.
Test-only change; no build is affected.
|
Pushed In Affected exactly the two callers that rely on the default argument:
I verified it by rendering the helper's own template, taken from each revision's AST rather than retyped, for every Test-only change, one line, no build impact. I did not squash or rebase, and left your commits untouched. |
CI finish ledger - 1ac6354No failure to own on this head: all 175 check-runs completed with 127 The CIDB records four Session id: cron:our-pr-ci-monitor:20260807-083000 |
… contract The AI review on 1ac6354 pointed out that while the PR body and changelog now mention the bounded one-time replay that happens when a committed watermark carries no table-generation marker (state written before generation tracking, or inherited from a table recreated at the same `paimon_keeper_path`), the structured setting description and the public engine documentation still promised strict "only new data since the last committed snapshot" semantics. Bring the public contract in line with the intended behaviour: - the `paimon_incremental_read` setting description now states that the watermark is bound to the table generation and that a watermark of unknown generation is discarded, causing a bounded one-time replay before the marker is latched (fail-close, never silent skipping); - the embedded engine documentation in `registerStorageObjectStorage.cpp` (the source of the autogenerated Paimon docs page) gains a Limitations bullet describing the same behaviour, including the upgrade case; - the `PaimonStreamState` at-most-once note and the `PaimonMetadata` `iterate` comment reference the exception explicitly. ClickHouse#107134 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
CI finish ledger - 4dd825bEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
Both failures are owned and neither is caused by this PR.
Conclusion histogram over all 175 check-runs on this head: 159 Session id: cron:our-pr-ci-monitor:20260807-213000 |
…out aborting The identity guard in `validateTableIdentity` threw `LOGICAL_ERROR`, which aborts the server in debug and sanitizer builds (`Exception::handleErrorCode`), so the fail-close path for an external `DROP` + re-`CREATE` was itself a crash there; it now throws `INCORRECT_DATA` (the same code `PlainRewritable` uses for a concurrently recreated directory). Per review, the `paimon_target_snapshot_id` recreate guard is now covered end-to-end: a new pauseable failpoint `paimon_iterate_pause_before_target_snapshot_load` holds a targeted read between the identity check at the top of `iterate` and `loadStateForSnapshot`, and `test_paimon_targeted_read_fails_closed_on_external_recreate` lands an external recreate inside that window and asserts the read fails closed instead of serving the recreated table's snapshot-1 under the old ClickHouse table.
…int-concurrent-read-crash
|
🕵 CI finish ledger — 4dd825b Every red on that head is classified below; the head pushed after it (
|
CI finish ledger - d863ae0Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose All 175 check-runs on this head completed: 161
The two failures owned on the previous head are both discharged rather than carried forward: Session id: cron:our-pr-ci-monitor:20260808-160000 |
The declaration comment in `PaimonMetadata.h` still said an absent `committed_table_identity` means the watermark is used, which is the pre-fix behavior. The implementation discards such a watermark once (fail-close) and reads the current table from its first snapshot; the comment now distinguishes the two cases correctly. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Fixing PR for the Completing my own ledger obligation from #107134 (comment): the readiness-probe mode is caused by #113409 remains deliberately unlinked: it raises |
CI finish ledger - 2aba6bdEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task CI is fully finished on this commit with no failed checks - every dispatched job Session id: cron:our-pr-ci-monitor:20260809-170000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a server crash (failed assertion
file_offset_of_buffer_end <= getFileSize()) when reading a Paimon table whosesnapshot/LATESThint file is concurrently rewritten by a Paimon writer. The background metadata refresh now reads the hint atomically. For a Paimon table using incremental read whose Keeper state was written before this change, the first read after upgrading re-emits the current snapshot once, after which the state is marked and reads are incremental again.Description
PaimonTableClient::getLatestTableSnapshotInfo()read thesnapshot/LATESThint file throughcreateReadBuffer(), which under the default remote-filesystem prefetch settings builds anAsynchronousBoundedReadBuffer. That buffer caches the file size at construction and assertsfile_offset_of_buffer_end <= getFileSize()innextImpl().LATESTis the only mutable object in a Paimon table: an external writer atomically rewrites it on every commit. When the file is rewritten to a longer value (e.g. snapshot id9->10) between the buffer capturing the size and the prefetch completing, the read passes the stale cached size and the assertion aborts the server. It fires on the background metadata refresh thread (runBackgroundRefresh->update->loadLatestState), so the surrounding try/catch does not catch it (chassertroutes throughabortOnFailedAssertion, not a C++ exception).This is the chronic
test_paimon_incremental_readflake on sanitizer builds (amd_msan/amd_asan_ubsan), where slower execution widens the race window.Fix: read the hint with
readSmallObjectAndGetObjectMetadata()(a single atomic small-object read with no cached-size invariant), mirroring how Iceberg reads itsversion-hint.text. The othercreateReadBuffer()uses inPaimonClientread write-once immutable files (snapshot-N, schema-N, manifests) and are unaffected.Added
gtest_paimon_latest_hintwhich rewrites the hint concurrently while reading: it aborts on the old code and passes on the fix.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.Follow-up commits extended the same treatment to the other metadata objects that are mutable in place across a supported external
DROP+ re-CREATEat a reused path (schema-0,snapshot-N): they are read viareadMutableMetadataJSON(plainreadObject, ETag-pinned on S3 unders3_validate_etag_on_read), so a concurrent rewrite surfaces as a normal exception instead of an abort or torn bytes. Per review, theLATESThint read is ETag-pinned the same way (makeEtagPinnedStoredObject), so a rewrite between retried S3 requests throwsS3_OBJECT_CHANGED_DURING_READand falls back to snapshot listing instead of splicing two hint generations. Per review, incremental read then fails closed on those exceptions:getSnapshotsBetweenprobes the snapshot object's existence after a failed load and rethrows if the file still exists, so the Keeper watermark only advances past snapshots genuinely removed by Paimon compaction (PaimonMetadata::isSnapshotLoadFailureSkippable, covered byPaimonIncrementalRead.SkipsOnlyGenuinelyMissingSnapshots). Per review, the watermark commit itself is also identity-guarded: an external recreate that starts after the initial identity check can delete oldsnapshot-Nfiles mid-scan (indistinguishable from compaction gaps for the existence probe), soiteratere-runsvalidateTableIdentityaftercollectIncrementalDataFilesand beforesetCommittedSnapshot— a recreate rewritesschema-0(itstimeMillischanges), the re-validation throws, and the old table's progress is never persisted under the reusedkeeper_path.Per review, the query-level targeted read (
paimon_target_snapshot_id) closes the same window:snapshot-Nlives at a path a recreate reuses and snapshot numbering restarts from 1 in the new table, soiteratere-validates the table identity right afterloadStateForSnapshot(target_snapshot_id)and beforecollectDeltaFilesForSnapshotconsumes it, instead of serving the recreated table's files under the old ClickHouse table (PaimonIncrementalRead.DetectsRecreateOnReusedTargetSnapshotPath).Per review, the committed incremental-read watermark is finally tied to the table generation rather than being a bare snapshot id. An external
DROPis not atomic, so it can remove oldsnapshot-Nfiles whileschema/schema-0is still the old one; at the point the watermark is committed that is indistinguishable from a Paimon compaction gap (the existence probe sees a missing file, the pre-commitvalidateTableIdentitysees the unchanged oldtimeMillis), so the skip path cannot be tightened there. InsteadPaimonStreamState::setCommittedSnapshotrecords the generation (schema-0timeMillis) in acommitted_table_identitynode in the same Keeper transaction ascommitted_snapshot, andPaimonMetadata::getCommittedSnapshotIddiscards a watermark whose recorded generation no longer matches (PaimonMetadata::isCommittedWatermarkFromSameTable), so a re-CREATEat the same path reusing the samekeeper_pathreads the new table from its first snapshot instead of skipping its first snapshots. A watermark written before generation tracking carries no marker and keeps the previous behaviour, recording the marker on its next commit. Covered byPaimonIncrementalRead.DiscardsWatermarkFromAnEarlierTableGeneration, which deletessnapshot-Nbefore changingschema-0and then walks the recreate.Per review, the generation pin is no longer S3-only.
readMutableMetadataJSONandreadSmallObjectAndGetObjectMetadataare shared by Azure-backed tables, andAzureObjectStorage::readObjectbuiltReadBufferFromAzureBlobStoragewith no expected ETag, so a rewrite ofLATEST,schema-0orsnapshot-Nbetween retried downloads could still splice two generations into one logical read instead of throwing — the fail-closed logic above would then accept mixed metadata on Azure while S3 correctly reportedS3_OBJECT_CHANGED_DURING_READ.ReadBufferFromAzureBlobStoragenow takes an expected ETag and, when it is set, pins everyDownload(initial download, in-buffer retries, andreadBigAt) to that generation withIf-Match, maps the resulting412 Precondition FailedtoS3_OBJECT_CHANGED_DURING_READ, validates the ETag reported by the download response (covering endpoints that ignore the condition header), and never retries a detected generation change.AzureObjectStorage::readObjectpassesStoredObject::etagthrough, andmakeEtagPinnedStoredObjectfetches the ETag for Azure as well. Covered by04655_azure_read_etag_validation, which mirrors the S3 test through a newazure_read_inject_etag_mismatchfailpoint.Per review, the Azure generation pin also applies on the cluster path.
StorageObjectStorageCluster::getTaskIteratorExtensionbuilds its iterator withskip_object_metadata=true, so a cluster worker receives anObjectInfowhosemetadatais a placeholder with an emptyetag; the placeholder refresh inStorageObjectStorageSource::createReaderwas gated onObjectStorageType::S3, so onazureBlobStorageClusterthe ETag stayed empty andReadBufferFromAzureBlobStoragesilently skipped the newIf-Matchand response-ETag checks even withs3_validate_etag_on_read=1. The refresh now coversObjectStorageType::Azuretoo, so the cluster path validates the generation exactly like the non-cluster path. A real metadata fetch that merely lacks an ETag still hasis_fetched=trueand is left alone, so no additionalGetPropertiesrequest is issued for it.Per review, an incremental-read watermark that carries no generation marker is no longer taken at face value. Such a watermark was written before generation tracking existed, so the generation it belongs to is unknown: it may be this table's own progress, or progress inherited from a table externally dropped and re-
CREATEd at the same path. It used to be trusted on the assumption that the marker would be recorded on the next commit, but thecommitted_snapshot_id >= state->snapshot_idbranch ofcollectIncrementalDataFilesreturns beforesetCommittedSnapshot, so an inherited watermark ahead of the recreated table's latest snapshot never got a marker and the table stayed silently skipped until it passed that watermark.PaimonMetadata::isCommittedWatermarkFromSameTablenow discards an unmarked watermark: trusting it is the only direction that can skip data, discarding it re-reads (fail-close), and it forces the initial-read branch, which always commits a watermark together with the marker — so this happens at most once per table, whether or not that first batch had new snapshots to read.Note on overlap: the minimal
LATEST-hint fix landed on master meanwhile as #112010, so the master merge here resolves the two resulting conflicts in favour of what is already merged.getLatestTableSnapshotInfokeeps master'sreadSmallObjectAndGetObjectMetadatacall, its 64-byte cap and its buffer-size floors, with only the ETag pin carried over from this branch;gtest_paimon_latest_hint.cppis taken from master verbatim, and this branch's tests for the other mutable metadata objects (schema-0,snapshot-N) and for the incremental-read guards moved to a newgtest_paimon_mutable_metadata.cpp(the two hint tests master's file now duplicates were dropped). What remains unique to this PR is the mutable-metadata / ETag-pinning and incremental-read-watermark scope described above.Related: #112010
The
CH Inc syncreport for the previous head exposed a real defect in the Azure pin, now fixed: Azure reports the same ETag in two spellings —ListBlobsreads it from the XML body of the response, while every single-blob request (GetProperties,Download) reads it from the HTTP header, where RFC 7232 requires the opaque tag to be quoted. AStoredObjectwhose ETag came from a listing therefore carries the unquoted form whileDownloadreturns the quoted one, so comparing the raw strings made every read of a listed Azure blob look like a concurrent rewrite (andIf-Matchwas sent with an unquoted, invalid opaque tag). That failed the Azure glob,AzureQueueand Azure-disk tests and04655_azure_read_etag_validationin the private report. Both the comparison and theIf-Matchheader now use the opaque tag only: the weak-validator prefix and the surrounding quotes are stripped before comparing, and the header is always sent quoted. Azurite is not reachable from the development environment, so this is verified by CI rather than locally.Per review, the Azure ETag test now also covers the cluster path: two
azureBlobStorageClustercases mirror thes3Clusterhalf of04339_s3_read_etag_validation— a plain one and one withcluster_table_function_split_granularity = 'bucket'— both with an explicit structure so schema inference cannot read the blob on the coordinator first, soS3_OBJECT_CHANGED_DURING_READcan only appear if the worker refreshes theskip_object_metadataplaceholder's emptyStoredObject::etagbefore reading.Per review, the watermark-generation fix is now also proven end-to-end through the real Keeper-backed
iterate→setCommittedSnapshot→getCommittedSnapshotIdflow rather than only through helper-level gtests.test_paimon_incremental_read/test.py::test_paimon_discards_watermark_after_external_recreatekeeps a fixedpaimon_keeper_path(deliberately not{uuid}-based, so it survives aDROPof the ClickHouse table), advances the committed watermark on the first table generation, externally drops and recreates the Paimon table at the same location, re-creates the ClickHouse table at the same keeper path, and proves the first incremental read returns the recreated table's rows instead of inheriting the old generation's watermark and returning no rows forever; a second read then returns nothing, showing the discarded watermark was re-latched to the new generation. Verified locally against a real Keeper and the dockerized Paimon writer.Per review, the
paimon_target_snapshot_idrecreate guard is now proven end-to-end rather than only through its prerequisite invariant. A new pauseable failpointpaimon_iterate_pause_before_target_snapshot_loadholds a targeted read in the exact window the guard closes — between the identity check at the top ofiterateandloadStateForSnapshot— andtest_paimon_incremental_read/test.py::test_paimon_targeted_read_fails_closed_on_external_recreatelands an externalDROP+ re-CREATEinside it, then asserts the resumed read fails closed with the "was recreated" error instead of serving the recreated table'ssnapshot-1under the old ClickHouse table; if the re-validation after the load were removed, the read would return the new generation's rows and the test would fail. Making that observable exposed thatvalidateTableIdentitythrewLOGICAL_ERROR, which aborts the server in debug and sanitizer builds (Exception::handleErrorCode) — the fail-close guard for an external recreate was itself a crash there; it now throwsINCORRECT_DATA(the codePlainRewritableuses for a concurrently recreated directory). Verified locally against the real dockerized Paimon writer.