huyuanfeng2018 opened a new issue, #9595: URL: https://github.com/apache/paimon/issues/9595
### Search before asking - [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar. ### Paimon version master ### Compute Engine spark ### Minimal reproduce step 1. Create a non-write-only Chain Table with partition expiration enabled, including `end-input.check-partition-expire`. 2. Configure aggressive snapshot retention: ```text snapshot.num-retained.min = 1 snapshot.num-retained.max = 1 snapshot.time-retained = 0s ``` 3. Write initial data so that the Snapshot branch contains a partition. 4. Continue writing only to the Delta branch. 5. Let partition expiration delete that partition from the Snapshot branch. 6. Check the snapshots and data files retained by the Snapshot branch. **Actual result:** The partition deletion creates a new snapshot on the Snapshot branch, but older snapshots on that branch are not expired automatically. ### What doesn't meet your expectations? A Delta commit runs snapshot expiration only for the current Delta branch. However, `ChainTablePartitionExpire` may also commit a partition deletion to the Snapshot branch. After that commit, snapshot expiration is not run for the Snapshot branch. Therefore, when users continuously write only to the Delta branch, old Snapshot-branch snapshots—and data files referenced only by those snapshots—may remain indefinitely. The configured retention policy does not take effect because the Snapshot branch expirer is never invoked. **Expected behavior:** After Chain Table partition expiration commits a deletion to the Snapshot branch, automatic maintenance should also expire snapshots on that branch according to the configured retention policy. ### Anything else? Relevant code: - [`AbstractFileStoreTable.newExpireRunnable()`](https://github.com/apache/paimon/blob/85c8d601acd85c1a69fe036b451b28b595e1edad/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java#L500) creates expiration operations only for the current table or branch. - [`ChainTablePartitionExpire`](https://github.com/apache/paimon/blob/85c8d601acd85c1a69fe036b451b28b595e1edad/paimon-core/src/main/java/org/apache/paimon/operation/ChainTablePartitionExpire.java#L336) commits Snapshot-branch partition deletions without expiring that branch's snapshots. - Original Chain Table partition-expiration PR: [#7643](https://github.com/apache/paimon/pull/7643). **Suggested direction:** Keep `ChainTablePartitionExpire` responsible for selecting and deleting expired partitions. Extend the normal expiration runnable for a Chain Delta table so that it expires: 1. Snapshots on the current Delta branch. 2. Snapshots on the configured Snapshot branch. This issue concerns automatic maintenance behavior and does not require a separate public `expire_chain_snapshots` action. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- 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]
