liveBook · Manning

Transaction log

As explained in Apache Kafka in Action

A transaction log is an append-oriented database record of transactions and the data changes they produce.

A transaction log is an append-oriented database record of data changes. When data is added, changed, or deleted, the database writes the change to the log before updating its tables. This ordering preserves a recoverable record of what happened. section 4.1.1

The log supports recovery and replication. After a failure, the database can replay recorded changes to restore a clean state; clustered instances can replicate the log and independently rebuild their tables from it. section 4.1.1 section 17.4.2

A transaction log provides several related capabilities:

  • Preserves the chronological history of changes rather than only the latest table state. section 4.1.2
  • Allows a database state from an earlier time to be reconstructed by replaying entries up to that point. section 4.1.2
  • Provides a source for keeping indexes, materialized views, and other derived structures current. section 17.4.2

Change data capture

A change data capture connector can monitor a relational database's transaction log instead of repeatedly inspecting the table itself. The Debezium connector for PostgreSQL is a concrete example of this approach, turning recorded database changes into an integration flow. section 11.9

Figure 4.1 A log is a sequential list where we add elements at the end and read them from a specific position (offset). For example, we read from offset 0, then choose to read from offset 4, and so on.
A red rectangular box with black text

AI-generated content may be incorrect.

Use the sequential-log diagram to follow append-at-the-end writes, chronological reads, and positions that identify where reading resumes. section 4.1.2

How Apache Kafka in Action covers it

How deep it goes
Explains write-before-table updates, replay, replication, and chronological access, but defers database-specific log formats.
Examples
Uses table updates, clustered database recovery, Debezium for PostgreSQL, and sequential entries identified by offsets.
What it assumes
Assumes basic familiarity with databases and tables while defining log writes, reads, replay, and recovery.
What you can do after
Operate change data capture by monitoring recorded relational-database changes with a connector.
How it connects
Connects database recovery, replication, change data capture, materialized views, and Kafka topics.

Also explained in

Compare how 6 books explain transaction log →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.