mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:04:13 +08:00
mdbx: minor refine logging inside fetch_sdb()
.
This commit is contained in:
parent
9230201ca9
commit
f57ca4fbf6
32
src/core.c
32
src/core.c
@ -13811,7 +13811,7 @@ static int mdbx_setup_dbx(MDBX_dbx *const dbx, const MDBX_db *const db,
|
||||
static int mdbx_fetch_sdb(MDBX_txn *txn, MDBX_dbi dbi) {
|
||||
MDBX_cursor_couple couple;
|
||||
if (unlikely(TXN_DBI_CHANGED(txn, dbi))) {
|
||||
mdbx_notice("dbi %u was changed", dbi);
|
||||
mdbx_notice("dbi %u was changed for txn %" PRIaTXN, dbi, txn->mt_txnid);
|
||||
return MDBX_BAD_DBI;
|
||||
}
|
||||
int rc = mdbx_cursor_init(&couple.outer, txn, MAIN_DBI);
|
||||
@ -13821,16 +13821,25 @@ static int mdbx_fetch_sdb(MDBX_txn *txn, MDBX_dbi dbi) {
|
||||
MDBX_dbx *const dbx = &txn->mt_dbxs[dbi];
|
||||
rc = mdbx_page_search(&couple.outer, &dbx->md_name, 0);
|
||||
if (unlikely(rc != MDBX_SUCCESS)) {
|
||||
mdbx_notice("dbi %u refs to inaccessible subDB (err %d)", dbi, rc);
|
||||
notfound:
|
||||
mdbx_notice("dbi %u refs to inaccessible subDB `%*s` for txn %" PRIaTXN
|
||||
" (err %d)",
|
||||
dbi, (int)dbx->md_name.iov_len,
|
||||
(const char *)dbx->md_name.iov_base, txn->mt_txnid, rc);
|
||||
return (rc == MDBX_NOTFOUND) ? MDBX_BAD_DBI : rc;
|
||||
}
|
||||
|
||||
MDBX_val data;
|
||||
struct node_result nsr = mdbx_node_search(&couple.outer, &dbx->md_name);
|
||||
if (unlikely(!nsr.exact))
|
||||
return MDBX_BAD_DBI;
|
||||
if (unlikely(!nsr.exact)) {
|
||||
rc = MDBX_NOTFOUND;
|
||||
goto notfound;
|
||||
}
|
||||
if (unlikely((node_flags(nsr.node) & (F_DUPDATA | F_SUBDATA)) != F_SUBDATA)) {
|
||||
mdbx_notice("dbi %u refs to not a named subDB (%s)", dbi, "wrong flags");
|
||||
mdbx_notice(
|
||||
"dbi %u refs to not a named subDB `%*s` for txn %" PRIaTXN " (%s)", dbi,
|
||||
(int)dbx->md_name.iov_len, (const char *)dbx->md_name.iov_base,
|
||||
txn->mt_txnid, "wrong flags");
|
||||
return MDBX_INCOMPATIBLE; /* not a named DB */
|
||||
}
|
||||
|
||||
@ -13841,7 +13850,10 @@ static int mdbx_fetch_sdb(MDBX_txn *txn, MDBX_dbi dbi) {
|
||||
return rc;
|
||||
|
||||
if (unlikely(data.iov_len != sizeof(MDBX_db))) {
|
||||
mdbx_notice("dbi %u refs to not a named subDB (%s)", dbi, "wrong rec-size");
|
||||
mdbx_notice(
|
||||
"dbi %u refs to not a named subDB `%*s` for txn %" PRIaTXN " (%s)", dbi,
|
||||
(int)dbx->md_name.iov_len, (const char *)dbx->md_name.iov_base,
|
||||
txn->mt_txnid, "wrong rec-size");
|
||||
return MDBX_INCOMPATIBLE; /* not a named DB */
|
||||
}
|
||||
|
||||
@ -13850,9 +13862,11 @@ static int mdbx_fetch_sdb(MDBX_txn *txn, MDBX_dbi dbi) {
|
||||
* have dropped and recreated the DB with other flags. */
|
||||
MDBX_db *const db = &txn->mt_dbs[dbi];
|
||||
if (unlikely((db->md_flags & DB_PERSISTENT_FLAGS) != md_flags)) {
|
||||
mdbx_notice("dbi %u refs to the re-created subDB with different flags "
|
||||
"(present 0x%x != wanna 0x%x)",
|
||||
dbi, db->md_flags & DB_PERSISTENT_FLAGS, md_flags);
|
||||
mdbx_notice("dbi %u refs to the re-created subDB `%*s` for txn %" PRIaTXN
|
||||
" with different flags (present 0x%X != wanna 0x%X)",
|
||||
dbi, (int)dbx->md_name.iov_len,
|
||||
(const char *)dbx->md_name.iov_base, txn->mt_txnid,
|
||||
db->md_flags & DB_PERSISTENT_FLAGS, md_flags);
|
||||
return MDBX_INCOMPATIBLE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user