| index 2b342b6bb..c01674099 100644 |
| --- a/docs/region-ha-runbook.md |
| +++ b/docs/region-ha-runbook.md |
| @@ -346,9 +346,23 @@ Set `CARLOS_HA_GENERATIONS` in the group's host.env, one group at a time: |
| |
| Turn on `on` first and run the drills before `fast`. Never turn it off once a host has `head.json`. A host with `head.json` keeps using generations whatever the setting says because its lock stays in generations mode. But a host that has `head.json` and an ordinary lock, woken by a box with storage generations off, is refused with `lock_not_generations`. |
| |
| -### The floor: nothing below v0.39.0 |
| +Before the first group in a deployment is switched on, the console must be at vG or later (see [the floor](#the-floor-nothing-below-vg)). Never roll the console back below vG while any host has `head.json`. An older console reads the host's root folder, not the folder `head.json` names. Its database door, backups, seed copies and drills then return stale data with no error for up to 7 days, and report no replica once the root folder is deleted. |
| |
| -Before switching a group on, set its `generations_floor` to v0.39.0. The group roll refuses any member below that release and any member that does not report `replica-generations-1`. A box older than v0.39.0 would read a generations host's lock as an ordinary lock and serve stale data. Do not lower or remove the floor while any host in the group has `head.json`. |
| +### The floor: nothing below vG |
| + |
| +vG is the release that carries storage generations, the first whose `carlos version --json` reports `replica-generations-1`. A box older than vG would read a generations host's lock as an ordinary lock and serve stale data. |
| + |
| +Before switching a group on, set its `generations_floor` to vG. The group roll refuses any member below that release and any member that does not report `replica-generations-1`. It also refuses while a declared fixed box has no edges file, because that box's release is unknown. Do not lower or remove the floor while any host in the group has `head.json`. |
| + |
| +The box enforces it too. A box whose host.env sets `CARLOS_HA_GENERATIONS` to anything but `0` or `off` refuses to activate a binary that does not report `replica-generations-1` in `carlos version --json`, and keeps the running binary. This covers an update, a rollback, `install-channel` and boot recovery, on fixed boxes and group members alike. The recovery unit makes the same check with `carlos system generations-allows-prev /opt/carlos/carlos.prev` (exit 0 allowed or not armed, 1 refused, 2 bad arguments). The refusal reads: |
| + |
| +```text |
| +this box serves region HA storage generations (CARLOS_HA_GENERATIONS is or was on); <binary> does not, so it cannot run here. Roll forward, or to a build at or above the first one with replica-generations-1. |
| +``` |
| + |
| +The refusal stays after the switch is removed. When a root process on the box first sees the switch on, it writes `/etc/carlos/ha-generations-floor`, and the box keeps refusing while that file exists. The adopt pass, which runs at boot and every hour, writes it, and so does any update or recovery. Do not delete the file while any host the box serves has `head.json`. |
| + |
| +On a box with the guard armed, the guard binary `/opt/carlos/system/guard/carlos` is not refreshed by updates, and a guard binary older than vG recovers without this check. Before switching such a box on, check that both `/opt/carlos/carlos` and `/opt/carlos/carlos.prev` report `replica-generations-1`, as for [PROXY protocol](#the-floor-nothing-below-vn-on-an-nlb-target). |
| |
| ### A wake refused with ha_generation_refused |
| |
| @@ -358,7 +372,7 @@ The box refused to start the host. The journal line names the reason: |
| - `no_l0` and `empty_plan_with_data` mean the previous holder's copy holds no usable starting point. |
| - `file_over_5gib` means one file is too large to copy. |
| - `head_missing` means generation folders exist but `head.json` does not. |
| -- `lock_not_generations` means a box with storage generations off met an ordinary lock on a host that has `head.json`. |
| +- `lock_not_generations` means a box with storage generations off met an ordinary lock on a host that has `head.json`. Every box at vG or later keeps a generations lock in generations mode, so a binary below the floor took that lock, or someone edited it by hand. |
| |
| L0 is the newest level of the host's database copy, where each uploaded change lands first. The host stays down and pages once an hour. Do not edit `head.json` or the lock to get past it. |
| |
| @@ -367,10 +381,12 @@ To restore the host, choose a folder to restart it from and point the host at it |
| 1. List the host's folders with `carlos ops ha-generations list <host>`. It shows the folder `head.json` names, the folders in its history, each folder's newest L0 transaction and the lock. Choose the folder `head.json` names or one marked `(in history)`. Point refuses any other folder. |
| 2. Check that folder with `carlos ops ha-generations verify <host> --gen <g-N>`. It restores the folder into a temporary file, checks it and removes the file. |
| 3. Do a dry run with `carlos ops ha-generations point <host> --gen <g-N> --accept-loss-after <txid>`, where `<txid>` is the folder's newest L0 transaction from `list`. It writes nothing. It prints the two files it would write and one sentence that says what is lost. Read that sentence. |
| -4. Run the same command again with `--yes`. Point keeps the host's data up to `<txid>` and permanently gives up every transaction after it. It writes `head.json`, then the lock. If it says that `head.json` was written and the lock was not, run `list` again, then point again. |
| +4. Run the same command again with `--yes`. Pointing at the folder `head.json` names keeps the host's data up to `<txid>` and permanently gives up every transaction after it. Pointing at a folder from the history permanently gives up every change written after that folder stopped being current, whatever the transaction numbers: they cannot be compared between folders. Point writes `head.json`, then the lock. If it says that `head.json` was written and the lock was not, run `list` again, then point again. |
| 5. Wake the host by sending it a request. |
| |
| -A host refused with `head_missing` has no `head.json`, and `carlos ops` has no recovery for it yet: point refuses it. A host refused with `lock_not_generations` was woken by a box with storage generations off, and point does not fix it. Set `CARLOS_HA_GENERATIONS` to `on` or `fast` in that group's host.env. |
| +A host refused with `head_missing` has no `head.json`, and `carlos ops` has no recovery for it yet: point refuses it. |
| + |
| +A host refused with `lock_not_generations` had its lock taken by a binary below the floor, or edited by hand. Point does not fix it. Before you switch the group on, list the host's root layout, the files under `instances/<host>/` outside its `g-<number>/` folders, and look for LTX files written after `created_by.at` in `head.json`. Those are changes the binary below the floor wrote after the last generations take. Switching on makes the next wake copy from the folder `head.json` names, so those changes are not served, and the box later deletes them with the root folder. If you find any, copy them somewhere safe and ask before you switch on. Then find the box below the floor and roll it forward. |
| |
| ### Old folders and the clock |
| |
| @@ -380,14 +396,6 @@ After each successful wake, the box deletes folders older than the 7-day restore |
| |
| Moves of a host with `head.json` are refused for now, before anything is copied. The follow-up is discussion #1253. |
| |
| -| Change | Revision | |
| -|---|---| |
| -| Refusal reasons | Defined the distinct meaning of all seven reason codes. | |
| -| Generation mode | Explained why hosts keep using generations and added the ordinary-lock exception. | |
| -| Missing storage time | Distinguished lock-write wake failure from switch-write retirement failure. | |
| - |
| -Flags: None. |
| - |
| ## Install chrony on a fixed box |
| |
| Before G3 step 4 on the G3 card, install chrony on each named fixed box during an attended maintenance window. Use the reviewed `scripts/region-ha-g3/chrony-fixed-box.sh` through SSM as root, with approval for the named box. Group boxes already configure Amazon Time Sync at first boot. |