mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:24:12 +08:00
mdbx: fix mdbx_xcursor_init1() for prev created databases.
This commit is contained in:
parent
3afa4498fe
commit
b7fb9bdeb1
13
src/core.c
13
src/core.c
@ -13058,10 +13058,19 @@ static int mdbx_xcursor_init1(MDBX_cursor *mc, MDBX_node *node) {
|
||||
(mc->mc_db->md_flags & MDBX_DUPFIXED) ? fp->mp_leaf2_ksize : 0;
|
||||
}
|
||||
|
||||
if (unlikely(mx->mx_db.md_xsize != mc->mc_db->md_xsize)) {
|
||||
if (unlikely(mc->mc_db->md_xsize != 0))
|
||||
return MDBX_CORRUPTED;
|
||||
if (unlikely((mc->mc_db->md_flags & MDBX_DUPFIXED) == 0))
|
||||
return MDBX_CORRUPTED;
|
||||
if (unlikely(mx->mx_db.md_xsize < mc->mc_dbx->md_vlen_min ||
|
||||
mx->mx_db.md_xsize > mc->mc_dbx->md_vlen_max))
|
||||
return MDBX_CORRUPTED;
|
||||
mc->mc_db->md_xsize = mx->mx_db.md_xsize;
|
||||
mc->mc_dbx->md_vlen_min = mc->mc_dbx->md_vlen_max = mx->mx_db.md_xsize;
|
||||
}
|
||||
mx->mx_dbx.md_klen_min = mc->mc_dbx->md_vlen_min;
|
||||
mx->mx_dbx.md_klen_max = mc->mc_dbx->md_vlen_max;
|
||||
if (unlikely(mx->mx_db.md_xsize != mc->mc_db->md_xsize))
|
||||
return MDBX_CORRUPTED;
|
||||
|
||||
mdbx_debug("Sub-db -%u root page %" PRIaPGNO, mx->mx_cursor.mc_dbi,
|
||||
mx->mx_db.md_root);
|
||||
|
Loading…
x
Reference in New Issue
Block a user