Server-to-server
Replica links, consensus commands, history fences and the header layouts used by Apache Iggy, including the replica wire revision 5 handshake.
Replicas use dedicated TCP listeners and 256-byte headers. Client listeners reject replica control commands. Replicas on different server versions link only when the release compatibility table lists them, and it lists none yet. Run the same server build and replica_connections_per_peer on every node.
Transport
The roster supplies each node's tcp_replica port and literal IP address. Lower replica IDs dial higher IDs. Each pair can use several links, which distribute traffic across shards. The default frame limit is 64 MiB through message_bus.max_message_size.
Each connection starts with an eight-byte placement preamble before TLS and the replica handshake:
[magic: IGRL, 4 bytes][version: u8][dialer_replica: u8][link_index: u16]Version 1 opens a replica link. Version 2 opens a join link, with the dialer and link bytes zero, and a build without join links refuses it. The preamble selects a shard and is not authentication. ReplicaHello repeats the peer and link identity and supplies the link count. The acceptor rejects a mismatch. With authentication enabled, placement fields participate in the handshake MAC. Shard counts can differ between nodes.
Handshake
ReplicaHello, ReplicaChallenge and ReplicaFinish establish the connection. [cluster.auth] enables the shared-key BLAKE3 MAC. [cluster.tls] encrypts traffic with TLS 1.3 and ALPN iggy-replica. TLS requires replica authentication. See Cluster security for configuration and key rotation.
Build identity and release compatibility
ReplicaHello, an accepted ReplicaChallenge and ReplicaFinish carry a 32-byte build identity at zero-based header bytes 193 to 224 inclusive. It is a BLAKE3 hash of the client protocol version, the replica wire revision, the server release and the storage format marker. A node also computes the identity of every release that its row of the release compatibility table lists, with its own protocol version, wire revision and storage marker.
A ReplicaHello carries the identity of the dialer in its header. Before replica wire revision 5, the dialer sends a header-only ReplicaHello. Starting with revision 5, the body carries one 32-byte identity for each release the dialer lists, up to 128 identities. The acceptor closes an oversized frame before reading its body and rejects a partial identity with IncompatibleBuild.
The acceptor selects the identity of the link. It selects the identity of the dialer when that is its own or one it lists. It selects its own when the hello body contains it. Otherwise it answers with a ReplicaChallenge of status IncompatibleBuild (6).
An accepted ReplicaChallenge and ReplicaFinish carry the selected identity and have no body. When authentication is enabled, both MACs cover that identity and the BLAKE3 hash of the complete ReplicaHello frame. The dialer closes the link when the challenge carries an identity that is neither its own nor one it lists.
A node can admit a later release that explicitly lists it. The table is compiled into the server and ships empty. See Release compatibility.
Join link
A node admitted outside the static roster binds its disk to its admission over a join link to a seed. Shard 0 of the seed serves the link itself, answers one bind request and closes it, so it never becomes a replica link. A seed serves at most four join links at a time and drops the others. With [cluster.tls] the link runs inside TLS after the preamble, and the joiner checks that the seed's certificate names the seed's IP address. Integers are little-endian.
The joiner's ReplicaHello carries replica byte 255 and, as on a replica link, its nonce, build identity and heartbeat timings. Its body starts with a 32-byte JoinHello block, followed by the build identities the joiner lists:
[operation_id: u64][storage_incarnation: u128][reserved: 8 bytes, zero]The seed answers a body shorter than the block, or one with a nonzero reserved byte, with status IncompatibleBuild (6). A seed without replica authentication answers with status JoinRequiresAuth (10), and a hello without a nonce is closed without an answer. Both handshake MACs bind the link placement as zero, the dialer id 255 and, after the channel binding, a mode byte 1 followed by operation_id and storage_incarnation.
On subsequent replica links involving an admitted node, each MAC includes mode byte 2 followed by the dialer and acceptor storage incarnations, in that order, as little-endian 128-bit integers. A static endpoint contributes zero. The acceptor replies with JoinRequiresAuth (10) if replica authentication is disabled.
The joiner sends its admission secret only after the seed's MAC verified, and the seed reads it only after the joiner's ReplicaFinish verified. Then the joiner sends one bind request and the seed one answer, each in a frame:
[length: u32][body: length bytes][mac: 32 bytes]The frame MAC is a keyed BLAKE3 hash under the replica authentication key of the tag apache-iggy replica-join frame v1, the handshake transcript, a direction byte (1 from the joiner, 2 from the seed), the body length as a u64 and the body. The bind request body has 52 bytes:
[secret: 32 bytes][slot: u8][endpoint: 19 bytes]An endpoint is [family: u8][address: 16 bytes][port: u16] with family 4 or 6, and an IPv4 address fills the first four address bytes and leaves the rest zero. slot is the joiner's --replica-id. The operation and the storage incarnation come from the JoinHello block.
The answer body starts with a kind byte. Kind 0 means the binding is not committed yet, has no further bytes, and the joiner asks again later. Kind 2 is a refusal followed by a reason byte: 1 unknown operation, 2 secret mismatch, 3 operation bound to another disk, 4 expired, 5 cancelled, 6 the seed cannot decide admissions now, 7 endpoint mismatch, and 8 slot mismatch followed by the slot the operation reserved. Kind 1 accepts the binding:
[slot: u8][endpoint: 19 bytes][directory_revision: u64][member_count: u8][members]Each member is [slot: u8][storage_incarnation: u128][endpoint: 19 bytes]. An answer lists at most 32 members, each slot once and below 32, so it is at most 1182 bytes.
Command discriminants
The command byte is at offset 60. This is the complete registry, including client commands:
| Value | Command |
|---|---|
| 0 | Reserved |
| 1 | Ping |
| 2 | Pong |
| 3 | PingClient |
| 4 | PongClient |
| 5 | Request |
| 6 | Prepare |
| 7 | PrepareOk |
| 8 | Reply |
| 9 | Commit |
| 10 | StartViewChange |
| 11 | DoViewChange |
| 12 | StartView |
| 13 | Eviction |
| 14 | ReplicaHello |
| 15 | ReplicaChallenge |
| 16 | ReplicaFinish |
| 17 | RequestStartView |
| 18 | RequestPrepares |
| 19 | RepairPrepare |
| 20 | RepairDone |
| 21 | RangeEvicted |
| 22 | RequestStateTransfer |
| 23 | StateTransferTarget |
| 24 | RequestStateChunk |
| 25 | StateChunk |
| 26 | ForwardRegister |
| 27 | ForwardRegisterResult |
| 28 | ForwardLogout |
| 29 | ForwardLogoutResult |
| 30 | ConsumerSessionHeartbeat |
| 31 | SessionRetirementProgress |
| 32 | ForwardCompletion |
| 33 | PrimaryRebalance |
| 34 | SegmentDelete |
| 35 | CommitReply |
| 36 | PrepareProgress |
Reserved and unused ping/pong forms do not establish a session. Reply and Eviction are client-bound and rejected on replica ingress. A replica Request uses the internal routed-request header, including its group and metadata watermark.
Consensus and history
The metadata group orders resources, users and sessions. Every partition has its own group for messages and offsets. The group field identifies the target. The metadata group uses 1 << 63, while partition groups use packed stream, topic and partition IDs.
Prepare carries an operation and its body. PrepareOk acknowledges the required replication and persistence work. Commit broadcasts the commit point and a liveness token. CommitReply proves that peers still respond. A primary that cannot reach a quorum relinquishes leadership.
StartViewChange, DoViewChange and StartView establish a new view. The DoViewChange flags byte defines four bits, and a receiver drops a vote with any other bit set.
Bit 0 marks a log that may lack writes its sender acknowledged before a restart, so a replica without proven history cannot vote as an authoritative empty log. Such a vote adds the bodies it can serve to the merge and never counts as a nack. Bit 1 marks a vote built from the sender's own journal. A replica barred from electing answers with a vote that carries no log and leaves bit 1 clear. For persisted partitions, the merge limits how many placeholders can hide an acknowledged operation.
Bit 2 marks a copy with no initialization record on a disk known to predate the partition. Bit 3 marks a missing copy whose disk may have replaced an earlier one. A sender sets at most one of these bits.
Each unmarked placeholder can hide an acknowledger. Among marked placeholders the merge counts all bit 3 senders, or one bit 2 sender if no bit 3 sender reported. The total must stay below the replication quorum when the merge needs every voter.
incarnation carries the sender's per-boot incarnation, and a receiver counts a vote only from the incarnation it registered for the sender. RequestStartView probes for the current view after recovery.
Partition incarnation fields fence an old partition history. Consumer ownership generations separately fence old group members. PrimaryRebalance moves a partition primary under metadata coordination. PrepareProgress lets a slow replica report received, held and committed progress while it catches up.
Frame integrity
Replica control frames use an XxHash3-64 frame seal widened to u128. Prepare and RepairPrepare use a prepare identity hash, and a parent identity links the history. Metadata prepare bodies have their own seal. Message batches carry their batch checksums. These unkeyed hashes detect corruption, not a malicious peer. Authentication and TLS provide separate protection.
Header layouts
Every header begins with the common 128-byte frame prefix shown in Framing. The tables below list the remaining fields in wire order. Multi-byte integers are little-endian. Reserved fields are not extension space for clients. RepairPrepare uses the PrepareHeader layout with its repair command value.
PrepareHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | client |
| 144 | 16 | parent |
| 160 | 16 | request_checksum |
| 176 | 8 | op |
| 184 | 8 | commit |
| 192 | 8 | timestamp |
| 200 | 8 | request |
| 208 | 1 | operation |
| 209 | 7 | operation_padding |
| 216 | 8 | group |
| 224 | 4 | user_id |
| 228 | 4 | retry_capacity |
| 232 | 8 | partition_incarnation |
| 240 | 8 | reserved |
| 248 | 8 | session |
PrepareOkHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | parent |
| 144 | 16 | prepare_checksum |
| 160 | 8 | op |
| 168 | 8 | commit |
| 176 | 8 | timestamp |
| 184 | 8 | request |
| 192 | 1 | operation |
| 193 | 7 | operation_padding |
| 200 | 8 | group |
| 208 | 48 | reserved |
CommitHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | commit_checksum |
| 144 | 8 | timestamp_monotonic |
| 152 | 8 | commit |
| 160 | 8 | checkpoint_op |
| 168 | 8 | group |
| 176 | 8 | partition_incarnation |
| 184 | 72 | reserved |
CommitReplyHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | timestamp_monotonic |
| 136 | 8 | group |
| 144 | 8 | partition_incarnation |
| 152 | 104 | reserved |
Each batched CommitReplyEntry is 32 bytes. Offsets are relative to the start of the entry.
| Offset | Bytes | Field |
|---|---|---|
| 0 | 8 | Group |
| 8 | 8 | Partition incarnation |
| 16 | 8 | Monotonic heartbeat timestamp |
| 24 | 4 | View |
| 28 | 1 | Sender's member index |
| 29 | 1 | Flags |
| 30 | 2 | Reserved, zero |
Bit 0 (STORAGE_RECOVERING) excludes the sender from handoff. Bit 1 (ACKS_FENCED) excludes it from the write quorum. Bit 2 (LEAVING) excludes a departing sender from handoff while its heartbeat still counts toward quorum if it can acknowledge. Receivers reject unknown bits.
PrepareProgressHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | nonce |
| 136 | 8 | group |
| 144 | 8 | partition_incarnation |
| 152 | 8 | observed_op |
| 160 | 8 | received_op |
| 168 | 8 | held_op |
| 176 | 8 | commit_op |
| 184 | 1 | kind |
| 185 | 1 | ready |
| 186 | 1 | recovery_flags |
| 187 | 5 | reserved |
| 192 | 16 | incarnation |
| 208 | 48 | reserved |
Kinds 0 and 1 carry a replication progress probe and reply. Kinds 2 and 3 carry a storage recovery probe and reply. For storage recovery, nonce and observed_op contain the low and high halves of the requester's fresh 128-bit challenge. A voter replies with its durable view and sets ready when its storage is trusted. The requester counts each other voter once for its own group and partition incarnation.
A mounted sender uses its nonzero boot incarnation. A refused copy answers with a stable nonzero incarnation for that copy, its verified durable view (at least the creation view) or the creation view when the record cannot be trusted, ready = 0 and only bit 1 set. It counts as a responder and may still hold history.
A recovery reply sets bit 0 of recovery_flags for a missing copy on a disk known to predate the partition, or bit 2 for a missing copy on a possible replacement disk. Bit 1 independently indicates that the sender cannot serve its history yet. The receiver rejects unknown bits.
A partition can elect with an empty history after every voter reports a missing copy and the number of possible replacement disks stays below the replication quorum. received_op, held_op and commit_op are zero in a recovery frame, and recovery_flags and incarnation are zero in kinds 0 and 1.
StartViewChangeHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | group |
| 136 | 8 | partition_incarnation |
| 144 | 112 | reserved |
DoViewChangeHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | op |
| 136 | 8 | commit |
| 144 | 8 | group |
| 152 | 4 | log_view |
| 156 | 1 | flags |
| 157 | 3 | reserved |
| 160 | 16 | incarnation |
| 176 | 40 | reserved |
| 216 | 8 | partition_incarnation |
| 224 | 16 | nack_bitset |
| 240 | 16 | present_bitset |
StartViewHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | op |
| 136 | 8 | commit |
| 144 | 8 | group |
| 152 | 8 | partition_incarnation |
| 160 | 80 | reserved |
| 240 | 16 | incarnation |
RequestStartViewHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 8 | group |
| 136 | 8 | partition_incarnation |
| 144 | 96 | reserved |
| 240 | 16 | incarnation |
RequestPreparesHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | from_op |
| 152 | 8 | to_op |
| 160 | 8 | group |
| 168 | 8 | partition_incarnation |
| 176 | 80 | reserved |
RepairRangeReplyHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | op |
| 152 | 8 | group |
| 160 | 8 | partition_incarnation |
| 168 | 88 | reserved |
RequestStateTransferHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | group |
| 152 | 8 | partition_incarnation |
| 160 | 96 | reserved |
StateTransferTargetHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | commit_op |
| 152 | 8 | group |
| 160 | 1 | available |
| 161 | 1 | unavailable_transient |
| 162 | 6 | reserved_alignment |
| 168 | 8 | commit_max |
| 176 | 8 | partition_incarnation |
| 184 | 72 | reserved |
RequestStateChunkHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | offset |
| 152 | 8 | group |
| 160 | 4 | len |
| 164 | 4 | artifact |
| 168 | 8 | partition_incarnation |
| 176 | 80 | reserved |
StateChunkHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 8 | offset |
| 152 | 8 | group |
| 160 | 4 | artifact |
| 164 | 84 | reserved |
| 248 | 8 | partition_incarnation |
ForwardRegisterHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | client |
| 144 | 16 | nonce |
| 160 | 4 | user_id |
| 164 | 92 | reserved |
ForwardRegisterResultHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 16 | client |
| 160 | 8 | epoch |
| 168 | 8 | watermark |
| 176 | 79 | reserved |
| 255 | 1 | outcome |
ForwardLogoutHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | client |
| 144 | 16 | nonce |
| 160 | 8 | session |
| 168 | 8 | request |
| 176 | 80 | reserved |
ForwardLogoutResultHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 16 | nonce |
| 144 | 16 | client |
| 160 | 8 | commit |
| 168 | 87 | reserved |
| 255 | 1 | outcome |
ForwardCompletionHeader
| Offset | Bytes | Field |
|---|---|---|
| 128 | 2 | reporter |
| 130 | 1 | operation |
| 131 | 125 | reserved |
Repair and state transfer
RequestPrepares asks for a retained operation range. RepairPrepare sends the original prepares. RepairDone terminates the stream, and RangeEvicted reports history that is no longer retained. Requests are bounded by repair_chunk_max and the peer queue capacity.
State transfer handles larger gaps. RequestStateTransfer obtains a manifest, then RequestStateChunk and StateChunk transfer artifacts. The receiver checks each complete artifact against its manifest length and checksum before using it. The manifest has magic ISM1, a u32 entry count, a u8 entry length and a trailing XxHash3-64 checksum. Entries contain kind, frontier, length and checksum.
Server 0.10.0 uses replica wire revision 1, writes metadata snapshot format 15, reads formats 14 and 15, and transfers the client table as ICT5. Server 0.10.1-edge.2 builds use revisions 4, 5, 6 and 7. Server 0.10.1-edge.3 uses revision 8 and the formats below.
| Kind | Artifact | Current format |
|---|---|---|
| 0 | Metadata snapshot | MessagePack version 22, readers accept 21 and 22 |
| 1 | Client table | ICT6 |
| 2 | Segment log | Canonical batch records |
| 3 | Consumer offsets and partition state | ICO1 version 9, readers accept 8 and 9 |
The offset artifact also retains partition history, retry state and producer state. These internal readability windows do not provide migration from a 0.9 data directory. Use the upgrade procedure.
The header definitions and command registry define the layouts. The replica transport implements preamble admission and authentication.
