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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new c176bf5af8b branch-4.1: [bug](cloud restore) forbid restoring table 
with property 'light_schema change' = 'false' in cloud mode #62914 (#64835)
c176bf5af8b is described below

commit c176bf5af8b62db895327170085b106bf034d5e0
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Jun 29 12:00:16 2026 +0800

    branch-4.1: [bug](cloud restore) forbid restoring table with property 
'light_schema change' = 'false' in cloud mode #62914 (#64835)
    
    Cherry-picked from #62914
    
    Co-authored-by: xy720 <[email protected]>
    Co-authored-by: lide <[email protected]>
---
 .../java/org/apache/doris/backup/RestoreJob.java     | 14 +++++++++++++-
 .../java/org/apache/doris/catalog/OlapTable.java     | 20 ++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java 
b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java
index 5297d6f13f9..7c0f52b93ed 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java
@@ -760,6 +760,12 @@ public class RestoreJob extends AbstractJob implements 
GsonPostProcessable {
                             }
                         }
 
+                        st = remoteOlapTbl.checkPropertiesForRestore();
+                        if (!st.ok()) {
+                            status = st;
+                            return;
+                        }
+
                         checkStorageVault(localOlapTbl);
                         if (!status.ok()) {
                             return;
@@ -865,9 +871,15 @@ public class RestoreJob extends AbstractJob implements 
GsonPostProcessable {
                         }
                     }
 
+                    Status st = remoteOlapTbl.checkPropertiesForRestore();
+                    if (!st.ok()) {
+                        status = st;
+                        return;
+                    }
+
                     // reset all ids in this table
                     String srcDbName = jobInfo.dbName;
-                    Status st = remoteOlapTbl.resetIdsForRestore(env, db, 
replicaAlloc, reserveReplica,
+                    st = remoteOlapTbl.resetIdsForRestore(env, db, 
replicaAlloc, reserveReplica,
                             reserveColocate, colocatePersistInfos, srcDbName);
                     if (!st.ok()) {
                         status = st;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
index 22fe2e9d418..f02aca90bad 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
@@ -798,6 +798,26 @@ public class OlapTable extends Table implements 
MTMVRelatedTableIf, GsonPostProc
         }
     }
 
+    /**
+     * Check properties before restore.
+     */
+    public Status checkPropertiesForRestore() {
+        if (tableProperty != null) {
+            if (Config.isCloudMode()) {
+                // Avoid restore non-light schema change table in cloud mode. 
Because non-light schema change table
+                // may have different schema with same schema version(which is 
always 0), which will cause very bad
+                // problem to metadata in cloud mode.
+                if (!tableProperty.getUseSchemaLightChange()) {
+                    String msg = String.format("Restoring table %s which has 
property `\"light_schema_change\""
+                            + " = \"false\"`, currently cloud mode only 
supports light schema change table."
+                            + " Please enable `light_schema_change` property 
before backup and restore.", name);
+                    return new Status(ErrCode.COMMON_ERROR, msg);
+                }
+            }
+        }
+        return Status.OK;
+    }
+
     /**
      * Set the related properties when is_being_synced properties is true.
      *


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to