mdbx-test: fix keygen-related issue.

Fixes https://github.com/erthink/libmdbx/issues/127
This commit is contained in:
Leonid Yuriev 2021-07-23 01:27:02 +03:00
parent e731260056
commit c2fa453725
3 changed files with 11 additions and 9 deletions

View File

@ -14,7 +14,6 @@ ChangeLog
- [Get rid of dirty-pages list in MDBX_WRITEMAP mode](https://github.com/erthink/libmdbx/issues/193).
- [Large/Overflow pages accounting for dirty-room](https://github.com/erthink/libmdbx/issues/192).
- [Support for RAW devices](https://github.com/erthink/libmdbx/issues/124).
- [Test framework issue](https://github.com/erthink/libmdbx/issues/127).
- [Support MessagePack for Keys & Values](https://github.com/erthink/libmdbx/issues/115).
- [Engage new terminology](https://github.com/erthink/libmdbx/issues/137).
- Finalize C++ API (few typos and trivia bugs are still likely for now).
@ -61,6 +60,7 @@ Fixes:
- Fixed [using bad meta-pages if DB was partially/recoverable corrupted](https://github.com/erthink/libmdbx/issues/217).
- Fixed extra `noexcept` for `buffer::&assign_reference()`.
- Fixed `bootid` generation on Windows for case of change system' time.
- Fixed [test framework keygen-related issue](https://github.com/erthink/libmdbx/issues/127).
## v0.10.1 at 2021-06-01

View File

@ -243,23 +243,25 @@ void maker::seek2end(serial_t &serial) const {
serial = actor_params::serial_mask(mapping.width) - 1;
}
bool maker::increment(serial_t &serial, int delta) const {
bool maker::increment(serial_t &serial, int64_t delta) const {
if (serial > actor_params::serial_mask(mapping.width)) {
log_extra("keygen-increment: %" PRIu64 " > %" PRIu64 ", overflow", serial,
actor_params::serial_mask(mapping.width));
return false;
}
serial_t target = serial + (int64_t)delta;
serial_t target = serial + delta;
if (target > actor_params::serial_mask(mapping.width) ||
((delta > 0) ? target < serial : target > serial)) {
log_extra("keygen-increment: %" PRIu64 "%-d => %" PRIu64 ", overflow",
log_extra("keygen-increment: %" PRIu64 "%-" PRId64 " => %" PRIu64
", overflow",
serial, delta, target);
return false;
}
log_extra("keygen-increment: %" PRIu64 "%-d => %" PRIu64 ", continue", serial,
delta, target);
log_extra("keygen-increment: %" PRIu64 "%-" PRId64 " => %" PRIu64
", continue",
serial, delta, target);
serial = target;
return true;
}

View File

@ -130,8 +130,8 @@ public:
bool is_unordered() const;
void seek2end(serial_t &serial) const;
bool increment(serial_t &serial, int delta) const;
bool increment_key_part(serial_t &serial, int delta,
bool increment(serial_t &serial, int64_t delta) const;
bool increment_key_part(serial_t &serial, int64_t delta,
bool reset_value_part = true) const {
if (reset_value_part) {
serial_t value_part_bits = ((serial_t(1) << mapping.split) - 1);
@ -139,7 +139,7 @@ public:
if (delta >= 0)
serial &= ~value_part_bits;
}
return increment(serial, delta << mapping.split);
return increment(serial, int64_t(uint64_t(delta) << mapping.split));
}
};