jimwwalker and daverigby MB-29816: btree_lookup is skipping a key
In btree_lookup_inner when processing a KV node a while loop
exits too soon.

The loop condition looks at the distance into the node and
the index into the input keys.

  while (bufpos < nodebuflen && current < end)

In the test we have many input keys, but 1 key in the
KV node.

The test has keys which after sorting means the first evaluated
key is not in the btree, so we will iterate once and revaluate
the loop condition. However bufpos = 50 and nodebuflen = 50
as we have read a key, however the second iteration doesn't
want to read a new key, it just wants to evaluate the second
input key. However bufpos < nodebuflen cause the loop to end
and we return with no callback for our key.

The commit updates the loop condition so that we keep going
whilst we have input keys and we explictly break from the
loop if an attempt to read a new key occurs and we have
no more buf space.

Change-Id: Ib93e11b5d5f03211f4a13301b64f20c7664b4ecd
Reviewed-on: http://review.couchbase.org/95669
Well-Formed: Build Bot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Tim Bradgate <tim.bradgate@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
Latest commit 3b4c35d Jun 13, 2018
Permalink
..
Failed to load latest commit information.
btree_purge Refactor: rename macro try to try_to Mar 28, 2017
mapreduce Merge tag 'v4.5.1-MP1' Dec 10, 2016
views MB-27758 Use aligned access for array of double values Feb 16, 2018
bulk.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
changecount.py Better path handling in Python tests Jan 22, 2014
changessincefilter.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
compact.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
corrupt.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
couchstoredoctest.h Port couchstore_testapp to the gtest framework. Aug 11, 2015
couchstoretest.cc MB-26047:[7-c] Switch over to using MicrosecondHistogram Nov 2, 2017
couchstoretest.h CBCS-2: Add latency collector for Couchstore APIs Mar 31, 2017
documents.cc Avoid undefined behaviour for zero-length Document May 4, 2018
documents.h couchstore_tests: Fix Windows compile failure Aug 11, 2015
dropdel.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
file_deduper_tests.c Use cb_mktemp for deduper-test and merger-test Feb 13, 2017
file_merger_tests.c Use cb_mktemp for deduper-test and merger-test Feb 13, 2017
file_sorter_tests.c Merge tag 'v4.5.1-MP1' Dec 10, 2016
gtest_internal_tests.cc MB-25509: Add periodic sync()ing after N bytes written Aug 14, 2017
gtest_tests.cc MB-29816: btree_lookup is skipping a key Jun 15, 2018
large.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
largefile.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
localdoc.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
macros.h Refactor: rename macro try to try_to Mar 28, 2017
purge.py Better path handling in Python tests Jan 22, 2014
rewind.py Better path handling in Python tests Jan 22, 2014
test_fileops.cc MB-25509: Add periodic sync()ing after N bytes written Aug 14, 2017
test_fileops.h MB-25509: Add periodic sync()ing after N bytes written Aug 14, 2017
testapp.c MB-20285 Revert startup snapshot blob which hampers performance Jul 29, 2016
testlib.lua Return a non-zero exit code if a Lua test fails Mar 31, 2016
wrapped_fileops_test.cc CBCS-4, MB-19995: Make read buffer unit size and count configurable Feb 27, 2017
wrapped_fileops_test.h Fix compiler warnings in test code Mar 30, 2017