Skip to content

[Store] Fix serializer backward compat: accept legacy 4-element Replica format#4

Open
stmatengss wants to merge 1 commit intohemist/cxl-level-storefrom
fix/serializer-backward-compat
Open

[Store] Fix serializer backward compat: accept legacy 4-element Replica format#4
stmatengss wants to merge 1 commit intohemist/cxl-level-storefrom
fix/serializer-backward-compat

Conversation

@stmatengss
Copy link
Copy Markdown

Problem

The new storage_level field in tiered storage bumped the Replica msgpack array from 4 to 5 elements. The deserializer strictly requires size == 5, so existing snapshots/persisted replicas fail with:

deserialize_msgpack Replica invalid array size: expected 5, got 4

Fix

Accept both sizes in deserialize:

  • size == 4 (legacy): default storage_level = StorageLevel::RAM, payload_index = 3
  • size == 5 (new): read storage_level from array_items[3], payload_index = 4

Serialization always writes 5 elements. Read path handles both formats for upgrade compatibility.

Impact

  • No change to write path
  • Existing snapshots read with StorageLevel::RAM (correct default)
  • No behavior change for new data

…ca format

The new tiered storage feature added a storage_level field to the Replica
msgpack format, bumping the array size from 4 to 5. Existing snapshots and
persisted replicas that were serialized with the old 4-element format would
fail deserialization with a hard error.

Accept both sizes: when size==4 (legacy), default storage_level to RAM and
use payload_index=3; when size==5 (new), read storage_level and use
payload_index=4. This preserves full read compatibility with pre-upgrade data.
@stmatengss stmatengss requested review from XucSh and YiXR as code owners April 22, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant