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..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 { @@ -1261,7 +1263,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/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); + } } 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); + } } 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();