diff --git a/drainer/syncer.go b/drainer/syncer.go index b7e6dd20f..a6cd2dbce 100644 --- a/drainer/syncer.go +++ b/drainer/syncer.go @@ -649,7 +649,9 @@ func skipDMLEvent(pv *pb.PrewriteValue, schema *Schema, filter *filter.Filter, b mutation.DeletedRows = mutation.DeletedRows[0:filteredDeleteIdx] } - muts = append(muts, mutation) + if len(mutation.Sequence) > 0 { + muts = append(muts, mutation) + } } pv.Mutations = muts diff --git a/drainer/syncer_test.go b/drainer/syncer_test.go index d5233fc86..efebf4249 100644 --- a/drainer/syncer_test.go +++ b/drainer/syncer_test.go @@ -54,7 +54,7 @@ func (s *syncerSuite) TestFilterTable(c *check.C) { // append one mutation that will not be dropped var keepID int64 = 2 schema.tableIDToName[keepID] = TableName{Schema: "keep", Table: "keep"} - pv.Mutations = append(pv.Mutations, pb.TableMutation{TableId: keepID}) + pv.Mutations = append(pv.Mutations, pb.TableMutation{TableId: keepID, Sequence: []pb.MutationType{pb.MutationType_Insert}}) ignore, err = skipDMLEvent(pv, schema, filter, nil) c.Assert(err, check.IsNil)