# Commit Log

> An ordered, append-only record of accepted state changes that can be replicated or replayed to reconstruct derived state.

- HTML version: https://robbiepalmer.me/ideas/commit-log
- Source: https://kafka.apache.org/26/getting-started/uses/

A commit log records accepted state changes in a stable order. Writers append new records, while
readers keep a position in the sequence and move forward independently. Replicas and recovering
consumers can replay the same records to reach the same derived state.

The word "committed" needs a precise scope. It may mean that a quorum has accepted a record, that a
transaction has crossed its durability boundary, or that downstream consumers may safely observe
it. Records beyond the committed position can exist temporarily and may disappear during recovery.

A commit log describes the meaning and lifecycle of an ordered record. Write-ahead logging adds an
ordering constraint between log durability and updates to another stored representation. One log
can serve both purposes, while a commit log can also be the authoritative representation from which
tables, indexes, caches, or other views are derived.

## Questions it prompts

* What event makes a record committed, and who agrees on that boundary?
* Is the log authoritative, or does it protect another representation of state?
* How do readers identify and persist their position?
* Can retention or compaction remove records required for a complete replay?

## Related ideas

- [Stream/Table Duality](https://robbiepalmer.me/ideas/stream-table-duality.md): A stream can describe the changes to a table, while a table represents the latest state produced by those changes.
- [Write-Ahead Log (WAL)](https://robbiepalmer.me/ideas/write-ahead-log.md): An append-only record written durably before the corresponding data changes, allowing a system to recover committed state after failure.

## Where it appears

- Technology: [Kafka](https://robbiepalmer.me/technologies/kafka.md)

---

Markdown index of this site: https://robbiepalmer.me/llms.txt
