mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 17:24:12 +08:00
mdbx-chk: use txnid as record-number for GC.
This commit is contained in:
parent
2ff1096c49
commit
0b870648af
@ -409,14 +409,12 @@ static int handle_freedb(const uint64_t record_number, const MDBX_val *key,
|
|||||||
problem_add("entry", record_number, "wrong txn-id", "%" PRIaTXN, txnid);
|
problem_add("entry", record_number, "wrong txn-id", "%" PRIaTXN, txnid);
|
||||||
else {
|
else {
|
||||||
if (data->iov_len < sizeof(pgno_t) || data->iov_len % sizeof(pgno_t))
|
if (data->iov_len < sizeof(pgno_t) || data->iov_len % sizeof(pgno_t))
|
||||||
problem_add("entry", record_number, "wrong idl size", "%" PRIuPTR,
|
problem_add("entry", txnid, "wrong idl size", "%" PRIuPTR, data->iov_len);
|
||||||
data->iov_len);
|
|
||||||
size_t number = (data->iov_len >= sizeof(pgno_t)) ? *iptr++ : 0;
|
size_t number = (data->iov_len >= sizeof(pgno_t)) ? *iptr++ : 0;
|
||||||
if (number < 1 || number > MDBX_PNL_MAX)
|
if (number < 1 || number > MDBX_PNL_MAX)
|
||||||
problem_add("entry", record_number, "wrong idl length", "%" PRIuPTR,
|
problem_add("entry", txnid, "wrong idl length", "%" PRIuPTR, number);
|
||||||
number);
|
|
||||||
else if ((number + 1) * sizeof(pgno_t) > data->iov_len) {
|
else if ((number + 1) * sizeof(pgno_t) > data->iov_len) {
|
||||||
problem_add("entry", record_number, "trimmed idl",
|
problem_add("entry", txnid, "trimmed idl",
|
||||||
"%" PRIuSIZE " > %" PRIuSIZE " (corruption)",
|
"%" PRIuSIZE " > %" PRIuSIZE " (corruption)",
|
||||||
(number + 1) * sizeof(pgno_t), data->iov_len);
|
(number + 1) * sizeof(pgno_t), data->iov_len);
|
||||||
number = data->iov_len / sizeof(pgno_t) - 1;
|
number = data->iov_len / sizeof(pgno_t) - 1;
|
||||||
@ -424,7 +422,7 @@ static int handle_freedb(const uint64_t record_number, const MDBX_val *key,
|
|||||||
/* LY: allow gap upto one page. it is ok
|
/* LY: allow gap upto one page. it is ok
|
||||||
* and better than shink-and-retry inside mdbx_update_gc() */
|
* and better than shink-and-retry inside mdbx_update_gc() */
|
||||||
envstat.ms_psize)
|
envstat.ms_psize)
|
||||||
problem_add("entry", record_number, "extra idl space",
|
problem_add("entry", txnid, "extra idl space",
|
||||||
"%" PRIuSIZE " < %" PRIuSIZE " (minor, not a trouble)",
|
"%" PRIuSIZE " < %" PRIuSIZE " (minor, not a trouble)",
|
||||||
(number + 1) * sizeof(pgno_t), data->iov_len);
|
(number + 1) * sizeof(pgno_t), data->iov_len);
|
||||||
|
|
||||||
@ -438,13 +436,13 @@ static int handle_freedb(const uint64_t record_number, const MDBX_val *key,
|
|||||||
for (unsigned i = 0; i < number; ++i) {
|
for (unsigned i = 0; i < number; ++i) {
|
||||||
const pgno_t pgno = iptr[i];
|
const pgno_t pgno = iptr[i];
|
||||||
if (pgno < NUM_METAS || pgno > envinfo.mi_last_pgno)
|
if (pgno < NUM_METAS || pgno > envinfo.mi_last_pgno)
|
||||||
problem_add("entry", record_number, "wrong idl entry",
|
problem_add("entry", txnid, "wrong idl entry",
|
||||||
"%u < %" PRIaPGNO " < %" PRIu64, NUM_METAS, pgno,
|
"%u < %" PRIaPGNO " < %" PRIu64, NUM_METAS, pgno,
|
||||||
envinfo.mi_last_pgno);
|
envinfo.mi_last_pgno);
|
||||||
else {
|
else {
|
||||||
if (MDBX_PNL_DISORDERED(prev, pgno)) {
|
if (MDBX_PNL_DISORDERED(prev, pgno)) {
|
||||||
bad = " [bad sequence]";
|
bad = " [bad sequence]";
|
||||||
problem_add("entry", record_number, "bad sequence",
|
problem_add("entry", txnid, "bad sequence",
|
||||||
"%" PRIaPGNO " <> %" PRIaPGNO, prev, pgno);
|
"%" PRIaPGNO " <> %" PRIaPGNO, prev, pgno);
|
||||||
}
|
}
|
||||||
if (walk.pagemap && walk.pagemap[pgno]) {
|
if (walk.pagemap && walk.pagemap[pgno]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user