From 5170b0197f2c2a6dec80c8aa8b48ceb9956b8ccc Mon Sep 17 00:00:00 2001 From: amyangfei Date: Thu, 9 Apr 2020 23:47:35 +0800 Subject: [PATCH] kv-client: ignore commit log without prewrite before initialized --- cdc/kv/client.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cdc/kv/client.go b/cdc/kv/client.go index 228b43f95ea..164b5a8fd81 100644 --- a/cdc/kv/client.go +++ b/cdc/kv/client.go @@ -1055,9 +1055,13 @@ func (s *eventFeedSession) singleEventFeed( for _, cacheEntry := range matcher.cachedCommit { value, ok := matcher.matchRow(cacheEntry) if !ok { - return atomic.LoadUint64(&checkpointTs), - errors.Errorf("prewrite not match, key: %b, start-ts: %d", - cacheEntry.GetKey(), cacheEntry.GetStartTs()) + // when cdc receives a commit log without a corresponding + // prewrite log before initialized, a committed log with + // the same key and start-ts must have been received. + log.Info("ignore commit event without prewrite", + zap.Binary("key", cacheEntry.GetKey()), + zap.Uint64("ts", cacheEntry.GetStartTs())) + continue } revent, err := assembleCommitEvent(cacheEntry, value) if err != nil {