Add "iter" state
This commit is contained in:
@@ -3040,6 +3040,7 @@ struct CheckJob {
|
||||
namespace check_point_read_state_machine {
|
||||
|
||||
CheckJob::continuation down_left_spine(CheckJob *job);
|
||||
CheckJob::continuation iter(CheckJob *job);
|
||||
|
||||
// Logically this is the same as performing firstGeq and then checking against
|
||||
// point or range version according to cmp, but this version short circuits as
|
||||
@@ -3049,7 +3050,10 @@ CheckJob::continuation begin(CheckJob *job) {
|
||||
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
||||
fprintf(stderr, "Check point read: %s\n", printable(key).c_str());
|
||||
#endif
|
||||
for (;; ++job->tls->point_read_iterations_accum) {
|
||||
return iter(job);
|
||||
}
|
||||
|
||||
CheckJob::continuation iter(CheckJob *job) {
|
||||
if (job->begin.size() == 0) {
|
||||
if (job->n->entryPresent) {
|
||||
job->setResult(job->n->entry.pointVersion <= job->readVersion);
|
||||
@@ -3080,8 +3084,8 @@ CheckJob::continuation begin(CheckJob *job) {
|
||||
|
||||
if (job->n->partialKeyLen > 0) {
|
||||
int commonLen = std::min<int>(job->n->partialKeyLen, job->begin.size());
|
||||
int i = longestCommonPrefix(job->n->partialKey(), job->begin.data(),
|
||||
commonLen);
|
||||
int i =
|
||||
longestCommonPrefix(job->n->partialKey(), job->begin.data(), commonLen);
|
||||
if (i < commonLen) {
|
||||
auto c = job->n->partialKey()[i] <=> job->begin[i];
|
||||
if (c > 0) {
|
||||
@@ -3097,8 +3101,7 @@ CheckJob::continuation begin(CheckJob *job) {
|
||||
}
|
||||
if (commonLen == job->n->partialKeyLen) {
|
||||
// partial key matches
|
||||
job->begin =
|
||||
job->begin.subspan(commonLen, job->begin.size() - commonLen);
|
||||
job->begin = job->begin.subspan(commonLen, job->begin.size() - commonLen);
|
||||
} else if (job->n->partialKeyLen > int(job->begin.size())) {
|
||||
// n is the first physical node greater than remaining, and there's no
|
||||
// eq node
|
||||
@@ -3111,7 +3114,9 @@ CheckJob::continuation begin(CheckJob *job) {
|
||||
job->setResult(true);
|
||||
return nullptr; // Done
|
||||
}
|
||||
}
|
||||
|
||||
++job->tls->point_read_iterations_accum;
|
||||
return iter;
|
||||
}
|
||||
|
||||
CheckJob::continuation down_left_spine(CheckJob *job) {
|
||||
|
Reference in New Issue
Block a user