Skip to content

Commit

Permalink
fix(resharding): fix dynamic config (#10297)
Browse files Browse the repository at this point in the history
Fixing the dynamic config since #10290 was accidentaly merged
prematurely before it was fully tested and fixed.
Tested on localnet for now, will then test on mocknet and only then
merge.
  • Loading branch information
wacban authored Dec 5, 2023
1 parent 345e8e0 commit a908de3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions chain/chain/src/resharding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ impl Chain {
config,
..
} = state_split_request;
let config = config.get();

tracing::debug!(target: "resharding", ?config, ?shard_uid, "build_state_for_split_shards_impl starting");
tracing::debug!(target: "resharding", config=?config.get(), ?shard_uid, "build_state_for_split_shards_impl starting");

let shard_id = shard_uid.shard_id();
let new_shards = next_epoch_shard_layout
Expand Down Expand Up @@ -361,7 +359,7 @@ impl Chain {
let batch = {
let histogram = RESHARDING_BATCH_PREPARE_TIME.with_label_values(&metrics_labels);
let _timer = histogram.start_timer();
let batch = get_trie_update_batch(&config, &mut iter);
let batch = get_trie_update_batch(&config.get(), &mut iter);
let batch = batch.map_err(Into::<StorageError>::into)?;
let Some(batch) = batch else { break };
batch
Expand Down Expand Up @@ -395,11 +393,11 @@ impl Chain {

// sleep between batches in order to throttle resharding and leave
// some resource for the regular node operation
std::thread::sleep(config.batch_delay);
std::thread::sleep(config.get().batch_delay);
}

state_roots = apply_delayed_receipts(
&config,
&config.get(),
&tries,
shard_uid,
state_root,
Expand Down
1 change: 1 addition & 0 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ pub struct Client {
impl Client {
pub(crate) fn update_client_config(&self, update_client_config: UpdateableClientConfig) {
self.config.expected_shutdown.update(update_client_config.expected_shutdown);
self.config.state_split_config.update(update_client_config.state_split_config);
}
}

Expand Down

0 comments on commit a908de3

Please sign in to comment.