This is an automated email from the ASF dual-hosted git repository.
xy720 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 d34b16c8fd3 [bug](cloud restore) forbid restoring table with property
'light_schema change' = 'false' in cloud mode (#62914)
d34b16c8fd3 is described below
commit d34b16c8fd3b67ed09f474e192090c35fb3d69c5
Author: xy720 <[email protected]>
AuthorDate: Thu May 7 20:39:59 2026 +0800
[bug](cloud restore) forbid restoring table with property 'light_schema
change' = 'false' in cloud mode (#62914)
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.
For example:
There is a partitioned table with 'light_schema change' = 'false', its
tablet schema is
Tablet a1's schema in Partition A before schema change
```
schema version 0
col1 uid=0
col2 uid=1
col3 uid=2
col4 uid=3
__delete_sign_column__ uid=4
```
Now we add column to this table, then:
Tablet a1's schema in Partition A after schema change
```
schema version 0
col1 uid=0
col2 uid=1
col3 uid=2
col4 uid=3
__delete_sign_column__ uid=4
col5 uid=5
```
Now we add partition B to this table, then
Tablet b1's schema in Partition B is:
```
schema version 0
col1 uid=0
col2 uid=1
col3 uid=2
col4 uid=3
col5 uid=4
__delete_sign_column__ uid=5
```
Then we will have two different tablet schema (a1 and b1) with same
index id and same schema version 0 in this table.
This should not happen in cloud mode.
if we backup and restore this table to cluster in cloud mode, the
restored table will not be select correctly.
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 9a5fd311ce6..528cbff5018 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
@@ -767,6 +767,12 @@ public class RestoreJob extends AbstractJob implements
GsonPostProcessable {
}
}
+ st = remoteOlapTbl.checkPropertiesForRestore();
+ if (!st.ok()) {
+ status = st;
+ return;
+ }
+
checkStorageVault(localOlapTbl);
if (!status.ok()) {
return;
@@ -872,9 +878,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 54a29fddedf..f4bbf72b353 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
@@ -806,6 +806,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]