From f96e2ca04c71edc54f9b05bd276b7b0b1945b7f9 Mon Sep 17 00:00:00 2001 From: lucklove Date: Fri, 26 Feb 2021 11:36:55 +0800 Subject: [PATCH] Fix checkpoint compare --- pkg/checkpoint/checkpoint.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/checkpoint/checkpoint.go b/pkg/checkpoint/checkpoint.go index c62a17fd23..c0751a560a 100644 --- a/pkg/checkpoint/checkpoint.go +++ b/pkg/checkpoint/checkpoint.go @@ -207,7 +207,7 @@ next_set: if cf.eq == nil { continue } - if !cf.eq(ma[cf.field], mb[cf.field]) { + if !contains(ma, cf.field) || !contains(mb, cf.field) || !cf.eq(ma[cf.field], mb[cf.field]) { continue next_set } } @@ -215,3 +215,8 @@ next_set: } return false } + +func contains(m map[string]interface{}, f string) bool { + _, ok := m[f] + return ok +}