Skip to content

Commit

Permalink
Skip the tiflash job.
Browse files Browse the repository at this point in the history
test:
1. create table t(id int);
2. ALTER TABLE t SET TIFLASH REPLICA 3 LOCATION LABELS "rack", "host", "abc";            // model.ActionSetTiFlashReplica
3. curl -X POST -d '{"id":45,"region_count":3,"flash_region_count":3}' https://127.0.0.1:10080/tiflash/replica  // model.ActionUpdateTiFlashReplicaStatus
4. performance write on table t and check can still replicate.

ref: pingcap/tidb#12453
  • Loading branch information
july2993 authored and sre-bot committed Apr 3, 2020
1 parent 9e5d5ec commit 0d86948
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drainer/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ func (s *Schema) handlePreviousDDLJobIfNeed(version int64) error {
return nil
}

func skipFlash(job *model.Job) bool {
switch job.Type {
case model.ActionUpdateTiFlashReplicaStatus: // empty job.Query
return true
case model.ActionSetTiFlashReplica:
return true
}

return false
}

// handleDDL has four return values,
// the first value[string]: the schema name
// the second value[string]: the table name
Expand Down
4 changes: 4 additions & 0 deletions drainer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ ForLoop:
} else if jobID > 0 {
log.Debug("get ddl binlog job", zap.Stringer("job", b.job))

if skipFlash(b.job) {
continue
}

// Notice: the version of DDL Binlog we receive are Monotonically increasing
// DDL (with version 10, commit ts 100) -> DDL (with version 9, commit ts 101) would never happen
s.schema.addJob(b.job)
Expand Down

0 comments on commit 0d86948

Please sign in to comment.