From 851c104813026a534467c2a42b4b6c8ea248a9d8 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 30 Sep 2019 13:32:42 +0000 Subject: [PATCH] batcheval: fix empty-span fast-path in AddSSTable collision check Given that the iterator has an upper-bound, it should simply be invalid after seeking past the span if empty. Release note: none. Release justification: small, low-risk fix for bug in new code that made it slower than expected. --- pkg/storage/batcheval/cmd_add_sstable.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/storage/batcheval/cmd_add_sstable.go b/pkg/storage/batcheval/cmd_add_sstable.go index e83fe14c4375..a536e04fc5c0 100644 --- a/pkg/storage/batcheval/cmd_add_sstable.go +++ b/pkg/storage/batcheval/cmd_add_sstable.go @@ -204,7 +204,7 @@ func checkForKeyCollisions( existingDataIter.Seek(mvccStartKey) if ok, err := existingDataIter.Valid(); err != nil { return emptyMVCCStats, errors.Wrap(err, "checking for key collisions") - } else if ok && !existingDataIter.UnsafeKey().Less(mvccEndKey) { + } else if !ok { // Target key range is empty, so it is safe to ingest. return emptyMVCCStats, nil }