sundapeng opened a new pull request, #11421:
URL: https://github.com/apache/paimon/pull/11421

   ### Purpose
   
   With `metadata.iceberg.storage` enabled, whenever Iceberg metadata has to be 
recreated from scratch — no base metadata file exists (first snapshot after 
enabling the compatibility, metadata directory deleted or expired, or an 
Iceberg format-version change) — `createMetadataWithoutBase` hardcoded the 
Iceberg snapshot summary operation to `"append"` even when the underlying 
Paimon snapshot was a COMPACT or OVERWRITE commit.
   
   The with-base path already derives the operation from the commit kind 
(`createWithDeleteManifestFileMetas` reports `replace` for COMPACT and 
`overwrite` for OVERWRITE), so the two paths disagreed. Iceberg consumers that 
select snapshots by the summary operation — incremental append scans such as 
`fromSnapshotExclusive`, changelog consumers, engines that skip `replace` 
snapshots because they carry no new logical rows — would replay a fully rebuilt 
snapshot as newly appended data.
   
   This PR derives the operation from `paimonSnapshot.commitKind()` in the 
rebuild path as well, mirroring the with-base path: COMPACT → `replace`, 
OVERWRITE → `overwrite`, otherwise `append`.
   
   ### Tests
   
   - 
`IcebergCompatibilityTest#testWithoutBaseRebuildDerivesOperationFromCommitKind`:
 after wiping the Iceberg metadata directory, a pure compaction commit rebuilds 
the metadata without a base and the rebuilt snapshot's summary operation must 
be `"replace"`. Fails on unmodified master with `expected: "replace" but was: 
"append"`.
   - `testWithoutBaseRebuildOverwriteDerivesOperation`: the same rebuild 
triggered by an overwrite commit must report `"overwrite"`. Fails on unmodified 
master with `expected: "overwrite" but was: "append"`.
   - `testWithoutBaseRebuildAppendKeepsAppendOperation`: pins the `"append"` 
default of the without-base export for plain append commits.
   - Each rebuild test asserts the metadata wipe really removed the directory, 
so the with-base path cannot silently cover the rebuild.
   - Full `IcebergCompatibilityTest` (65 tests) passes with this patch.
   
   ### API and Format
   
   No API or storage format changes.
   
   ### Documentation
   
   No documentation update needed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to