From 84849cb194a398afdffd6543321e1386f43fd1a8 Mon Sep 17 00:00:00 2001 From: Yongqiang YANG Date: Thu, 20 Jun 2024 09:38:31 +0800 Subject: [PATCH] fix --- .../org/apache/doris/backup/RestoreJob.java | 44 +++---------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java index 8be2a155be9427d..9b870af8b9dfad3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java @@ -67,7 +67,7 @@ import org.apache.doris.common.util.TimeUtils; import org.apache.doris.datasource.property.S3ClientBEProperties; import org.apache.doris.persist.gson.GsonPostProcessable; -// import org.apache.doris.persist.gson.GsonUtils; +import org.apache.doris.persist.gson.GsonUtils; import org.apache.doris.resource.Tag; import org.apache.doris.task.AgentBatchTask; import org.apache.doris.task.AgentTask; @@ -100,7 +100,6 @@ import org.apache.logging.log4j.Logger; import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -2097,45 +2096,16 @@ private void setTableStateToNormal(Database db, boolean committed, boolean isRep } } - public void write(DataOutput out) throws IOException { - // ATTN: must write type first - Text.writeString(out, type.name()); - - out.writeLong(repoId); - Text.writeString(out, label); - out.writeLong(jobId); - out.writeLong(dbId); - Text.writeString(out, dbName); - - out.writeLong(createTime); - out.writeLong(finishedTime); - out.writeLong(timeoutMs); - - if (!taskErrMsg.isEmpty()) { - out.writeBoolean(true); - // we only save at most 3 err msgs - int savedNum = Math.min(3, taskErrMsg.size()); - out.writeInt(savedNum); - for (Map.Entry entry : taskErrMsg.entrySet()) { - if (savedNum == 0) { - break; - } - out.writeLong(entry.getKey()); - Text.writeString(out, entry.getValue()); - savedNum--; - } - Preconditions.checkState(savedNum == 0, savedNum); + public static RestoreJob read(DataInput in) throws IOException { + if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_136) { + RestoreJob job = new RestoreJob(); + job.readFields(in); + return job; } else { - out.writeBoolean(false); + return GsonUtils.GSON.fromJson(Text.readString(in), RestoreJob.class); } } - public static RestoreJob read(DataInput in) throws IOException { - RestoreJob job = new RestoreJob(); - job.readFields(in); - return job; - } - @Deprecated @Override public void readFields(DataInput in) throws IOException {