fix starcoin_db_export apply file limit
MODIFY
node/src/node.rs
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<RegistryService>,
}
@@ -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(

MODIFY
storage/src/db_storage/mod.rs
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,

fix starcoin_db_export apply file limit (#3261)