mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 22:24:13 +08:00
mdbx-test: don't fail on key-space overflow.
Change-Id: I22a8cb359849c4c02cd393047cb7ea33974607fd
This commit is contained in:
parent
fa3adb759a
commit
aaf49bb816
@ -65,8 +65,10 @@ bool testcase_hill::run() {
|
|||||||
|
|
||||||
while (should_continue()) {
|
while (should_continue()) {
|
||||||
const keygen::serial_t a_serial = serial_count;
|
const keygen::serial_t a_serial = serial_count;
|
||||||
if (unlikely(!keyvalue_maker.increment(serial_count, 1)))
|
if (unlikely(!keyvalue_maker.increment(serial_count, 1))) {
|
||||||
failure("uphill: unexpected key-space overflow");
|
log_notice("uphill: unexpected key-space overflow");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const keygen::serial_t b_serial = serial_count;
|
const keygen::serial_t b_serial = serial_count;
|
||||||
assert(b_serial > a_serial);
|
assert(b_serial > a_serial);
|
||||||
@ -186,7 +188,7 @@ bool testcase_hill::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (serial_count > 0) {
|
while (serial_count > 1) {
|
||||||
if (unlikely(!keyvalue_maker.increment(serial_count, -2)))
|
if (unlikely(!keyvalue_maker.increment(serial_count, -2)))
|
||||||
failure("downhill: unexpected key-space underflow");
|
failure("downhill: unexpected key-space underflow");
|
||||||
|
|
||||||
|
@ -184,7 +184,8 @@ bool maker::increment(serial_t &serial, int delta) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
serial_t target = serial + (int64_t)delta;
|
serial_t target = serial + (int64_t)delta;
|
||||||
if (target > mask(mapping.width)) {
|
if (target > mask(mapping.width) ||
|
||||||
|
((delta > 0) ? target < serial : target > serial)) {
|
||||||
log_extra("keygen-increment: %" PRIu64 "%-d => %" PRIu64 ", overflow",
|
log_extra("keygen-increment: %" PRIu64 "%-d => %" PRIu64 ", overflow",
|
||||||
serial, delta, target);
|
serial, delta, target);
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,8 +132,10 @@ bool testcase_ttl::run() {
|
|||||||
failure_perror("mdbx_put(head)", err);
|
failure_perror("mdbx_put(head)", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!keyvalue_maker.increment(serial, 1)))
|
if (unlikely(!keyvalue_maker.increment(serial, 1))) {
|
||||||
failure("uphill: unexpected key-space overflow");
|
log_notice("ttl: unexpected key-space overflow");
|
||||||
|
goto bailout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = breakable_restart();
|
err = breakable_restart();
|
||||||
if (unlikely(err != MDBX_SUCCESS)) {
|
if (unlikely(err != MDBX_SUCCESS)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user