airborne12 opened a new pull request, #69441:
URL: https://github.com/apache/doris/pull/69441
### What problem does this PR solve?
Issue Number: None
Related PR: #68674
Problem Summary:
The light `DROP INDEX` pre-check added in #68674
(`SchemaChangeHandler#checkNoIndexChangeJobOnPartitions`) calls
`hasIndexChangeJobOnPartition` once per partition, and every call copies and
scans the whole retained `indexChangeJobs` history (finished jobs are kept for
days). For a table with P partitions and a history of H jobs that is O(P * H)
work while the table write lock is held, on top of the existing per-partition
check in `buildOrDeleteTableInvertedIndices`. A recent `BUILD INDEX` on a table
with many partitions leaves at least one record per partition, which makes it
quadratic in the number of partitions.
The pre-check also reported a conflict with the `BUILD INDEX` wording
`partition xxx has been built specified index. please check your build stmt.`,
which is misleading for a `DROP INDEX`.
Fix: the pre-check takes one snapshot of the job history and scans it once,
matching jobs on any of the table's partitions. The match condition is
extracted into `isConflictingIndexChangeJob` and shared with
`hasIndexChangeJobOnPartition`, so both checks keep the same rule. The
pre-check reports `partition xxx of table t has an unfinished index change job,
please retry after it finishes.` The `BUILD INDEX` / `DROP INDEX ... PARTITION`
check and its message are unchanged.
### Release note
A light DROP INDEX rejected because of an unfinished index change job now
reports `partition xxx of table t has an unfinished index change job, please
retry after it finishes.`
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
`SchemaChangeHandlerTest#testDropIndexRejectedByIndexChangeJobKeepsMetadata`
now expects the new message, and keeps checking the rejected DROP leaves the
metadata unchanged and the drop succeeds once the job finishes.
- Behavior changed:
- [ ] No.
- [x] Yes. <!-- Explain the behavior change -->
Only the error message of a rejected light DROP INDEX changes.
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]