From aa50e9646f5c2d37c6a504a9fff546da3b3a2fdb Mon Sep 17 00:00:00 2001 From: Oliver Nordbjerg Date: Mon, 28 Aug 2023 15:45:42 +0200 Subject: [PATCH] chore: increase max dbs --- crates/storage/db/src/implementation/mdbx/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index b9cce246938c..50a8e694ee7e 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -73,7 +73,10 @@ impl Env { }; let mut inner_env = Environment::new(); - inner_env.set_max_dbs(Tables::ALL.len()); + + // Note: We set max dbs to 256 here to allow for custom tables. This needs to be set on environment creation. + debug_assert!(Tables::ALL.len() <= 256, "number of tables exceed max dbs"); + inner_env.set_max_dbs(256); inner_env.set_geometry(Geometry { // Maximum database size of 4 terabytes size: Some(0..(4 * TERABYTE)), @@ -116,7 +119,7 @@ impl Env { LogLevel::Extra => 7, }); } else { - return Err(DatabaseError::LogLevelUnavailable(log_level)) + return Err(DatabaseError::LogLevelUnavailable(log_level)); } }