WAL (Write-Ahead Log) — universal durability mechanism. Append-only sequential file, fsync semantics, group commit, checkpoint, crash recovery. Used in Postgres, MySQL InnoDB, RocksDB, Kafka log, etcd, Spanner, ext4 journal. Concept page covering write path (modify in-memory → WAL append → fsync → ack → flush page later), crash recovery (replay WAL from last checkpoint), group commit batching, and synchronous_commit=off trade-off.
WAL не означает «сначала записали бизнес-строку в log table». Это physical/logical recovery protocol: redo information становится durable до data page, а commit ACK привязан к выбранной flush policy.
| Компонент | Ответственность |
|---|---|
| Transaction Client | Получает success, timeout или failure; timeout оставляет ambiguous outcome. |
| Transaction Engine | Формирует changes, WAL records и commit record. |
| WAL Buffer | Временная память; сама по себе не переживает crash. |
| Durable WAL | Ordered redo stream на проверенном non-volatile storage boundary. |
| Dirty Data Pages | Могут сбрасываться позже WAL и быть частично записанными при power loss. |
| Checkpointer | Продвигает recovery starting point; checkpoint не заменяет backup. |
| WAL Archive and Base Backup | Поддерживает PITR при непрерывной цепочке и проверенном restore. |
| Crash Recovery | Читает control/checkpoint state и replay WAL до consistent state. |
The engine appends the transaction and commit record, flushes WAL to the configured durable boundary, and only then acknowledges. Dirty data pages need not be flushed at commit.
Проверяемый исход: A success response means the configured WAL durability contract was reached; data pages may still be only in buffer cache.
An async policy may acknowledge before the commit record is durably flushed. A crash in that interval can lose recent acknowledged transactions; the bound depends on implementation and load.
Проверяемый исход: The UI states the non-zero RPO and never invents a universal millisecond loss bound.
A checkpoint flushes pages over time and writes recovery metadata. Full-page images after checkpoints protect the first modified page from partial-page writes on ordinary storage.
Проверяемый исход: Recovery starts from a valid checkpoint and uses WAL to restore page consistency; full_page_writes is not disabled by blanket advice.
A base backup plus an unbroken archived WAL chain is restored into an isolated target and replay stops at the selected time/LSN.
Проверяемый исход: PITR is proven by restore testing; checkpoints or replicas alone are not called backups.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
[CONCEPT]database-migration-strategies
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет