diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 90fc288bf5..421304c716 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -2469,7 +2469,17 @@ ACTOR Future<GetKeyValuesReply> readRange(StorageServer* data, else readBegin = range.begin; - vCurrent = view.lower_bound(readBegin); + if (vCurrent) { + // We can get first greater or equal from the result of lastLessOrEqual + if (vCurrent.key() != readBegin) { + ++vCurrent; + } + } else { + // There's nothing less than or equal to readBegin in view, so + // begin() is the first thing greater than readBegin, or end(). + // Either way that's the correct result for lower_bound. + vCurrent = view.begin(); + } while (limit > 0 && *pLimitBytes > 0 && readBegin < range.end) { ASSERT(!vCurrent || vCurrent.key() >= readBegin);