Skip to main content

Module upgrade

Module upgrade 

Expand description

Converts a data directory from log format 2 (a log per shard) to log format 3 (one shared log, [crate::wal]), offline.

Every valid record of every shard’s segments is copied, in LSN order, so both retained checkpoints of every shard still find the records after them (recovery skips what a checkpoint covers). Records are re-encoded once into the shared log’s canonical form; run stores, checkpoints and archives stay where they are.

The conversion survives a crash at any point. The new log is written under wal.tmp, synced and renamed to wal; only then does fusee.meta switch to log=3 (written to a temporary file, synced and renamed), and only after that are the old segments deleted. Until the meta file says log=3, the directory opens as format 2 and a leftover wal is removed by the next attempt; after it, leftover old segments are ignored and the next attempt removes them.

Enums§

Upgraded
What upgrade_to_shared_log did.

Functions§

upgrade_to_shared_log
Converts the directory at dir (closed: this takes its lock) to the shared log. local supplies the flush method and segment size.