Expand description
Producer-snapshot selection, validation, replay, and deletion decisions.
The rules are Kafka’s, from three places:
LogLoader.loadpicks the log start the reload runs against, and first callsProducerStateManager.removeStraySnapshotswith the base offset of every local segment.ProducerStateManager.truncateAndReload(logStartOffset, logEndOffset, _)deletes every snapshot outside(logStartOffset, logEndOffset], thenloadFromSnapshotloads the newest snapshot that is left.UnifiedLog.rebuildProducerStatereplays each local segment frommax(segment.baseOffset, mapEndOffset, logStartOffset).
Structs§
- Producer
Reload Range - The offsets one producer-state reload runs against.
- Producer
Snapshot Entry Facts - One decoded producer-state snapshot entry, field for field as Kafka’s
ProducerStateManagersnapshot schema (version 1) lays it out, minus the timestamp, which no validity rule reads.
Functions§
- producer_
snapshot_ entry_ valid - Validate one decoded producer entry against its snapshot’s exclusive
offset boundary: the result is
snapshot_entry_valid_model. - producer_
snapshot_ latest_ index - Return the index of the newest snapshot a reload keeps, as Kafka’s
loadFromSnapshotloadslatestSnapshotFile()aftertruncateAndReloaddeleted every snapshot outside(log_start, log_end]. - producer_
snapshot_ reload_ keeps - Keep a snapshot through a reload exactly when Kafka’s
truncateAndReloadkeeps it: when it lies in(log_start, log_end]. - producer_
snapshot_ reload_ log_ start - Pick the log start a producer-state reload runs against, as Kafka’s
LogLoader.loaddoes. - producer_
snapshot_ replay_ start - Select the replay cursor after a reload loaded
snapshot, or none. - producer_
snapshot_ stray - Delete the snapshot at
snapshots[index]exactly when Kafka’sremoveStraySnapshotsdeletes it, given every local segment’s base offset. The snapshot offsets must be distinct; their order is irrelevant. - producer_
snapshot_ strays - Classify all producer snapshots using their on-disk offset order.