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
readBegin = readBeginTemp = keyAfter( result.data.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.
//if (track) printf("skip clear\n");
readBegin = vStart->getEndKey(); // next disk read should start at the end of the clear
} else if (vEnd && vEnd->isClearTo()) {
ASSERT(vEnd->getEndKey() > readBegin);
readBegin = vEnd->getEndKey();
vStart = vEnd;
++vStart;
} else { // Otherwise, continue at readEnd
//if (track) printf("continue\n");
readBegin = readEnd;
} else {
ASSERT(limit<=0 || *pLimitBytes<=0 || readEnd == range.end);
break;
}
}
// all but the last item are less than *pLimitBytes