[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: MDB_INVALID: File is not an LMDB file
- To: Chris Trenkamp <chris@christrenkamp.com>
- Subject: Re: MDB_INVALID: File is not an LMDB file
- From: Ervin Hegedüs <airween@gmail.com>
- Date: Wed, 30 May 2018 23:13:47 +0200
- Cc: openldap-technical@openldap.org
- Content-disposition: inline
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kWCWohz8Hhn+pFhz8eDflF7jO+/8KQjpToPZvgUuVyU=; b=s2RrK/xenEZA4vxP140hwJmiELm4XtUhjbEbmdR0EZf+k5XyJPY0lbUmHnVzFFKJTb YEmVviMksOqcsNIxHM4HBDq6y/hDLFGZPm1WCrVqEWNQNRPXjcmwLFyBSMUZQw1qytVA HgVqHdMuoyE/gntmeNwmRpn6rO5rhJYaB+i9J25bskTd+T6HQq7KggAccryQZ0W5g+Vm x06q/5SILvVXYl+3mXmR01p4n8aC/WzLRstesmv+xtjB+aZ4iDil/tvJDAT2vNuyMG6n NcvkZeMhSdXCvZOmZWYxC3OW82JD6RW5U/Rbx604Uxgylw/SyhOYEev0Dn23Bssmk+V0 eXDg==
- In-reply-to: <CAMp-Go1rUWM4FEkdW61WQBJ+asyHncPuaQudqVMFqji2wPmWOw@mail.gmail.com>
- References: <CAMp-Go1rUWM4FEkdW61WQBJ+asyHncPuaQudqVMFqji2wPmWOw@mail.gmail.com>
- User-agent: Mutt/1.5.24 (2015-08-30)
Hi,
On Wed, May 30, 2018 at 11:10:41AM -0400, Chris Trenkamp wrote:
> 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?
I think you should use this form of mdb_env_open:
mdb_env_open(env, "./brokedb", MDB_WRITEMAP | MDB_NOSUBDIR, 0664);
see:
http://www.lmdb.tech/doc/group__mdb.html
CTRL-F - mdb_env_open -> parameters -> flags
Regards,
a.