Commit 2c70d043 authored by Howard Chu's avatar Howard Chu
Browse files

Fix mdb_drop() if not deleting the DB record

parent 77b1017b
......@@ -5342,10 +5342,19 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
mdb_cursor_close(mc);
return rc;
if (del) {
/* Can't delete the main DB */
if (del && dbi > MAIN_DBI) {
rc = mdb_del(txn, MAIN_DBI, &mc->mc_dbx->md_name, NULL);
if (!rc)
mdb_close(txn->mt_env, dbi);
} else {
txn->mt_dbflags[dbi] |= DB_DIRTY;
txn->mt_dbs[dbi].md_depth = 0;
txn->mt_dbs[dbi].md_branch_pages = 0;
txn->mt_dbs[dbi].md_leaf_pages = 0;
txn->mt_dbs[dbi].md_overflow_pages = 0;
txn->mt_dbs[dbi].md_entries = 0;
txn->mt_dbs[dbi].md_root = P_INVALID;
}
mdb_cursor_close(mc);
return rc;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment