Skip to content

Commit

Permalink
Sync lmdb.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Oct 30, 2015
1 parent f61b5cc commit bd1b241
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/lmdb/mdb.c
Expand Up @@ -214,6 +214,12 @@ union semun {
#define ESECT
#endif

#ifdef _MSC_VER
#define CALL_CONV WINAPI
#else
#define CALL_CONV
#endif

/** @defgroup internal LMDB Internals
* @{
*/
Expand Down Expand Up @@ -3748,7 +3754,7 @@ mdb_env_write_meta(MDB_txn *txn)
toggle, txn->mt_dbs[MAIN_DBI].md_root));

env = txn->mt_env;
flags = txn->mt_flags & env->me_flags;
flags = txn->mt_flags | env->me_flags;
mp = env->me_metas[toggle];
mapsize = env->me_metas[toggle ^ 1]->mm_mapsize;
/* Persist any increases of mapsize config */
Expand Down Expand Up @@ -7965,13 +7971,12 @@ mdb_rebalance(MDB_cursor *mc)
indx_t oldki;

if (IS_BRANCH(mc->mc_pg[mc->mc_top])) {
minkeys = 1;
minkeys = 2;
thresh = 1;
} else {
minkeys = 2;
minkeys = 1;
thresh = FILL_THRESHOLD;
}
minkeys = 1 + (IS_BRANCH(mc->mc_pg[mc->mc_top]));
DPRINTF(("rebalancing %s page %"Z"u (has %u keys, %.1f%% full)",
IS_LEAF(mc->mc_pg[mc->mc_top]) ? "leaf" : "branch",
mdb_dbg_pgno(mc->mc_pg[mc->mc_top]), NUMKEYS(mc->mc_pg[mc->mc_top]),
Expand Down Expand Up @@ -8111,7 +8116,6 @@ mdb_rebalance(MDB_cursor *mc)
* move one key from it. Otherwise we should try to merge them.
* (A branch page must never have less than 2 keys.)
*/
minkeys = 1 + (IS_BRANCH(mn.mc_pg[mn.mc_top]));
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) {
rc = mdb_node_move(&mn, mc);
if (mc->mc_ki[mc->mc_top-1]) {
Expand Down Expand Up @@ -8725,7 +8729,7 @@ typedef struct mdb_copy {
} mdb_copy;

/** Dedicated writer thread for compacting copy. */
static THREAD_RET ESECT
static THREAD_RET ESECT CALL_CONV
mdb_env_copythr(void *arg)
{
mdb_copy *my = arg;
Expand Down

0 comments on commit bd1b241

Please sign in to comment.