mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:04:12 +08:00
mdbx: minor refine logging inside page_alloc()
.
This commit is contained in:
parent
f57ca4fbf6
commit
548d0a50b8
28
src/core.c
28
src/core.c
@ -6808,14 +6808,24 @@ no_loose:
|
|||||||
mdbx_assert(env,
|
mdbx_assert(env,
|
||||||
mdbx_pnl_check4assert(txn->tw.reclaimed_pglist,
|
mdbx_pnl_check4assert(txn->tw.reclaimed_pglist,
|
||||||
txn->mt_next_pgno - MDBX_ENABLE_REFUND));
|
txn->mt_next_pgno - MDBX_ENABLE_REFUND));
|
||||||
if (likely(!(flags & MDBX_ALLOC_FAKE)))
|
int level;
|
||||||
|
const char *what;
|
||||||
|
if (likely(!(flags & MDBX_ALLOC_FAKE))) {
|
||||||
txn->mt_flags |= MDBX_TXN_ERROR;
|
txn->mt_flags |= MDBX_TXN_ERROR;
|
||||||
if (num != 1 || ret.err != MDBX_NOTFOUND)
|
level = MDBX_LOG_ERROR;
|
||||||
mdbx_notice("alloc %u pages failed, flags 0x%x, errcode %d", num, flags,
|
what = "pages";
|
||||||
ret.err);
|
} else if (flags & MDBX_ALLOC_SLOT) {
|
||||||
else
|
level = MDBX_LOG_NOTICE;
|
||||||
mdbx_trace("alloc %u pages failed, flags 0x%x, errcode %d", num, flags,
|
what = "gc-slot/backlog";
|
||||||
ret.err);
|
} else {
|
||||||
|
level = MDBX_LOG_NOTICE;
|
||||||
|
what = "backlog-pages";
|
||||||
|
}
|
||||||
|
if (mdbx_log_enabled(level))
|
||||||
|
mdbx_debug_log(level, __func__, __LINE__,
|
||||||
|
"unable alloc %u %s, flags 0x%x, errcode %d\n", num, what,
|
||||||
|
flags, ret.err);
|
||||||
|
|
||||||
mdbx_assert(env, ret.err != MDBX_SUCCESS);
|
mdbx_assert(env, ret.err != MDBX_SUCCESS);
|
||||||
ret.page = NULL;
|
ret.page = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
@ -6825,8 +6835,8 @@ done:
|
|||||||
mdbx_assert(env, !(flags & MDBX_ALLOC_SLOT));
|
mdbx_assert(env, !(flags & MDBX_ALLOC_SLOT));
|
||||||
mdbx_ensure(env, pgno >= NUM_METAS);
|
mdbx_ensure(env, pgno >= NUM_METAS);
|
||||||
if (unlikely(flags & MDBX_ALLOC_FAKE)) {
|
if (unlikely(flags & MDBX_ALLOC_FAKE)) {
|
||||||
mdbx_debug("return NULL-page for %u pages of %s mode", num,
|
mdbx_debug("return NULL-page for %u pages %s allocation", num,
|
||||||
"MDBX_ALLOC_FAKE");
|
"gc-slot/backlog");
|
||||||
ret.page = NULL;
|
ret.page = NULL;
|
||||||
ret.err = MDBX_SUCCESS;
|
ret.err = MDBX_SUCCESS;
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user