From 6635c8b80b0091128fa7a9c99233a3429581c057 Mon Sep 17 00:00:00 2001 From: Yongqiang YANG Date: Wed, 19 Jun 2024 19:27:17 +0800 Subject: [PATCH] fix --- .../org/apache/doris/backup/BackupJobInfo.java | 14 ++++++++------ .../apache/doris/backup/RestoreFileMapping.java | 9 +++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJobInfo.java b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJobInfo.java index aa127961e3d217e..8382e4a8fc294c3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJobInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJobInfo.java @@ -21,6 +21,7 @@ import org.apache.doris.analysis.PartitionNames; import org.apache.doris.analysis.TableRef; import org.apache.doris.backup.RestoreFileMapping.IdChain; +import org.apache.doris.catalog.Env; import org.apache.doris.catalog.MaterializedIndex; import org.apache.doris.catalog.MaterializedIndex.IndexExtState; import org.apache.doris.catalog.OdbcCatalogResource; @@ -34,6 +35,7 @@ import org.apache.doris.catalog.View; import org.apache.doris.common.Config; import org.apache.doris.common.FeConstants; +import org.apache.doris.common.FeMetaVersion; import org.apache.doris.common.Version; import org.apache.doris.common.io.Text; import org.apache.doris.common.io.Writable; @@ -133,6 +135,7 @@ public static class NetworkAddrss { // This map is used to save the table alias mapping info when processing a restore job. // origin -> alias + @SerializedName("tblalias") public Map tblAlias = Maps.newHashMap(); public long getBackupTime() { @@ -807,17 +810,16 @@ public void releaseSnapshotInfo() { } public static BackupJobInfo read(DataInput in) throws IOException { - return BackupJobInfo.readFields(in); + if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_135) { + return BackupJobInfo.readFields(in); + } + String json = Text.readString(in); + return genFromJson(json); } @Override public void write(DataOutput out) throws IOException { Text.writeString(out, toJson(false)); - out.writeInt(tblAlias.size()); - for (Map.Entry entry : tblAlias.entrySet()) { - Text.writeString(out, entry.getKey()); - Text.writeString(out, entry.getValue()); - } } public static BackupJobInfo readFields(DataInput in) throws IOException { diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreFileMapping.java b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreFileMapping.java index 829367d96a6ca64..8967cebb35fc27e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreFileMapping.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreFileMapping.java @@ -17,7 +17,9 @@ package org.apache.doris.backup; +import org.apache.doris.common.io.Text; import org.apache.doris.common.io.Writable; +import org.apache.doris.persist.gson.GsonUtils; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; @@ -102,10 +104,7 @@ public int hashCode() { @Override public void write(DataOutput out) throws IOException { - out.writeInt(chain.length); - for (Long id : chain) { - out.writeLong(id); - } + Text.writeString(out, GsonUtils.GSON.toJson(this)); } public void readFields(DataInput in) throws IOException { @@ -124,8 +123,10 @@ public static IdChain read(DataInput in) throws IOException { } // catalog ids -> repository ids + @SerializedName("m") private Map mapping = Maps.newHashMap(); // tablet id -> is overwrite + @SerializedName("o") private Map overwriteMap = Maps.newHashMap(); public RestoreFileMapping() {