Operational reality — pipelining, batching, and the no-op trick

The no-op-on-election rule — one empty log entry appended the instant a server becomes leader — is the single mechanism that discharges three correctness obligations the curriculum has been collecting (Figure 8 commit propagation, ReadIndex correctness, single-server membership-change safety); the remaining operational realities — pipelining, batching, leadership transfer, ElectionTick tuning — are throughput and availability tuning around the fsync floor that dominates every Raft server.

Previously

Across earlier scenes the phrase 'no-op on election' has been mentioned three times — scene 5 used it to commit prior-term entries via the current-term rule (Figure 8), scene 7 used it to close the 2015 single-server membership-change hole, and scene 9 used it to make ReadIndex correct from the moment of election. Each time, the rule was a forward reference. This scene looks at it directly and reveals that the same one log entry is doing all three jobs.

Scene 10

Operational reality — the no-op trick, pipelining, batching, fsync

  1. Watch
  2. Try it
  3. Predict
  4. Capture
S1FOLLOWERT:4vote:S21t12t23t3▲commitS2LEADERT:4vote:S21t12t23t34▲commitS3FOLLOWERT:4vote:S21t12t23t3▲commitAppendEntries · T4 pi…AppendEntries · T4 pi…term colors: 1 blue · 2 teal · 3 amber · 4 violet · 5 roseAppendEntriesheartbeatRequestVoteInstallSnapshot▲commitIndexS2 has just won the election for term 4. The very first AppendEntries it broadcasts carries a single empty **no-op** entry of its…
no-op @ idx=4, term=4
What to watch for

You've seen the same rule mentioned three times already — in scene 5 (the Figure 8 fix), in scene 7 (the single-server membership-change fix), and in scene 9 (ReadIndex correctness). Each time it was a forward pointer to here. It's time to look at it directly. The rule, in plain English: the moment a server becomes leader, it appends one empty log entry of its current term and replicates it. That single act discharges three correctness obligations the curriculum has been collecting. The formal name: no-op on election. Formal statement: a newly-elected leader appends and replicates a single empty (no-op) entry of its own term before serving any other work. S2 has just won the election for term 4. Watch the first AppendEntries it broadcasts — it carries exactly one entry, the no-op. The next phase reveals why the same entry shows up in three otherwise-disjoint correctness proofs.

Continue unlocks when the animation finishes.
Implementation

Highlighted lines are the ones running in the diagram right now.

Leader.onElectionWin
one routine, three downstream sites — Figure 8, ReadIndex, single-server change
def onElectionWin(self, newTerm):
# 1. append a no-op entry of OUR term — the load-bearing trick
noop = LogEntry(term=newTerm, payload=NOOP, index=self.lastIndex+1)
self.appendAndReplicate(noop)
# 2. block downstream operations until the no-op commits
self.pendingReadIndexMessages = [] # scene 9
self.pendingConfigChanges = [] # scene 7 (Ongaro 2015 fix)
self.waitForCommit(noop.index)
# 3. once committed, three obligations discharged at once:
# a. prior-term entries on this majority commit transitively
# (current-term commit rule, scene 5 / Figure 8)
# b. commitIndex now reflects OUR term — ReadIndex safe
# (scene 9, drains pendingReadIndexMessages)
# c. configuration changes may now be appended
# (scene 7, drains pendingConfigChanges)

Where this sits in Build Raft — consensus you can defend

Scene 10 of 12. The no-op-on-election rule does triple duty: Figure 8 fix, ReadIndex correctness, single-server change safety. Plus the throughput knobs (pipelining, batching) and graceful TimeoutNow handoff that separate paper Raft from deployed Raft.

Up next. Every safety mechanism is now defended, the no-op trick is unified, and every operational reality — fsync floors, pipelining limits, batching trade-offs, graceful handoff — is named. You have the complete toolkit needed to walk into scene 11 and commit to a production Raft configuration for a specific workload: election timeout, batch window, read mode, membership strategy, snapshot cadence — each choice defendable against the invariants that justify it.

All 12 scenes in Build Raft — consensus you can defend · Every curriculum

Built with Arqly
Every scene in Build Raft — consensus you can defend builds on the one before it.All 12 Build Raft — consensus you can defend scenes