Skip to content

Commit

Permalink
ddl: skip write binlog when ddl type is update tiflash replica status (
Browse files Browse the repository at this point in the history
…pingcap#16049)

Signed-off-by: crazycs520 <[email protected]>
  • Loading branch information
crazycs520 authored and sre-bot committed Apr 7, 2020
1 parent f2ebfa2 commit 0f7659d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 0f7659d

Please sign in to comment.