Repository navigation
Re-add paimon storage engine - #102343
Merged
hanfei1991 merged 40 commits intoMay 8, 2026
Merged
Re-add paimon storage engine#102343
Conversation
This reverts commit f724fa1.
Contributor
|
Workflow [PR], commit [840828f] Summary: ✅ AI ReviewSummaryThis PR re-introduces ClickHouse Rules
Final Verdict
|
Contributor
Author
|
@hanfei1991 @JiaQiTang98 Please have a look. |
Contributor
Author
|
@hanfei1991 When can this PR be merged, please have a look. |
Contributor
LLVM Coverage Report
Changed lines: 59.22% (565/954) | lost baseline coverage: 6 line(s) · Uncovered code |
hanfei1991
approved these changes
May 8, 2026
This was referenced May 10, 2026
1 task done
pull Bot
pushed a commit
to AnotherGenZ/ClickHouse
that referenced
this pull request
Jun 6, 2026
…-4165) A `BackgroundJobsAssignee` task on a pool thread can race with `~StorageMergeTree` / `~StorageReplicatedMergeTree` and dispatch `data.scheduleDataProcessingJob(*this)` through a vtable that has already demoted to `MergeTreeData`. `scheduleDataProcessingJob` is pure virtual at the `MergeTreeData` level (only the leaf storages override it), so the dispatch lands on `__cxa_pure_virtual` and aborts the server. This is reachable in practice when `shutdown` throws partway through the cleanup. `StorageReplicatedMergeTree::~StorageReplicatedMergeTree` wraps the `shutdown` call in a try/catch and swallows the exception, so member destruction proceeds with the background scheduler still alive. `~BackgroundJobsAssignee::finish()` then calls `deactivate()`, which blocks on `exec_mutex` waiting for the in-flight `threadFunc` to finish — but `threadFunc`'s next call is the pure-virtual dispatch above. The fix is a defensive `false`-returning override of `scheduleDataProcessingJob` on `MergeTreeData`. In normal operation, the derived overrides win the virtual dispatch and this default is dead code. During the destruction race, the default takes the dispatch: `threadFunc` reads `false` as "no work scheduled" and falls through to `postpone()`, which is a no-op once `finish()` has moved the holder out. The pool thread completes `execute()` normally, the destructor's `deactivate()` returns, and destruction proceeds safely. Affected runs (all identical stack traces, all unrelated PRs): - PR ClickHouse#102343 (Paimon) — Stress test (arm_asan_ubsan) - PR ClickHouse#101027 (obfuscateQuery revert) — Stress test (arm_asan_ubsan, s3) - PR ClickHouse#100272 (h3 → h3o) — Stress test (arm_asan_ubsan, s3) - PR ClickHouse#104472 (count_distinct_optimization) — Stress test (arm_debug) CI report (latest): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104472&sha=ad31d65c8cb512098dc41a848bfa9e42650e123e&name_0=PR&name_1=Stress%20test%20%28arm_debug%29 Co-Authored-By: Claude Opus 4.7 <[email protected]>
This was referenced Aug 4, 2026
Open
pull Bot
pushed a commit
to Mu-L/ClickHouse
that referenced
this pull request
Aug 16, 2026
The Keeper watermark advances at file-collection time, before the collected batch is delivered (documented at-most-once semantics of Paimon incremental reads). The pauseable failpoint paimon_incremental_read_pause_after_watermark_commit sits exactly between the watermark commit and delivery, so integration tests can pin that a crash inside the window loses the batch - and will flip if delivery ever becomes at-least-once. Inert unless enabled via SYSTEM ENABLE FAILPOINT. Related: ClickHouse#102343 Co-Authored-By: Claude Fable 5 <[email protected]>
w62
pushed a commit
to w62/ClickHouse
that referenced
this pull request
Nov 1, 2026
…snapshot's schema A Paimon schema change (`ALTER TABLE ... ADD COLUMNS`, `RENAME COLUMN`, `DROP COLUMN`) writes a new `schema/schema-N` file but no snapshot. `PaimonMetadata::loadLatestState` built the latest table state with `snapshot.schema_id`, i.e. the schema the last commit was written with, so until the next commit `DESCRIBE` showed the old columns, `SELECT` of an added column failed with `UNKNOWN_IDENTIFIER`, and a renamed or dropped column kept its old name. `PaimonTableState::operator==` compares `schema_id`, but the id never changed, so `update()` did not republish the state either. In Paimon a read of the latest state uses the latest schema file: `FileStoreTableFactory.create` takes `SchemaManager.latest()`, which lists `schema/` and picks the highest `schema-N`; a snapshot's `schemaId` is only the schema its files were written with. Spark, Flink and pypaimon return the added column as NULL for existing rows. `loadLatestState` now lists the schema directory after reading the snapshot (`PaimonTableClient::getLatestTableSchemaInfo`, already used by `create`) and builds the state with that id. Every consumer of the latest state keys off `state->schema_id` (table structure, per-query columns, cluster workers, partition pruner, options, manifest parsing), so they all follow. Manifest parsing uses the schema only for partition types, and Paimon refuses to rename, retype or drop partition keys, so parsing with the latest schema is safe; the manifest cache key includes the schema id. States loaded for a specific snapshot id (incremental read, `paimon_target_snapshot_id`) keep the snapshot's own schema. This is a regression: v26.3 re-read the latest schema file on every update; ClickHouse#102343 ("Re-add paimon storage engine") switched to the snapshot's schema id (first stable release v26.5). Mapping data files written before a RENAME/DROP by field id is out of scope (ClickHouse#127816). Closes ClickHouse#128308 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add
Paimon,PaimonS3,PaimonAzure,PaimonHDFS, andPaimonLocaltable engines with incremental read support backed by Keeper snapshot progress tracking. Incremental mode returns only new rows since the last committed snapshot. Targeted snapshot delta reads are available viapaimon_target_snapshot_id, and per-query snapshot caps viamax_consume_snapshots. Background metadata refresh is configurable withpaimon_metadata_refresh_interval_sec. Gated byallow_experimental_paimon_storage_engine.Documentation entry for user-facing changes
Motivation:
Paimontables can now be consumed incrementally in ClickHouse with persisted snapshot progress in Keeper, enabling streaming-like snapshot delta consumption semantics. Previously Paimon was only accessible via table functions; now dedicated table engines allow persistent table definitions with Paimon-specific settings.Parameters:
Table-level settings (specified in
SETTINGSclause ofCREATE TABLE):paimon_incremental_read(Bool, defaultfalse): Enable incremental read mode. When enabled, the table tracks the last committed snapshot in Keeper and each read returns only rows added since then.paimon_keeper_path(String): Keeper path for incremental read state. Must be unique per table. Supports macros{database},{table},{uuid}.paimon_replica_name(String): Replica identity for incremental read state. Must be unique per replica. Supports macros{replica}.paimon_metadata_refresh_interval_sec(Int64, default30): Background metadata refresh interval in seconds. When greater than 0, a background task periodically pulls the latest snapshot from object storage.Query-level settings:
paimon_target_snapshot_id(Int64, default-1): Read a specific snapshot delta without advancing committed incremental state. When > 0, overrides the normal incremental read flow.max_consume_snapshots(UInt64, default0): Maximum number of snapshots to consume per incremental read. 0 means no limit.use_paimon_partition_pruning(Bool, defaultfalse): Enable Paimon partition pruning.allow_experimental_paimon_storage_engine(Bool, defaultfalse): Gate for creatingPaimon*table engines.Example use: