Skip to content

[core] Fail drop branch DDL when the branch directory cannot be deleted - #10238

Open
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-058-drop-branch
Open

LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-058-drop-branch

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

FileSystemBranchManager.dropBranch caught the IOException from deleting the branch directory, logged it at INFO, and returned normally, so the DDL reported success while the branch directory and its data still existed. A later create of the same branch name then failed unexpectedly with "already exists".

This rethrows the failure as a RuntimeException, the same way the sibling createBranch, renameBranch, and fastForward methods in this class already do, so the drop-branch DDL fails when the directory cannot be deleted. The pre-existing checkArgument(branchExists(...)) guard is unchanged, so dropping a branch that is already absent still surfaces the "doesn't exist" error rather than a delete failure.

This closes #10237.

Tests

Added FileSystemBranchManagerTest.testDropBranchFailsWhenDeleteFails: it stubs FileIO.delete to throw IOException, asserts dropBranch rethrows the failure, and asserts the branch directory is left in place.

API and Format

No.

Documentation

No.

dropBranch caught the IOException from deleting the branch directory,
logged it at INFO and returned normally, so the DDL reported success
while the branch directory and all its data still existed, and a later
create of the same branch name failed unexpectedly.

Rethrow like the sibling createBranch methods do.

Assisted-by: GLM-5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Drop branch DDL reports success when the branch directory cannot be deleted

1 participant