Failure model

Failure model

What happens to records and clients when a node, a zone, or a dependency fails, and how Nova tests it.

An acknowledged record survives the failure of any node, because it is in object storage before the acknowledgement. When a node fails, writes to the streams it led pause until another node takes over, about the metadata store's session timeout plus a second or two. Reads of indexed records continue throughout, from any node. This page says what each failure does, and how these claims are tested.

Append fails, the SDK retries The session expires after 10 or 15 s Open Take the lease Fence the old ledger at its cut Index every slot below the cut Delete slots above the cut Ready Resend unacknowledged batches Producer Failed leader Metadata store New leader Object storage
Failover after a crash. The new leader fences the old ledger before it serves, so the old node can never add a record.

The parts

PartWhat it does
SessionA node's connection to the metadata store. Its leases end when it expires: 10 seconds after the last renewal with an external store, 15 seconds with the built-in one.
LedgerThe run of WAL slots one node wrote under one epoch
CutThe first slot of a ledger that a fence blocked. Every slot below it that holds a flight is committed, and nothing at or above it can be.
Ledger recoveryFences a stopped ledger and records in the metadata store where its records are
Retry budgetHow long the SDK keeps retrying a call across failovers: 30 seconds

When a node fails

A node's memory holds only copies of records that are already in object storage, plus batches it has not acknowledged. So a crash loses no acknowledged record. Recovery has two jobs: give the node's streams new leaders, and index what it acknowledged but had not yet absorbed.

  1. The failed node's session expires, and its leases end with it.
  2. The next producer to open one of its streams gets a new leader. A read that needs the end of one of its streams does not wait for a producer, and the auditor covers the streams nobody touches.
  3. The new leader runs ledger recovery on the failed node's ledger. It first fences the ledger: it copies any partly written slot to enough buckets, then writes a marker into the first empty slot, the cut. It then records where every record below the cut is. No record data moves.
  4. It deletes the slots above the cut, written but never acknowledged. It looks one full upload window past the cut to find them all.
  5. The new leader serves. The SDK resends the batches that were not acknowledged.

A slot that was committed before the crash is kept, even when its acknowledgement never reached the client. A plain append whose acknowledgement was lost is therefore stored twice after the resend. A batch with a match sequence number is refused instead, and the client learns that an earlier attempt may have been stored. Sequence numbers continue with no gap. See Writer coordination.

A node that only seemed dead, because it paused or lost its network, finds the marker on its next write and stops. A planned move needs none of this: the departing leader indexes its records before it releases the lease, and its successor has nothing to recover.

How long failover takes

Failover takes the session timeout plus the recovery after it. On a local three-node cluster, a crashed node's streams accepted appends on another node 0.5 to 2 seconds after its session expired. With the default timeouts, that is about 11 seconds after the crash with an external metadata store, and about 17 with the built-in one.

With the built-in store, a crash can take longer. When the failed node also led the metadata store's coordinator, the coordinator has to move before any of the node's metadata can. At the built-in store's default timeout, the same tests measured 25 to 32 seconds from the crash in that case. The common case fits in the SDK's 30-second retry budget. The slow case can exceed it, and then the application sees the error.

Reads follow the same timeline. A tail check, a read that reaches the end, a fence, and a subscription waiting at the end each run the recovery themselves once the session has expired. Until then they are sent to the failed node and fail, and the SDK retries them. A waiting subscription checks about once a second, so it can take a second longer. Streams the failed node did not lead are not affected, because a node that does not lead a stream sends the client to its leader at once.

The SDK remembers each stream's leader. A call that fails only because the caller's own deadline passed does not make it forget. It forgets the leader when that node says it no longer leads, cannot be reached, or times out three calls in a row.

Other failures

