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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java:
##########
@@ -128,102 +128,109 @@ public void run(ConnectContext ctx, StmtExecutor 
executor) throws Exception {
     public LogicalPlan completeQueryPlan(ConnectContext ctx, LogicalPlan 
logicalQuery) {
         checkTable(ctx);
 
-        Map<String, Expression> colNameToExpression = 
Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
-        Map<String, Expression> partialUpdateColNameToExpression = 
Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
-        for (EqualTo equalTo : assignments) {
-            List<String> colNameParts = ((UnboundSlot) 
equalTo.left()).getNameParts();
-            checkAssignmentColumn(ctx, colNameParts, this.nameParts, 
this.tableAlias);
-            colNameToExpression.put(colNameParts.get(colNameParts.size() - 1), 
equalTo.right());
-            
partialUpdateColNameToExpression.put(colNameParts.get(colNameParts.size() - 1), 
equalTo.right());
-        }
-        // check if any key in update clause
-        if (targetTable.getFullSchema().stream().filter(Column::isKey)
-                .anyMatch(column -> 
partialUpdateColNameToExpression.containsKey(column.getName()))) {
-            throw new AnalysisException("Only value columns of unique table 
could be updated");
-        }
-        List<NamedExpression> selectItems = Lists.newArrayList();
-        String tableName = tableAlias != null ? tableAlias : 
Util.getTempTableDisplayName(targetTable.getName());
-        Expression setExpr = null;
-        for (Column column : targetTable.getFullSchema()) {
-            // if it sets sequence column in stream load phase, the sequence 
map column is null, we query it.
-            if (!column.isVisible() && !column.isSequenceColumn()
-                    && !(column.isTtlColumn() && 
targetTable.isDirectRowTtl())) {
-                continue;
+        // Light schema changes rebuild the column metadata in place under the 
table write lock.
+        // Keep all schema reads consistent until the UPDATE logical plan has 
been constructed.
+        targetTable.readLock();

Review Comment:
   [P2] Bound the UPDATE table-lock wait before plan construction. 
`targetTable.readLock()` blocks indefinitely before Nereids reaches 
`StatementContext.lock()`, which otherwise uses a one-minute `tryReadLock` 
timeout. A light-schema-change ALTER holds the table write lock while 
`AlterLightSchChangeHelper.callForColumnsInfo()` waits for BE RPC futures (up 
to the session/default timeout), so `EXPLAIN UPDATE` and direct plan completion 
can hang for that entire interval instead of failing or retrying on the planner 
timeout. Acquire this read lock through the same bounded/cancellation-aware 
path and report the lock failure deterministically.



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