This is an automated email from the ASF dual-hosted git repository.
morningman 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 e33275e79cf [fix](meta) make OP_CERATE_DB compatible with 3.1 (#55149)
e33275e79cf is described below
commit e33275e79cf9fa4324ee8e7771f342b56542bc21
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Sat Sep 6 22:51:03 2025 -0700
[fix](meta) make OP_CERATE_DB compatible with 3.1 (#55149)
### What problem does this PR solve?
Related PR: #55148
Compatible with 3.1. In 3.1 (#55148), we use `Database` to save catalog
name and db name for
`create external database`. And in 4.0, we should use `CreateDbInfo` to
save these info.
---
.../src/main/java/org/apache/doris/catalog/Database.java | 12 ++++++++++++
.../src/main/java/org/apache/doris/persist/EditLog.java | 11 ++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
index 897e002f3cd..42cad430f1e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
@@ -130,6 +130,13 @@ public class Database extends MetaObject implements
Writable, DatabaseIf<Table>,
// from dbProperties;
private BinlogConfig binlogConfig = new BinlogConfig();
+ // ATTN: This field is only used for compatible with old version
+ // Do not use it except for replaying OP_CREATE_DB
+ // it will be removed in version 4.0
+ @Deprecated
+ @SerializedName(value = "cn")
+ private String ctlName;
+
public Database() {
this(0, null);
}
@@ -154,6 +161,11 @@ public class Database extends MetaObject implements
Writable, DatabaseIf<Table>,
this.dbEncryptKey = new DatabaseEncryptKey();
}
+ // DO NOT use it except for replaying OP_CREATE_DB
+ public String getCtlName() {
+ return ctlName;
+ }
+
public void markDropped() {
isDropped = true;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
index eeea4691593..c4dc8e7c58b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
@@ -309,8 +309,17 @@ public class EditLog {
break;
}
case OperationType.OP_CREATE_DB: {
+ // This OP_CREATE_DB is deprecated in version 4.0, the
following logic are just for compatibility
+ // when upgrading from 3.x to 4.0
Database db = (Database) journal.getData();
- CreateDbInfo info = new
CreateDbInfo(db.getCatalog().getName(), db.getName(), db);
+ CreateDbInfo info;
+ if (!Strings.isNullOrEmpty(db.getCtlName())) {
+ // if ctlName is not empty, it means this db is
created in an external catalog
+ // we just need db name and ctl name
+ info = new CreateDbInfo(db.getCtlName(), db.getName(),
null);
+ } else {
+ info = new CreateDbInfo(db.getCatalog().getName(),
db.getName(), db);
+ }
env.replayCreateDb(info);
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]