[BugFix] Adding dynamic partition failure for one table may block other tables (backport #51440) #51665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why I'm doing:
This bug is introduced by #47106. It changes
DdlException
toSemanticException
which leads toDynamicPartitionScheduler.executeDynamicPartitionForTable
can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.A way to reproduce is as following. Create a partition named
p20241008
explicitly which will conflict with the dynamic partition to create. Dynamic partition will report exceptionGetting analyzing error. Detail message: Duplicate partition name p20241008
. Note that changep20241008
to the current day you execute the sql.What I'm doing:
catch
Exception
rather thanDdlException
inDynamicPartitionScheduler.executeDynamicPartitionForTable
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
This is an automatic backport of pull request #51440 done by [Mergify](https://mergify.com). ## Why I'm doing: This bug is introduced by #47106. It changes [`DdlException` to `SemanticException`](https://github.com//pull/47106/files#diff-d823bc00d682d8a36f2257a3ddcfa045cd2f248ef768d7f9fb0c9a53b039d82cR1035) which leads to `DynamicPartitionScheduler.executeDynamicPartitionForTable` can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.
A way to reproduce is as following. Create a partition named
p20241008
explicitly which will conflict with the dynamic partition to create. Dynamic partition will report exceptionGetting analyzing error. Detail message: Duplicate partition name p20241008
. Note that changep20241008
to the current day you execute the sql.What I'm doing:
catch
Exception
rather thanDdlException
inDynamicPartitionScheduler.executeDynamicPartitionForTable
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist: