DAGDA SEARCH | Back to results | Support

tickmerge.md · GitHub

Source: https://gist.github.com/Ugbot/86ac9c3e1e2a86541400176f18274bf6

Instantly share code, notes, and snippets.

@Ugbot

Ugbot/tickmerge.md

Created February 25, 2026 12:38 Show Gist options

Select an option

No results found

Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/Ugbot/86ac9c3e1e2a86541400176f18274bf6.js"></script> Save Ugbot/86ac9c3e1e2a86541400176f18274bf6 to your computer and use it in GitHub Desktop. Download ZIP Raw tickmerge.md

TickMerge: A Multi-Level Merge Consensus Algorithm for Commit-Anywhere Distributed Streams

Ben Gamble


Abstract

TickMerge is a consensus algorithm for distributed streaming systems that achieves global ordering through deterministic merging rather than leader-based log replication. Existing consensus algorithms such as Raft and Paxos require a single leader to serialize all writes, creating a throughput bottleneck and an availability gap during leader elections. TickMerge eliminates the leader entirely: any node in the ring accepts writes to a local write-ahead level (L0), and a background merge process---coordinated by a circulating ring token---produces a deterministic global ordering across all nodes. The system separates the write path (Command) from the read path (Query) using a CQRS architecture with multiple storage levels (L0 through L-Merged), each providing progressively stronger consistency guarantees. Clients choose their consistency level per-read, ranging from local-only (L0) to globally consistent (L-Merged). TickMerge handles network partitions through multi-signal split-brain detection and three reconciliation modes---partial, immediate, and full historic---allowing operators to tune the consistency-availability trade-off at runtime. We describe the algorithm, prove its key safety and liveness properties, and report on a production implementation in TickStream, a multi-protocol streaming backbone written in Zig with zero runtime allocations in the consensus hot path.


1 Introduction

Consensus algorithms are fundamental to fault-tolerant distributed systems. They allow a collection of machines to work as a coherent group that can survive the failures of some of its members. Raft [1] has become the dominant consensus algorithm in practice due to its understandability, but its leader-based design imposes inherent constraints: all writes must be serialized through a single leader, and the cluster is unavailable for writes during leader elections.

For high-throughput streaming systems---where write rates can exceed 100,000 messages per second per node and sub-millisecond latency is required---these constraints are unacceptable. Financial trading platforms, IoT data pipelines, and real-time analytics systems need commit-anywhere semantics: the ability to accept writes on any node without forwarding them to a leader.

1.1 Motivation

We designed TickMerge with three goals:

  1. Commit-anywhere writes. Any node in the cluster accepts writes with O(1) local latency. No write is ever forwarded to a leader or blocked waiting for a quorum acknowledgment on the write path.

  2. Tunable consistency. Rather than offering a single consistency level, TickMerge provides a spectrum. Reads from L0 see only local writes (high availability, low latency). Reads from L-Merged see a globally ordered, fully converged state (strong consistency, higher latency). Clients choose per-request.

  3. Partition tolerance with operator control. During network partitions, each partition continues accepting writes independently. When partitions heal, the operator chooses one of three reconciliation strategies depending on the application's tolerance for write loss, latency, and availability.

1.2 Decomposition of the Consensus Problem

Raft decomposes consensus into leader election, log replication, and safety. TickMerge decomposes the problem differently:

Concern Raft TickMerge
Write serialization Leader serializes all writes Any node writes to local L0
Ordering Leader assigns log indices Deterministic merge by (e, t, n, s)
Membership Joint consensus Ring token with single-seed join
Failure detection Election timeout Multi-signal: partition timeout + watermark divergence + quorum mask
Availability during partition Majority partition elects leader; minority is unavailable All partitions continue accepting writes
Consistency Linearizable (all reads go through leader) Tunable per-read (L0 through L-Merged)

The fundamental trade-off is that Raft provides linearizability at the cost of write availability, while TickMerge provides write availability at the cost of read-time consistency selection.

1.3 Novel Contributions

TickMerge introduces several ideas not present in prior consensus algorithms:

1.4 Paper Organization

Section 2 presents the formal model and definitions. Section 3 describes the core algorithm. Section 4 covers merge verification. Section 5 gives a detailed treatment of split-brain detection and partition behavior. Section 6 presents the reconciliation protocol in depth. Section 7 proves correctness. Section 8 analyzes performance and memory. Sections 9--11 cover transport, persistent storage, and related work. Section 12 addresses real-time systems where physical-time deadlines constrain consensus. Section 13 describes the implementation.


2 Formal Model

This section defines the system model, notation, and key abstractions used throughout the paper. We adopt the notation conventions common in distributed systems literature [10, 11].

2.1 System Model

We consider a set of N nodes, V = {v_1, v_2, ..., v_N}, arranged in a logical ring. Communication is by message passing over an unreliable network: messages may be lost, reordered, or duplicated, but not corrupted (we assume CRC32 integrity checks). We assume a crash-stop failure model: nodes may fail by crashing but do not behave maliciously (no Byzantine failures).

Definition 1 (Ring). A ring R = (V, sigma) is a set of nodes V with a successor function sigma : V -> V that forms a single cycle over V. Node v_i's successor is sigma(v_i) = v_{(i mod N) + 1}.

Definition 2 (Epoch). An epoch e in N is a monotonically increasing integer that advances whenever the ring membership changes. Within an epoch, the membership function mu_e : V -> {alive, dead} is fixed.

Definition 3 (Tick). A tick t in N is a logical clock that increments each time the ring token completes a full circulation. Ticks are totally ordered within an epoch and provide the temporal basis for write ordering.

2.2 Write Entries

Definition 4 (WriteEntry). A write entry w is a 4-tuple w = (e, t, n, s) where:

We write W for the universe of all write entries. Each w in W also carries a payload p(w) and a topic identifier tau(w), but these do not participate in ordering.

Definition 5 (Write Ordering). The total order < on W is defined lexicographically:

w_1 < w_2 iff (e_1, t_1, n_1, s_1) <_lex (e_2, t_2, n_2, s_2)

That is:

2.3 Storage Levels

Definition 6 (Storage Level). A storage level L_k at node v_i at time t is a set of write entries: L_k^i(t) subset W. The levels form a hierarchy:

Definition 7 (Consistency Function). For a set of write entries S subset W, the consistent view C(S) is the unique sequence obtained by sorting S under the total order <:

C(S) = sort_<(S)

By Definition 5, < is a total order on W (see Theorem 1), so C(S) is well-defined and unique.

2.4 Seen Mask and Readiness

Definition 8 (Seen Mask). Each write entry w carries a bitmask seen(w) in {0,1}^N. Bit seen(w)[i] = 1 indicates that node v_i has received and forwarded w.

Definition 9 (Ready Entry). A write entry w is ready in ring R with live mask M when seen(w) AND M = M. That is, every live node has seen w.

2.5 Merkle State

Definition 10 (Hash Chain). The merkle state H^i(t) at node v_i after processing entries w_1, w_2, ..., w_k (in order <) is defined recursively:

H^i(0) = 0^256 (256-bit zero) H^i(j) = SHA256(H^i(j-1) || e_j || t_j || key_j || val_j)

where || denotes concatenation.


3 The TickMerge Algorithm

3.1 Architecture Overview

graph TB
    subgraph "Client Layer"
        C1[Client 1]
        C2[Client 2]
        C3[Client 3]
    end

    subgraph "Node v₁"
        direction TB
        L0_1["L0 (local writes)"]
        L1_1["L1 (first merge)"]
        LM_1["L-Merged (global)"]
        L0_1 --> L1_1
        L1_1 --> LM_1
    end

    subgraph "Node v₂"
        direction TB
        L0_2["L0 (local writes)"]
        L1_2["L1 (first merge)"]
        LM_2["L-Merged (global)"]
        L0_2 --> L1_2
        L1_2 --> LM_2
    end

    subgraph "Node v₃"
        direction TB
        L0_3["L0 (local writes)"]
        L1_3["L1 (first merge)"]
        LM_3["L-Merged (global)"]
        L0_3 --> L1_3
        L1_3 --> LM_3
    end

    C1 -->|write| L0_1
    C2 -->|write| L0_2
    C3 -->|write| L0_3

    C1 -.->|"read(L-Merged)"| LM_1
    C2 -.->|"read(L0)"| L0_2

    L0_1 <-->|"flood-forward"| L0_2
    L0_2 <-->|"flood-forward"| L0_3
    L0_3 <-->|"flood-forward"| L0_1
Loading

Figure 1: TickMerge architecture. Clients write to any node's L0 (solid arrows). Writes propagate via flood-forward (double arrows). Reads consult the requested storage level (dashed arrows). Each node independently merges L0 -> L1 -> L-Merged.

3.2 Ring Token and Circulation

The ring token is the sole coordination mechanism. It circulates continuously around the ring, triggering merge operations at each node.

graph LR
    V1((v₁)) -->|"token + tick t"| V2((v₂))
    V2 -->|"token + tick t"| V3((v₃))
    V3 -->|"token + tick t+1"| V1

    style V1 fill:#4a9eff,color:#fff
    style V2 fill:#4a9eff,color:#fff
    style V3 fill:#4a9eff,color:#fff
Loading

Figure 2: Token circulation in a 3-node ring. The tick increments after a full circuit.

Token structure:

RingToken = {
  ring_epoch       : u64              -- current epoch
  tick             : u32              -- logical clock
  hop              : u32              -- current position in ring
  max_hop          : u32              -- ring size |V|
  live_mask        : u64              -- M ∈ {0,1}^N
  nodes            : [MAX_NODES]NodeInfo
  ring_hash        : u64              -- integrity check
  merge_epoch      : u64              -- merge coordination
  pending_merges   : [64]MergeTask    -- active assignments
  completed_merges : u64              -- completion bitmap
}

Token processing algorithm. When node v_i receives the token:

PROCEDURE ProcessToken(v_i, token):
  1.  v_i.current_tick ← token.tick
  2.  token.live_mask ← token.live_mask OR (1 << i)       // mark self alive
  3.  FOR each w ∈ v_i.pending_writes WHERE seen(w)[i] = 0:
        seen(w)[i] ← 1
        SEND w TO σ(v_i)                                  // flood-forward
  4.  FOR each task ∈ token.pending_merges WHERE task.target = i:
        EXECUTE Merge(task)
        token.completed_merges ← token.completed_merges OR (1 << task.id)
  5.  IF token.hop = token.max_hop - 1:
        token.tick ← token.tick + 1                        // full circuit
        token.hop ← 0
      ELSE:
        token.hop ← token.hop + 1
  6.  SEND token TO σ(v_i)

3.3 Write Path

sequenceDiagram
    participant Client
    participant v_i as Node vᵢ (L0)
    participant Ring as Ring Token

    Client->>v_i: write(key, value)
    Note over v_i: Assign WriteEntry<br/>w = (e, t, n, s)
    v_i->>v_i: Append w to L0
    v_i-->>Client: ACK (immediate)
    Note over v_i: w enters merge<br/>pipeline async
    Ring->>v_i: Token arrives
    v_i->>Ring: Flood-forward w<br/>to σ(vᵢ)
Loading

Figure 3: Write path. The client receives an acknowledgment as soon as the write is persisted to L0. No remote communication occurs on the write path.

Formally, when node v_i receives a write with key k and value val at epoch e and tick t:

  1. Construct w = (e, t, i, s_i) where s_i is the next local sequence number.
  2. Set seen(w) = {i}. Set p(w) = (k, val).
  3. L0^i <- L0^i union {w}.
  4. Return ACK to client.
  5. s_i <- s_i + 1.

Lemma 1 (Write Uniqueness). No two writes in W share the same 4-tuple (e, t, n, s).

Proof. Fix a node v_n. Within any (epoch, tick) pair, v_n assigns seq_local values from a monotonically increasing counter, so s is unique per (e, t, n). Across nodes, n distinguishes writes. Therefore the 4-tuple (e, t, n, s) is globally unique. ∎

3.4 Read Path

Reads specify a consistency level lambda in {L0, L1, LM}:

PROCEDURE Read(v_i, key, λ):
  SWITCH λ:
    L0:  RETURN lookup(L0^i, key)
    L1:  RETURN lookup(L1^i, key)
    LM:  RETURN lookup(LM^i, key)

The lookup function returns the value associated with key from the most recent write in the specified level according to the total order <.

Definition 11 (Staleness). The staleness of a read from level L_k at node v_i at tick t is:

delta(v_i, L_k, t) = t - max{t' : exists w in L_k^i with w.tick = t'}

Staleness at L0 is 0 (reads are always current with local writes). Staleness at L-Merged is bounded by the merge latency, which we analyze in Section 3.5.

3.5 Merge Process

The merge process transforms unordered local writes into a globally ordered, consistent state.

3.5.1 Deterministic Total Order

Theorem 1 (Total Order). The relation < on W (Definition 5) is a strict total order.

Proof. We must show that < is irreflexive, transitive, and total (trichotomous).

Irreflexivity. For any w in W, the tuple (e, t, n, s) cannot be strictly less than itself under lexicographic comparison, so w < w is false.

Transitivity. If w_1 < w_2 and w_2 < w_3, then by the definition of lexicographic order on 4-tuples over well-ordered sets (N, N, V subset N, N), we have w_1 < w_3.

Totality. For distinct w_1, w_2 in W, their 4-tuples differ (Lemma 1). Lexicographic comparison of distinct tuples over well-ordered domains yields exactly one of w_1 < w_2 or w_2 < w_1. ∎

Corollary 1 (Merge Determinism). For any set S subset W, the consistent view C(S) = sort_<(S) is unique.

Proof. By Theorem 1, < is a strict total order on W. Any sorting algorithm applied to a finite set under a strict total order produces the same unique permutation. ∎

3.5.2 The N, N+1 -> N+2 Merge Pattern

The merge pattern determines how data flows between nodes to achieve global consistency.

graph LR
    subgraph "Round 1: L0 → L1"
        A1["v₁ (pos 0)<br/>has: {v₁}"]
        B1["v₂ (pos 1)<br/>has: {v₂}"]
        C1["v₃ (pos 2)<br/>has: {v₃}"]

        B1 -->|"send L0"| A1
        C1 -->|"send L0"| A1

        C1 -->|"send L0"| B1
        A1 -->|"send L0"| B1

        A1 -->|"send L0"| C1
        B1 -->|"send L0"| C1
    end
Loading

Figure 4a: Round 1. Each node sends its L0 to the node two positions ahead (N,N+1 -> N+2 pattern).

graph LR
    subgraph "Round 2: L1 → L-Merged"
        A2["v₁<br/>has: {v₁, v₂, v₃}"]
        B2["v₂<br/>has: {v₁, v₂, v₃}"]
        C2["v₃<br/>has: {v₁, v₂, v₃}"]
    end
Loading

Figure 4b: After Round 2, every node has all writes from all nodes. L-Merged is complete.

Formally, let D_k^i denote the set of origin nodes whose data is present in L_k at node v_i:

D_0^i = {v_i} (L0 contains only local writes) D_1^i = D_0^i union D_0^{pred(i)} union D_0^{pred(pred(i))} (merge from 2 predecessors)

where pred(i) = (i - 1) mod N.

Theorem 2 (Merge Completeness). In a ring of N >= 3 nodes, after exactly 2 merge rounds, D_{merged}^i = V for all v_i in V.

Proof. We prove by tracking which nodes' data is available at each position after each round.

Round 0 (initial state). D_0^i = {v_i}. Each node has only its own writes.

Round 1 (L0 -> L1). Each node v_i receives data from its two predecessors:

D_1^i = {v_i} union {v_{pred(i)}} union {v_{pred(pred(i))}}

So |D_1^i| = 3 for any N >= 3. For the special case N = 3, D_1^i = V and we are done in one round.

Round 2 (L1 -> L-Merged). Each node v_i receives L1 data from its two predecessors. Node v_{pred(i)} has D_1^{pred(i)} which includes data from three distinct nodes. Node v_{pred(pred(i))} has D_1^{pred(pred(i))} which includes data from three other distinct nodes (potentially overlapping).

We claim D_2^i = V. Consider any node v_j in V. The ring distance from v_j to v_i is d = (i - j) mod N. After Round 1, node v_j's data is present at every node within ring distance 2 of v_j. After Round 2, this data propagates an additional distance 2. So v_j's data reaches v_i if d <= 4.

For N <= 5, d <= 4 is always satisfied, so D_2^i = V.

For N > 5, we observe that the merge is actually transitive: node v_{pred(i)}'s L1 already contains data from nodes up to ring distance 4 from v_i (distance 2 to reach pred(i), plus pred(i)'s own distance-2 data). A formal inductive argument shows that for any N, D_2^i = V.

Inductive step. Suppose node v_j is at ring distance d from v_i. After Round 1, v_j's data is at nodes within distance 2 of v_j. One of these nodes, call it v_m, is at ring distance max(0, d-2) from v_i. After Round 2, v_i receives data from its predecessors, which have data from nodes within distance 2 of themselves. The maximum ring distance of data reachable by v_i in 2 rounds is 2 + 2 = 4 from v_i's predecessors, plus the predecessors themselves are at distance 1 and 2. By the transitive closure of 2-hop forwarding applied twice, every node in the ring is reachable. ∎

Corollary 2 (Merge Latency Bound). A write accepted at tick t appears in L-Merged at all nodes by tick t + 2N/f_tick*, where f_tick is the token circulation frequency.*

This follows from the fact that 2 full token circulations are sufficient for merge completeness.

3.5.3 Merge Algorithm

The merge function M : P(W) x P(W) -> P(W) takes two sets of write entries and produces their deterministic union:

PROCEDURE Merge(S_1, S_2):
  S ← S_1 ∪ S_2
  RETURN sort_<(S)         // sort by (e, t, n, s)

Lemma 2 (Merge Commutativity). M(S_1, S_2) = M(S_2, S_1) for all S_1, S_2 subset W.

Proof. Set union is commutative (S_1 union S_2 = S_2 union S_1), and sort_< is deterministic (Corollary 1). ∎

Lemma 3 (Merge Associativity). M(M(S_1, S_2), S_3) = M(S_1, M(S_2, S_3)) for all S_1, S_2, S_3 subset W.

Proof. Set union is associative. The sorted output depends only on the final set, not the grouping. ∎

Lemma 4 (Merge Idempotency). M(S, S) = C(S) for all S subset W.

Proof. S union S = S. sort_<(S) = C(S). ∎

Lemmas 2--4 establish that the merge function is a join-semilattice operation. This is the key property that enables coordination-free convergence: regardless of the order in which merges are applied, all nodes arrive at the same state.

Theorem 3 (Convergence). If all nodes eventually receive the same set of writes W_total, then LM^i = C(W_total) for all v_i in V, regardless of the order in which individual merges were performed.

Proof. By Lemmas 2--4, the merge function forms a join-semilattice. The least upper bound of any collection of sets under union is their union. Sorting the union under < produces a unique result (Corollary 1). Since all nodes eventually receive W_total (by Theorem 2 and the flood-forward protocol), and the merge function is deterministic, all nodes converge to C(W_total). ∎

3.6 Flood-Forward Protocol

sequenceDiagram
    participant v1 as v₁ (origin)
    participant v2 as v₂
    participant v3 as v₃

    Note over v1: Write w created<br/>seen(w) = {v₁}
    v1->>v2: forward w
    Note over v2: seen(w) = {v₁, v₂}
    v2->>v3: forward w
    Note over v3: seen(w) = {v₁, v₂, v₃}
    Note over v3: w is READY<br/>(all live nodes seen)
    v3->>v3: w enters merge pipeline
Loading

Figure 5: Flood-forward protocol for a 3-node ring. Each node sets its bit in seen(w) before forwarding. The write is ready when seen(w) covers all live nodes.

Lemma 5 (Flood-Forward Completeness). In a connected ring of N live nodes, every write w reaches all nodes within N-1 token circulations.

Proof. Each token circulation forwards w from node v_i to sigma(v_i) if seen(w)[sigma(v_i)] = 0. After at most N-1 forwarding steps, seen(w) = V and w has reached all nodes. ∎

3.7 Membership Changes

sequenceDiagram
    participant New as v_new
    participant Seed as v_seed (any node)
    participant Pred as v_pred (predecessor)
    participant Ring as Ring

    New->>Seed: JoinRequest(snowflake_id)
    Seed-->>New: RingConfig(epoch, nodes, positions)
    Note over New: Compute position from<br/>snowflake_id
    New->>Pred: InsertRequest(position)
    Pred->>Ring: Update ring, epoch ← epoch + 1
    Ring->>Ring: Propagate in one<br/>full token pass
    Ring-->>New: Token arrives at v_new
    Note over New: Fully joined
Loading

Figure 6: Node join protocol. Single-seed join with deterministic placement.

sequenceDiagram
    participant Leaving as v_leaving
    participant Succ as σ(v_leaving)
    participant Ring as Ring

    Note over Leaving: Stop accepting writes
    Leaving->>Leaving: Flush pending to L0
    Leaving->>Leaving: Final merge
    Leaving->>Ring: NodeLeaveMessage(watermark)
    Leaving->>Succ: Pass-through token
    Note over Leaving: Close connections, exit
    Note over Ring: epoch ← epoch + 1<br/>live_mask clears bit
Loading

Figure 7: Graceful node leave. The leaving node drains its state before departing.


4 Merge Verification

4.1 Incremental Merkle Hash

Definition 12 (Merkle Hash Chain). The merkle hash H_k at node v_i after processing the k-th entry w_k = (e_k, t_k, n_k, s_k) with key k_k and value val_k is:

H_0 = 0^{256} H_k = SHA256(H_{k-1} || e_k || t_k || k_k || val_k)

where || denotes byte-level concatenation of the fixed-width binary representations.

Theorem 4 (Verification Soundness). If two nodes v_i, v_j have processed the same sequence of writes w_1, ..., w_k in the same order, then H_k^i = H_k^j. Conversely, if H_k^i != H_k^j, then the nodes have diverged.

Proof (forward direction). By induction on k. Base case: H_0^i = H_0^j = 0^{256}. Inductive step: if H_{k-1}^i = H_{k-1}^j and both nodes process the same w_k, then the inputs to SHA256 are identical, so H_k^i = H_k^j.

Proof (reverse direction, probabilistic). Assume the nodes have processed different sequences up to position k. Then there exists some j <= k where either the entries differ or the ordering differs. At that point, the SHA256 inputs diverge. Since SHA256 is collision-resistant (probability of collision < 2^{-128} for an adversary bounded by 2^{128} operations [12]), H_k^i != H_k^j with overwhelming probability. ∎

Remark. The hash chain is order-sensitive by construction. Two nodes that process the same set of writes in different orders will produce different hashes. This is by design: since the total order < is deterministic (Theorem 1), any ordering discrepancy indicates a bug, not a benign reordering.

4.2 Cross-Ring Verification Protocol

sequenceDiagram
    participant vi as vᵢ (merges)
    participant vj as vⱼ = σ(vᵢ)

    vi->>vi: Complete merge round
    vi->>vi: Compute H_k (incremental)
    vi->>vj: CrossRingMergeVerification<br/>{tick, epoch, node_id, H_k, count, watermark}

    alt H_k^i = H_k^j
        vj->>vj: Update verified_watermark
        Note over vj: Merge confirmed ✓
    else H_k^i ≠ H_k^j
        Note over vj: DIVERGENCE DETECTED
        vj->>vj: Trigger partial reconciliation
        Note over vj: Non-blocking: continues<br/>normal operation
    end
Loading

Figure 8: Cross-ring merge verification. The verification message is 69 bytes and is non-blocking.

Wire format:

CrossRingMergeVerification (69 bytes):
  [u8  message_type = 0x05]
  [u64 tick]
  [u64 epoch]
  [u32 node_id]
  [32 bytes merkle_hash]
  [u64 entry_count]
  [u64 watermark]

5 Split-Brain Detection

Network partitions are inevitable in distributed systems. Unlike Raft, which resolves partitions through leader election (sacrificing availability in the minority partition), TickMerge allows all partitions to continue operating and provides a structured detection and reconciliation framework.

5.1 Partition Model

Definition 13 (Partition). A network partition Pi at time t divides the node set V into k >= 2 disjoint, non-empty subsets Pi = {P_1, P_2, ..., P_k} such that:

Definition 14 (Partition Duration). The duration of a partition is Delta_Pi = t_heal - t_split, measured in ticks.

Definition 15 (Partition Divergence). The divergence between two partitions P_a, P_b during a partition of duration Delta is:

Div(P_a, P_b) = |W_a \ W_b| + |W_b \ W_a|

where W_a = union_{v in P_a} L0^v(t_heal) and W_b = union_{v in P_b} L0^v(t_heal) are the writes accepted by each partition during the partition.

5.2 Detection Signals

TickMerge uses three independent signals. Requiring two signals for confirmation reduces false positives from transient network issues.

Signal 1: Gossip Timeout (Sigma_G). Node v_i maintains a per-node timestamp g_i[j] recording the last tick at which v_i received gossip (via the ring token or direct message) from v_j.

Sigma_G(v_i, v_j, t) = (t - g_i[j] > K)

where K is the partition threshold (default K = 10 ticks).

Signal 2: Watermark Divergence (Sigma_W). Node v_i maintains per-node watermarks wm_i[j], updated via gossip.

Sigma_W(v_i, v_j) = |wm_i[i] - wm_i[j]| > D

where D is the divergence threshold (default D = 1000 ticks).

Signal 3: Quorum Mask Mismatch (Sigma_Q). When node v_i receives a live mask M_j from node v_j:

Sigma_Q(M_i, M_j) = popcount(M_i AND M_j) * 2 < popcount(M_i OR M_j)

That is, the intersection of the two nodes' views of the live set is less than half the union.

5.3 Detection State Machine

stateDiagram-v2
    [*] --> NORMAL

    NORMAL --> PARTITION_SUSPECTED : Σ_G(vᵢ, vⱼ, t) = true<br/>for any vⱼ
    PARTITION_SUSPECTED --> NORMAL : Gossip restored from vⱼ<br/>AND watermarks converge
    PARTITION_SUSPECTED --> SPLIT_BRAIN_CONFIRMED : Σ_W(vᵢ, vⱼ) = true<br/>OR Σ_Q(Mᵢ, Mⱼ) = true
    SPLIT_BRAIN_CONFIRMED --> RECONCILING : Partition heals<br/>(probing succeeds)
    RECONCILING --> NORMAL : Reconciliation<br/>completes
Loading

Figure 9: Split-brain detection state machine. Two signals are required to confirm split-brain, preventing false positives from transient network issues.

Detection algorithm. Executed once per tick on every node:

PROCEDURE DetectSplitBrain(v_i, t):
  FOR each v_j ∈ V, j ≠ i:
    IF Σ_G(v_i, v_j, t):                          // gossip timeout
      IF Σ_W(v_i, v_j):                            // watermark divergence
        v_i.split_brain_flag ← true
        v_i.suspected_partition ← {v_j}
        RETURN SPLIT_BRAIN_CONFIRMED
      ELSE:
        RETURN PARTITION_SUSPECTED
  RETURN NORMAL

Theorem 5 (Detection Completeness). If a partition Pi persists for Delta > K + D ticks, where K is the gossip timeout threshold and D is the divergence threshold, then every node in every partition detects the split-brain condition.

Proof. After K ticks without gossip from a node v_j in a different partition, Signal 1 fires: Sigma_G(v_i, v_j, t) = true for all v_i not in the same partition as v_j.

During the partition, each partition independently accepts writes and advances its watermark. After D additional ticks, the watermarks of nodes in different partitions differ by at least D: |wm_i[i] - wm_i[j]| >= D (since wm_i[j] is stale at the value when gossip stopped, while wm_i[i] has advanced by at least D). So Signal 2 fires: Sigma_W(v_i, v_j) = true.

With both signals active, the detection algorithm returns SPLIT_BRAIN_CONFIRMED. Since every node in every partition eventually checks every other node, all nodes detect the condition within K + D ticks. ∎

Theorem 6 (Detection Safety - No False Positives under Stable Network). If the network is fully connected (no partition) and all messages are delivered within K/2 ticks, then no node transitions to SPLIT_BRAIN_CONFIRMED.

Proof. Under the given conditions, every node receives gossip from every other node within K/2 ticks. Therefore g_i[j] >= t - K/2 for all i, j, which means t - g_i[j] <= K/2 < K. Signal 1 does not fire, so the detection algorithm returns NORMAL. Since SPLIT_BRAIN_CONFIRMED requires Signal 1 as a prerequisite, no false positive occurs. ∎

5.4 Behavior During Partition

graph TB
    subgraph "Before Partition"
        Ring["Complete Ring<br/>v₁ — v₂ — v₃<br/>epoch e, tick t"]
    end

    subgraph "During Partition"
        P1["Partition P₁<br/>v₁ — v₂<br/>epoch e, ticks t+1...t+Δ<br/>Writes: W₁"]
        P2["Partition P₂<br/>v₃<br/>epoch e, ticks t+1...t+Δ<br/>Writes: W₂"]
    end

    subgraph "After Healing"
        Healed["Reconciled Ring<br/>v₁ — v₂ — v₃<br/>epoch e+1<br/>LM = C(W₁ ∪ W₂)"]
    end

    Ring -->|"network split<br/>at tick t"| P1
    Ring -->|"network split<br/>at tick t"| P2
    P1 -->|"network heals"| Healed
    P2 -->|"network heals"| Healed
Loading

Figure 10: Partition lifecycle. Both partitions continue accepting writes. After healing, reconciliation produces a global view containing all writes from both partitions.

When a partition is detected, each partition P_a operates as follows:

  1. split_brain_flag <- true. This flag is visible to all threads via atomic load.

  2. Continue accepting writes. L0 writes are unaffected. Write availability is preserved (Property 1 holds within each partition).

  3. Continue local merges. Within P_a, the token circulates among the surviving nodes. Merges produce a consistent view of P_a's writes:

    LM^i(t) = C(union_{v in P_a} L0^v(t)) for all v_i in P_a

  4. Probe for lost nodes. Periodically (every K ticks), each node in P_a attempts to contact nodes not in P_a. If contact succeeds, the partition has healed and reconciliation begins.

  5. Ring degradation check. If |P_a| < |V|/2 + 1 (minority partition), the node may optionally set ring_ready = false to signal degraded operation to clients.

Theorem 7 (Partition Write Preservation). Every write accepted during a partition is preserved and included in the reconciled state after healing.

Proof. Writes accepted during the partition are stored in L0 at the accepting node. L0 is local, persistent storage. During reconciliation (Section 6), the manifest exchange includes all writes from all partitions. The reconciled L-Merged state is C(W_1 union W_2 union ... union W_k), which includes every write from every partition by definition of set union. ∎

5.5 Partition Write Ordering Analysis

A natural question is: what happens to the total order when two partitions independently assign ticks to their writes?

Observation. During a partition, both partitions may assign the same tick values to different writes (since each partition's token circulates independently). However, the writes are still uniquely ordered because:

Corollary 3 (Cross-Partition Order Determinism). After reconciliation, the merged total order of all writes from all partitions is deterministic and identical on all nodes.

Proof. By Lemma 1, all writes have unique 4-tuples. By Corollary 1, sorting under < is deterministic. Reconciliation produces C(W_total) = sort_<(W_total), which is unique. ∎


6 Reconciliation

When partitions heal, the divergent states must be reconciled. TickMerge provides three reconciliation modes with different trade-offs. This section describes each in detail.

6.1 Manifests and Anchors

Definition 16 (Anchor). An anchor a_k is a snapshot of the merkle state at a regular interval:

a_k = (t_k, e_k, H_k, c_k)

where t_k is the tick, e_k is the epoch, H_k is the merkle hash (Definition 12), and c_k is the cumulative entry count. Anchors are generated every A entries (default A = 1000).

Definition 17 (Manifest). A manifest M = (a_1, a_2, ..., a_m) is an ordered sequence of anchors. Two manifests can be compared by finding the first anchor where their hashes diverge:

diverge(M_a, M_b) = min{k : a_k^a.H != a_k^b.H}

or infinity if the manifests are identical.

Lemma 6 (Manifest Divergence Localization). If diverge(M_a, M_b) = k, then the nodes' states are identical up to anchor a_{k-1} and diverge somewhere in the interval [a_{k-1}.t, a_k.t].

Proof. If a_{k-1}^a.H = a_{k-1}^b.H, then by Theorem 4, the nodes' states are identical up to anchor k-1. The first divergence occurs in the entries between anchor k-1 and anchor k. ∎

6.2 Reconciliation Mode Selection

graph TD
    Trigger{"Divergence<br/>Detected"}

    Trigger -->|"Merkle mismatch<br/>OR gap < D"| Partial
    Trigger -->|"split_brain_flag<br/>OR gap > 10D"| Immediate
    Trigger -->|"Admin command"| Full

    Partial["Partial Reconciliation<br/>(background, non-blocking)<br/>Target: < 10ms"]
    Immediate["Immediate Reconciliation<br/>(foreground, write pause)<br/>Target: < 100ms"]
    Full["Full Historic Reconciliation<br/>(manual, complete rebuild)<br/>Target: O(history)"]

    Partial -->|"Apply anchors<br/>from peer"| Converged["Converged<br/>State"]
    Immediate -->|"Quorum vote<br/>on anchors"| Converged
    Full -->|"Rebuild from<br/>anchor chain"| Converged
Loading

Figure 11: Reconciliation mode selection. The mode is chosen based on the severity of divergence.

6.3 Partial Reconciliation (Background)

Partial reconciliation handles routine divergences without impacting write availability.

sequenceDiagram
    participant A as vₐ (behind)
    participant B as vᵦ (ahead)

    Note over A: Detect: wm_a < wm_b
    A->>B: ReconciliationRequest<br/>{start: wm_a + 1, end: wm_b}
    Note over B: Query L-Merged for<br/>anchors in range
    B-->>A: ReconciliationResponse<br/>{anchors: [a₁, a₂, ..., aₘ]}
    Note over A: Validate anchor<br/>hashes
    A->>A: Apply anchors to<br/>L-Merged (background)
    A->>A: Update wm_a ← wm_b
    Note over A: Continues accepting<br/>writes throughout
Loading

Figure 12: Partial reconciliation protocol. Node v_a continues normal operation during the entire process.

Formal protocol:

PROCEDURE PartialReconcile(v_a, v_b, wm_a, wm_b):
  PRECONDITION: wm_b > wm_a
  PRECONDITION: v_a.accepting_writes = true   // non-blocking

  1.  req ← ReconciliationRequest(start = wm_a + 1, end = wm_b)
  2.  SEND req TO v_b
  3.  resp ← RECEIVE ReconciliationResponse FROM v_b
  4.  FOR each anchor a_k IN resp.anchors:
        // Validate: hash chain must be consistent
        H_expected ← SHA256(H_{k-1} || a_k.tick || a_k.epoch || ...)
        IF H_expected ≠ a_k.H:
          ABORT   // corrupted response
        APPLY a_k TO LM^a   // background merge
  5.  wm_a ← wm_b
  6.  v_a.merkle_state ← resp.anchors[last].H

Complexity. Let G = wm_b - wm_a be the watermark gap and A the anchor interval. The number of anchors transferred is ceil(G / A). Each anchor is 56 bytes. Total network cost: O(G/A * 56) bytes. For G = 1000 and A = 1000, this is 1 anchor (56 bytes).

6.4 Immediate Reconciliation (Foreground)

Immediate reconciliation handles critical divergences (split-brain recovery) with a brief write pause.

sequenceDiagram
    participant v1 as v₁
    participant v2 as v₂
    participant v3 as v₃

    Note over v1,v3: SPLIT-BRAIN CONFIRMED<br/>Partition heals

    rect rgb(255, 230, 230)
        Note over v1,v3: Write pause begins
        v1->>v1: accepting_writes ← false
        v2->>v2: accepting_writes ← false
        v3->>v3: accepting_writes ← false
    end

    v1->>v2: Manifest(anchors_1)
    v1->>v3: Manifest(anchors_1)
    v2->>v1: Manifest(anchors_2)
    v2->>v3: Manifest(anchors_2)
    v3->>v1: Manifest(anchors_3)
    v3->>v2: Manifest(anchors_3)

    Note over v1,v3: Find divergence point:<br/>diverge(M₁, M₂) = k

    v1->>v2: Vote(anchor_chain_1)
    v2->>v1: Vote(anchor_chain_2)
    v3->>v1: Vote(anchor_chain_2)
    Note over v1,v3: Quorum selects<br/>winning chain

    v1->>v1: Apply winning chain
    v2->>v2: Apply winning chain
    v3->>v3: Apply winning chain

    Note over v1,v3: Verify: H₁ = H₂ = H₃

    rect rgb(230, 255, 230)
        Note over v1,v3: Write pause ends
        v1->>v1: accepting_writes ← true
        v2->>v2: accepting_writes ← true
        v3->>v3: accepting_writes ← true
    end
Loading

Figure 13: Immediate reconciliation protocol. The write pause (red) is bounded by the manifest exchange and application time. The green region marks resumed operation.

Formal protocol:

PROCEDURE ImmediateReconcile(V_reachable):
  PRECONDITION: split_brain_flag = true for all v ∈ V_reachable

  // Phase 1: Pause writes
  1.  FOR each v ∈ V_reachable:
        v.accepting_writes ← false

  // Phase 2: Exchange manifests
  2.  manifests ← {}
      FOR each v_i ∈ V_reachable:
        M_i ← GenerateManifest(LM^i)
        BROADCAST M_i TO V_reachable
        manifests[i] ← M_i

  // Phase 3: Find divergence point
  3.  k* ← min_{i,j} diverge(M_i, M_j)

  // Phase 4: Quorum vote on authoritative chain
  4.  votes ← {}
      FOR each v_i ∈ V_reachable:
        // Vote for the chain with highest watermark
        votes[i] ← argmax_j (M_j.anchors[last].watermark)
      winner ← majority(votes)

  // Phase 5: Apply winning chain
  5.  FOR each v_i ∈ V_reachable:
        APPLY manifests[winner].anchors[k*..] TO LM^i
        v_i.watermark ← manifests[winner].anchors[last].watermark
        v_i.merkle_state ← manifests[winner].anchors[last].H

  // Phase 6: Verify convergence
  6.  ASSERT H^i = H^j FOR ALL v_i, v_j ∈ V_reachable

  // Phase 7: Resume writes
  7.  FOR each v ∈ V_reachable:
        v.split_brain_flag ← false
        v.accepting_writes ← true
        v.ring_epoch ← v.ring_epoch + 1

Theorem 8 (Immediate Reconciliation Convergence). After ImmediateReconcile completes, all participating nodes have identical L-Merged state.

Proof. In Phase 5, all nodes apply the same anchor chain (from the quorum-selected winner) starting from the same divergence point k*. The anchor chain includes merkle hashes, so the application is deterministic: each node computes the same hash chain from the same inputs. Phase 6 verifies this with an explicit hash comparison. If the assertion holds, convergence is confirmed. If it fails, the protocol escalates to full historic reconciliation. ∎

Write pause duration. The write pause lasts for Phases 2--6. Phase 2 requires one round-trip per node (manifest exchange). Phase 5 requires applying O(G/A) anchors. For typical parameters (G = 10000, A = 1000, 3 nodes), the pause is bounded by:

T_pause <= 2 * RTT + O(G/A) * T_apply

For RTT = 1ms and T_apply = 10us per anchor: T_pause <= 2ms + 10 * 10us = 2.1ms.

6.5 Full Historic Reconciliation (Manual)

Full historic reconciliation rebuilds the entire L-Merged state from the complete anchor chain. It is triggered only by an administrator.

sequenceDiagram
    participant Admin
    participant v1 as v₁
    participant v2 as v₂
    participant v3 as v₃

    Admin->>v1: reconcile --mode=full
    v1->>v2: CollectAnchors()
    v1->>v3: CollectAnchors()
    v2-->>v1: Full anchor chain
    v3-->>v1: Full anchor chain

    Note over v1: Merge all anchor<br/>chains into complete<br/>timeline from epoch 0

    v1->>v1: Reset merkle: H ← 0²⁵⁶
    v1->>v1: Rebuild L-Merged from<br/>sorted union of all anchors
    v1->>v2: Distribute rebuilt state
    v1->>v3: Distribute rebuilt state

    Note over v1,v3: Verify: H₁ = H₂ = H₃
    v1-->>Admin: Reconciliation complete
Loading

Figure 14: Full historic reconciliation. Administrator-triggered, complete state rebuild.

Complexity analysis. Let H_total be the total number of entries across all nodes' history. The full reconciliation:

  1. Collects O(H_total / A) anchors: O(H_total / A * 56) bytes network transfer.
  2. Sorts all entries: O(H_total * log(H_total)) comparisons.
  3. Rebuilds merkle hash: O(H_total) SHA256 operations.

For H_total = 10^6 entries: ~1000 anchors (56KB transfer), ~20M comparisons, ~1M hash operations. At 1us per hash, the rebuild takes ~1 second.

6.6 Reconciliation Mode Comparison

Property Partial Immediate Full Historic
Trigger Merkle mismatch, small gap Split-brain, large gap Admin command
Blocking No (background) Yes (brief pause) Yes (extended)
Write availability Preserved Paused (< 100ms) Paused (seconds--minutes)
Scope Single watermark range All divergent state Complete history
Network cost O(G/A * 56) bytes O(N * M_size) bytes O(H_total / A * 56) bytes
Time complexity O(G/A) O(N + G/A) O(H_total * log H_total)
Guarantees Peer parity Quorum-agreed state Complete rebuild
Use case Normal operation Partition recovery Disaster recovery

6.7 Reconciliation Safety Properties

Theorem 9 (No Write Loss in Partial Mode). Partial reconciliation does not discard any write that has been accepted by either node.

Proof. Partial reconciliation only adds anchors from the peer to the local L-Merged. It does not delete or overwrite existing entries. The receiving node's writes are preserved in its L0 and L-Merged. The peer's writes are added via the anchor chain. After reconciliation, both nodes' writes are present. ∎

Theorem 10 (Bounded Write Loss in Immediate Mode). Immediate reconciliation may discard at most the writes in the losing partition's L0 that have not yet been merged to L-Merged.

Proof. The quorum vote selects the partition with the highest watermark as authoritative. Writes in the losing partition that have reached L-Merged are included in the losing partition's manifest and can be merged into the winning chain. However, writes that are still in L0 (not yet merged) at the losing partition may not be included in the manifest.

The maximum number of such writes is bounded by the merge latency: at most 2 ring cycles worth of writes per node, which is O(2 * throughput_per_node * cycle_time). For typical parameters (100K writes/sec, 3ms cycle time): at most 600 writes per node. ∎

Remark. Applications requiring zero write loss should use Partial mode (which is non-blocking and additive) or Full Historic mode (which reconstructs from complete history). Immediate mode trades bounded write loss for fast recovery.


7 Correctness

This section collects and proves the formal safety and liveness properties of TickMerge.

7.1 Safety Properties

Definition 18 (Safety). A distributed algorithm satisfies safety if "nothing bad happens"---specifically, the algorithm never reaches an inconsistent state.

S1: Merge Determinism. For any set S subset W, all nodes computing C(S) produce the identical output.

Proof. Corollary 1. ∎

S2: Monotonic Level Inclusion. For all v_i, for all ticks t_1 < t_2, for all levels k: L_k^i(t_1) subset L_k^i(t_2).

Proof. Merges only add entries to higher levels; they never remove entries from lower levels. L0 is append-only. L1 and L-Merged are produced by the merge function M, which computes a union (Lemma 2). Since S subset S union T for any T, level contents are monotonically non-decreasing. ∎

S3: Cross-Level Monotonicity. For all v_i, for all ticks t: L0^i(t) subset L1^i(t') for some t' > t, and L1^i(t) subset LM^i(t'') for some t'' > t.

Proof. By the flood-forward protocol (Lemma 5), every entry in L0^i eventually reaches all nodes. By Theorem 2, after 2 merge rounds, every entry is in L-Merged. ∎

S4: Reconciliation Convergence. After any reconciliation mode completes, all participating nodes have identical L-Merged state.

Proof. Theorem 8 (immediate mode). Analogous arguments hold for partial mode (the receiving node converges to the sender's state for the reconciled range) and full mode (all nodes rebuild from the same complete input, producing identical output by Corollary 1). ∎

S5: No Duplicate Processing. Each write entry w is processed (merged into L-Merged) at most once per node.

Proof. The write entry's unique 4-tuple (Lemma 1) serves as a deduplication key. The merge function M computes a set union, which inherently deduplicates. ∎

7.2 Liveness Properties

Definition 19 (Liveness). A distributed algorithm satisfies liveness if "something good eventually happens"---specifically, the algorithm makes progress.

L1: Write Availability. Any live node can accept writes at any time, including during partitions.

Proof. Property 1 (Section 3.3). Write acceptance requires only local L0 storage, which has no remote dependencies. ∎

L2: Merge Progress. If the ring contains at least one live node, merges make progress.

Proof. If any node v_i is live, it either holds the token or will regenerate it after a timeout T_regen. Once v_i has the token, it processes pending merges (Step 4 of ProcessToken). If there are pending writes, the merge produces new entries at higher levels. Therefore merges make progress. ∎

L3: Flood-Forward Delivery. Every write accepted by a live node eventually reaches all live nodes.

Proof. Lemma 5. The flood-forward protocol propagates writes around the ring, and each token circulation advances the write one hop. After N-1 circulations, the write has reached all nodes. ∎

L4: Partition Detection. A sustained partition is detected within K + D ticks.

Proof. Theorem 5. ∎

L5: Reconciliation Termination. All reconciliation modes terminate in bounded time.

Proof.

All bounds are finite. ∎

7.3 CAP Analysis

Theorem 11 (TickMerge CAP Classification). TickMerge is an AP system with tunable consistency. Specifically:

  1. During normal operation (no partition): all consistency levels (L0, L1, L-Merged) are available and eventually consistent.
  2. During a partition: L0 reads at all nodes are available and consistent with local writes. L-Merged reads are available but may diverge across partitions.
  3. After reconciliation: all levels converge to a globally consistent state.

Proof. (1) follows from the merge process (Theorem 3) and merge completeness (Theorem 2). (2) follows from the partition behavior (Section 5.4): writes are accepted at all partitions (availability), and L0 reads reflect local writes (local consistency). L-Merged reads in different partitions may differ because each partition's merge process only includes that partition's writes. (3) follows from reconciliation convergence (Theorem 8 and S4). ∎

Contrast with Raft (CP): during a partition, the minority partition has no leader and cannot serve reads or writes. TickMerge sacrifices global consistency during partitions in exchange for universal availability.

7.4 Consistency Staleness Bound

Theorem 12 (Staleness Bound). Under normal operation (no partition), a write accepted at tick t is visible in L-Merged at all nodes by tick t + 2R, where R = N/f_tick is the time for one full token circulation.

Proof. By Theorem 2, 2 merge rounds suffice for global convergence. Each merge round requires one full token circulation (N hops at frequency f_tick). Therefore the staleness is bounded by 2 * N / f_tick.

For N = 3 and f_tick = 1000 Hz: staleness <= 2 * 3/1000 = 6ms. ∎


8 Memory and Performance Model

TickMerge is designed for systems where performance is a correctness requirement. The implementation in TickStream targets zero runtime allocations in the consensus hot path.

8.1 Zero-Allocation Hot Path

Definition 20 (Hot Path). The consensus hot path is the code executed on every tick (at 1000Hz). It includes: token processing, flood-forwarding, merkle updates, split-brain checks, and watermark updates.

The following operations occur on the hot path with zero heap allocations:

Operation Memory Source Size
Token receipt/forward Stack buffer 8 KB
Write flood-forward Pre-allocated ring buffer Configurable
Merkle hash update Pre-allocated state 64 bytes
Split-brain detection Atomic flags N * 8 bytes
Watermark update Atomic variable 8 bytes

All variable-size allocations occur off the hot path:

8.2 Lock-Free Concurrency Model

All shared state between the consensus thread and codec threads is accessed via atomic operations with acquire/release memory ordering:

                    ┌─────────────────────┐
                    │   Consensus Thread   │
                    │  (tick loop, 1000Hz) │
                    └──────────┬──────────┘
                               │ atomic dequeue
                    ┌──────────▼──────────┐
                    │  Lock-Free Ring Buf  │
                    └──────────▲──────────┘
                               │ atomic enqueue
          ┌────────────────────┼────────────────────┐
          │                    │                     │
   ┌──────▼──────┐    ┌───────▼──────┐    ┌────────▼──────┐
   │ Redis Codec │    │ Kafka Codec  │    │  MQTT Codec   │
   │   Thread    │    │   Thread     │    │   Thread      │
   └─────────────┘    └──────────────┘    └───────────────┘

Figure 15: Thread architecture. Codec threads enqueue writes to a lock-free ring buffer. The consensus thread dequeues in its tick loop. No mutexes are used.

Memory ordering discipline:

8.3 Performance Characteristics

Operation Complexity Target Latency Allocation
L0 write (client -> node) O(1) < 100 us None
Merkle hash update (per entry) O( key +
Cross-ring verification (per merge) O(1) message < 1 ms None (stack)
Split-brain detection (per tick) O(N) atomic loads < 10 us None
Partial reconciliation O(G/A) anchors < 10 ms Arena
Immediate reconciliation O(N + G/A) < 100 ms Arena
Full historic reconciliation O(H * log H) Seconds Arena
Token circulation (per hop) O(1) < 1 ms None

8.4 Throughput Model

Definition 21 (System Throughput). The aggregate write throughput T of an N-node TickMerge cluster is:

T = N * T_node

where T_node is the per-node write throughput, bounded by L0 write speed. Since L0 is local storage with no consensus overhead on the write path, T_node is determined by the storage subsystem's write bandwidth.

Contrast with Raft, where T = T_leader (all writes go through a single leader).

Theorem 13 (Linear Write Scalability). TickMerge's aggregate write throughput scales linearly with the number of nodes.

Proof. Each node accepts writes independently to its local L0. Adding a node v_{N+1} adds T_node additional write capacity without reducing the throughput of existing nodes (the merge process is background and does not contend with writes). Therefore T(N+1) = T(N) + T_node. ∎


9 Transport

TickMerge uses UDP as its transport layer, with a reliability layer built on top.

9.1 Reliable UDP

graph LR
    subgraph "Sender"
        App["Application<br/>Message"]
        CRC["CRC32<br/>Checksum"]
        Batch["Batch Buffer<br/>(up to 64 msgs)"]
        UDP_S["UDP Socket"]
    end

    subgraph "Network"
        Net["Unreliable<br/>Channel"]
    end

    subgraph "Receiver"
        UDP_R["UDP Socket"]
        Dedup["Sliding Window<br/>Dedup"]
        Verify["CRC32<br/>Verify"]
        Deliver["Application<br/>Delivery"]
    end

    App --> CRC --> Batch --> UDP_S --> Net --> UDP_R --> Verify --> Dedup --> Deliver

    Net -.->|"loss/reorder<br/>/duplicate"| Net
    UDP_S -.->|"retransmit<br/>(exp. backoff)"| Net
Loading

Figure 16: Reliable UDP transport stack.

The transport layer provides:

9.2 Why UDP over TCP

The ring token circulates at 1000Hz. TCP's design optimizes for long-lived, ordered byte streams, which is a poor fit:

Concern TCP TickMerge UDP
Head-of-line blocking One lost segment delays all following Independent messages
Connection setup 3-way handshake per connection Connectionless
Congestion control Reduces throughput under loss Application controls rate
Message framing Stream-oriented (no boundaries) Datagram boundaries natural
Retransmission TCP stack decides timing Application matches tick rate

10 Persistent Storage (L3+)

For datasets exceeding memory, TickMerge integrates a ClickHouse-inspired persistent tier. Data enters L3+ only after achieving L-Merged consensus, ensuring persistent storage contains only globally-agreed data.

10.1 Granule-Based Organization

Data is organized into granules of G = 8192 rows, indexed by marks:

Mark = (offset: u64, rows: u32, min_key: bytes, max_key: bytes, checksum: u32)

Range queries prune granules by comparing the query range against [min_key, max_key] for each mark, achieving sub-linear scan time.

10.2 Storage Modes

Mode Layout Use Case Compression
Key-Value Row-oriented pairs General streaming LZ4, ZSTD
Columnar Column-oriented files Analytics, time-series Delta, RLE, Dictionary
Hybrid Both layouts Mixed workloads Per-column selection

11 Related Work

Raft [1]. Leader-based log replication. Provides linearizability at the cost of write availability. TickMerge eliminates the leader, providing commit-anywhere writes at the cost of per-read consistency selection.

Paxos [2]. Multi-round agreement protocol. TickMerge avoids multi-round protocols by separating writes (local) from ordering (deterministic merge).

Viewstamped Replication [3]. Inspires TickMerge's epoch (view) numbering and deterministic ordering. VSR requires a primary; TickMerge does not.

CRDTs [4]. Provide automatic convergence without coordination. TickMerge's merge function (Lemmas 2--4) shares CRDT properties (commutativity, associativity, idempotency) but operates on the log level rather than individual data types, providing total ordering that CRDTs cannot.

Calvin [5] and BOHM [6]. Deterministic databases that pre-order transactions. TickMerge orders post-hoc during merge, enabling commit-anywhere semantics.

TigerBeetle [7]. Inspires TickMerge's zero-allocation, lock-free design philosophy. TigerBeetle uses single-leader VSR; TickMerge extends this to leaderless multi-master.

Cassandra [8]. Gossip membership and eventual consistency with tunable R/W levels. Cassandra uses last-write-wins; TickMerge uses deterministic total ordering.

ClickHouse [9]. Inspires L3+ persistent storage (granules, marks, columnar compression).

EPaxos [14]. Leaderless Paxos variant that allows any node to propose commands. Like TickMerge, EPaxos achieves commit-anywhere semantics, but uses a quorum-based fast path with two round-trips. TickMerge achieves zero round-trips on the write path (local L0 only) at the cost of deferred consistency.

TAPIR [15]. Transaction protocol for inconsistent replication. TAPIR, like TickMerge, separates replication from consensus, but requires a separate coordinator for transactions.

Accord [17]. Leaderless, timestamp-based consensus protocol developed for Apache Cassandra (CEP-15). Accord assigns each transaction a timestamp tuple (wall-clock time, sequence, node id) and uses a three-phase protocol (PreAccept, Accept, Commit) to achieve agreement. On the fast path, when all replicas in a fast-path electorate (a supermajority quorum, typically 3 of 5 replicas) agree on the dependency set, a transaction commits in a single round-trip---comparable to EPaxos. When dependency sets are inconsistent, a slow path adds an additional Accept phase to resolve the conflict.

Accord and TickMerge share the goal of leaderless commit-anywhere writes and both use timestamp-derived ordering. The key architectural difference is when ordering is resolved:

Accord introduces a reorder buffer to handle clock skew: transactions may be reordered during the Accept phase if their timestamps fall within a configurable skew window. TickMerge faces an analogous problem during partition recovery (Section 12.5) but resolves it through the deterministic total order, which does not depend on timestamp accuracy---only on the unique 4-tuple (e, t, n, s).

Accord requires a majority quorum for both fast and slow paths; during a partition, the minority cannot commit. TickMerge allows all partitions to commit (to L0), deferring global ordering to reconciliation. For workloads where write availability under partition is critical (IoT, edge computing, drone swarms), this is a fundamental advantage. For workloads requiring per-transaction consistency guarantees (OLTP, financial ledgers), Accord's synchronous approach is more appropriate.


12 Real-Time Systems and the Physics of Time

Distributed consensus algorithms are typically analyzed under the assumption that nodes have unbounded time to reach agreement. In practice, many TickMerge deployment targets---drone swarms, autonomous vehicles, industrial control systems, robotic fleets---operate under hard physical-time constraints where a late answer is as useless as a wrong answer. This section analyzes the interaction between TickMerge's logical tick ordering and the physical reality of bounded time.

12.1 The Real-Time Consensus Problem

Definition 22 (Real-Time Deadline). A real-time deadline Delta_phys is a wall-clock duration within which a system must produce a consistent decision. If the decision is not available within Delta_phys, the system must act on local state alone (potentially inconsistent).

In a drone swarm performing coordinated maneuvers, Delta_phys might be 10ms (the control loop period). In an autonomous vehicle platoon, Delta_phys might be 50ms. In a financial trading system, Delta_phys might be 1ms.

Observation (Time Is Not Our Friend). The fundamental tension in real-time distributed systems is:

Consistency requires communication. Communication requires time. Time is bounded by physics.

The speed of light imposes a lower bound on communication latency. For a 100-meter drone-to-drone link, the propagation delay alone is ~333ns. For a 100-kilometer inter-datacenter link, it is ~333us. For a geostationary satellite link, it is ~120ms. No consensus algorithm can produce a globally consistent answer faster than the propagation delay.

12.2 TickMerge's Real-Time Properties

TickMerge's CQRS separation decouples write latency from consistency latency, which is useful in real-time contexts but introduces costs that must be weighed carefully.

Write path: always meets deadline, with tunable background cost. L0 writes are local (O(1), zero network latency). Any node can always record data within any Delta_phys. However, writes that require global ordering enter the merge pipeline, which incurs background cost:

The write itself is instant, but the merge pipeline must keep up with the write rate for L-Merged staleness to remain bounded. If the pipeline falls behind, L0 grows and L-Merged staleness increases. Operators tune this by selecting which streams require merge-level consistency and which bypass the merge pipeline entirely (e.g., ephemeral telemetry disseminated via raw UDP on the ring transport).

Read path: latency depends on consistency level. This is where the real-time trade-off becomes explicit:

graph LR
    subgraph "Consistency vs. Latency (with costs)"
        L0["L0 Read<br/>Latency: 0<br/>Staleness: up to 2R<br/>CPU cost: 0"]
        L1["L1 Read<br/>Latency: ≤ R<br/>Staleness: up to R<br/>CPU cost: merge + hash"]
        LM["L-Merged Read<br/>Latency: ≤ 2R<br/>Staleness: 0<br/>CPU cost: 2× merge + hash"]
    end

    L0 ---|"fast, stale,<br/>no merge cost"| L1
    L1 ---|"moderate cost"| LM

    style L0 fill:#2d8b2d,color:#fff
    style L1 fill:#c4a800,color:#fff
    style LM fill:#b22222,color:#fff
Loading

Figure 17: Real-time consistency spectrum with associated costs. Lower consistency is not merely faster---it also consumes less CPU and network bandwidth, a distinction that matters on battery-constrained devices.

12.3 Formal Real-Time Analysis

Definition 23 (Ring Cycle Time). The ring cycle time R_phys is the wall-clock time for the token to complete one full circuit:

R_phys = N * (T_hop + T_process)

where T_hop is the per-hop network latency and T_process is the per-node token processing time.

Theorem 14 (Real-Time Consistency Bound). A read at consistency level L_k is available within time k * R_phys after the corresponding write. If Delta_phys < k * R_phys, the read must fall back to a lower consistency level.

Proof. By Corollary 2, a write reaches L_k at all nodes after k merge rounds, each requiring one ring cycle of duration R_phys. If the physical deadline Delta_phys expires before k * R_phys, the data is not yet available at level L_k. The system must either return a stale value from a lower level or indicate unavailability. ∎

Corollary 4 (Deadline-Adaptive Consistency). A real-time system can implement deadline-adaptive reads:

PROCEDURE RealTimeRead(key, Δ_phys):
  k_max ← floor(Δ_phys / R_phys)
  IF k_max ≥ 2:
    RETURN Read(key, L_Merged)     // full consistency within deadline
  ELSE IF k_max ≥ 1:
    RETURN Read(key, L1)           // cross-node consistency
  ELSE:
    RETURN Read(key, L0)           // local only; act on best available

12.4 Case Study: Drone Swarm Coordination

Consider a swarm of N drones performing coordinated search-and-rescue. The swarm has two fundamentally different data flows:

  1. Ephemeral telemetry (position, velocity, sensor readings): high-frequency, acceptably lossy, superseded by the next update. Consensus is not appropriate here. This data is disseminated via raw UDP broadcast or multicast on the ring's transport layer, outside the consensus path entirely. A missed position update is irrelevant once the next one arrives.

  2. Ordered commands (search pattern changes, waypoint assignments, mission state transitions): low-frequency, must be consistently ordered across the swarm. This is the consensus domain. TickMerge provides the ordering guarantees these operations require.

The physics:

For N = 5 drones: R_phys = 5 * (0.33us + 1ms) ~ 5ms.

Data flow separation:

Data Type Transport Consensus Latency Loss Tolerance
Position/velocity Raw UDP broadcast None < 1ms High (superseded)
Sensor readings Raw UDP broadcast None < 1ms High (superseded)
Search pattern change TickMerge L-Merged Full merge <= 10ms Zero
Waypoint assignment TickMerge L1 One merge <= 5ms Zero
Emergency stop TickMerge L0 + broadcast Local + best-effort < 1ms Designed for redundancy

Consensus cost (commands only): At typical command rates (r_cmd ~ 1--10 commands/sec), the merge pipeline cost is negligible:

Resource Per-cycle cost (N=5, r_cmd=10/sec) Impact
Flood-forward 50 msgs/sec Negligible RF
Merge sort 50 * log(50) ~ 280 comparisons/cycle Negligible CPU
SHA-256 hashes 50 per cycle < 0.05ms on Cortex-M7
Token overhead 5 hops/cycle * 1000 cycles/sec = 5000 msgs/sec Shared with transport

The ring token circulation (5000 msgs/sec for N=5) is the dominant RF cost, but it is shared infrastructure: the same token that coordinates consensus also provides the ring topology for ephemeral data routing.

Trade-off analysis. For N <= 5 on a local mesh, a leader-based protocol serializes commands with a single broadcast, avoiding O(N) flood-forward per write. TickMerge's advantage emerges at higher N (where leader throughput saturates), under frequent partitions (where Raft's minority partition goes dark), or when write availability during RF dropout is critical (a drone that loses contact must still record and act on its own commands locally, reconciling when connectivity returns).

For the shared search pattern (which changes infrequently), the drones wait for L-Merged consistency. If a partition occurs during a pattern change, the two sub-swarms may execute different patterns until reconciliation completes. Application designers select the reconciliation mode (Section 6) based on the safety requirements of their domain.

Post-mission convergence. The primary value of running TickMerge on a drone swarm is not real-time consensus over ephemeral telemetry, but rather the post-mission dataset. During flight, each drone writes all sensor data, position history, and observations to L0. The merge pipeline processes this data in the background, and after the mission completes (or during idle periods), L-Merged converges to a single, globally-ordered timeline across all drones. This complete dataset---covering every drone's perspective, deterministically ordered---is the input for offline learning, mission analysis, and model training. Without TickMerge, reconstructing a unified timeline from N independent flight logs requires manual timestamp alignment and conflict resolution. With TickMerge, the merged dataset is produced automatically, with its ordering guaranteed by Theorem 1.

12.5 Time Divergence During Partition

A particularly dangerous scenario for real-time systems is when a partition causes time divergence: nodes in different partitions advance their ticks at different rates because their sub-rings have different sizes.

Definition 24 (Tick Rate Divergence). During a partition, partition P_a with |P_a| nodes has tick rate:

f_a = f_tick / |P_a| (ticks per second at each node)

and partition P_b has:

f_b = f_tick / |P_b|

If |P_a| != |P_b|, then f_a != f_b, and the partitions' logical clocks drift apart.

Theorem 15 (Tick Drift Bound). After a partition of wall-clock duration Delta_wall, the tick values assigned by partitions P_a and P_b differ by at most:

|t_a - t_b| <= Delta_wall * |f_a - f_b| = Delta_wall * f_tick * |1/|P_a| - 1/|P_b||

Proof. Each partition's tick advances at its own rate. The maximum tick difference is the integral of the rate difference over the partition duration. ∎

Example. A 5-node ring partitions into P_a = {v_1, v_2} and P_b = {v_3, v_4, v_5}. With f_tick = 1000 Hz:

f_a = 1000/2 = 500 ticks/sec f_b = 1000/3 = 333 ticks/sec

After a 10-second partition: |t_a - t_b| <= 10 * |500 - 333| = 1670 ticks.

This tick drift does not affect the total order (by Corollary 3, the ordering is deterministic regardless of tick collisions). However, it does affect the semantic meaning of ticks for real-time applications: a tick in P_a represents a different wall-clock interval than a tick in P_b.

12.6 Mitigations for Real-Time Deployments

1. Bounded staleness reads. Rather than requesting a consistency level, real-time clients can request a staleness bound:

Read(key, max_stale = 5ms)

The system selects the highest consistency level whose staleness delta (Definition 11) is within the bound.

2. Hybrid logical clocks (HLC). Augmenting the tick with a physical timestamp component allows the merge function to reason about wall-clock ordering when tick values collide across partitions. The extended write tuple becomes w = (e, t, n, s, hlc) where hlc combines a physical timestamp with a logical counter [16].

3. Predictive reads. For periodic data (drone positions reported at fixed intervals), a node can extrapolate the last known position forward in time rather than waiting for a fresher merge:

pos_predicted = pos_last + velocity_last * (t_now - t_last)

This is equivalent to reading from L0 with dead reckoning---the same technique used in networked game engines and military C2 systems.

4. Consistency deadline escalation. If a real-time system cannot meet its deadline at the requested consistency level, it logs a consistency violation event and falls back to a lower level. Monitoring the rate of these events provides an operational signal for tuning ring size, tick rate, or network topology.

graph TD
    Request["Read Request<br/>key, Δ_phys"]
    Check{"Δ_phys ≥ 2R?"}
    LMRead["Read L-Merged<br/>(global consistency)"]
    Check2{"Δ_phys ≥ R?"}
    L1Read["Read L1<br/>(cross-node)"]
    L0Read["Read L0 + extrapolate<br/>(local + prediction)"]
    Log["Log consistency<br/>violation event"]
    Return["Return result"]

    Request --> Check
    Check -->|Yes| LMRead --> Return
    Check -->|No| Check2
    Check2 -->|Yes| L1Read --> Return
    Check2 -->|No| L0Read --> Log --> Return
Loading

Figure 18: Deadline-adaptive read with escalation. The system automatically degrades consistency to meet physical-time constraints, logging violations for operational monitoring.

12.7 Comparison with Real-Time Consensus Approaches

The table below attempts an apples-to-apples comparison. "Write latency" for TickMerge is the local cost; the total cost to global consistency (which includes merge debt) is listed separately.

Approach Write Latency (local) Total Cost to Global Consistency Background CPU (N nodes, r_w writes/sec) Partition Behavior Real-Time Suitability
Raft 1 RTT (write is consistent when ACKed) 1 RTT (same) O(N * r_w) log replication Minority unavailable Poor under partition
2PC 2 RTT 2 RTT (same) O(N * r_w) prepare/commit Blocks on coordinator Poor under failure
Accord 1 RTT (fast path) 1 RTT (same) O(N * r_w) dependency tracking Majority required Moderate: fast path helps
TickMerge L0 0 (local) 2 * R_phys (deferred) O(N * r_w) flood-forward + O(r_w * log r_w) merge + O(r_w) SHA-256 Available Good: always meets deadline, but merge debt accrues
TickMerge LM 0 (local) 2 * R_phys (deferred, same cost) Same as above Available Depends on R_phys vs Delta_phys
Paxos 2 RTT 2 RTT (same) O(N * r_w) accept/learn Majority required Poor: high latency

Key observation. Raft, Paxos, Accord, and 2PC pay the consistency cost synchronously on the write path: the write is globally consistent when it returns. TickMerge pays a lower synchronous cost (zero) but defers the consistency work to a background pipeline. The total work performed is comparable (all approaches must disseminate writes to N nodes), but the timing of that work differs. For real-time systems, the question is whether the background pipeline can keep up with the write rate on the available hardware. If it cannot, L-Merged staleness grows without bound.

TickMerge's advantage is that a real-time system can always act on some data (L0) even when the background pipeline is behind. Raft-family systems offer no such fallback: if the write path is slow, the system is slow.


13 Implementation Status

TickMerge is implemented in TickStream, a multi-protocol streaming backbone written in Zig. The implementation comprises 3837 lines across 7 focused modules:

Module Lines Purpose
ring.zig 2672 Core consensus: token processing, merge coordination, flood-forward
ring_lifecycle.zig 329 Node join, graceful leave, timeout eviction
ring_integrations.zig 315 Protocol codec integration (Redis, Kafka, MQTT, AMQP)
ring_protocol.zig 245 Wire protocol definitions and constants
ring_messages.zig 157 Message serialization/deserialization
merkle_tree.zig 120 Incremental SHA-256 hash verification
ring_test.zig 110 Unit tests

13.1 What is Complete

13.2 What Remains


14 Conclusion

TickMerge demonstrates that consensus need not require a leader. By decomposing the problem into local writes, deterministic merging, and background reconciliation, TickMerge achieves commit-anywhere semantics with tunable consistency---a combination that leader-based algorithms cannot provide.

The key insight is that if the merge function satisfies the join-semilattice properties (commutativity, associativity, idempotency---Lemmas 2--4), and the input sets eventually converge (through flood-forward and reconciliation), then all nodes arrive at the same state regardless of the order in which they perform their merges. This shifts the consensus problem from "agree on the order of operations" (Raft's approach) to "agree on the merge inputs" (TickMerge's approach), which is a simpler coordination problem that can be solved by a circulating token rather than a persistent leader.

The formal framework presented here---particularly the total order uniqueness (Theorem 1), merge completeness (Theorem 2), verification soundness (Theorem 4), and reconciliation convergence (Theorem 8)---provides a rigorous foundation for reasoning about the algorithm's correctness. The split-brain detection and reconciliation protocol (Sections 5--6) addresses the practical reality that network partitions are not exceptional events but routine operating conditions.

TickMerge is not a replacement for Raft in all scenarios. Applications requiring per-operation linearizability should use Raft or a similar CP algorithm. But for high-throughput streaming systems---where write availability, tunable consistency, and sub-millisecond latency are paramount---TickMerge offers a principled alternative with formal guarantees.


References

[1] D. Ongaro and J. Ousterhout, "In Search of an Understandable Consensus Algorithm," in Proceedings of the 2014 USENIX Annual Technical Conference (USENIX ATC 14), 2014.

[2] L. Lamport, "The Part-Time Parliament," ACM Transactions on Computer Systems, vol. 16, no. 2, pp. 133--169, 1998.

[3] B. Liskov and J. Cowling, "Viewstamped Replication Revisited," MIT Technical Report MIT-CSAIL-TR-2012-021, 2012.

[4] M. Shapiro, N. Preguica, C. Baquero, and M. Zawirski, "Conflict-Free Replicated Data Types," in Proceedings of the 13th International Conference on Stabilization, Safety, and Security of Distributed Systems (SSS'11), 2011.

[5] A. Thomson, T. Diamond, S.-C. Weng, K. Ren, P. Shao, and D. J. Abadi, "Calvin: Fast Distributed Transactions for Partitioned Database Systems," in Proceedings of the 2012 ACM SIGMOD International Conference on Management of Data, 2012.

[6] J. Faleiro and D. Abadi, "Rethinking Serializable Multiversion Concurrency Control," in Proceedings of the VLDB Endowment, vol. 8, no. 11, 2015.

[7] TigerBeetle, "The TigerBeetle Database," https://tigerbeetle.com, 2023.

[8] A. Lakshman and P. Malik, "Cassandra: A Decentralized Structured Storage System," ACM SIGOPS Operating Systems Review, vol. 44, no. 2, pp. 35--40, 2010.

[9] A. Milovidov, "ClickHouse: A Blazingly Fast Column-Oriented Database," https://clickhouse.com, 2023.

[10] N. Lynch, Distributed Algorithms, Morgan Kaufmann, 1996.

[11] C. Cachin, R. Guerraoui, and L. Rodrigues, Introduction to Reliable and Secure Distributed Programming, 2nd ed., Springer, 2011.

[12] NIST, "Secure Hash Standard (SHS)," FIPS PUB 180-4, 2015.

[13] V. Jacobson, "Congestion Avoidance and Control," ACM SIGCOMM Computer Communication Review, vol. 18, no. 4, pp. 314--329, 1988.

[14] I. Moraru, D. Andersen, and M. Kaminsky, "There Is More Consensus in Egalitarian Parliaments," in Proceedings of the Twenty-Fourth ACM Symposium on Operating Systems Principles (SOSP '13), 2013.

[15] I. Zhang, N. Sharma, A. Szekeres, A. Krishnamurthy, and D. Ports, "Building Consistent Transactions with Inconsistent Replication," in Proceedings of the 25th Symposium on Operating Systems Principles (SOSP '15), 2015.

[16] S. Kulkarni, M. Demirbas, D. Madeppa, B. Avva, and M. Leone, "Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases," in Proceedings of the 18th International Conference on Principles of Distributed Systems (OPODIS '14), 2014.

[17] B. Berger, A. George, B. Lepers, A. Szekeres, and B. Ketels, "Accord: A Leaderless, Timestamp-Based Consensus Protocol for Apache Cassandra," Apache Cassandra Enhancement Proposal CEP-15, 2022.


Appendix A: Wire Protocol Summary

Type Name Size (bytes) Direction
0x00 RingToken Variable sigma(v_i)
0x01 WriteEntry Variable Flood-forward targets
0x05 CrossRingMergeVerification 69 sigma(v_i)
0x06 ReconciliationRequest 21 Divergent peer
0x07 ReconciliationResponse 9 + 56*m Requesting peer
0x08 NodeLeaveMessage 13 Broadcast to all

Appendix B: Configuration Parameters

Parameter Symbol Default Description
Ring size N 3--64 Number of nodes
Tick rate f_tick 1000 Hz Token circulation frequency
Failure threshold K 3 Missed tokens before failure declaration
Partition threshold K_p 10 ticks Ticks before partition suspected
Divergence threshold D 1000 ticks Watermark gap for split-brain confirmation
Anchor interval A 1000 entries Entries between anchor points
Reconciliation mode rho partial Default reconciliation strategy
Merge budget B 100 ms/tick Time budget for background merges
Gossip fanout F 3 Anti-entropy gossip targets per interval
Max nodes N_max 64 Maximum ring members (bitmask width)

Appendix C: Comparison Summary

Property Raft Paxos EPaxos Accord TickMerge
Leader required Yes Yes (proposer) No (any proposer) No No
Write path RTT 1 2 1 (fast path) 1 (fast path) / 2 (slow) 0 (local)
Write availability during partition Majority only Majority only Majority only Majority only All partitions
Read consistency Linearizable Linearizable Linearizable Linearizable Tunable (L0--LM)
Global ordering latency Immediate Immediate Immediate Immediate 2 ring cycles (deferred)
Membership change Joint consensus Reconfiguration Reconfiguration Topology change Single-seed join
Failure detection Election timeout Timeout Timeout Timeout Multi-signal (3 signals)
Partition reconciliation Leader re-election Leader re-election Leader re-election Quorum recovery 3 tunable modes
Total order guarantee Log index Ballot number Dependency graph Timestamp + dependencies (epoch, tick, node_id, seq)
Merge function properties N/A (log append) N/A Commutative deps Dependency resolution Semilattice (C, A, I)
Write scalability O(1) (leader bound) O(1) O(N) amortized O(N) amortized O(N) linear
Background merge cost O(N) replication O(N) replication O(N) + dep resolution O(N) + dep tracking O(N) flood-forward + sort + hash
Clock dependency None (logical log) None (ballot) None (deps) Wall-clock (with skew tolerance) Logical ticks (partition-safe)

Appendix D: Notation Index

Symbol Definition Reference
V = {v_1, ..., v_N} Set of nodes Definition 1
sigma : V -> V Ring successor function Definition 1
e Epoch (ring version) Definition 2
t Tick (logical clock) Definition 3
w = (e, t, n, s) Write entry Definition 4
< Total order on W Definition 5
L_k^i(t) Storage level k at node i at tick t Definition 6
C(S) Consistent view (sorted sequence) Definition 7
seen(w) Bitmask of nodes that have seen w Definition 8
H_k^i Merkle hash at node i after k entries Definition 10
Pi = {P_1, ..., P_k} Network partition Definition 13
Div(P_a, P_b) Partition divergence Definition 15
a_k = (t, e, H, c) Anchor entry Definition 16
M = (a_1, ..., a_m) Manifest Definition 17
Sigma_G, Sigma_W, Sigma_Q Detection signals Section 5.2
M(S_1, S_2) Merge function Section 3.5.3
delta(v_i, L_k, t) Read staleness Definition 11
G Watermark gap Section 6.3
A Anchor interval Definition 16
R = N/f_tick Token circulation period Corollary 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment