Skip to content

Commit

Permalink
kv client: ignore prewrite event if value is empty (pingcap#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoppro authored Apr 10, 2020
1 parent 966672c commit 6ef44cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cdc/kv/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ func newMatcher() *matcher {
}

func (m *matcher) putPrewriteRow(row *cdcpb.Event_Row) {
m.unmatchedValue[newMatchKey(row)] = row.GetValue()
key := newMatchKey(row)
value := row.GetValue()
// tikv may send a prewrite event with empty value
// here we need to avoid the invalid prewrite event overwrite the value
if _, exist := m.unmatchedValue[key]; exist && len(value) == 0 {
return
}
m.unmatchedValue[key] = value
}

func (m *matcher) matchRow(row *cdcpb.Event_Row) ([]byte, bool) {
Expand Down

0 comments on commit 6ef44cc

Please sign in to comment.