Skip to content

Conversation

roberto-bayardo
Copy link
Collaborator

@roberto-bayardo roberto-bayardo commented Jun 16, 2025

  • Changes fixed journal's replay functionality to guarantee in-order element production & optimizes it a bit.
  • Changes adb::any's snapshot building to use replay now that it is ordered.
  • Removes concurrency from variable journal's replay() so it produces elements in-order, though without any significant simplification or optimization.
  • Removes replay_concurrency config parameters throughout.

Performance on the fixed_replay benchmark is about 25-30% faster.

Archive restart benchmark unaffected.

Addresses #1109.

@roberto-bayardo roberto-bayardo requested a review from Copilot June 16, 2025 23:21
Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the journal replay functionality by enforcing in-order element production and optimizing performance. Key changes include:

  • Removing the replay_concurrency parameter and updating the journal.replay API across modules.
  • Adjusting test and configuration setups to align with the new replay API.
  • Extending benchmark coverage in a few files by increasing workload sizes.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
storage/src/archive/storage.rs Removed replay_concurrency from journal.replay call
storage/src/archive/mod.rs Removed replay_concurrency from config and tests
storage/src/archive/benches/utils.rs Removed replay_concurrency from benchmark configuration
storage/src/adb/any.rs Updated snapshot building to use new replay API signature
runtime/src/utils/buffer/read.rs Added blob_size() helper method
examples/log/src/main.rs Removed replay_concurrency from example configuration
consensus/* and simplex/* files Removed replay_concurrency from configuration, tests, and actor code
consensus/src/ordered_broadcast/* Removed journal_replay_concurrency from configuration and actor code
Comments suppressed due to low confidence (2)

storage/src/archive/storage.rs:119

  • Ensure the API documentation and in-code comments for journal.replay are updated to reflect the new signature (single replay_buffer parameter) after removing replay_concurrency.
let stream = journal.replay(cfg.replay_buffer).await?;

consensus/src/ordered_broadcast/engine.rs:978

  • Update the documentation for journal.replay in this context to clearly indicate that the concurrent replay parameter is no longer used, ensuring consistency with the new API.
.replay(self.journal_replay_buffer)

@roberto-bayardo roberto-bayardo marked this pull request as ready for review June 17, 2025 00:21
@roberto-bayardo roberto-bayardo changed the title [storage/journal/fixed + storage/adb/any] Make replay ordered [storage/journal + storage/adb/any] Make replay ordered Jun 17, 2025
@roberto-bayardo roberto-bayardo force-pushed the ordered-replay branch 5 times, most recently from fdc5cd3 to 9e34f3b Compare June 17, 2025 14:57
}
let start_offset = (start_pos % items_per_blob) * Self::CHUNK_SIZE_U64;

let stream = stream::iter(blob_plus).flat_map(move |(i, blob_index, blob, sz)| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use size

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// Replay all blobs in order and stream items as they are read (to avoid occupying too much
// memory with buffered data)
Ok(
stream::iter(blobs).flat_map(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol that was easy

@roberto-bayardo roberto-bayardo force-pushed the ordered-replay branch 2 times, most recently from a04428f to 4ed1bde Compare June 17, 2025 18:42
@patrick-ogrady patrick-ogrady merged commit 54eedf7 into main Jun 17, 2025
15 checks passed
@patrick-ogrady patrick-ogrady deleted the ordered-replay branch June 17, 2025 18:59
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 96.52174% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.01%. Comparing base (bf35da2) to head (a9f6351).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
storage/src/adb/any.rs 91.17% 3 Missing ⚠️
storage/src/journal/fixed.rs 98.21% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
- Coverage   91.03%   91.01%   -0.02%     
==========================================
  Files         191      191              
  Lines       55316    55231      -85     
==========================================
- Hits        50355    50269      -86     
- Misses       4961     4962       +1     
Files with missing lines Coverage Δ
consensus/src/ordered_broadcast/engine.rs 89.66% <100.00%> (-0.02%) ⬇️
consensus/src/ordered_broadcast/mod.rs 99.61% <ø> (-0.01%) ⬇️
consensus/src/simplex/actors/voter/actor.rs 92.82% <100.00%> (-0.01%) ⬇️
consensus/src/simplex/actors/voter/mod.rs 98.45% <ø> (-0.01%) ⬇️
consensus/src/simplex/config.rs 68.75% <ø> (+0.17%) ⬆️
consensus/src/simplex/engine.rs 95.14% <ø> (-0.05%) ⬇️
consensus/src/simplex/mod.rs 98.33% <ø> (-0.02%) ⬇️
...sensus/src/threshold_simplex/actors/voter/actor.rs 94.00% <100.00%> (-0.01%) ⬇️
...onsensus/src/threshold_simplex/actors/voter/mod.rs 98.42% <ø> (-0.01%) ⬇️
consensus/src/threshold_simplex/config.rs 68.75% <ø> (+0.17%) ⬆️
... and 8 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf35da2...a9f6351. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants