Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [MR-354] Load & validate protos asynchronously #2594

Merged
merged 78 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
18c6b63
Lazy pagemaps
pakhomov-dfinity Aug 23, 2024
8f8f95b
Merge branch 'tmp4' into pakhomov/async-pagemaps
pakhomov-dfinity Aug 23, 2024
ac2c657
m
pakhomov-dfinity Aug 26, 2024
a655bd5
m
pakhomov-dfinity Aug 26, 2024
ea21f5b
debugging
pakhomov-dfinity Aug 26, 2024
cee3a30
lazy11
pakhomov-dfinity Aug 26, 2024
a86eb09
m
pakhomov-dfinity Aug 27, 2024
29a9cf1
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Aug 27, 2024
8105131
m
pakhomov-dfinity Aug 28, 2024
c2cef11
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Sep 6, 2024
e72b04f
m
pakhomov-dfinity Sep 6, 2024
5e9067b
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Sep 19, 2024
46728de
wip
pakhomov-dfinity Sep 24, 2024
5b5aee1
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Sep 24, 2024
1caa8e5
flush deallocation thread
pakhomov-dfinity Sep 25, 2024
6869775
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Sep 25, 2024
455d7a5
m
pakhomov-dfinity Sep 30, 2024
cdbc988
m
pakhomov-dfinity Oct 1, 2024
f25dd23
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Oct 1, 2024
8fb6a42
failing loop test
pakhomov-dfinity Oct 3, 2024
d754f3d
test fix
pakhomov-dfinity Oct 3, 2024
aa78221
draft ready
pakhomov-dfinity Oct 4, 2024
8eafb6e
m
pakhomov-dfinity Oct 4, 2024
d265fae
m
pakhomov-dfinity Oct 4, 2024
934abeb
Update rs/state_manager/src/split.rs
pakhomov-dfinity Oct 11, 2024
ecb8988
m
pakhomov-dfinity Oct 14, 2024
6d09a75
Merge branch 'master' into pakhomov/async-pagemaps
pakhomov-dfinity Oct 14, 2024
271957f
m
pakhomov-dfinity Oct 15, 2024
5d74487
Review comments
pakhomov-dfinity Oct 15, 2024
c2e388e
test fix
pakhomov-dfinity Oct 15, 2024
2703943
clippy
pakhomov-dfinity Oct 16, 2024
def7b19
switch from layout
pakhomov-dfinity Oct 18, 2024
007f78d
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Oct 25, 2024
b5a12f8
m
pakhomov-dfinity Oct 28, 2024
7561a64
m
pakhomov-dfinity Oct 28, 2024
e945f48
m
pakhomov-dfinity Oct 30, 2024
d107a93
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Oct 30, 2024
4abd712
m
pakhomov-dfinity Oct 30, 2024
1e24f5e
Merge branch 'master' into pakhomov/xfs_resize
pakhomov-dfinity Nov 4, 2024
0519826
m
pakhomov-dfinity Nov 4, 2024
81bfd6f
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Nov 4, 2024
74cee4a
m
pakhomov-dfinity Nov 5, 2024
735f8b7
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Nov 13, 2024
daecef6
m
pakhomov-dfinity Nov 13, 2024
e43dfcc
Merge branch 'pakhomov/xfs_resize' into pakhomov/tmp
pakhomov-dfinity Nov 13, 2024
800a993
Merge branch 'master' into pakhomov/async-protos-bench
pakhomov-dfinity Nov 18, 2024
9bba61d
m
pakhomov-dfinity Nov 25, 2024
8f62f74
m
pakhomov-dfinity Nov 25, 2024
2e2d7b0
Revert sync
pakhomov-dfinity Nov 25, 2024
35f93eb
Revert sync
pakhomov-dfinity Nov 25, 2024
742a3fc
m
pakhomov-dfinity Nov 25, 2024
97a5bf2
wip validate_eq in tip thread
pakhomov-dfinity Nov 26, 2024
7e1d2ed
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Nov 27, 2024
a3d84da
m
pakhomov-dfinity Nov 27, 2024
ee5889d
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Nov 28, 2024
438609b
wip
pakhomov-dfinity Dec 2, 2024
fa387db
m
pakhomov-dfinity Dec 2, 2024
067930e
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Dec 11, 2024
9dd342d
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Dec 20, 2024
1282905
Back after break
pakhomov-dfinity Jan 3, 2025
e2e2896
Critical error
pakhomov-dfinity Jan 6, 2025
8479b2d
Testing in progress
pakhomov-dfinity Jan 7, 2025
bc2f24a
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Jan 7, 2025
4145f36
m
pakhomov-dfinity Jan 7, 2025
39d8584
testing
pakhomov-dfinity Jan 8, 2025
f212eb1
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Jan 17, 2025
94faec4
Revert "testing"
pakhomov-dfinity Jan 17, 2025
850cb62
Validate & discard canisters and snapshots
pakhomov-dfinity Jan 17, 2025
3c01ab9
Review comments
pakhomov-dfinity Jan 20, 2025
91d850b
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Jan 21, 2025
3746253
Test validate is called
pakhomov-dfinity Jan 22, 2025
92a1e0c
Deconstruct ReplicatedState
pakhomov-dfinity Jan 22, 2025
cce4a76
doc comment validate
pakhomov-dfinity Jan 22, 2025
2ff6ffd
m,
pakhomov-dfinity Jan 22, 2025
9886b91
m
pakhomov-dfinity Jan 23, 2025
63b25a4
clippy
pakhomov-dfinity Jan 23, 2025
41f9889
Arc::clone
pakhomov-dfinity Jan 24, 2025
ae2f735
Merge branch 'master' into pakhomov/async-protos
pakhomov-dfinity Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rs/replicated_state/src/canister_state/queues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub struct CanisterQueues {

/// Slot and memory reservation stats. Message count and size stats are
/// maintained separately in the `MessagePool`.
#[validate_eq(CompareWithValidateEq)]
queue_stats: QueueStats,

/// Round-robin schedule for `pop_input()` across ingress, local subnet senders
Expand Down Expand Up @@ -1896,7 +1897,7 @@ impl TryFrom<(pb_queues::CanisterQueues, &dyn CheckpointLoadingMetrics)> for Can
///
/// Stats for the enqueued messages themselves (counts and sizes by kind,
/// context and class) are tracked separately in `message_pool::MessageStats`.
#[derive(Clone, Eq, PartialEq, Debug, Default)]
#[derive(Clone, Eq, PartialEq, Debug, Default, ValidateEq)]
struct QueueStats {
/// Count of guaranteed response memory reservations across input and output
/// queues. This is equivalent to the number of outstanding (inbound or outbound)
Expand Down
3 changes: 2 additions & 1 deletion rs/replicated_state/src/page_map/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ pub(crate) struct StorageImpl {
overlays: Vec<OverlayFile>,
}

pub fn verify(storage_layout: &dyn StorageLayout) -> Result<(), PersistenceError> {
/// Validate that the overlay files are loadable.
pub fn validate(storage_layout: &dyn StorageLayout) -> Result<(), PersistenceError> {
StorageImpl::load(storage_layout)?;
Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions rs/replicated_state/src/page_map/storage/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{

use crate::page_map::{
storage::{
verify, Checkpoint, FileIndex, MergeCandidate, MergeDestination, OverlayFile,
validate, Checkpoint, FileIndex, MergeCandidate, MergeDestination, OverlayFile,
PageIndexRange, Shard, Storage, StorageLayout, CURRENT_OVERLAY_VERSION,
PAGE_INDEX_RANGE_NUM_BYTES, SIZE_NUM_BYTES, VERSION_NUM_BYTES,
},
Expand Down Expand Up @@ -1388,7 +1388,7 @@ fn overlapping_shards_is_an_error() {
tempdir.path().join("000000_010_vmemory_0.overlay"),
]
);
assert!(verify(&ShardedTestStorageLayout {
assert!(validate(&ShardedTestStorageLayout {
dir_path: tempdir.path().to_path_buf(),
base: tempdir.path().join("vmemory_0.bin"),
overlay_suffix: "vmemory_0.overlay".to_owned(),
Expand All @@ -1399,7 +1399,7 @@ fn overlapping_shards_is_an_error() {
tempdir.path().join("000000_011_vmemory_0.overlay"),
)
.unwrap();
assert!(verify(&ShardedTestStorageLayout {
assert!(validate(&ShardedTestStorageLayout {
dir_path: tempdir.path().to_path_buf(),
base: tempdir.path().join("vmemory_0.bin"),
overlay_suffix: "vmemory_0.overlay".to_owned(),
Expand All @@ -1425,7 +1425,7 @@ fn returns_an_error_if_file_size_is_not_a_multiple_of_page_size() {
.write_all(&vec![1; PAGE_SIZE / 2])
.unwrap();

match verify(&base_only_storage_layout(heap_file.to_path_buf())) {
match validate(&base_only_storage_layout(heap_file.to_path_buf())) {
Err(err) => assert!(
err.is_invalid_heap_file(),
"Expected invalid heap file error, got {:?}",
Expand Down
28 changes: 28 additions & 0 deletions rs/replicated_state/src/replicated_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,34 @@ impl ReplicatedState {
}
}

/// References into _all_ fields.
pub fn component_refs(
&self,
) -> (
&BTreeMap<CanisterId, CanisterState>,
&SystemMetadata,
&CanisterQueues,
&Vec<ConsensusResponse>,
&RawQueryStats,
&CanisterSnapshots,
) {
let ReplicatedState {
ref canister_states,
ref metadata,
ref subnet_queues,
ref consensus_queue,
ref epoch_query_stats,
ref canister_snapshots,
} = self;
(
&canister_states,
&metadata,
&subnet_queues,
&consensus_queue,
&epoch_query_stats,
&canister_snapshots,
)
}
pub fn canister_state(&self, canister_id: &CanisterId) -> Option<&CanisterState> {
self.canister_states.get(canister_id)
}
Expand Down
Loading
Loading