diff --git a/node/src/node.rs b/node/src/node.rs index 6a1f74f3a9..046cb62d99 100644 --- a/node/src/node.rs +++ b/node/src/node.rs @@ -16,7 +16,7 @@ use starcoin_account_service::{AccountEventService, AccountService, AccountStora use starcoin_block_relayer::BlockRelayer; use starcoin_chain_notify::ChainNotifyHandlerService; use starcoin_chain_service::ChainReaderService; -use starcoin_config::{check_open_fds_limit, NodeConfig}; +use starcoin_config::NodeConfig; use starcoin_executor::VMMetrics; use starcoin_genesis::{Genesis, GenesisError}; use starcoin_logger::prelude::*; @@ -57,8 +57,6 @@ 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, } @@ -279,7 +277,6 @@ 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 + RES_FDS)?; let mut storage_instance = StorageInstance::new_cache_and_db_instance( CacheStorage::new_with_capacity(config.storage.cache_size(), storage_metrics.clone()), DBStorage::new( diff --git a/storage/src/db_storage/mod.rs b/storage/src/db_storage/mod.rs index dd91a05fdd..366a3541dc 100644 --- a/storage/src/db_storage/mod.rs +++ b/storage/src/db_storage/mod.rs @@ -8,11 +8,13 @@ use crate::storage::{ColumnFamilyName, InnerStore, KeyCodec, ValueCodec, WriteOp use crate::{StorageVersion, DEFAULT_PREFIX_NAME}; use anyhow::{ensure, format_err, Error, Result}; use rocksdb::{Options, ReadOptions, WriteBatch as DBWriteBatch, WriteOptions, DB}; -use starcoin_config::RocksdbConfig; +use starcoin_config::{check_open_fds_limit, RocksdbConfig}; use std::collections::HashSet; use std::marker::PhantomData; use std::path::Path; +const RES_FDS: u64 = 4096; + #[allow(clippy::upper_case_acronyms)] pub struct DBStorage { db: DB, @@ -92,7 +94,7 @@ impl DBStorage { rocksdb_opts.create_missing_column_families(true); Self::open_inner(&rocksdb_opts, path, column_families.clone())? }; - + check_open_fds_limit(rocksdb_config.max_open_files as u64 + RES_FDS)?; Ok(DBStorage { db, cfs: column_families,