Skip to content

Commit

Permalink
Only deserialize from old log state (#6616)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Oct 18, 2024
1 parent f301d29 commit 5133b55
Show file tree
Hide file tree
Showing 28 changed files with 112 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/airdrop_bot/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
4 changes: 4 additions & 0 deletions backend/canisters/community/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Only deserialize from old log state ([#6616](https://github.com/open-chat-labs/open-chat/pull/6616))

## [[2.0.1397](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1397-community)] - 2024-10-18

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/escrow/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/event_relay/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
4 changes: 4 additions & 0 deletions backend/canisters/group/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Only deserialize from old log state ([#6616](https://github.com/open-chat-labs/open-chat/pull/6616))

## [[2.0.1398](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1398-group)] - 2024-10-18

### Added
Expand Down
7 changes: 4 additions & 3 deletions backend/canisters/group/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/group_index/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/identity/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/market_maker/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
14 changes: 4 additions & 10 deletions backend/canisters/notifications/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = match msgpack::deserialize(reader) {
Ok((data, errors, logs, traces)) => (data, errors, logs, traces),
Err(_) => {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
(data, Vec::new(), logs, traces)
}
};
let (data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);
// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
Loading

0 comments on commit 5133b55

Please sign in to comment.