Skip to content

Commit

Permalink
feature(collator): fast sync config param
Browse files Browse the repository at this point in the history
  • Loading branch information
drmick committed Feb 24, 2025
1 parent 164d06b commit cb215c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion collator/src/internal_queue/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn gc_task<V: InternalMessageValue>(
.get(partition)
.unwrap_or(&FastHashMap::default())
.get(shard)
.map_or(true, |last_key| *current_last_key > *last_key);
.is_none_or(|last_key| *current_last_key > *last_key);

if can_delete {
let range = vec![QueueShardRange {
Expand Down
16 changes: 10 additions & 6 deletions collator/src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ where
// skip diff below min processed to
if let Some(min_pt) = min_processed_to {
if queue_diff.as_ref().max_message <= *min_pt {
tracing::debug!(target: tracing_targets::COLLATION_MANAGER,
tracing::trace!(target: tracing_targets::COLLATION_MANAGER,
"Skipping diff for block {}: max_message {} <= min_processed_to {}",
block_entry.block_id.as_short_id(),
queue_diff.as_ref().max_message,
Expand Down Expand Up @@ -1440,11 +1440,15 @@ where
}).collect::<Vec<_>>().as_slice(),
);

// collect top blocks queue diffs already applied to
let queue_diffs_applied_to_top_blocks = if let Some(applied_to_mc_block_id) =
self.get_queue_diffs_applied_to_mc_block_id(last_collated_mc_block_id)
{
self.get_top_blocks_seqno(&applied_to_mc_block_id).await?
let queue_diffs_applied_to_top_blocks = if self.config.fast_sync {
if let Some(applied_to_mc_block_id) =
self.get_queue_diffs_applied_to_mc_block_id(last_collated_mc_block_id)
{
// collect top blocks queue diffs already applied to
self.get_top_blocks_seqno(&applied_to_mc_block_id).await?
} else {
FastHashMap::default()
}
} else {
FastHashMap::default()
};
Expand Down
2 changes: 2 additions & 0 deletions collator/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct CollatorConfig {
pub min_mc_block_delta_from_bc_to_sync: u32,
pub check_value_flow: bool,
pub validate_config: bool,
pub fast_sync: bool,
}

impl Default for CollatorConfig {
Expand All @@ -38,6 +39,7 @@ impl Default for CollatorConfig {
min_mc_block_delta_from_bc_to_sync: 3,
check_value_flow: false,
validate_config: true,
fast_sync: false,
}
}
}
Expand Down

0 comments on commit cb215c8

Please sign in to comment.