From b77304672a238d9b738abc375c0ccd9c06a39c44 Mon Sep 17 00:00:00 2001 From: crazycs520 Date: Fri, 3 Apr 2020 15:40:45 +0800 Subject: [PATCH] ddl: skip write binlog when ddl type is update tiflash replica status Signed-off-by: crazycs520 --- ddl/ddl_worker.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ddl/ddl_worker.go b/ddl/ddl_worker.go index 6e9b0b1dec514..a6de4696903b4 100644 --- a/ddl/ddl_worker.go +++ b/ddl/ddl_worker.go @@ -511,12 +511,26 @@ func (w *worker) handleDDLJobQueue(d *ddlCtx) error { } } +func skipWriteBinlog(job *model.Job) bool { + switch job.Type { + // ActionUpdateTiFlashReplicaStatus is a TiDB internal DDL, + // it's used to update table's TiFlash replica available status. + case model.ActionUpdateTiFlashReplicaStatus: + return true + } + + return false +} + func writeBinlog(binlogCli *pumpcli.PumpsClient, txn kv.Transaction, job *model.Job) { if job.IsDone() || job.IsRollbackDone() || // When this column is in the "delete only" and "delete reorg" states, the binlog of "drop column" has not been written yet, // but the column has been removed from the binlog of the write operation. // So we add this binlog to enable downstream components to handle DML correctly in this schema state. (job.Type == model.ActionDropColumn && job.SchemaState == model.StateDeleteOnly) { + if skipWriteBinlog(job) { + return + } binloginfo.SetDDLBinlog(binlogCli, txn, job.ID, int32(job.SchemaState), job.Query) } }