Update Path
The update path is how a new configuration reaches a running reader. The agent
validates and publishes; the reader only notices and attaches. A reader starts
no thread: the lookup that sees a change does the work, or
refresh() does it earlier from a thread the application picks.
The Switch
Section titled “The Switch”- Publish. The agent writes a new immutable generation, then atomically
replaces the
selectedtable, then moves the namespace’s sequence in thechangefile. The table has an entry per namespace, each with its own sequence. - Notice. Each lookup loads its namespace’s sequence from the mapped
changefile, so a publish in another namespace moves nothing it reads. - Attach. One thread wins
refreshing, re-readsselected, attaches each namespace whose entry names a new generation and publishes a new view. Everyone else keeps reading the installed view. - Retire. A handle keeps at most four views. An old view is freed only once its counters sum to zero, so no reader ever reads freed memory.
Failures Keep the Installed View
Section titled “Failures Keep the Installed View”A generation that fails verification, a refused directory or a lease that
can’t be taken frees what the attempt built and keeps the installed view.
Lookups keep answering from it until the sequence moves again or refresh()
runs. A revision that goes backwards within one incarnation is refused.
A namespace with no generation yet answers each call’s fallback with the
status UNAVAILABLE. A store that doesn’t exist yet opens; the reader retries
it at most once per 200 ms.
Validation
Section titled “Validation”Validation happens in the agent, completely, before a generation is selected: the delivery’s authentication, framing and schema, then the generation’s records and digests. The reader checks ownership, mode and ACLs of the store and every record it opens, and verifies each page against its digest on first touch. See Delivery and Local Images and Snapshot Format.
Pre-forking servers inherit handles. A child forked while another thread is mid-lookup or mid-refresh keeps a working handle and sees the next publish.