@@ -2318,7 +2318,7 @@ pub async fn rebuild_rocks_db(
2318
2318
rx_thread_pool. push ( rx) ;
2319
2319
}
2320
2320
2321
- let _ = hiro_system_kit:: thread_named ( "Block data compression" )
2321
+ let compression_thread = hiro_system_kit:: thread_named ( "Block data compression" )
2322
2322
. spawn ( move || {
2323
2323
for rx in rx_thread_pool. into_iter ( ) {
2324
2324
let block_compressed_tx_moved = block_compressed_tx. clone ( ) ;
@@ -2328,7 +2328,7 @@ pub async fn rebuild_rocks_db(
2328
2328
while let Ok ( Some ( block_bytes) ) = rx. recv ( ) {
2329
2329
let raw_block_data = parse_downloaded_block ( block_bytes) . unwrap ( ) ;
2330
2330
let compressed_block = LazyBlock :: from_full_block ( & raw_block_data)
2331
- . expect ( "unable to serialize block" ) ;
2331
+ . expect ( "unable to compress block" ) ;
2332
2332
let block_data = hord:: parse_ordinals_and_standardize_block (
2333
2333
raw_block_data,
2334
2334
& moved_bitcoin_network,
@@ -2347,7 +2347,7 @@ pub async fn rebuild_rocks_db(
2347
2347
2348
2348
let cloned_ctx = ctx. clone ( ) ;
2349
2349
2350
- let _storage_thread = hiro_system_kit:: thread_named ( "Ordered blocks dispatcher" )
2350
+ let storage_thread = hiro_system_kit:: thread_named ( "Ordered blocks dispatcher" )
2351
2351
. spawn ( move || {
2352
2352
let mut inbox = HashMap :: new ( ) ;
2353
2353
let mut inbox_cursor = start_sequencing_blocks_at_height. max ( start_block) ;
@@ -2367,7 +2367,7 @@ pub async fn rebuild_rocks_db(
2367
2367
let mut chunk = Vec :: new ( ) ;
2368
2368
while let Some ( ( block, compacted_block) ) = inbox. remove ( & inbox_cursor) {
2369
2369
cloned_ctx. try_log ( |logger| {
2370
- slog :: info!(
2370
+ info ! (
2371
2371
logger,
2372
2372
"Dequeuing block #{inbox_cursor} for processing (# blocks inboxed: {})" ,
2373
2373
inbox. len( )
@@ -2379,7 +2379,7 @@ pub async fn rebuild_rocks_db(
2379
2379
if chunk. is_empty ( ) {
2380
2380
// Early return / wait for next block
2381
2381
cloned_ctx. try_log ( |logger| {
2382
- slog :: info!( logger, "Inboxing compacted block #{block_index}" )
2382
+ info ! ( logger, "Inboxing compacted block #{block_index}" )
2383
2383
} ) ;
2384
2384
continue ;
2385
2385
} else {
@@ -2391,27 +2391,12 @@ pub async fn rebuild_rocks_db(
2391
2391
2392
2392
if blocks_processed == number_of_blocks_to_process {
2393
2393
cloned_ctx. try_log ( |logger| {
2394
- slog :: info!(
2394
+ info ! (
2395
2395
logger,
2396
2396
"Local block storage successfully seeded with #{blocks_processed} blocks"
2397
2397
)
2398
2398
} ) ;
2399
2399
break ;
2400
- // match guard.report().build() {
2401
- // Ok(report) => {
2402
- // ctx.try_log(|logger| {
2403
- // slog::info!(logger, "Generating report");
2404
- // });
2405
-
2406
- // let file = std::fs::File::create("hord-perf.svg").unwrap();
2407
- // report.flamegraph(file).unwrap();
2408
- // }
2409
- // Err(e) => {
2410
- // ctx.try_log(|logger| {
2411
- // slog::error!(logger, "Reporting failed: {}", e.to_string());
2412
- // });
2413
- // }
2414
- // }
2415
2400
}
2416
2401
}
2417
2402
( )
@@ -2437,6 +2422,41 @@ pub async fn rebuild_rocks_db(
2437
2422
thread_index = ( thread_index + 1 ) % hord_config. ingestion_thread_max ;
2438
2423
}
2439
2424
2425
+ ctx. try_log ( |logger| {
2426
+ info ! (
2427
+ logger,
2428
+ "Gargbage collecting will start"
2429
+ )
2430
+ } ) ;
2431
+
2432
+ for tx in tx_thread_pool. iter ( ) {
2433
+ let _ = tx. send ( None ) ;
2434
+ }
2435
+ let _ = compression_thread. join ( ) ;
2436
+ let _ = storage_thread. join ( ) ;
2440
2437
let _ = set. shutdown ( ) ;
2438
+
2439
+ ctx. try_log ( |logger| {
2440
+ info ! (
2441
+ logger,
2442
+ "Gargbage collecting did finish"
2443
+ )
2444
+ } ) ;
2445
+
2446
+ // match guard.report().build() {
2447
+ // Ok(report) => {
2448
+ // ctx.try_log(|logger| {
2449
+ // slog::info!(logger, "Generating report");
2450
+ // });
2451
+ // let file = std::fs::File::create("hord-perf.svg").unwrap();
2452
+ // report.flamegraph(file).unwrap();
2453
+ // }
2454
+ // Err(e) => {
2455
+ // ctx.try_log(|logger| {
2456
+ // slog::error!(logger, "Reporting failed: {}", e.to_string());
2457
+ // });
2458
+ // }
2459
+ // }
2460
+
2441
2461
Ok ( ( ) )
2442
2462
}
0 commit comments