My program suddenly started returning this error, "MDB_INVALID: File is not an LMDB file" whenever it tries to open the database file. It is running on Windows.
I made a copy of the database, compiled lmdb with MDB_DEBUG set to 2 and ran this program:
#include <stdio.h> #include "lmdb.h"
int main(int argc, char* argv[]) { int rc; MDB_env *env; rc = mdb_env_create(&env); printf("%d\n", rc); rc = mdb_env_open(env, "./brokedb", 0, 0644); printf("%d\n", rc); }
And it gave this output: 0 mdb_env_read_header:4040 page 0 not a meta page -30793
Does anyone know how this might have happened, and things to look for in my program that might have caused this? Is there a way to recover the data from the file?
Thanks.