Skip to content

Commit

Permalink
fix starcoin_db_export apply file limit (#3261)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg authored Mar 4, 2022
1 parent cd81149 commit 86d4dcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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>,
}
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions storage/src/db_storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 86d4dcd

Please sign in to comment.