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 b06f3edcab2 [fix](meta) fix meta replay issue when upgrading from v2.0 to master (#28532) b06f3edcab2 is described below commit b06f3edcab2ac1ce5271c03280c906d150bd8eeb Author: Mingyu Chen <morning...@163.com> AuthorDate: Sun Dec 17 22:16:42 2023 +0800 [fix](meta) fix meta replay issue when upgrading from v2.0 to master (#28532) Introduced from #27861 The `dbName` saved in `CreateTableInfo` has `default_cluster` prefix, it should be removed. Also modify the entry of `getDb` in internal catalog. This is a cover-up plan in case there may still db name exist with `default_cluster` prefix. --- .../org/apache/doris/datasource/InternalCatalog.java | 3 ++- .../java/org/apache/doris/journal/JournalEntity.java | 3 +-- .../doris/persist/AlterDatabasePropertyInfo.java | 15 ++++++++------- .../org/apache/doris/persist/CreateTableInfo.java | 19 +++++++++++++------ .../apache/doris/persist/meta/PersistMetaModules.java | 2 +- 5 files changed, 25 insertions(+), 17 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 8d8e76c3cf6..2ca083c73fb 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 class InternalCatalog implements CatalogIf<Database> { 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 class InternalCatalog implements CatalogIf<Database> { } 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 b0749db1fe1..2f77113dea4 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 class JournalEntity implements Writable { 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 5f1c2bec5b2..c9879c6d9b9 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.DataOutput; 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<String, String> properties; - public AlterDatabasePropertyInfo() { - // for persist - this.dbName = ""; - this.properties = null; - } - public AlterDatabasePropertyInfo(long dbId, String dbName, Map<String, String> properties) { this.dbId = dbId; this.dbName = dbName; @@ -74,4 +70,9 @@ public class AlterDatabasePropertyInfo implements Writable { 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 722a1e04e7e..7ed43e2371c 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.DataOutput; 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 class CreateTableInfo implements Writable { 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 class CreateTableInfo implements Writable { 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 f6161629d99..ad9009ae196 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<String> DEPRECATED_MODULE_NAMES = ImmutableList.of( - "loadJob", "cooldownJob", "AnalysisMgr", "mtmvJobManager"); + "loadJob", "cooldownJob", "AnalysisMgr", "mtmvJobManager", "JobTaskManager"); static { MODULES_MAP = Maps.newHashMap(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org