This is an automated email from the ASF dual-hosted git repository. dataroaring 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 0fc0cc73836 [feat](binlog) Support rename rollup & partition binlogs (#44526) 0fc0cc73836 is described below commit 0fc0cc7383688e36d97b83ac70b59aea8130fb81 Author: walter <maoch...@selectdb.com> AuthorDate: Mon Nov 25 23:40:44 2024 +0800 [feat](binlog) Support rename rollup & partition binlogs (#44526) --- .../java/org/apache/doris/binlog/BinlogManager.java | 20 ++++++++++++++++++++ .../main/java/org/apache/doris/persist/EditLog.java | 8 ++++---- gensrc/thrift/FrontendService.thrift | 6 +++--- 3 files changed, 27 insertions(+), 7 deletions(-) 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 0fadfc2b542..3a033c98103 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 @@ -337,6 +337,26 @@ public class BinlogManager { addBinlog(dbId, tableIds, commitSeq, timestamp, type, data, false, info); } + public void addRollupRename(TableInfo info, long commitSeq) { + long dbId = info.getDbId(); + List<Long> tableIds = Lists.newArrayList(); + tableIds.add(info.getTableId()); + long timestamp = -1; + TBinlogType type = TBinlogType.RENAME_ROLLUP; + String data = info.toJson(); + addBinlog(dbId, tableIds, commitSeq, timestamp, type, data, false, info); + } + + public void addPartitionRename(TableInfo info, long commitSeq) { + long dbId = info.getDbId(); + List<Long> tableIds = Lists.newArrayList(); + tableIds.add(info.getTableId()); + long timestamp = -1; + TBinlogType type = TBinlogType.RENAME_PARTITION; + String data = info.toJson(); + addBinlog(dbId, tableIds, commitSeq, timestamp, type, data, false, info); + } + public void addModifyComment(ModifyCommentOperationLog info, long commitSeq) { long dbId = info.getDbId(); List<Long> tableIds = Lists.newArrayList(); 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 96f5d43aed2..1e70eb634b2 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 @@ -318,7 +318,7 @@ public class EditLog { case OperationType.OP_RENAME_PARTITION: { TableInfo info = (TableInfo) journal.getData(); env.replayRenamePartition(info); - env.getBinlogManager().addTableRename(info, logId); + env.getBinlogManager().addPartitionRename(info, logId); break; } case OperationType.OP_RENAME_COLUMN: { @@ -366,7 +366,7 @@ public class EditLog { case OperationType.OP_RENAME_ROLLUP: { TableInfo info = (TableInfo) journal.getData(); env.replayRenameRollup(info); - env.getCurrentEnv().getBinlogManager().addTableRename(info, logId); + env.getBinlogManager().addRollupRename(info, logId); break; } case OperationType.OP_LOAD_START: @@ -1591,13 +1591,13 @@ public class EditLog { public void logRollupRename(TableInfo tableInfo) { long logId = logEdit(OperationType.OP_RENAME_ROLLUP, tableInfo); LOG.info("log rollup rename, logId : {}, infos: {}", logId, tableInfo); - Env.getCurrentEnv().getBinlogManager().addTableRename(tableInfo, logId); + Env.getCurrentEnv().getBinlogManager().addRollupRename(tableInfo, logId); } public void logPartitionRename(TableInfo tableInfo) { long logId = logEdit(OperationType.OP_RENAME_PARTITION, tableInfo); LOG.info("log partition rename, logId : {}, infos: {}", logId, tableInfo); - Env.getCurrentEnv().getBinlogManager().addTableRename(tableInfo, logId); + Env.getCurrentEnv().getBinlogManager().addPartitionRename(tableInfo, logId); } public void logColumnRename(TableRenameColumnInfo info) { diff --git a/gensrc/thrift/FrontendService.thrift b/gensrc/thrift/FrontendService.thrift index c79931fe885..fc7f98e16e3 100644 --- a/gensrc/thrift/FrontendService.thrift +++ b/gensrc/thrift/FrontendService.thrift @@ -1194,6 +1194,8 @@ enum TBinlogType { REPLACE_TABLE = 18, MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES = 19, INDEX_CHANGE_JOB = 20, + RENAME_ROLLUP = 21, + RENAME_PARTITION = 22, // Keep some IDs for allocation so that when new binlog types are added in the // future, the changes can be picked back to the old versions without breaking @@ -1210,9 +1212,7 @@ enum TBinlogType { // MODIFY_XXX = 17, // MIN_UNKNOWN = 18, // UNKNOWN_3 = 19, - MIN_UNKNOWN = 21, - UNKNOWN_6 = 22, - UNKNOWN_7 = 23, + MIN_UNKNOWN = 23, UNKNOWN_8 = 24, UNKNOWN_9 = 25, UNKNOWN_10 = 26, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org