Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opt](binlog) Support modify comment binlog #39783 #43825

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;
Expand Down Expand Up @@ -375,6 +376,15 @@ public void addColumnRename(TableRenameColumnInfo info, long commitSeq) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,9 @@ public void logBatchRemoveTransactions(BatchRemoveTransactionsOperationV2 op) {
}

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@ public static ModifyCommentOperationLog read(DataInput in) throws IOException {
String json = Text.readString(in);
return GsonUtils.GSON.fromJson(json, ModifyCommentOperationLog.class);
}

public String toJson() {
return GsonUtils.GSON.toJson(this);
}
}
1 change: 1 addition & 0 deletions gensrc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ enum TBinlogType {
TRUNCATE_TABLE = 13,
RENAME_TABLE = 14,
RENAME_COLUMN = 15,
MODIFY_COMMENT = 16,
}

struct TBinlog {
Expand Down
Loading