Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Jun 20, 2024
1 parent 152c44a commit ad2d76f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
13 changes: 6 additions & 7 deletions fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,12 @@ private String getBackupObjs() {
return Joiner.on(", ").join(list);
}

public static BackupJob read(DataInput in) throws IOException {
BackupJob job = new BackupJob();
job.readFields(in);
return job;
}

@Override
public void write(DataOutput out) throws IOException {
super.write(out);
Expand Down Expand Up @@ -1034,13 +1040,6 @@ public void write(DataOutput out) throws IOException {
}
}

public static BackupJob read(DataInput in) throws IOException {
BackupJob job = new BackupJob();
job.readFields(in);
return job;
}

@Deprecated
public void readFields(DataInput in) throws IOException {
super.readFields(in);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.doris.backup;

import org.apache.doris.catalog.Env;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.persist.gson.GsonUtils;
Expand All @@ -33,7 +35,7 @@

public class RestoreFileMapping implements Writable {

public static class IdChain implements Writable {
public static class IdChain {
// tblId, partId, idxId, tabletId, replicaId
@SerializedName("c")
private Long[] chain;
Expand Down Expand Up @@ -102,11 +104,6 @@ public int hashCode() {
return code;
}

@Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, GsonUtils.GSON.toJson(this));
}

public void readFields(DataInput in) throws IOException {
int size = in.readInt();
chain = new Long[size];
Expand Down Expand Up @@ -154,9 +151,13 @@ public boolean isOverwrite(long tabletId) {
}

public static RestoreFileMapping read(DataInput in) throws IOException {
RestoreFileMapping mapping = new RestoreFileMapping();
mapping.readFields(in);
return mapping;
if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_135) {
RestoreFileMapping mapping = new RestoreFileMapping();
mapping.readFields(in);
return mapping;
} else {
return GsonUtils.GSON.fromJson(Text.readString(in), RestoreFileMapping.class);
}
}

public void clear() {
Expand All @@ -166,17 +167,7 @@ public void clear() {

@Override
public void write(DataOutput out) throws IOException {
out.writeInt(mapping.size());
for (Map.Entry<IdChain, IdChain> entry : mapping.entrySet()) {
entry.getKey().write(out);
entry.getValue().write(out);
}

out.writeInt(overwriteMap.size());
for (Map.Entry<Long, Boolean> entry : overwriteMap.entrySet()) {
out.writeLong(entry.getKey());
out.writeBoolean(entry.getValue());
}
Text.writeString(out, GsonUtils.GSON.toJson(this));
}

public void readFields(DataInput in) throws IOException {
Expand Down

0 comments on commit ad2d76f

Please sign in to comment.