This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new d62a765190f [opt](binlog) Support modify comment binlog #39783 (#43825)
d62a765190f is described below
commit d62a765190f296f5b69ade870f2874b81b9a1304
Author: walter <[email protected]>
AuthorDate: Wed Nov 13 12:33:51 2024 +0800
[opt](binlog) Support modify comment binlog #39783 (#43825)
cherry pick from #39783
Co-authored-by: smallx <[email protected]>
---
.../src/main/java/org/apache/doris/binlog/BinlogManager.java | 10 ++++++++++
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java | 4 +++-
.../org/apache/doris/persist/ModifyCommentOperationLog.java | 4 ++++
gensrc/thrift/FrontendService.thrift | 1 +
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
index 47b0bb3c767..4f67f663879 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
@@ -29,6 +29,7 @@ import org.apache.doris.persist.BarrierLog;
import org.apache.doris.persist.BatchModifyPartitionsInfo;
import org.apache.doris.persist.BinlogGcInfo;
import org.apache.doris.persist.DropPartitionInfo;
+import org.apache.doris.persist.ModifyCommentOperationLog;
import org.apache.doris.persist.ModifyTablePropertyOperationLog;
import org.apache.doris.persist.ReplacePartitionOperationLog;
import org.apache.doris.persist.TableAddOrDropColumnsInfo;
@@ -375,6 +376,15 @@ public class BinlogManager {
addBarrierLog(log, commitSeq);
}
+ public void addModifyComment(ModifyCommentOperationLog info, long
commitSeq) {
+ long dbId = info.getDbId();
+ long tableId = info.getTblId();
+ TBinlogType type = TBinlogType.MODIFY_COMMENT;
+ String data = info.toJson();
+ BarrierLog log = new BarrierLog(dbId, tableId, type, data);
+ addBarrierLog(log, commitSeq);
+ }
+
// get the dropped partitions of the db.
public List<Long> getDroppedPartitions(long dbId) {
lock.readLock().lock();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
index 963a1e06c8a..7fdac2ebfaa 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
@@ -1739,7 +1739,9 @@ public class EditLog {
}
public void logModifyComment(ModifyCommentOperationLog op) {
- logEdit(OperationType.OP_MODIFY_COMMENT, op);
+ long logId = logEdit(OperationType.OP_MODIFY_COMMENT, op);
+ LOG.info("log modify comment, logId : {}, infos: {}", logId, op);
+ Env.getCurrentEnv().getBinlogManager().addModifyComment(op, logId);
}
public void logCreateSqlBlockRule(SqlBlockRule rule) {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyCommentOperationLog.java
b/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyCommentOperationLog.java
index 0b6f1f98450..f9bb7f5084e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyCommentOperationLog.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/persist/ModifyCommentOperationLog.java
@@ -94,4 +94,8 @@ public class ModifyCommentOperationLog implements Writable {
String json = Text.readString(in);
return GsonUtils.GSON.fromJson(json, ModifyCommentOperationLog.class);
}
+
+ public String toJson() {
+ return GsonUtils.GSON.toJson(this);
+ }
}
diff --git a/gensrc/thrift/FrontendService.thrift
b/gensrc/thrift/FrontendService.thrift
index 575643030e1..2739b1c2096 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1029,6 +1029,7 @@ enum TBinlogType {
TRUNCATE_TABLE = 13,
RENAME_TABLE = 14,
RENAME_COLUMN = 15,
+ MODIFY_COMMENT = 16,
}
struct TBinlog {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]