Browse Source
Don't run full compaction after initial import is over
refactor-mempool
Roman Zeyde
7 years ago
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB
1 changed files with
7 additions and
7 deletions
-
src/bin/electrs.rs
|
|
@ -38,18 +38,18 @@ fn run_server(config: &Config) -> Result<()> { |
|
|
|
// Perform initial indexing from local blk*.dat block files.
|
|
|
|
let store = DBStore::open(&config.db_path, /*low_memory=*/ config.jsonrpc_import); |
|
|
|
let index = Index::load(&store, &daemon, &metrics, config.index_batch_size)?; |
|
|
|
let store = if config.jsonrpc_import { |
|
|
|
index.update(&store, &signal)?; // slower: uses JSONRPC for fetching blocks
|
|
|
|
full_compaction(store) |
|
|
|
let store = if is_fully_compacted(&store) { |
|
|
|
store // initial import and full compaction are over
|
|
|
|
} else { |
|
|
|
// faster, but uses more memory
|
|
|
|
if is_fully_compacted(&store) == false { |
|
|
|
if config.jsonrpc_import { |
|
|
|
index.update(&store, &signal)?; // slower: uses JSONRPC for fetching blocks
|
|
|
|
full_compaction(store) |
|
|
|
} else { |
|
|
|
// faster, but uses more memory
|
|
|
|
let store = bulk::index_blk_files(&daemon, config.bulk_index_threads, &metrics, store)?; |
|
|
|
let store = full_compaction(store); |
|
|
|
index.reload(&store); // make sure the block header index is up-to-date
|
|
|
|
store |
|
|
|
} else { |
|
|
|
store |
|
|
|
} |
|
|
|
}.enable_compaction(); // enable auto compactions before starting incremental index updates.
|
|
|
|
|
|
|
|