mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 23:39:19 +08:00
mdbx: 'unlikely' for DB_STALE.
This commit is contained in:
parent
acdaeeab5c
commit
cf8ef06ebc
9
mdb.c
9
mdb.c
@ -5763,7 +5763,7 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags)
|
||||
return MDB_BAD_TXN;
|
||||
} else {
|
||||
/* Make sure we're using an up-to-date root */
|
||||
if (*mc->mc_dbflag & DB_STALE) {
|
||||
if (unlikely(*mc->mc_dbflag & DB_STALE)) {
|
||||
MDB_cursor mc2;
|
||||
if (unlikely(TXN_DBI_CHANGED(mc->mc_txn, mc->mc_dbi)))
|
||||
return MDB_BAD_DBI;
|
||||
@ -7826,15 +7826,14 @@ mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx)
|
||||
mc->mc_pg[0] = 0;
|
||||
mc->mc_flags = 0;
|
||||
mc->mc_ki[0] = 0;
|
||||
mc->mc_xcursor = NULL;
|
||||
if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) {
|
||||
mdb_tassert(txn, mx != NULL);
|
||||
mx->mx_cursor.mc_signature = MDBX_MC_SIGNATURE;
|
||||
mc->mc_xcursor = mx;
|
||||
mdb_xcursor_init0(mc);
|
||||
} else {
|
||||
mc->mc_xcursor = NULL;
|
||||
}
|
||||
if (*mc->mc_dbflag & DB_STALE) {
|
||||
if (unlikely(*mc->mc_dbflag & DB_STALE)) {
|
||||
mdb_page_search(mc, NULL, MDB_PS_ROOTONLY);
|
||||
}
|
||||
}
|
||||
@ -10226,7 +10225,7 @@ mdbx_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *arg, size_t bytes)
|
||||
if (unlikely(txn->mt_flags & MDB_TXN_BLOCKED))
|
||||
return MDB_BAD_TXN;
|
||||
|
||||
if (txn->mt_dbflags[dbi] & DB_STALE) {
|
||||
if (unlikely(txn->mt_dbflags[dbi] & DB_STALE)) {
|
||||
MDB_cursor mc;
|
||||
MDB_xcursor mx;
|
||||
/* Stale, must read the DB's root. cursor_init does it for us. */
|
||||
|
Loading…
Reference in New Issue
Block a user