This repository was archived by the owner on Jan 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ impl Blockstore {
180
180
fs:: create_dir_all ( & ledger_path) ?;
181
181
let blockstore_path = ledger_path. join ( BLOCKSTORE_DIRECTORY ) ;
182
182
183
- adjust_ulimit_nofile ( ) ;
183
+ adjust_ulimit_nofile ( ) ? ;
184
184
185
185
// Open the database
186
186
let mut measure = Measure :: start ( "open" ) ;
@@ -2987,10 +2987,12 @@ pub fn make_chaining_slot_entries(
2987
2987
}
2988
2988
2989
2989
#[ cfg( not( unix) ) ]
2990
- fn adjust_ulimit_nofile ( ) { }
2990
+ fn adjust_ulimit_nofile ( ) -> Result < ( ) > {
2991
+ Ok ( ( ) )
2992
+ }
2991
2993
2992
2994
#[ cfg( unix) ]
2993
- fn adjust_ulimit_nofile ( ) {
2995
+ fn adjust_ulimit_nofile ( ) -> Result < ( ) > {
2994
2996
// Rocks DB likes to have many open files. The default open file descriptor limit is
2995
2997
// usually not enough
2996
2998
let desired_nofile = 65000 ;
@@ -3018,11 +3020,13 @@ fn adjust_ulimit_nofile() {
3018
3020
if cfg ! ( target_os = "macos" ) {
3019
3021
error ! ( "On mac OS you may need to run |sudo launchctl limit maxfiles 65536 200000| first" ) ;
3020
3022
}
3023
+ return Err ( BlockstoreError :: UnableToSetOpenFileDescriptorLimit ) ;
3021
3024
}
3022
3025
3023
3026
nofile = get_nofile ( ) ;
3024
3027
}
3025
3028
info ! ( "Maximum open file descriptors: {}" , nofile. rlim_cur) ;
3029
+ Ok ( ( ) )
3026
3030
}
3027
3031
3028
3032
#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ pub enum BlockstoreError {
56
56
FsExtraError ( #[ from] fs_extra:: error:: Error ) ,
57
57
SlotCleanedUp ,
58
58
UnpackError ( #[ from] UnpackError ) ,
59
+ UnableToSetOpenFileDescriptorLimit ,
59
60
}
60
61
pub type Result < T > = std:: result:: Result < T , BlockstoreError > ;
61
62
You can’t perform that action at this time.
0 commit comments