1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhance the wal.c source file with an ASCII-art schematic of the -shm file

header.

FossilOrigin-Name: a6c160e08a61d105f8aab959440ac5ec4f1aaca8f0d393e08e7c2c67815b5bb2
This commit is contained in:
drh
2021-07-29 18:34:35 +00:00
parent b71959cb4e
commit f873392dde
3 changed files with 71 additions and 8 deletions

View File

@@ -400,6 +400,70 @@ struct WalCkptInfo {
};
#define READMARK_NOT_USED 0xffffffff
/*
** This is a schematic view of the complete 136-byte header of the
** wal-index file (also known as the -shm file):
**
** +-----------------------------+
** 0: | iVersion | \
** +-----------------------------+ |
** 4: | (unused padding) | |
** +-----------------------------+ |
** 8: | iChange | |
** +-------+-------+-------------+ |
** 12: | bInit | bBig | szPage | |
** +-------+-------+-------------+ |
** 16: | mxFrame | | First copy of the
** +-----------------------------+ | WalIndexHdr object
** 20: | nPage | |
** +-----------------------------+ |
** 24: | aFrameCksum | |
** | | |
** +-----------------------------+ |
** 32: | aSalt | |
** | | |
** +-----------------------------+ |
** 40: | aCksum | |
** | | /
** +-----------------------------+
** 48: | iVersion | \
** +-----------------------------+ |
** 52: | (unused padding) | |
** +-----------------------------+ |
** 56: | iChange | |
** +-------+-------+-------------+ |
** 60: | bInit | bBig | szPage | |
** +-------+-------+-------------+ | Second copy of the
** 64: | mxFrame | | WalIndexHdr
** +-----------------------------+ |
** 68: | nPage | |
** +-----------------------------+ |
** 72: | aFrameCksum | |
** | | |
** +-----------------------------+ |
** 80: | aSalt | |
** | | |
** +-----------------------------+ |
** 88: | aCksum | |
** | | /
** +-----------------------------+
** 96: | nBackfill |
** +-----------------------------+
** 100: | 5 read marks |
** | |
** | |
** | |
** | |
** +-------+-------+------+------+
** 120: | Write | Ckpt | Rcvr | Rd0 | \
** +-------+-------+------+------+ ) 8 lock bytes
** | Read1 | Read2 | Rd3 | Rd4 | /
** +-------+-------+------+------+
** 128: | nBackfillAttempted |
** +-----------------------------+
** 132: | (unused padding) |
** +-----------------------------+
*/
/* A block of WALINDEX_LOCK_RESERVED bytes beginning at
** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems