File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ pub struct Config {
4444 /// Tx cache size in megabytes
4545 pub tx_cache_size : usize ,
4646
47+ /// Enable compaction during initial sync
48+ ///
49+ /// By default compaction is off until initial sync is finished for performance reasons,
50+ /// however, this requires much more disk space.
51+ pub initial_sync_compaction : bool ,
52+
4753 #[ cfg( feature = "liquid" ) ]
4854 pub parent_network : BNetwork ,
4955 #[ cfg( feature = "liquid" ) ]
@@ -412,6 +418,7 @@ impl Config {
412418 cors : m. value_of ( "cors" ) . map ( |s| s. to_string ( ) ) ,
413419 precache_scripts : m. value_of ( "precache_scripts" ) . map ( |s| s. to_string ( ) ) ,
414420 tx_cache_size : value_t_or_exit ! ( m, "tx_cache_size" , usize ) ,
421+ initial_sync_compaction : m. is_present ( "initial_sync_compaction" ) ,
415422
416423 #[ cfg( feature = "liquid" ) ]
417424 parent_network,
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl DB {
9090 db_opts. set_compression_type ( rocksdb:: DBCompressionType :: Snappy ) ;
9191 db_opts. set_target_file_size_base ( 1_073_741_824 ) ;
9292 db_opts. set_write_buffer_size ( 256 << 20 ) ;
93- db_opts. set_disable_auto_compactions ( true ) ; // for initial bulk load
93+ db_opts. set_disable_auto_compactions ( !config . initial_sync_compaction ) ; // for initial bulk load
9494
9595 // db_opts.set_advise_random_on_open(???);
9696 db_opts. set_compaction_readahead_size ( 1 << 20 ) ;
You can’t perform that action at this time.
0 commit comments