diff options
| author | tv <tv@krebsco.de> | 2026-11-20 04:16:12 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-20 05:29:48 +0100 |
| commit | 7926a9764626878f5cc244286cce9eb502358929 (patch) | |
| tree | 7ba6082872afd464490feb296c4f54afbc5c80a9 /docs | |
| parent | 00cac6466057c2a8a92dae9e4cd46369e72bcad9 (diff) | |
keep-actor by default: the writer kept across a clean stop, writes held till a sync
A node that stopped cleanly writes on as the writer of before, as
`--keep-actor` had it, now by default: an epoch gathers a writer per node
and per crash, drop or rejoin, not per start. `keep-actor = false`, in a
configuration file, has a node write as a fresh writer each start; a
node without a document file has nothing to keep, which is no longer an
error.
Writing on as the writer of before, a node holds its writes (`mutate_doc`
and the API's through it) until it synced once with a ready neighbour,
level with it, or 10 seconds passed (`AppState::hold_writes`,
`KEPT_WRITER_WAIT`): a neighbour holding later changes of that writer,
which a copy of the node's files made (a backup restored, a disk rolled
back), hands them over first, and the node takes a fresh writer then, as
it did. A node that reaches no neighbour within the wait writes on.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/example.toml | 16 | ||||
| -rw-r--r-- | docs/lifecycle.md | 30 | ||||
| -rw-r--r-- | docs/measurements.md | 2 |
3 files changed, 26 insertions, 22 deletions
diff --git a/docs/example.toml b/docs/example.toml index 6a6f7b3..cdf942a 100644 --- a/docs/example.toml +++ b/docs/example.toml @@ -284,13 +284,15 @@ htpasswd = "/etc/continuum/htpasswd" # document-rewrite = "1h" # Resume writing as the actor this node wrote with before it stopped, if it stopped -# cleanly (its document file holds everything it wrote then), instead of a fresh one: -# an epoch then gathers a writer per node and per crash or drop rather than per start, -# and every transfer of its history carries a signature per writer. Never start two -# nodes from copies of one document file, nor a node from an older copy of its own (a -# restored backup, a rolled-back disk): both would write as the same actor. Needs -# document-file. -# keep-actor = false +# cleanly (its document file holds everything it wrote then), instead of a fresh one, +# holding its writes until it synced once with a ready neighbour, or 10s passed: an +# epoch then gathers a writer per node and per crash or drop rather than per start, and +# every transfer of its history carries a signature per writer. A copy of the data +# directory (two nodes from copies of one document file, a restored backup, a +# rolled-back disk) writes as the same actor: a neighbour holding the other copy's later +# changes hands them over within the wait, and the node takes a fresh actor. Without +# document-file, nothing is kept. +# keep-actor = true # --- Timings and sizes ------------------------------------------------------------------- # Durations: seconds (30, 0.5) or with units (500ms, 30s, 1m, 1h30m, 7d). diff --git a/docs/lifecycle.md b/docs/lifecycle.md index a221063..41a4ddc 100644 --- a/docs/lifecycle.md +++ b/docs/lifecycle.md @@ -95,20 +95,22 @@ document file holding a document is an error with no override. by a crash is dropped when reading. A file is read only by a version that knows every kind of record in it: one a later version wrote is unusable to an earlier one, which doesn't start on it unless told to move it aside (`--force badDocumentFile`). A node starting from it is ready at once; sync - merges what it missed, or it rejoins a newer epoch. A node writes as a fresh actor - each start, unless `--keep-actor` and it stopped cleanly (the file marks a clean - stop, and the mark is undone as the node starts on it, before it decides its actor): - then it writes on as the actor of before, as nothing it wrote is missing. Where the - mark can't be undone (the disk full, say), it writes as a fresh one. Two nodes - started on copies of one file would both write on as that actor, and each one's - changes would be refused as forged by peers holding the other's: don't start a copy - of a node's data directory while the node runs, or after it, with `--keep-actor`. A - node receiving a change of its own actor that it didn't make, signed with its own - key, writes on as a fresh actor at once, and logs a warning (unsigned, it is - anyone's forgery: refused, and nothing switches); what both wrote before stays refused where the - other's came first. Fewer actors mean fewer signatures in every - transfer of the epoch's history (a writer each); a crash, a drop, or a switch or a - rejoin still starts a fresh one. + merges what it missed, or it rejoins a newer epoch. A node that stopped cleanly writes + on as the actor of before (`--keep-actor`, on by default), as nothing it wrote is + missing: the file marks a clean stop, and the mark is undone as the node starts on it, + before it decides its actor. Where the mark can't be undone (the disk full, say), or + the node didn't stop cleanly, it writes as a fresh one. Writing on as the actor of + before, it holds its writes (the API's among them) until it synced once with a ready + neighbour, or 10 seconds passed. Two nodes started on copies of one file, or a node on + an older copy of its own (a restored backup, a rolled-back disk), write as the same + actor: a neighbour holding the other copy's later changes hands them over within that + wait, and a node receiving a change of its own actor that it didn't make, signed with + its own key, writes on as a fresh actor at once, and logs a warning (unsigned, it is + anyone's forgery: refused, and nothing switches). What both wrote before stays refused + where the other's came first, so don't start a copy of a node's data directory while + the node runs; `keep-actor = false` has a node write as a fresh actor each start. + Fewer actors mean fewer signatures in every transfer of the epoch's history (a writer + each); a crash, a drop, or a switch or a rejoin still starts a fresh one. * **A backup** (`GET /admin/document`) is the whole document with its history, naming its swarm and epoch. `--recover-from` starts a node on it; `--genesis --remake import:FILE` starts a *new* swarm with its content; an `import` remake brings its diff --git a/docs/measurements.md b/docs/measurements.md index 2adc9ed..60eac40 100644 --- a/docs/measurements.md +++ b/docs/measurements.md @@ -39,7 +39,7 @@ whole seconds in JSON unless named `…Ms`; Prometheus has seconds throughout. | JSON | Prometheus | Meaning | |---|---|---| | `document.heads` | `document_heads` | Heads of the local document now. 1 means every change has been merged into one line of history; more means concurrent writes not yet followed by a merging write. | -| `document.writers` | `document_writers` | Writers (Automerge actors) with changes in the document, counted with the saved size. Each start, rejoin or drop of a node makes one (a start keeps the one of before with `--keep-actor` after a clean stop), and every transfer of the whole history carries a signature for each; a remake starts again from the writers that write in the new epoch. | +| `document.writers` | `document_writers` | Writers (Automerge actors) with changes in the document, counted with the saved size. Each rejoin or drop of a node makes one, and each start but after a clean stop (`--keep-actor`), and every transfer of the whole history carries a signature for each; a remake starts again from the writers that write in the new epoch. | | `document.maxHeads` | `document_max_heads` | The most heads seen right after applying a sync message. A high value shows how concurrent the swarm's writing gets; it also bounds keepalive size (above 32 heads, keepalives carry a digest and 32 of them). | | `document.savedBytes` | `document_saved_bytes` | The document as Automerge saves it (compressed): roughly what a joining node downloads and what a document file rewrite writes. Measured in the background, only after a change, at least a minute apart and at most 1% of the time (a document that takes 2 s to save is measured every 200 s at most); an export (`GET /admin/document`) counts as a measurement. `savedBytesSecsAgo` and `savedBytesTookMs` say how fresh and how costly. | | `document.lockWait.read`, `.write`: `count`, `sumUs`, `maxUs`, `buckets[]` (`leUs`) | `document_lock_wait_seconds{mode}` (histogram), `document_lock_wait_max_seconds{mode}` | How long takers of the document's lock waited for it, since start, by mode. Readers (the API's reads, topology, stats, generating sync messages, serving changes and deltas, saves) wait only for a writer; writers (applying sync messages and fetched changes, writes, epoch switches) wait for everyone. Buckets from 10 µs to 10 s, the last unbounded; not cumulative in JSON. | |
