From 91ad68dbd2e099a854dced9c880d69325401f879 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Mon, 9 Dec 2024 15:43:12 +0000 Subject: [PATCH] Continue migration to stable memory now that reserved cycles limit increased --- backend/canisters/community/impl/src/lib.rs | 2 -- .../community/impl/src/lifecycle/post_upgrade.rs | 11 +++++++++-- backend/canisters/community/impl/src/model/members.rs | 2 -- backend/canisters/group/impl/src/lib.rs | 1 - backend/libraries/group_chat_core/src/members.rs | 2 -- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/canisters/community/impl/src/lib.rs b/backend/canisters/community/impl/src/lib.rs index 978fff0c69..6cf8f1ab99 100644 --- a/backend/canisters/community/impl/src/lib.rs +++ b/backend/canisters/community/impl/src/lib.rs @@ -366,9 +366,7 @@ struct Data { expiring_member_actions: ExpiringMemberActions, user_cache: UserCache, user_event_sync_queue: GroupedTimerJobQueue, - #[serde(default)] stable_memory_keys_to_garbage_collect: Vec, - #[serde(skip_deserializing)] members_migrated_to_stable_memory: bool, #[serde(default)] bot_permissions: BTreeMap, diff --git a/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs index 9dbb020c75..3448da4be1 100644 --- a/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs @@ -1,8 +1,8 @@ use crate::jobs::import_groups::finalize_group_import; use crate::lifecycle::{init_env, init_state}; use crate::memory::{get_stable_memory_map_memory, get_upgrades_memory}; -use crate::timer_job_types::MigrateMembersToStableMemoryJob; -use crate::{read_state, Data}; +use crate::timer_job_types::{MigrateMembersToStableMemoryJob, TimerJob}; +use crate::{mutate_state, read_state, Data}; use canister_logger::LogEntry; use canister_timer_jobs::Job; use canister_tracing_macros::trace; @@ -54,5 +54,12 @@ fn post_upgrade(args: Args) { .record_instructions_count(InstructionCountFunctionId::PostUpgrade, now) }); + mutate_state(|state| { + state + .data + .timer_jobs + .cancel_jobs(|j| matches!(j, TimerJob::MigrateMembersToStableMemory(_))); + }); + MigrateMembersToStableMemoryJob.execute(); } diff --git a/backend/canisters/community/impl/src/model/members.rs b/backend/canisters/community/impl/src/model/members.rs index 038db21d3a..7e2cb4646f 100644 --- a/backend/canisters/community/impl/src/model/members.rs +++ b/backend/canisters/community/impl/src/model/members.rs @@ -38,9 +38,7 @@ pub struct CommunityMembers { members_with_display_names: BTreeSet, members_with_referrals: BTreeSet, updates: BTreeSet<(TimestampMillis, UserId, MemberUpdate)>, - #[serde(skip_deserializing)] migrate_to_stable_memory_queue: VecDeque, - #[serde(skip_deserializing)] migration_to_stable_memory_complete: bool, } diff --git a/backend/canisters/group/impl/src/lib.rs b/backend/canisters/group/impl/src/lib.rs index 8213e371ab..1daeee6e0d 100644 --- a/backend/canisters/group/impl/src/lib.rs +++ b/backend/canisters/group/impl/src/lib.rs @@ -471,7 +471,6 @@ struct Data { expiring_member_actions: ExpiringMemberActions, user_cache: UserCache, user_event_sync_queue: GroupedTimerJobQueue, - #[serde(skip_deserializing)] members_migrated_to_stable_memory: bool, stable_memory_keys_to_garbage_collect: Vec, #[serde(default)] diff --git a/backend/libraries/group_chat_core/src/members.rs b/backend/libraries/group_chat_core/src/members.rs index e6bd04b92d..0b1914477d 100644 --- a/backend/libraries/group_chat_core/src/members.rs +++ b/backend/libraries/group_chat_core/src/members.rs @@ -41,9 +41,7 @@ pub struct GroupMembers { suspended: BTreeSet, updates: BTreeSet<(TimestampMillis, UserId, MemberUpdate)>, latest_update_removed: TimestampMillis, - #[serde(skip_deserializing)] migrate_to_stable_memory_queue: VecDeque, - #[serde(skip_deserializing)] migration_to_stable_memory_complete: bool, }