You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by xu...@apache.org on 2023/11/17 13:25:00 UTC

(doris) branch master updated: [Bug](SchemeChange) Loading tasks during alter job cause modify column failed (#26975)

This is an automated email from the ASF dual-hosted git repository.

xuyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e3e249c5842 [Bug](SchemeChange) Loading tasks during alter job cause modify column failed (#26975)
e3e249c5842 is described below

commit e3e249c5842dd9d5ef1b9955e29f2e2061a5cd3e
Author: xy720 <22...@users.noreply.github.com>
AuthorDate: Fri Nov 17 21:24:53 2023 +0800

    [Bug](SchemeChange) Loading tasks during alter job cause modify column failed (#26975)
    
    When a table is doing schema-change, it adds _doris_shadow prefix in name of modified columns in shadow index.
    
    The writes during schema-change will generate rowset schema with _doris_shadow prefix in BE.
    
    If the alter task arrives at be after the write request, it will use the rowset schema with max version which has the _doris_shadow prefix.
    
    And an error will be thrown as below:
    
    a shadow column is encountered __doris_shadow_p_retailprice
    [INTERNAL_ERROR]failed due to operate on shadow column
    
    This commit will disable shadow prefix in rowset meta schema.
---
 .../src/main/java/org/apache/doris/planner/OlapTableSink.java      | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
index fa3b4abee9a..e2cc67d992a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.planner;
 
+import org.apache.doris.alter.SchemaChangeHandler;
 import org.apache.doris.analysis.Analyzer;
 import org.apache.doris.analysis.Expr;
 import org.apache.doris.analysis.SlotDescriptor;
@@ -252,6 +253,12 @@ public class OlapTableSink extends DataSink {
             columns.addAll(indexMeta.getSchema().stream().map(Column::getNonShadowName).collect(Collectors.toList()));
             for (Column column : indexMeta.getSchema()) {
                 TColumn tColumn = column.toThrift();
+                // When schema change is doing, some modified column has prefix in name. Columns here
+                // is for the schema in rowset meta, which should be no column with shadow prefix.
+                // So we should remove the shadow prefix here.
+                if (column.getName().startsWith(SchemaChangeHandler.SHADOW_NAME_PREFIX)) {
+                    tColumn.setColumnName(column.getNonShadowName());
+                }
                 column.setIndexFlag(tColumn, table);
                 columnsDesc.add(tColumn);
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org