github-actions[bot] commented on code in PR #69441:
URL: https://github.com/apache/doris/pull/69441#discussion_r4345804049


##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -3974,20 +3976,25 @@ public boolean hasIndexChangeJobOnPartition(
             List<Index> alterIndexes, boolean isDrop) {
         // TODO: this is temporary methods
         for (IndexChangeJob indexChangeJob : 
ImmutableList.copyOf(indexChangeJobs.values())) {
-            if (indexChangeJob.getOriginIndexId() == originIndexId
-                    && indexChangeJob.getDbId() == dbId
-                    && indexChangeJob.getTableId() == tableId
-                    && indexChangeJob.getPartitionName().equals(partitionName)
-                    && ((Config.isNotCloudMode() && 
indexChangeJob.hasSameAlterInvertedIndex(isDrop, alterIndexes))
-                    || Config.isCloudMode())
-                    && !indexChangeJob.isDone()) {
-                // if JobState is done (CANCELLED or FINISHED), also allow 
user to create job again
+            if (isConflictingIndexChangeJob(indexChangeJob, originIndexId, 
dbId, tableId, alterIndexes, isDrop)

Review Comment:
   [P2] Keep the partition guard ahead of index-list matching
   
   `hasIndexChangeJobOnPartition` is still called once per selected partition 
by `buildOrDeleteTableInvertedIndices`. Moving the partition comparison after 
`isConflictingIndexChangeJob` makes local mode run 
`hasSameAlterInvertedIndex`'s nested index scans for every retained job on the 
table, including finished jobs, for every partition. For example, after a batch 
partition DROP of 50 indexes across 1,000 partitions completes, dropping a 
disjoint batch of 50 indexes across those partitions now performs about 2.5 
billion index-ID comparisons against that history instead of 2.5 million (in 
addition to the existing history scans). This work holds the table write lock 
and can substantially stall metadata access. Preserve the partition-name short 
circuit before invoking the shared conflict predicate.



-- 
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]

Reply via email to