CoreyKaylor / Lightning.NET

.NET library for LMDB key-value store
Other
397 stars 82 forks source link

NativeMethods.ExecuteHelper (System.Func`2[T,TResult] action, System.Func`2[T,TResult] shouldThrow) LightningDB.LightningException: MDB_DBS_FULL: Environment maxdbs limit reached #126

Closed Perry89 closed 4 years ago

Perry89 commented 4 years ago

Hi guys,

NativeMethods.ExecuteHelper (System.Func2[T,TResult] action, System.Func2[T,TResult] shouldThrow) LightningDB.LightningException: MDB_DBS_FULL: Environment maxdbs limit reached

I've had that issue for a while. I thought initally that it has something to do with dabase running out of space and not expanding itself, but that is not the case. I am using package in Xamarin.Forms project.

AlgorithmsAreCool commented 4 years ago

So you are encountering this exception? If so, it means that the maximum number of Databases has been reached.

When opening the environment, you should set LightningEnvironment.MaxDatabases to something higher.



using (var env = new LightningEnvironment("pathtofolder"))
{
    env.MaxDatabases = 100; // <-- set this to something high
    env.Open();

        //do things here
}
Perry89 commented 4 years ago

Thank you for the reply!

By maximum number of databases, you mean an actual amount of databases locally? or amount of tables? If first than I only have 1 database.

AlgorithmsAreCool commented 4 years ago

LMDB terminology is kinda weird. A LMDB "Database" is what most people would call a table (A list of key/value records) A LMDB "Environment" is what most people would call a Database (A collection of "Tables")

LMDB has the ability to limit the number of databases in an environment. Hosting a "very high" number of DBs in a single environment can have a performance impact (more memory usage), but in general you don't need to worry about it.

Perry89 commented 4 years ago

OMG that explain it. Thank you for your help, we do indeed have a lot of tables.