Avoid a call to VersionedMap::ViewAtVersion::lower_bound (#6606)

* Avoid a call to VersionedMap::ViewAtVersion::lower_bound in some cases

* Avoid lower_bound in both cases
This commit is contained in:
Andrew Noyes 2022-03-17 09:03:20 -07:00 committed by GitHub
parent 6f57935eb4
commit d39b881045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);