|
|
@ -957,6 +957,8 @@ struct MDB_env { |
|
|
|
MDB_ID2 me_dirty_list[MDB_IDL_UM_SIZE]; |
|
|
|
MDB_ID2 me_dirty_list[MDB_IDL_UM_SIZE]; |
|
|
|
/** Max number of freelist items that can fit in a single overflow page */ |
|
|
|
/** Max number of freelist items that can fit in a single overflow page */ |
|
|
|
unsigned int me_maxfree_1pg; |
|
|
|
unsigned int me_maxfree_1pg; |
|
|
|
|
|
|
|
/** Max size of a node on a page */ |
|
|
|
|
|
|
|
unsigned int me_nodemax; |
|
|
|
#ifdef _WIN32 |
|
|
|
#ifdef _WIN32 |
|
|
|
HANDLE me_rmutex; /* Windows mutexes don't reside in shared mem */ |
|
|
|
HANDLE me_rmutex; /* Windows mutexes don't reside in shared mem */ |
|
|
|
HANDLE me_wmutex; |
|
|
|
HANDLE me_wmutex; |
|
|
@ -2897,6 +2899,7 @@ mdb_env_open2(MDB_env *env) |
|
|
|
} |
|
|
|
} |
|
|
|
env->me_psize = meta.mm_psize; |
|
|
|
env->me_psize = meta.mm_psize; |
|
|
|
env->me_maxfree_1pg = (env->me_psize - PAGEHDRSZ) / sizeof(pgno_t) - 1; |
|
|
|
env->me_maxfree_1pg = (env->me_psize - PAGEHDRSZ) / sizeof(pgno_t) - 1; |
|
|
|
|
|
|
|
env->me_nodemax = (env->me_psize - PAGEHDRSZ) / MDB_MINKEYS; |
|
|
|
|
|
|
|
|
|
|
|
env->me_maxpg = env->me_mapsize / env->me_psize; |
|
|
|
env->me_maxpg = env->me_mapsize / env->me_psize; |
|
|
|
|
|
|
|
|
|
|
@ -5037,8 +5040,7 @@ reuse: |
|
|
|
} |
|
|
|
} |
|
|
|
offset += offset & 1; |
|
|
|
offset += offset & 1; |
|
|
|
if (NODESIZE + sizeof(indx_t) + NODEKSZ(leaf) + NODEDSZ(leaf) + |
|
|
|
if (NODESIZE + sizeof(indx_t) + NODEKSZ(leaf) + NODEDSZ(leaf) + |
|
|
|
offset >= (mc->mc_txn->mt_env->me_psize - PAGEHDRSZ) / |
|
|
|
offset >= mc->mc_txn->mt_env->me_nodemax) { |
|
|
|
MDB_MINKEYS) { |
|
|
|
|
|
|
|
/* yes, convert it */ |
|
|
|
/* yes, convert it */ |
|
|
|
dummy.md_flags = 0; |
|
|
|
dummy.md_flags = 0; |
|
|
|
if (mc->mc_db->md_flags & MDB_DUPFIXED) { |
|
|
|
if (mc->mc_db->md_flags & MDB_DUPFIXED) { |
|
|
@ -5353,7 +5355,7 @@ mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data) |
|
|
|
size_t sz; |
|
|
|
size_t sz; |
|
|
|
|
|
|
|
|
|
|
|
sz = LEAFSIZE(key, data); |
|
|
|
sz = LEAFSIZE(key, data); |
|
|
|
if (sz >= env->me_psize / MDB_MINKEYS) { |
|
|
|
if (sz >= env->me_nodemax) { |
|
|
|
/* put on overflow page */ |
|
|
|
/* put on overflow page */ |
|
|
|
sz -= data->mv_size - sizeof(pgno_t); |
|
|
|
sz -= data->mv_size - sizeof(pgno_t); |
|
|
|
} |
|
|
|
} |
|
|
@ -5378,7 +5380,7 @@ mdb_branch_size(MDB_env *env, MDB_val *key) |
|
|
|
size_t sz; |
|
|
|
size_t sz; |
|
|
|
|
|
|
|
|
|
|
|
sz = INDXSIZE(key); |
|
|
|
sz = INDXSIZE(key); |
|
|
|
if (sz >= env->me_psize / MDB_MINKEYS) { |
|
|
|
if (sz >= env->me_nodemax) { |
|
|
|
/* put on overflow page */ |
|
|
|
/* put on overflow page */ |
|
|
|
/* not implemented */ |
|
|
|
/* not implemented */ |
|
|
|
/* sz -= key->size - sizeof(pgno_t); */ |
|
|
|
/* sz -= key->size - sizeof(pgno_t); */ |
|
|
@ -5446,7 +5448,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, |
|
|
|
if (F_ISSET(flags, F_BIGDATA)) { |
|
|
|
if (F_ISSET(flags, F_BIGDATA)) { |
|
|
|
/* Data already on overflow page. */ |
|
|
|
/* Data already on overflow page. */ |
|
|
|
node_size += sizeof(pgno_t); |
|
|
|
node_size += sizeof(pgno_t); |
|
|
|
} else if (node_size + data->mv_size >= mc->mc_txn->mt_env->me_psize / MDB_MINKEYS) { |
|
|
|
} else if (node_size + data->mv_size >= mc->mc_txn->mt_env->me_nodemax) { |
|
|
|
int ovpages = OVPAGES(data->mv_size, mc->mc_txn->mt_env->me_psize); |
|
|
|
int ovpages = OVPAGES(data->mv_size, mc->mc_txn->mt_env->me_psize); |
|
|
|
int rc; |
|
|
|
int rc; |
|
|
|
/* Put data on overflow page. */ |
|
|
|
/* Put data on overflow page. */ |
|
|
|