From 8ddd518c7395f029eda7b40c13f4efaf8a2e7ac6 Mon Sep 17 00:00:00 2001 From: morningman Date: Sun, 17 Dec 2023 17:06:53 +0800 Subject: [PATCH 1/3] 1 --- .../doris/datasource/InternalCatalog.java | 1 - .../apache/doris/journal/JournalEntity.java | 3 +-- .../apache/doris/persist/CreateTableInfo.java | 19 +++++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java index 78b02a477f73d6..73853fec429df5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java @@ -1261,7 +1261,6 @@ public void createTableAsSelect(CreateTableAsSelectStmt stmt) throws DdlExceptio } public void replayCreateTable(String dbName, Table table) throws MetaNotFoundException { - Database db = this.fullNameToDb.get(dbName); try { db.createTableWithLock(table, true, false); diff --git a/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java b/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java index b0749db1fe14ea..2f77113dea4ad9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java +++ b/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java @@ -217,8 +217,7 @@ public void readFields(DataInput in) throws IOException { break; } case OperationType.OP_CREATE_TABLE: { - data = new CreateTableInfo(); - ((CreateTableInfo) data).readFields(in); + data = CreateTableInfo.read(in); isRead = true; break; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/CreateTableInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/CreateTableInfo.java index 722a1e04e7eec3..7ed43e2371c0cb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/persist/CreateTableInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/persist/CreateTableInfo.java @@ -18,8 +18,10 @@ package org.apache.doris.persist; import org.apache.doris.catalog.Table; +import org.apache.doris.cluster.ClusterNamespace; import org.apache.doris.common.io.Text; import org.apache.doris.common.io.Writable; +import org.apache.doris.persist.gson.GsonPostProcessable; import org.apache.doris.persist.gson.GsonUtils; import com.google.gson.annotations.SerializedName; @@ -31,7 +33,7 @@ import java.io.IOException; import java.util.Objects; -public class CreateTableInfo implements Writable { +public class CreateTableInfo implements Writable, GsonPostProcessable { public static final Logger LOG = LoggerFactory.getLogger(CreateTableInfo.class); @SerializedName(value = "dbName") @@ -61,17 +63,17 @@ public void write(DataOutput out) throws IOException { table.write(out); } - public void readFields(DataInput in) throws IOException { - dbName = Text.readString(in); - table = Table.read(in); - } - public static CreateTableInfo read(DataInput in) throws IOException { CreateTableInfo createTableInfo = new CreateTableInfo(); createTableInfo.readFields(in); return createTableInfo; } + private void readFields(DataInput in) throws IOException { + dbName = ClusterNamespace.getNameFromFullName(Text.readString(in)); + table = Table.read(in); + } + @Override public int hashCode() { return Objects.hash(dbName, table); @@ -99,4 +101,9 @@ public String toJson() { public String toString() { return toJson(); } + + @Override + public void gsonPostProcess() throws IOException { + dbName = ClusterNamespace.getNameFromFullName(dbName); + } } From d684bd14545c33e96c23daee64d2d9d6be50df06 Mon Sep 17 00:00:00 2001 From: morningman Date: Sun, 17 Dec 2023 17:12:16 +0800 Subject: [PATCH 2/3] 2 --- .../apache/doris/datasource/InternalCatalog.java | 2 ++ .../doris/persist/AlterDatabasePropertyInfo.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java index 73853fec429df5..c929edb96f1cb0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java @@ -254,6 +254,8 @@ public Database getDbNullable(String dbName) { if (StringUtils.isEmpty(dbName)) { return null; } + // ATTN: this should be removed in v3.0 + dbName = ClusterNamespace.getNameFromFullName(dbName); if (fullNameToDb.containsKey(dbName)) { return fullNameToDb.get(dbName); } else { diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/AlterDatabasePropertyInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/AlterDatabasePropertyInfo.java index 5f1c2bec5b2321..c9879c6d9b9bd4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/persist/AlterDatabasePropertyInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/persist/AlterDatabasePropertyInfo.java @@ -17,8 +17,10 @@ package org.apache.doris.persist; +import org.apache.doris.cluster.ClusterNamespace; import org.apache.doris.common.io.Text; import org.apache.doris.common.io.Writable; +import org.apache.doris.persist.gson.GsonPostProcessable; import org.apache.doris.persist.gson.GsonUtils; import com.google.gson.annotations.SerializedName; @@ -28,7 +30,7 @@ import java.io.IOException; import java.util.Map; -public class AlterDatabasePropertyInfo implements Writable { +public class AlterDatabasePropertyInfo implements Writable, GsonPostProcessable { @SerializedName(value = "dbId") private long dbId; @@ -38,12 +40,6 @@ public class AlterDatabasePropertyInfo implements Writable { @SerializedName(value = "properties") private Map properties; - public AlterDatabasePropertyInfo() { - // for persist - this.dbName = ""; - this.properties = null; - } - public AlterDatabasePropertyInfo(long dbId, String dbName, Map properties) { this.dbId = dbId; this.dbName = dbName; @@ -74,4 +70,9 @@ public static AlterDatabasePropertyInfo read(DataInput in) throws IOException { public String toJson() { return GsonUtils.GSON.toJson(this); } + + @Override + public void gsonPostProcess() throws IOException { + dbName = ClusterNamespace.getNameFromFullName(dbName); + } } From cefd9b0b43cbbc2a3ae80e5fcc4d28ee87d216c4 Mon Sep 17 00:00:00 2001 From: morningman Date: Sun, 17 Dec 2023 17:23:58 +0800 Subject: [PATCH 3/3] 3 --- .../java/org/apache/doris/persist/meta/PersistMetaModules.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/meta/PersistMetaModules.java b/fe/fe-core/src/main/java/org/apache/doris/persist/meta/PersistMetaModules.java index f6161629d99169..ad9009ae196029 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/persist/meta/PersistMetaModules.java +++ b/fe/fe-core/src/main/java/org/apache/doris/persist/meta/PersistMetaModules.java @@ -43,7 +43,7 @@ public class PersistMetaModules { // Modules in this list is deprecated and will not be saved in meta file. (also should not be in MODULE_NAMES) public static final ImmutableList DEPRECATED_MODULE_NAMES = ImmutableList.of( - "loadJob", "cooldownJob", "AnalysisMgr", "mtmvJobManager"); + "loadJob", "cooldownJob", "AnalysisMgr", "mtmvJobManager", "JobTaskManager"); static { MODULES_MAP = Maps.newHashMap();