Step 2 of fixing storage server range reads: eliminate some unnecessary iterations in the forward case

This commit is contained in:
A.J. Beamon 2020-02-06 12:58:59 -08:00
parent 7037edc3f8
commit 1c61957ca1
1 changed files with 7 additions and 6 deletions

View File

@ -1140,13 +1140,14 @@ ACTOR Future<GetKeyValuesReply> readRange( StorageServer* data, Version version,
if (more) { // if there might be more data on disk, begin reading right after the last key read if (more) { // if there might be more data on disk, begin reading right after the last key read
readBegin = readBeginTemp = keyAfter( result.data.end()[-1].key ); readBegin = readBeginTemp = keyAfter( result.data.end()[-1].key );
ASSERT( limit<=0 || *pLimitBytes<=0 || result.data.end()[-1].key == atStorageVersion.end()[-1].key ); ASSERT( limit<=0 || *pLimitBytes<=0 || result.data.end()[-1].key == atStorageVersion.end()[-1].key );
} else if (vStart && vStart->isClearTo()){ // if vStart is a clear, skip it. } else if (vEnd && vEnd->isClearTo()) {
//if (track) printf("skip clear\n"); ASSERT(vEnd->getEndKey() > readBegin);
readBegin = vStart->getEndKey(); // next disk read should start at the end of the clear readBegin = vEnd->getEndKey();
vStart = vEnd;
++vStart; ++vStart;
} else { // Otherwise, continue at readEnd } else {
//if (track) printf("continue\n"); ASSERT(limit<=0 || *pLimitBytes<=0 || readEnd == range.end);
readBegin = readEnd; break;
} }
} }
// all but the last item are less than *pLimitBytes // all but the last item are less than *pLimitBytes