userzhy opened a new pull request, #6896:
URL: https://github.com/apache/paimon/pull/6896
### Purpose
Linked issue: close #6272
When a branch is created from a tag, the tag's snapshot information is
copied to the branch directory. However, if the tag is deleted, the snapshot
expiration process may clean up data files that are still needed by the branch,
making the branch unqueryable.
This change implements Tag Deletion Protection: before deleting a tag, we
check if any branches were created from that tag. If so, the deletion is
blocked with an error message listing the referencing branches.
Changes:
- Added `branchesCreatedFromTag(String tagName)` method to `BranchManager`
interface with default empty implementation for backward compatibility
- Implemented `branchesCreatedFromTag()` in `FileSystemBranchManager` to
check each branch's tag directory for the specified tag
- Added validation in `AbstractFileStoreTable.deleteTag()` to prevent
deletion of tags that are still referenced by branches
### Tests
- Added `testDeleteTagReferencedByBranch()` in `SimpleTableTestBase` to
verify:
- Deleting a tag referenced by a branch throws `IllegalStateException`
- The error message includes the referencing branch names
- After deleting all referencing branches, the tag can be deleted
successfully
### API and Format
- Added new method `branchesCreatedFromTag(String tagName)` to
`BranchManager` interface with default implementation returning empty list, so
existing implementations remain compatible
- No storage format changes
### Documentation
This is a bug fix, no new feature documentation 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]