fix: attempt to tweak rocksdb

This commit is contained in:
Ludo Galabru
2023-06-14 13:48:30 -04:00
parent 063318233d
commit 11b9b6be62
3 changed files with 8 additions and 6 deletions

View File

@@ -859,7 +859,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
let mut missing_blocks = vec![];
for i in 1..=790000 {
if find_lazy_block_at_block_height(i, 10, &blocks_db_rw, &ctx).is_none() {
if find_lazy_block_at_block_height(i, 4, &blocks_db_rw, &ctx).is_none() {
println!("Missing block {i}");
missing_blocks.push(i);
}
@@ -899,7 +899,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
let config = Config::default(false, false, false, &cmd.config_path)?;
let stacks_db = open_readonly_stacks_db_conn(&config.expected_cache_path(), &ctx)
.expect("unable to read stacks_db");
match get_stacks_block_at_block_height(cmd.block_height, true, 10, &stacks_db) {
match get_stacks_block_at_block_height(cmd.block_height, true, 4, &stacks_db) {
Ok(Some(block)) => {
info!(ctx.expect_logger(), "{}", json!(block));
}

View File

@@ -80,7 +80,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
let blocks_db_rw =
open_readwrite_hord_db_conn_rocks_db(&config.expected_cache_path(), ctx)?;
if find_lazy_block_at_block_height(end_block as u32, 10, &blocks_db_rw, &ctx).is_none() {
if find_lazy_block_at_block_height(end_block as u32, 4, &blocks_db_rw, &ctx).is_none() {
// Count how many entries in the table
// Compute the right interval
// Start the build local storage routine

View File

@@ -198,7 +198,9 @@ pub fn open_readonly_hord_db_conn_rocks_db(
_ctx: &Context,
) -> Result<DB, String> {
let path = get_default_hord_db_file_path_rocks_db(&base_dir);
let opts = rocks_db_default_options();
let mut opts = rocks_db_default_options();
opts.set_disable_auto_compactions(true);
opts.set_max_background_jobs(0);
let db = DB::open_for_read_only(&opts, path, false)
.map_err(|e| format!("unable to open blocks_db: {}", e.to_string()))?;
Ok(db)
@@ -979,7 +981,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
tx.get_cumulated_sats_in_until_input_index(input_index),
)
}
None => match find_lazy_block_at_block_height(ordinal_block_number, 10, &blocks_db, &ctx) {
None => match find_lazy_block_at_block_height(ordinal_block_number, 4, &blocks_db, &ctx) {
None => {
return Err(format!("block #{ordinal_block_number} not in database"));
}
@@ -1078,7 +1080,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
}
let lazy_block =
match find_lazy_block_at_block_height(ordinal_block_number, 10, &blocks_db, &ctx) {
match find_lazy_block_at_block_height(ordinal_block_number, 4, &blocks_db, &ctx) {
Some(block) => block,
None => {
return Err(format!("block #{ordinal_block_number} not in database"));