Doris-Breakwater opened a new pull request, #66424:
URL: https://github.com/apache/doris/pull/66424
### What problem does this PR solve?
Issue Number: N/A
Related PR: N/A
Problem Summary:
Concurrent `TRUNCATE TABLE` operations can snapshot the same original
partition ID. If one operation replaces the partition first, the other
operation currently reads the old partition's storage policy from the unlocked
live `OlapTable`. The old ID has already been removed from `PartitionInfo`, so
this lookup throws a null pointer exception before the existing stale-partition
validation can return its retryable `DdlException`.
This change uses the `DataProperty` from the deep-copied table snapshot
consistently while creating replacement partitions. The stale truncate can then
finish temporary partition creation, reach the write-lock validation, return
`Partition [...] is changed during truncating table, please retry`, and clean
its temporary tablet metadata.
A deterministic FE unit test pauses one truncate after its snapshot, lets a
second truncate replace the partition, resumes the first operation, and
verifies the retryable error, surviving partition ID, and exact tablet metadata
cleanup.
Please backport this fix to `branch-4.1` after merge.
### Release note
Fix a null pointer exception when truncating the same table concurrently.
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- Added `TruncateTableCommandTest.testConcurrentTruncateTable`.
- Local execution was attempted with `run-fe-ut.sh`, but
generated-source creation stopped before test compilation because
`thirdparty/installed/bin/protoc` is unavailable in the provided worktree. The
standard `build.sh --fe -j 90` path is blocked by the same missing
prerequisite. CI validation is required.
- [ ] Manual test
- [ ] No need to test or manual test
- Behavior changed:
- [x] Yes. A stale concurrent truncate now returns the existing
retryable partition-changed error instead of a null pointer exception.
- [ ] No.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Review
An independent static review covered correctness, concurrency/locking,
cleanup, performance, maintainability, and test determinism. The review found
one teardown robustness issue in the initial test; it was fixed, and re-review
reported no remaining findings. `git diff --check` passes.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]