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


##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -2375,9 +2387,17 @@ public int getAsInt() {
             List<Index> alterIndexes = new ArrayList<>();
             Map<Long, Set<String>> indexOnPartitions = new HashMap<>();
             boolean isDropIndex = false;
+            // isDropIndex only reflects the last index clause, a light index 
change needs delete jobs whenever
+            // any of its clauses drops an index.
+            boolean hasLightDropIndex = false;
             Map<String, String> propertyMap = new HashMap<>();
-            Map<String, List<String>> sequenceMapping = 
olapTable.getColumnSeqMapping() == null ? new HashMap<>()
-                    : new HashMap<>(olapTable.getColumnSeqMapping());
+            // Copy the column groups too: processDropSequenceMapping removes 
columns from them, and the table's
+            // mapping must only change through the schema change job.
+            Map<String, List<String>> sequenceMapping = new HashMap<>();
+            if (olapTable.getColumnSeqMapping() != null) {
+                olapTable.getColumnSeqMapping().forEach(
+                        (seqColumn, columnGroup) -> 
sequenceMapping.put(seqColumn, new ArrayList<>(columnGroup)));

Review Comment:
   [P1] Validate copied sequence groups against the staged schema
   
   On a MOR UNIQUE table with `sequence_mapping.s1='c,d'` and 
`light_schema_change=true`, `ALTER TABLE t DROP COLUMN c, ADD COLUMN x 
VARCHAR(20) PROPERTIES ('sequence_mapping.s1'='c,x')` now passes. DROP removes 
`c` only from this copy, while `checkSeqMapConditionMet` still checks the live 
table mapping, so ADD accepts `c` and inserts it back into the staged group 
even though the staged schema no longer contains it. Previously the shared list 
caused that check to reject the batch. `createJob` sends the invalid group to 
`CreateReplicaTask`; `ColumnsUtil` resolves missing `c` to UID `-1`, and 
`TabletSchema::init_from_pb` asserts on that nonexistent UID (then dereferences 
the failed lookup without assertions), so the schema change can crash a BE. 
Keep the deep copy, but validate the final mapping against the staged schema 
before creating the job, and add this DROP+ADD regression case.



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