automerge
This commit is contained in:
@ -177,7 +177,7 @@ impl Blockstore {
|
|||||||
fs::create_dir_all(&ledger_path)?;
|
fs::create_dir_all(&ledger_path)?;
|
||||||
let blockstore_path = ledger_path.join(BLOCKSTORE_DIRECTORY);
|
let blockstore_path = ledger_path.join(BLOCKSTORE_DIRECTORY);
|
||||||
|
|
||||||
adjust_ulimit_nofile();
|
adjust_ulimit_nofile()?;
|
||||||
|
|
||||||
// Open the database
|
// Open the database
|
||||||
let mut measure = Measure::start("open");
|
let mut measure = Measure::start("open");
|
||||||
@ -2780,10 +2780,12 @@ pub fn make_chaining_slot_entries(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
fn adjust_ulimit_nofile() {}
|
fn adjust_ulimit_nofile() -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn adjust_ulimit_nofile() {
|
fn adjust_ulimit_nofile() -> Result<()> {
|
||||||
// Rocks DB likes to have many open files. The default open file descriptor limit is
|
// Rocks DB likes to have many open files. The default open file descriptor limit is
|
||||||
// usually not enough
|
// usually not enough
|
||||||
let desired_nofile = 65000;
|
let desired_nofile = 65000;
|
||||||
@ -2811,11 +2813,13 @@ fn adjust_ulimit_nofile() {
|
|||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
error!("On mac OS you may need to run |sudo launchctl limit maxfiles 65536 200000| first");
|
error!("On mac OS you may need to run |sudo launchctl limit maxfiles 65536 200000| first");
|
||||||
}
|
}
|
||||||
|
return Err(BlockstoreError::UnableToSetOpenFileDescriptorLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
nofile = get_nofile();
|
nofile = get_nofile();
|
||||||
}
|
}
|
||||||
info!("Maximum open file descriptors: {}", nofile.rlim_cur);
|
info!("Maximum open file descriptors: {}", nofile.rlim_cur);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -55,6 +55,7 @@ pub enum BlockstoreError {
|
|||||||
Serialize(#[from] Box<bincode::ErrorKind>),
|
Serialize(#[from] Box<bincode::ErrorKind>),
|
||||||
FsExtraError(#[from] fs_extra::error::Error),
|
FsExtraError(#[from] fs_extra::error::Error),
|
||||||
SlotCleanedUp,
|
SlotCleanedUp,
|
||||||
|
UnableToSetOpenFileDescriptorLimit,
|
||||||
}
|
}
|
||||||
pub type Result<T> = std::result::Result<T, BlockstoreError>;
|
pub type Result<T> = std::result::Result<T, BlockstoreError>;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user