Full_Name: Engin Lee Version: LMDB 0.9.14 2014/9/30 OS: Linux URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (59.124.230.221)
Hi,
I found a strange issue: If I try to compact a empty database to another one, there would be an assert if I try to put something into the compacted one. Here is my testing code:
==== #include <stdio.h>A#23include "lmdb.h"
int main(void) { MDB_env * env; mdb_env_create(&env); int r = mdb_env_open(env, "temp", MDB_CREATE, 0664); if (r == MDB_SUCCESS) { r = mdb_env_copy2(env, ".", MDB_CP_COMPACT); if (r != MDB_SUCCESS) printf("?COMPACT: %s", mdb_strerror(r)); } else { printf("?COMPACT: %s", mdb_strerror(r)); } mdb_env_close(env);
mdb_env_create(&env); r = mdb_env_open(env, ".", 0, 0664); if (r == MDB_SUCCESS) { MDB_txn *txn; mdb_txn_begin(env, NULL, 0, &txn); MDB_dbi hDB; r = mdb_dbi_open(txn, NULL, MDB_CREATE, &B%B); if (r != MDB_SUCCESS) printf("?OPEN: %s", mdb_strerror(r));
MDB_val key, data; key.mv_data = (void*)"test"; key.mv_size = sizeof("test"); data.mv_data = (void*)"test"; data.mv_size = sizeof("test"); int rc = mdb_put(txn, hDB, &key, &data, 0); if (rc != MDB_SUCCESS) printf("?PUT: %s", mdb_strerror(rc)); mdb_txn_commit(txn); } else { printf("?COMPACT: %s", mdb_strerror(r)); } mdb_env_close(env);
return 0; } ==== output: # ./a.out mdb.c:5115: Assertion 'root > 1' failed in mdb_page_search() Aborted ====
Could you solve this issue or tell me if my usage is wrong? Thank you.