-
Notifications
You must be signed in to change notification settings - Fork 89
refactor(network): db executor communicates through channels #2121
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## shahak/remove_data #2121 +/- ##
======================================================
- Coverage 64.39% 64.37% -0.03%
======================================================
Files 136 136
Lines 17870 17941 +71
Branches 17870 17941 +71
======================================================
+ Hits 11508 11550 +42
- Misses 5083 5113 +30
+ Partials 1279 1278 -1 ☔ View full report in Codecov by Sentry. |
6cdd91e
to
ecb746d
Compare
771f1f9
to
fc774a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
fc774a1
to
48cd1af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
087e025
to
7267f39
Compare
48cd1af
to
cb8c766
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 88 at r2 (raw file):
state_diff_queries_receiver: Option<SqmrQueryReceiver<StateDiffQuery, DataOrFin<StateDiffChunk>>>, }
The DBExecutor is going to become the SyncServer. And therefore it make sense to have specific reference to header and state diff. right?
Code quote:
pub struct DBExecutor {
storage_reader: StorageReader,
// TODO(shahak): Make this non-option.
header_queries_receiver: Option<SqmrQueryReceiver<HeaderQuery, DataOrFin<SignedBlockHeader>>>,
// TODO(shahak): Make this non-option.
state_diff_queries_receiver:
Option<SqmrQueryReceiver<StateDiffQuery, DataOrFin<StateDiffChunk>>>,
}
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
tokio::select! { Some((query_result, response_sender)) = header_queries_receiver_future => {
What happens if the future returns None?
Code quote:
Some((query_result, response_sender)) = header_queries_receiver_future => {
crates/papyrus_network/src/db_executor/mod.rs
line 264 at r2 (raw file):
// If this function fails, we still want to send fin before failing. let result = send_data_without_fin_for_query(&storage_reader, query, &mut sender).await; sender.feed(DataOrFin(None)).await?;
when do we flush?
Code quote:
sender.feed(DataOrFin(None)).await?;
crates/papyrus_network/src/db_executor/mod.rs
line 295 at r2 (raw file):
for data in data_vec { // TODO: consider implement retry mechanism. sender.feed(DataOrFin(Some(data))).await?;
When do we flush?
Code quote:
sender.feed(DataOrFin(Some(data))).await?;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @matan-starkware)
crates/papyrus_network/src/db_executor/mod.rs
line 88 at r2 (raw file):
Previously, matan-starkware wrote…
The DBExecutor is going to become the SyncServer. And therefore it make sense to have specific reference to header and state diff. right?
Yes, we will move it from the network crate
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, matan-starkware wrote…
What happens if the future returns None?
Fixed. If you're interested I can tell you what was the previous code in huddle
crates/papyrus_network/src/db_executor/mod.rs
line 264 at r2 (raw file):
Previously, matan-starkware wrote…
when do we flush?
We don't need to, it's flushed automatically (not sure when but I've checked the final PR with e2e with the node executable so it works)
crates/papyrus_network/src/db_executor/mod.rs
line 295 at r2 (raw file):
Previously, matan-starkware wrote…
When do we flush?
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, ShahakShama wrote…
Fixed. If you're interested I can tell you what was the previous code in huddle
I don't see any change in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, matan-starkware wrote…
I don't see any change in the code.
Forgot to push 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, ShahakShama wrote…
Forgot to push 😅
Ok. Do we prefer expect
outside of test code?
c354b00
to
4a49a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, matan-starkware wrote…
Ok. Do we prefer
expect
outside of test code?
You and clippy are best friends
7267f39
to
15cbec4
Compare
4a49a45
to
bb9be89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ShahakShama)
crates/papyrus_network/src/db_executor/mod.rs
line 123 at r2 (raw file):
Previously, ShahakShama wrote…
You and clippy are best friends
:D
* refactor(network): remove Data from db executor * refactor(network): fix cr comments * refactor(network): db executor communicates through channels (#2121) * refactor(network): db executor communicates through channels * refactor(network): fix cr comments * refactor(network): db executor is removed from NetworkManager and runs in a separate task (#2122) * refactor(network): db executor is removed from NetworkManager and runs in a separate task * test(network): return network manager tests (#2124)
This change is