airborne12 commented on code in PR #71130:
URL: https://github.com/apache/doris/pull/71130#discussion_r4746773481


##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -3095,6 +3110,7 @@ public void updatePartitionsProperties(Database db, 
String tableName, List<Strin
             }
         }
         String storagePolicy = 
properties.get(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY);
+        checkNoIndexBuildBeforeStoragePolicy(db.getId(), olapTable, 
storagePolicy);

Review Comment:
   Confirmed and fixed in 9b0a0144509.
   
   A MODIFY PARTITION that sets a storage policy now reserves the change under 
the table write lock before it sends anything to BE: the build-job check and an 
in-memory count of policy changes in progress for the table. It releases the 
reservation once the partition metadata is changed or the statement fails, and 
the BE requests stay outside the lock. BUILD IMMEDIATE picks its path under the 
same lock and treats a policy change in progress, or a table-level policy, like 
a partition policy, so it runs the heavy schema change. ALTER TABLE ... SET now 
checks and sets the table policy under the table write lock as well. So the two 
always see each other: either the policy is rejected because build jobs exist, 
or BUILD IMMEDIATE sees the policy.
   
   
`SchemaChangeHandlerTest#testAddIndexBuildImmediateRunsHeavyWhileStoragePolicyIsSet`
 reproduces the interleaving in order rather than with threads: with a policy 
change reserved, as the first ALTER holds it while waiting on BE, `ADD INDEX 
... BUILD IMMEDIATE` must run the heavy schema change; the same for a table 
whose table policy is set before its partitions. It failed before the change 
(the reserved case took the build-job path) and passes now; 
`ModifyPartitionStoragePolicyTest` still 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]

Reply via email to