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 67df2b4 commit b3fdebf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static BackupMeta read(DataInput in) throws IOException {
return backupMeta;
}

// We can not change, because backup meta stored in external storage
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(tblNameMap.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.apache.doris.common.util.PropertyAnalyzer;
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.resource.Tag;
import org.apache.doris.task.AgentBatchTask;
Expand Down Expand Up @@ -107,7 +108,7 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class RestoreJob extends AbstractJob {
public class RestoreJob extends AbstractJob implements GsonPostProcessable {
private static final String PROP_RESERVE_REPLICA = "reserve_replica";
private static final String PROP_RESERVE_DYNAMIC_PARTITION_ENABLE = "reserve_dynamic_partition_enable";
private static final String PROP_IS_BEING_SYNCED = PropertyAnalyzer.PROPERTIES_IS_BEING_SYNCED;
Expand Down Expand Up @@ -2187,6 +2188,13 @@ public void readFields(DataInput in) throws IOException {
isBeingSynced = Boolean.parseBoolean(properties.get(PROP_IS_BEING_SYNCED));
}

@Override
public void gsonPostProcess() throws IOException {
reserveReplica = Boolean.parseBoolean(properties.get(PROP_RESERVE_REPLICA));
reserveDynamicPartitionEnable = Boolean.parseBoolean(properties.get(PROP_RESERVE_DYNAMIC_PARTITION_ENABLE));
isBeingSynced = Boolean.parseBoolean(properties.get(PROP_IS_BEING_SYNCED));
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder(super.toString());
Expand Down
28 changes: 12 additions & 16 deletions fe/fe-core/src/main/java/org/apache/doris/backup/SnapshotInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

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;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -117,26 +120,19 @@ public String getTabletPath() {
}

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

@Override
public void write(DataOutput out) throws IOException {
out.writeLong(dbId);
out.writeLong(tblId);
out.writeLong(partitionId);
out.writeLong(indexId);
out.writeLong(tabletId);
out.writeLong(beId);
out.writeInt(schemaHash);
Text.writeString(out, path);

out.writeInt(files.size());
for (String file : files) {
Text.writeString(out, file);
}
Text.writeString(out, GsonUtils.GSON.toJson(this));
}

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

0 comments on commit b3fdebf

Please sign in to comment.