forked from weaselab/conflict-set
Assert that interleaved and sequential report same metrics
This commit is contained in:
+17
-11
@@ -763,6 +763,7 @@ struct ReadContext {
|
||||
int64_t conflicts_accum = 0;
|
||||
int64_t too_olds_accum = 0;
|
||||
ConflictSet::Impl *impl;
|
||||
bool operator==(const ReadContext &) const = default; // GCOVR_EXCL_LINE
|
||||
};
|
||||
|
||||
// A type that's plumbed along the non-const call tree. Same lifetime as
|
||||
@@ -3131,14 +3132,14 @@ template <class NodeT> void iter(CheckJob *job, CheckContext *context) {
|
||||
}
|
||||
}
|
||||
|
||||
++context->readContext.point_read_iterations_accum;
|
||||
|
||||
if (job->maxV <= job->readVersion) {
|
||||
job->setResult(true);
|
||||
++context->readContext.point_read_short_circuit_accum;
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
|
||||
++context->readContext.point_read_iterations_accum;
|
||||
|
||||
if (job->begin.size() == 0) [[unlikely]] {
|
||||
if (n->entryPresent) {
|
||||
job->setResult(n->entry.pointVersion <= job->readVersion);
|
||||
@@ -3260,14 +3261,14 @@ template <class NodeT> void iter(CheckJob *job, CheckContext *context) {
|
||||
}
|
||||
}
|
||||
|
||||
++context->readContext.prefix_read_iterations_accum;
|
||||
|
||||
if (job->maxV <= job->readVersion) {
|
||||
job->setResult(true);
|
||||
++context->readContext.prefix_read_short_circuit_accum;
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
|
||||
++context->readContext.prefix_read_iterations_accum;
|
||||
|
||||
if (job->begin.size() == 0) [[unlikely]] {
|
||||
job->setResult(job->maxV <= job->readVersion);
|
||||
MUSTTAIL return complete(job, context);
|
||||
@@ -3398,14 +3399,14 @@ void common_prefix_iter(CheckJob *job, CheckContext *context) {
|
||||
job->remaining.size() -
|
||||
(1 + child->partialKeyLen));
|
||||
|
||||
++context->readContext.range_read_iterations_accum;
|
||||
|
||||
if (job->maxV <= job->readVersion) {
|
||||
job->setResult(true);
|
||||
++context->readContext.range_read_short_circuit_accum;
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
|
||||
++context->readContext.range_read_iterations_accum;
|
||||
|
||||
if (job->remaining.size() == 0) {
|
||||
job->continuation = done_common_prefix_iter<NodeT>;
|
||||
MUSTTAIL return job->continuation(job, context);
|
||||
@@ -3588,13 +3589,13 @@ PRESERVE_NONE void left_side_iter(CheckJob *job, CheckContext *context) {
|
||||
}
|
||||
}
|
||||
|
||||
++context->readContext.range_read_iterations_accum;
|
||||
|
||||
if (job->maxV <= job->readVersion) {
|
||||
job->continuation = done_left_side_iter;
|
||||
MUSTTAIL return job->continuation(job, context);
|
||||
}
|
||||
|
||||
++context->readContext.range_read_iterations_accum;
|
||||
|
||||
if (job->remaining.size() == 0) {
|
||||
assert(job->maxV > job->readVersion);
|
||||
job->setResult(false);
|
||||
@@ -3733,8 +3734,7 @@ PRESERVE_NONE void right_side_iter(CheckJob *job, CheckContext *context) {
|
||||
MUSTTAIL return job->continuation(job, context);
|
||||
}
|
||||
|
||||
if (n->entryPresent && (n->entry.pointVersion > job->readVersion ||
|
||||
n->entry.rangeVersion > job->readVersion)) {
|
||||
if (n->entryPresent && n->entry.pointVersion > job->readVersion) {
|
||||
job->setResult(false);
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
@@ -3745,6 +3745,11 @@ PRESERVE_NONE void right_side_iter(CheckJob *job, CheckContext *context) {
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
|
||||
if (n->entryPresent && n->entry.rangeVersion > job->readVersion) {
|
||||
job->setResult(false);
|
||||
MUSTTAIL return complete(job, context);
|
||||
}
|
||||
|
||||
auto c = getChild(job->n, job->remaining[0]);
|
||||
Node *child = c;
|
||||
if (child == nullptr) {
|
||||
@@ -4279,9 +4284,10 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
||||
Arena arena;
|
||||
auto *results2 = new (arena) Result[count];
|
||||
CheckContext context2;
|
||||
context.readContext.impl = this;
|
||||
context2.readContext.impl = this;
|
||||
useSequential(reads, results2, count, context2);
|
||||
assert(memcmp(result, results2, count) == 0);
|
||||
assert(context.readContext == context2.readContext);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user