From d535d501d1e1bdb186eb0b5061cd445ef1ac9e7f Mon Sep 17 00:00:00 2001 From: DC <413331538@qq.com> Date: Tue, 26 Nov 2024 19:48:17 +0800 Subject: [PATCH] [DOCS] Improve description of WAL record format (#14936) Signed-off-by: DC <413331538@qq.com> --- tsdb/docs/format/wal.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tsdb/docs/format/wal.md b/tsdb/docs/format/wal.md index 39be2a808..db1ce97a8 100644 --- a/tsdb/docs/format/wal.md +++ b/tsdb/docs/format/wal.md @@ -17,7 +17,15 @@ Notable deviations are that the record fragment is encoded as: └───────────┴──────────┴────────────┴──────────────┘ ``` -The type flag has the following states: +The initial type byte is made up of three components: a 3-bit reserved field, a 1-bit zstd compression flag, a 1-bit snappy compression flag, and a 3-bit type flag. + +``` +┌─────────────────┬──────────────────┬────────────────────┬──────────────────┐ +│ reserved <3bit> │ zstd_flag <1bit> │ snappy_flag <1bit> │ type_flag <3bit> │ +└─────────────────┴──────────────────┴────────────────────┴──────────────────┘ +``` + +The lowest 3 bits within this flag represent the record type as follows: * `0`: rest of page will be empty * `1`: a full record encoded in a single fragment