@@ -228,6 +228,8 @@ pub struct GlobalDatabaseOptions {
228228 pub wal_ttl_seconds : Option < u64 > ,
229229 /// The size limit for the WAL in MB.
230230 pub wal_size_limit_mb : Option < u64 > ,
231+ /// The maximum number of background jobs (compactions + flushes).
232+ pub max_background_jobs : Option < i32 > ,
231233 /// Whether to enable statistics.
232234 pub enable_statistics : bool ,
233235 /// If true, databases are opened using `OptimisticTransactionDB` instead of the standard DB.
@@ -244,7 +246,8 @@ impl Default for GlobalDatabaseOptions {
244246 keep_log_file_num : Some ( 50 ) ,
245247 wal_ttl_seconds : Some ( 60 * 60 * 24 * 2 ) , // 2 days,
246248 wal_size_limit_mb : Some ( 10 * 1024 ) , // 10 GB,
247- enable_statistics : false ,
249+ max_background_jobs : Some ( 16 ) ,
250+ enable_statistics : true ,
248251 use_optimistic_transaction_db : true ,
249252 }
250253 }
@@ -282,6 +285,10 @@ impl From<&GlobalDatabaseOptions> for Options {
282285 options. set_wal_size_limit_mb ( wal_size_limit_mb) ;
283286 }
284287
288+ if let Some ( max_background_jobs) = value. max_background_jobs {
289+ options. set_max_background_jobs ( max_background_jobs) ;
290+ }
291+
285292 if value. enable_statistics {
286293 options. enable_statistics ( ) ;
287294 options. set_statistics_level ( StatsLevel :: ExceptHistogramOrTimers ) ;
0 commit comments