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 ad2d76f commit fae6bd5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
23 changes: 11 additions & 12 deletions fe/fe-core/src/main/java/org/apache/doris/analysis/TableRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.Pair;
import org.apache.doris.common.UserException;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.datasource.hive.HMSExternalTable;
import org.apache.doris.datasource.hudi.HudiUtils;
import org.apache.doris.persist.gson.GsonUtils;
import org.apache.doris.rewrite.ExprRewriter;
import org.apache.doris.rewrite.ExprRewriter.ClauseType;

Expand Down Expand Up @@ -977,23 +979,20 @@ public String toString() {

@Override
public void write(DataOutput out) throws IOException {
name.write(out);
if (partitionNames == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
partitionNames.write(out);
}
Text.writeString(out, GsonUtils.GSON.toJson(this));
}

if (hasExplicitAlias()) {
out.writeBoolean(true);
Text.writeString(out, getExplicitAlias());
public static TableRef read(DataInput in) throws IOException {
if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_135) {
TableRef ref = new TableRef();
ref.readFields(in);
return ref;
} else {
out.writeBoolean(false);
return GsonUtils.GSON.fromJson(Text.readString(in), TableRef.class);
}
}

public void readFields(DataInput in) throws IOException {
private void readFields(DataInput in) throws IOException {
name = new TableName();
name.readFields(in);
if (in.readBoolean()) {
Expand Down
13 changes: 9 additions & 4 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 @@ -1045,10 +1045,11 @@ public void readFields(DataInput in) throws IOException {

// table refs
int size = in.readInt();
LOG.info("read {} tablerefs ", size);

tableRefs = Lists.newArrayList();
for (int i = 0; i < size; i++) {
TableRef tblRef = new TableRef();
tblRef.readFields(in);
TableRef tblRef = TableRef.read(in);
tableRefs.add(tblRef);
}

Expand All @@ -1060,14 +1061,16 @@ public void readFields(DataInput in) throws IOException {

// snapshot info
size = in.readInt();
LOG.info("read {} snapshotinfo ", size);

for (int i = 0; i < size; i++) {
SnapshotInfo snapshotInfo = new SnapshotInfo();
snapshotInfo.readFields(in);
SnapshotInfo snapshotInfo = SnapshotInfo.read(in);
snapshotInfos.put(snapshotInfo.getTabletId(), snapshotInfo);
}

// backup meta
if (in.readBoolean()) {
LOG.info("read backup meta");
backupMeta = BackupMeta.read(in);
}

Expand All @@ -1083,6 +1086,8 @@ public void readFields(DataInput in) throws IOException {
}
// read properties
size = in.readInt();
LOG.info("read {} property ", size);

for (int i = 0; i < size; i++) {
String key = Text.readString(in);
String value = Text.readString(in);
Expand Down
13 changes: 1 addition & 12 deletions fe/fe-core/src/main/java/org/apache/doris/backup/BackupMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,7 @@ public static BackupMeta read(DataInput in) throws IOException {
// We can not change, because backup meta stored in external storage
@Override
public void write(DataOutput out) throws IOException {
if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_135) {
out.writeInt(tblNameMap.size());
for (Table table : tblNameMap.values()) {
table.write(out);
}
out.writeInt(resourceNameMap.size());
for (Resource resource : resourceNameMap.values()) {
resource.write(out);
}
} else {
Text.writeString(out, toJson());
}
Text.writeString(out, toJson());
}

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

0 comments on commit fae6bd5

Please sign in to comment.