This is an automated email from the ASF dual-hosted git repository. gavinchou pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 1cb2a3fa665 [feature](binlog) Allow BarrierLog to wrap another binlog (#42993) 1cb2a3fa665 is described below commit 1cb2a3fa665b6edd6fdbcd53aba6c2037d2400c0 Author: walter <w41te...@gmail.com> AuthorDate: Thu Oct 31 21:05:11 2024 +0800 [feature](binlog) Allow BarrierLog to wrap another binlog (#42993) to make it work in the old Doris version without breaking compatibility --- .../java/org/apache/doris/persist/BarrierLog.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/BarrierLog.java b/fe/fe-core/src/main/java/org/apache/doris/persist/BarrierLog.java index ea849d217d7..2b4245b290c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/persist/BarrierLog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/persist/BarrierLog.java @@ -20,6 +20,7 @@ package org.apache.doris.persist; import org.apache.doris.common.io.Text; import org.apache.doris.common.io.Writable; import org.apache.doris.persist.gson.GsonUtils; +import org.apache.doris.thrift.TBinlogType; import com.google.gson.annotations.SerializedName; @@ -37,6 +38,11 @@ public class BarrierLog implements Writable { @SerializedName(value = "tableName") String tableName; + @SerializedName(value = "binlogType") + int binlogType; + @SerializedName(value = "binlog") + String binlog; + public BarrierLog() { } @@ -47,6 +53,28 @@ public class BarrierLog implements Writable { this.tableName = tableName; } + // A trick: Wrap the binlog as part of the BarrierLog so that it can work in + // the old Doris version without breaking the compatibility. + public BarrierLog(long dbId, long tableId, TBinlogType binlogType, String binlog) { + this.dbId = dbId; + this.tableId = tableId; + this.binlogType = binlogType.getValue(); + this.binlog = binlog; + } + + public boolean hasBinlog() { + return binlog != null; + } + + public String getBinlog() { + return binlog; + } + + // null is returned if binlog is not set or binlogType is not recognized. + public TBinlogType getBinlogType() { + return binlog == null ? null : TBinlogType.findByValue(binlogType); + } + public long getDbId() { return dbId; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org