Skip to content

refactor: drop the legacy canister_log store from SystemState#10821

Draft
mraszyk wants to merge 2 commits into
masterfrom
mraszyk/drop-canister-log
Draft

refactor: drop the legacy canister_log store from SystemState#10821
mraszyk wants to merge 2 commits into
masterfrom
mraszyk/drop-canister-log

Conversation

@mraszyk

@mraszyk mraszyk commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

The one-time migration from the legacy CanisterLog store to the LogMemoryStore has completed on all subnets and the dual-write kept the legacy store around only so checkpoints stayed readable by replicas that predate the log memory store (see #10755). That downgrade window has now elapsed and the migration code has already been removed, so the legacy store and its serialized fields can be removed.

  • Remove the SystemState.canister_log field;
  • Stop serializing canister_log_records, next_canister_log_record_idx and log_memory_store_migrated; the corresponding proto fields (43, 44, 66) are marked reserved.
  • Replace the StateMachine::canister_log test helper with canister_log_records and canister_log_bytes_used, reading directly from LogMemoryStore (via a new test-only LogMemoryStore::all_records_for_testing), and migrate all callers.

The CanisterLog type and the transient SystemStateModifications delta log buffer are retained. This re-applies the parts of the reverted #10714 that were left as a follow-up in #10755.

The one-time migration from the legacy `CanisterLog` store to the
`LogMemoryStore` has completed on all subnets and the dual-write kept the
legacy store around only so checkpoints stayed readable by replicas that
predate the log memory store (see #10755). That downgrade window has now
elapsed, so the legacy store and its serialized fields can be removed.

- Remove the `SystemState.canister_log` field; constructors and
  `new_from_checkpoint` no longer take or initialize it, and the
  `CanisterState` log wrappers (`clear_log`/`remove_log`/`set_log`)
  operate solely on `log_memory_store`. `set_log` now takes a
  `LogMemoryStore` instead of a `(CanisterLog, LogMemoryStore)` tuple.
- Drop the dual-write in `SandboxSafeSystemState`: the transient delta
  log now feeds only `log_memory_store`.
- Stop serializing `canister_log_records`, `next_canister_log_record_idx`
  and `log_memory_store_migrated`; the corresponding proto fields (43, 44,
  66) are marked reserved. Remove the obsolete `canister_log` vs
  `log_memory_store` next-index consistency check in checkpoint loading.
- Replace the `StateMachine::canister_log` test helper with
  `canister_log_records` and `canister_log_bytes_used`, reading directly
  from `LogMemoryStore` (via a new test-only
  `LogMemoryStore::all_records_for_testing`), and migrate all callers.

The `CanisterLog` type and the transient `SystemStateModifications` delta
log buffer are retained. This re-applies the parts of the reverted #10714
that were left as a follow-up in #10755.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mraszyk mraszyk added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Jul 19, 2026
const METRIC_PAYLOAD_SIZE: usize = 1_000;

#[test]
fn test_metric_canister_log_memory_usage_bytes_from_canister_log() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

covered by test_metric_canister_log_memory_usage_bytes_from_log_memory_store

`records_mut` is now used in production by `LogMemoryStore::append_delta_log`
(it drains the delta records into the ring buffer), so the
`#[allow(dead_code)]` and its `TODO(DSM-11)` — which was conditioned on the
log memory store being used in production — are no longer needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI_ALL_BAZEL_TARGETS Runs all bazel targets refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant