mdbx: add error-logging to mdbx_page_get().

Change-Id: I6a1a95ec6fc73aa7bf28875a89b1dd6c02ef5164
This commit is contained in:
Leo Yuriev 2018-10-04 16:00:27 +03:00 committed by Leonid Yuriev
parent 7a3c8743f3
commit 0f82db941b

View File

@ -6927,13 +6927,20 @@ mapped:
p = pgno2page(env, pgno);
done:
if (unlikely(p->mp_pgno != pgno))
if (unlikely(p->mp_pgno != pgno)) {
mdbx_error("mismatch pgno %" PRIaPGNO " (actual) != %" PRIaPGNO
" (expected)",
p->mp_pgno, pgno);
return MDBX_CORRUPTED;
}
if (unlikely(p->mp_upper < p->mp_lower ||
PAGEHDRSZ + p->mp_upper > env->me_psize) &&
!IS_OVERFLOW(p))
!IS_OVERFLOW(p)) {
mdbx_error("invalid page lower(%u)/upper(%u), pg-limit %u", p->mp_lower,
p->mp_upper, env->me_psize - PAGEHDRSZ);
return MDBX_CORRUPTED;
}
/* TODO: more checks here, including p->mp_validator */
*ret = p;