wal-read

command
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command wal-read prints a NornicDB WAL directory as one JSON object per visited entry, for reading a framed, mixed WAL stream by hand.

A WAL directory (see pkg/storage) is not one compressed archive: it is a set of sealed segments plus the active wal.log, each a sequence of length-prefixed frames whose payload may be JSON control records or typed (optionally zstd-compressed) records. This command therefore never treats a file as a single zstd stream and never shells out to a compressor: it walks the directory through storage.VisitWALEntriesAfterFromDir, the same reader recovery and db.txlog use, and renders each entry's payload with storage.EntryPayloadJSON, the WAL's typed display owner.

Usage:

go run ./scripts/wal-read -dir /path/to/wal [-from N] [-to N]

Each output line is one JSON object with seq, timestamp (RFC 3339Nano, UTC), database, kind and payload. payload is the entry's JSON value, not a JSON-escaped string. Bounds are inclusive: -from is the lowest sequence to print (default 1) and -to the highest (default 0, no upper bound). Entries may be out of sequence on disk, so a sequence above -to never stops the scan; it is only skipped.

The command is read-only: it opens no WAL for writing, creates no directory, and never invents a transaction id for an entry that has none. This scope holds only published storage API, so it observes exactly what a recovery reader observes. That reader reports a torn end-of-file as an incomplete write and stops without an error; correcting or masking that limit belongs to pkg/storage, not here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL