WAL extensions
WAL extensions allow you to add auxiliary information to each write-ahead log record. For example, you can enable storing an old and new tuple for each CRUD operation performed. This information might be helpful for implementing a CDC (Change Data Capture) utility that transforms a data replication stream.
See also: Configure the write-ahead log.
WAL extensions are disabled by default. To configure them, use the
wal.ext.* configuration options.
Inside the wal.ext block, you can enable storing old and new tuples as
follows:
- To store old and new tuples in a write-ahead log for all spaces, set
the wal.ext.old and
wal.ext.new options to
true:
ext:new: trueold: true
-
To adjust these options for specific spaces, specify the wal.ext.spaces option:
wal:ext:old: truenew: truespaces:space1:old: falsespace2:new: falseThe configuration for specific spaces has priority over the configuration in the
wal.ext.newandwal.ext.oldoptions. It means that only new tuples are added to the log forspace1and only old tuples forspace2.
Note that records with additional fields are replicated as follows:
- If a replica doesn't support the extended format configured on a master, auxiliary fields are skipped.
- If a replica and master have different configurations for WAL records, the master's configuration is ignored.
The table below demonstrates how write-ahead log records might look for
the specific CRUD operations if storing old and
new tuples is enabled for the bands space.
Operation | Example | WAL information |
|---|---|---|
insert |
| | new_tuple: [4, 'The Beatles', 1960] | tuple: [4, 'The Beatles', 1960] |
delete |
| | key: [4] | old_tuple: [4, 'The Beatles', 1960] |
update |
| | new_tuple: [2, 'Pink Floyd', 1965] | old_tuple: [2, 'Scorpions', 1965] | key: [2] | tuple: [['=', 2, 'Pink Floyd']] |
upsert |
| | new_tuple: [2, 'The Doors', 1965] | old_tuple: [2, 'Pink Floyd', 1965] | operations: [['=', 2, 'The Doors']] | tuple: [2, 'Pink Floyd', 1965] |
replace |
| | old_tuple: [1, 'Roxette', 1986] | new_tuple: [1, 'The Beatles', 1960] | tuple: [1, 'The Beatles', 1960] |
Storing both old and new tuples is especially useful for the update
operation because a write-ahead log record contains only a key value.