#define MDB_CURSOR_FULL (-30787)
/** Page has not enough space - internal error */
#define MDB_PAGE_FULL (-30786)
- /** Database contents grew beyond environment mapsize */
+ /** Environment mapsize was changed by another process */
#define MDB_MAP_RESIZED (-30785)
/** MDB_INCOMPATIBLE: Operation and DB incompatible, or DB flags changed */
#define MDB_INCOMPATIBLE (-30784)
#endif
if ((rc = mdb_page_flush(txn, 0)) ||
- (rc = mdb_env_sync(env, 0)) ||
(rc = mdb_env_write_meta(txn)))
goto fail;
static int
mdb_env_write_meta(MDB_txn *txn)
{
- MDB_env *env;
+ MDB_env *env = txn->mt_env;
MDB_meta meta, metab, *mp;
off_t off;
int rc, len, toggle;
int r2;
#endif
+ /* Sync data and previous metapage before writing a new metapage */
+ if ((rc = mdb_env_sync(env, 0)) != MDB_SUCCESS)
+ return rc;
+
toggle = txn->mt_txnid & 1;
DPRINTF(("writing meta page %d for root page %"Z"u",
toggle, txn->mt_dbs[MAIN_DBI].md_root));
- env = txn->mt_env;
mp = env->me_metas[toggle];
if (env->me_flags & MDB_WRITEMAP) {