diff --git a/config/src/storage_config.rs b/config/src/storage_config.rs index ce45b9c0c4..6f249e5d6e 100644 --- a/config/src/storage_config.rs +++ b/config/src/storage_config.rs @@ -37,14 +37,9 @@ pub struct RocksdbConfig { } impl RocksdbConfig { - #[cfg(any(target_os = "macos"))] + #[cfg(unix)] fn default_max_open_files() -> i32 { - 4096 - } - - #[cfg(any(target_os = "linux"))] - fn default_max_open_files() -> i32 { - 4096 + 40960 } #[cfg(windows)] diff --git a/node/src/node.rs b/node/src/node.rs index 2974f106fa..3230f1045a 100644 --- a/node/src/node.rs +++ b/node/src/node.rs @@ -57,6 +57,8 @@ use starcoin_types::system_events::SystemStarted; use std::sync::Arc; use std::time::{Duration, SystemTime}; +const RES_FDS: u64 = 4096; + pub struct NodeService { registry: ServiceRef<RegistryService>, } @@ -277,7 +279,7 @@ impl NodeService { "rocksdb max open files {}", config.storage.rocksdb_config().max_open_files ); - check_open_fds_limit(config.storage.rocksdb_config().max_open_files as u64)?; + check_open_fds_limit(config.storage.rocksdb_config().max_open_files as u64 + RES_FDS)?; let storage = Storage::new(StorageInstance::new_cache_and_db_instance( CacheStorage::new_with_capacity(config.storage.cache_size(), storage_metrics.clone()), DBStorage::new(