FailureWhat clients seeHow Nova recovers
Object storage slowsAppends take longer, then wait as the limits fillResumes as writes complete. See Backpressure.
A slot cannot be written for 30 secondsAppends waitThe node fences its own ledger, starts the next one, and writes the unacknowledged flights again
One availability zone fails, Express with three zonesNothing. Appends are acknowledged at two copies of three.Nothing to recover. Reads try another zone's bucket.
Two zones failExpress appends waitWrites resume when a zone returns
The metadata store is slowOpens and lookups are slower. Appends wait once the backlog fills.Absorb catches up, and the backlog drains
The metadata store is down for longer than the session timeoutWrites stop, and reads that need a lookup failNodes lose their sessions and exit. When the store returns, restarted nodes rejoin and recover their streams as after a crash.
The auditor stopsNothingStorage grows until it runs again, then the due jobs run
A Gateway or object cache instance failsClients reconnect to another Gateway instance. Reads skip a failed cache instance.Neither holds state that must be recovered.

What the model does not cover

Object storage is where records are durable. Nova protects against losing nodes, not against losing objects: a record is as safe as the bucket that holds it, and an Express record is in two zones once acknowledged. The metadata store is the only index of where records are. Its own replication covers the loss of a server, and backups cover the loss of the whole store. See Backups and restore.

How Nova is tested

Nova checks these claims at three levels. Formal specifications check the protocols. Fault-injection tests check the code against real failures. A linearizability checker checks what clients observed.

Formal specifications

Eight TLA+ specifications describe the protocols, and the TLC model checker explores every state they can reach within set bounds:

SpecificationWhat it checks
LedgerSlots written to K buckets and committed at W copies, then fenced. An acknowledged slot stays committed, nothing is acknowledged at or above the cut, and every fencer finds the same cut.
Stream leadershipLeases, the open gate, the clean-release mark, and ledger recovery. Every acknowledged record is indexed exactly once, with no gaps.
Plain streamFencing tokens, fence, trim, reconfigure, and delete, as clients see them
Scalable streamSplits, merges, producer resends, and readers. Each key keeps its order, and a reader neither skips nor repeats records.
Range rowsA split run in steps, its intent, and cleanup after a crash
RegistryBucket and stream rows under concurrent writers that crash between steps
Object lifecycleRewrites, two-stage deletes, orphans, and read plans. No ref points at a deleted object.
MembershipA node from start to retirement: drain, decommission, and cleanup after a crash

Each defect the specifications found, and each design option they ruled out, is kept as a configuration with its guard switched off, and the checker must report the violation. These 64 configurations show that each guard is still needed, and that the specifications can still find the bug. The specifications are checked in CI whenever they or the API definitions change, and every week with a longer random search. A coverage ledger maps every API call to the specification that models it, or says why none does.

The specifications check the design, not the Go code. The tests below check the code.

Fault injection

On every pull request:

  • Chaos tests run a node against storage that fails a share of writes and reads, with random restarts. Each failure is decided by hashing a seed with the call and its attempt number, so a failing seed replays the same faults whatever the timing. After healing, the tests check that no acknowledged record is lost, sequence numbers have no gaps, every record is exact, and no batch is stored in part.
  • Integration tests run real novad processes against an Oxia metadata store and S3-compatible storage. They kill, stop, pause, and restart nodes, and cut one node off from storage or from the metadata store through a proxy. Fault points built into test builds inject a fault at an exact step, such as losing an acknowledgement just before it is sent.
  • Crash-point tests stop each multi-step metadata change between every pair of steps and check that a re-run reaches the same result.

A longer acceptance suite runs the same kinds of faults, and splits and merges under load, on a three-node Docker cluster. It takes about two hours and is run by hand.

Linearizability

The tests record every append and read that concurrent clients make, with the time each started and ended. The Porcupine checker then searches for one order of all operations that explains every result. An append that failed counts as maybe applied, and the checker tries both cases. The strictest model requires that once an append is acknowledged, every later read sees it. A violation fails the test and saves a visual history of the operations. The checker runs under combined faults, leader kills, storage cuts, lost acknowledgements, and metadata store session expiry, and on each range of a scalable stream.

Go deeper

For what an operator sees and does during these failures, see Failure modes. Back to the concepts: Guarantees.

On this page