Skip to content

Commit

Permalink
[fix](cloud) fix replay journal fail when FE node upgrade (#36156)
Browse files Browse the repository at this point in the history
## Proposed changes

introduce by #32759

when upgrade 2.1 to master, error happened:
```
java.io.EOFException: null
        at java.io.DataInputStream.readInt(DataInputStream.java:398) ~[?:?]
        at org.apache.doris.common.io.Text.readString(Text.java:413) ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
        at org.apache.doris.load.loadv2.LoadJobFinalOperation.readFields(LoadJobFinalOperation.java:160) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.transaction.TxnCommitAttachment.read(TxnCommitAttachment.java:77) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.journal.JournalEntity.readFields(JournalEntity.java:569) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.journal.bdbje.BDBJournalCursor.next(BDBJournalCursor.java:115) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.catalog.Env.replayJournal(Env.java:2863) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.catalog.Env.transferToMaster(Env.java:1503) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.catalog.Env.access$1300(Env.java:332) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.catalog.Env$5.runOneCycle(Env.java:2764) ~[doris-fe.jar:1.2-SNAPSHOT]
        at org.apache.doris.common.util.Daemon.run(Daemon.java:116) ~[doris-fe.jar:1.2-SNAPSHOT]
```

Using a comparison of the FE meta version to solve this problem. 2.1 fe
meta version is 129, use the fe version 131 used by
[pr](#32759) at that time as the
comparison value.
  • Loading branch information
sollhui authored and dataroaring committed Jun 26, 2024
1 parent dbf1953 commit 88b16a2
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.doris.load.loadv2;

import org.apache.doris.common.Config;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.load.EtlStatus;
Expand Down Expand Up @@ -139,10 +140,12 @@ public void write(DataOutput out) throws IOException {
out.writeBoolean(true);
failMsg.write(out);
}
Text.writeString(out, copyId);
Text.writeString(out, loadFilePaths);
Gson gson = new Gson();
Text.writeString(out, properties == null ? "" : gson.toJson(properties));
if (Config.isCloudMode()) {
Text.writeString(out, copyId);
Text.writeString(out, loadFilePaths);
Gson gson = new Gson();
Text.writeString(out, properties == null ? "" : gson.toJson(properties));
}
}

public void readFields(DataInput in) throws IOException {
Expand All @@ -157,12 +160,14 @@ public void readFields(DataInput in) throws IOException {
failMsg = new FailMsg();
failMsg.readFields(in);
}
copyId = Text.readString(in);
loadFilePaths = Text.readString(in);
String property = Text.readString(in);
properties = property.isEmpty() ? new HashMap<>()
: (new Gson().fromJson(property, new TypeToken<Map<String, String>>() {
}.getType()));
if (Config.isCloudMode()) {
copyId = Text.readString(in);
loadFilePaths = Text.readString(in);
String property = Text.readString(in);
properties = property.isEmpty() ? new HashMap<>()
: (new Gson().fromJson(property, new TypeToken<Map<String, String>>() {
}.getType()));
}
}

@Override
Expand Down

0 comments on commit 88b16a2

Please sign in to comment.