diff --git a/ddl/ddl_worker.go b/ddl/ddl_worker.go index 6176abf696083..0a7937fe940f7 100644 --- a/ddl/ddl_worker.go +++ b/ddl/ddl_worker.go @@ -493,12 +493,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) } }