mdbx: backport - drop obsolete assertion & refine related code.

Fixes https://github.com/leo-yuriev/libmdbx/issues/69

Change-Id: I8f87a5cccc754405c338dd1357065dd066a3e3ce
This commit is contained in:
Leonid Yuriev 2019-11-18 16:49:02 +03:00
parent 53b60cdecc
commit 67a8f581b6

View File

@ -5339,7 +5339,6 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
mdbx_assert(env,
pending < METAPAGE(env, 0) || pending > METAPAGE(env, NUM_METAS));
mdbx_assert(env, (env->me_flags & (MDBX_RDONLY | MDBX_FATAL_ERROR)) == 0);
mdbx_assert(env, !META_IS_STEADY(head) || env->me_sync_pending != 0);
mdbx_assert(env, pending->mm_geo.next <= pending->mm_geo.now);
const size_t usedbytes = pgno_align2os_bytes(env, pending->mm_geo.next);
@ -5961,9 +5960,12 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower,
goto bailout;
head = /* base address could be changed */ mdbx_meta_head(env);
}
env->me_sync_pending += env->me_psize;
mdbx_meta_set_txnid(env, &meta, mdbx_meta_txnid_stable(env, head) + 1);
rc = mdbx_sync_locked(env, env->me_flags, &meta);
if (inside_txn)
env->me_txn->mt_flags |= MDBX_TXN_DIRTY;
else {
mdbx_meta_set_txnid(env, &meta, mdbx_meta_txnid_stable(env, head) + 1);
rc = mdbx_sync_locked(env, env->me_flags, &meta);
}
}
} else if (pagesize != (intptr_t)env->me_psize) {
mdbx_setup_pagesize(env, pagesize);
@ -6322,7 +6324,6 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, const int lck_rc) {
mdbx_ensure(env, mdbx_meta_eq(env, &meta, head));
mdbx_meta_set_txnid(env, &meta, txnid + 1);
env->me_sync_pending += env->me_psize;
err = mdbx_sync_locked(env, env->me_flags | MDBX_SHRINK_ALLOWED, &meta);
if (err) {
mdbx_info("error %d, while updating meta.geo: "
@ -13150,12 +13151,7 @@ int mdbx_canary_put(MDBX_txn *txn, const mdbx_canary *canary) {
txn->mt_canary.z = canary->z;
}
txn->mt_canary.v = txn->mt_txnid;
if ((txn->mt_flags & MDBX_TXN_DIRTY) == 0) {
MDBX_env *env = txn->mt_env;
txn->mt_flags |= MDBX_TXN_DIRTY;
env->me_sync_pending += env->me_psize;
}
txn->mt_flags |= MDBX_TXN_DIRTY;
return MDBX_SUCCESS;
}