Skip to content

Commit

Permalink
fix: attempt to tweak rocksdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Jun 14, 2023
1 parent 0633182 commit 11b9b6b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/chainhook-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/scan/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions components/chainhook-sdk/src/hord/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"));
}
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit 11b9b6b

Please sign in to comment.