[Feature] Atomic schema evolution for chain tables
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- java
- Ambito
- data-engineering, databases
Direzione di ricerca
Inizia leggendo AbstractCatalog.alterTable e alterTableImpl, quindi segui SchemaManager.commit e FileStoreTableFactory.createChainTable. Esamina FallbackReadFileStoreTable.validateSchema e ChainGroupReadTable.newScan per comprendere i controlli di coerenza. Il lavoro è completo quando l’evoluzione dello schema del gruppo di catene è coordinata tramite lo schema principale canonico, preservando al contempo la risoluzione locale dei rami legacy.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Search before asking
- I searched in the issues and found nothing similar.
Motivation
Background
Chain tables use three branches — main, snapshot, and delta — each maintaining its own independent schema log (schema/schema-N). The current documentation requires users to keep schemas consistent across all three branches manually (e.g. when setting up fallback branches or partition expiration options).
Today, a single logical ALTER TABLE on the base table only commits schema to one branch. There is no catalog-level coordination to update main, snapshot, and delta atomically.
Problem
Because each branch commits schema independently via SchemaManager.commit() → FileIO.tryToWriteAtomic, partial failures can leave the chain group in an inconsistent state:
-
Immediate read failure:
FallbackReadFileStoreTable.validateSchema()/ChainGroupReadTable.newScan()checks row type and primary key consistency across branches. If e.g.ADD COLUMNsucceeds onmainbut fails onsnapshot/delta, the entire chain table becomes unreadable at scan planning time. -
Operational burden: Users must remember to run the same DDL three times (main + snapshot + delta), which is error-prone and not enforced by the catalog.
Example failure after partial ADD COLUMN:
main latest: schema-11, fields = [a, b, c]
snapshot latest: schema-10, fields = [a, b]
delta latest: schema-10, fields = [a, b]
→ chain reader fails with "does not have the same row type" before any data file is read.
Current behavior (as of master)
AbstractCatalog.alterTabledelegates toalterTableImplfor a single identifier; no chain-table-aware multi-branch sync.FileStoreTableFactory.createChainTableloads snapshot/delta schemas from their respective branch-localSchemaManager.- Docs explicitly state: "Chain table should ensure that the schema of each branch is consistent."
- No rollback if multi-branch DDL is attempted manually and fails midway.
Solution
- Main branch schema log becomes the single canonical source for shared fields / field IDs / PK / partition keys.
- One atomic write to
main/schema/schema-Npublishes the schema for the entire chain group. - Branch-specific options (e.g. different
bucketper branch) are stored in the canonical main schema and materialized per branch at read/write time. - Legacy schemas before a cutover point continue to be resolved from branch-local schema files for backward compatibility.
Example: canonical main schema with per-branch options
Shared columns / PK / partition keys live in the top-level TableSchema. Per-branch effective options are stored as JSON strings in options (exact key names TBD):
{
"id": 25,
"fields": [
{"id": 0, "name": "id", "type": "BIGINT NOT NULL"},
{"id": 1, "name": "dt", "type": "STRING NOT NULL"}
],
"partitionKeys": ["dt"],
"primaryKeys": ["id", "dt"],
"options": {
"chain-table.enabled": "true",
"scan.fallback-snapshot-branch": "snapshot",
"scan.fallback-delta-branch": "delta",
"bucket": "64",
"bucket-key": "id",
"chain-table.member-options.snapshot": "{\"bucket\":\"32\",\"bucket-key\":\"id\"}",
"chain-table.member-options.delta": "{\"bucket\":\"128\",\"bucket-key\":\"id\"}"
}
}
At resolve time, each branch gets a normal TableSchema with the same id, fields, PK, and partition keys, but different effective options:
| Branch | Effective bucket |
Source |
|---|---|---|
main |
64 | top-level options |
snapshot |
32 | member-options.snapshot |
delta |
128 | member-options.delta |
A base-table ALTER TABLE ... SET TBLPROPERTIES ('bucket' = '96') would update all three members in one canonical commit. An explicit ALTER TABLE t$branch_delta SET TBLPROPERTIES ('bucket' = '256') would only update member-options.delta, still via a single main schema write.
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lingua principale
- Java
- Stelle
- 3.4k
- Fork
- 1.4k
- Merge medio
- 1g 14h
- PR unite (30g)
- 468
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/paimon
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[Bug] [Hive] IndexOutOfBoundsException when converting an unavailable dynamic BETWEEN predicate Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Tutte le issue di apache/paimon
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
infinispan/infinispan#18150 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100