From 55ece805e45aa1403bcdb95e5c50f1a593430e2a Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sun, 15 Apr 2018 01:37:23 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20include=20empty/deleted=20value?= =?UTF-8?q?s=20from=20KV=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When looping over a range of KV items, it should ignore items which have been set to NULL and whose latest version has therefore been deleted. --- kvs/mysql/tx.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kvs/mysql/tx.go b/kvs/mysql/tx.go index 0741619c..26e533ce 100644 --- a/kvs/mysql/tx.go +++ b/kvs/mysql/tx.go @@ -114,7 +114,9 @@ func many(res *sql.Rows, err error) ([]kvs.KV, error) { if err != nil { return nil, &kvs.DBError{} } - out = append(out, kv) + if kv.val != nil { + out = append(out, kv) + } } if err = res.Err(); err != nil {