Kaynağa Gözat

docs: 2.17.2 -> 2.20.1 is a verified two-way door, tested not reasoned

The database owner tested the rollback rather than reading the diff:
2.17.2 boots from a 2.20.1 snapshot, not read-only, 0 WAL replayed, 290
rows with updates decrypting exactly, encryption-verify CLEAN. No boot
migration, no format version, no index key change anywhere in the 16-file
diff.

So detectability, memory peak and OOM re-runnability are moot here -
unlike 2.17.x, whose first-boot migration could not be skipped and
OOM-killed under a 900 MiB cap. Same product, one upgrade needing a sized
window and one needing none, which is why the question is per-upgrade.

The one rollback caveat - a regex pattern STORED under 2.20.x in a view
where or policy predicate is invalid std::regex and fails closed silently
on 2.17.2 - is measured inapplicable: 0 views, 0 policies on all six
projects, and createView and the policy API appear nowhere in our source,
so it cannot arrive through our layer.
fszontagh 1 ay önce
ebeveyn
işleme
33b076aa29
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. 3 0
      CLAUDE.md

+ 3 - 0
CLAUDE.md

@@ -290,6 +290,9 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **The error was verifying the mechanism's PURPOSE instead of its EFFECT.** `policy-rc.d` genuinely is the standard Debian way to prevent a maintainer script starting a service; it is just not effective against a script that bypasses `invoke-rc.d`. Checking that it is the right tool is not the same as checking that it works here, and one `systemctl show -p ActiveEnterTimestamp` before the install - or one `grep systemctl` over the postinst - would have shown it. **A control nobody has seen fire is not a control.** If a window needs a pause, REHEARSE THE PAUSE, not just the migration: install on a scratch box and confirm the service did NOT start. The consumer's framing is the one to keep - they asked for a pause and then treated it as load-bearing without either of us testing that it pauses.
   **To actually hold a start for this package: `systemctl mask` the unit for the duration**, confirmed upstream - a masked unit REFUSES the start and the postinst's `|| true` absorbs the failure, so the install completes with nothing running. Then unmask and start deliberately. Upstream is also moving the postinst to `deb-systemd-invoke` so `policy-rc.d` will work too, but that is ROADMAP, not shipped. Whichever route, PROVE it by reading `ActiveEnterTimestamp` before and after the install rather than assuming the hold took.
 - **A DATABASE OUTAGE ERASES ITS OWN EVIDENCE FROM THE FUNCTION RUN LOG, because the run log lives in the database.** Observed by a consumer diagnosing the 50-second window: ZERO recorded function runs inside it, not failures. They had to infer the gap from the surrounding minute-cron ticks (16:21:05, then 16:22:46) rather than read it. So when diagnosing a past outage, the run log goes QUIET rather than showing errors, and absence of failures there is not evidence that nothing failed - the same absence-is-not-information trap as a missing `scan_capped`, one layer out.
+- **DATABASE 2.17.2 -> 2.20.1 IS A VERIFIED TWO-WAY DOOR: NOTHING BETWEEN THEM MIGRATES ANYTHING ON DISK, AND 2.17.2 READS A DATA DIRECTORY 2.20.1 HAS RUN ON.** Established by the database owner 2026-10-19 by TEST rather than by reading the diff, which is why it is quotable: 2.17.2 seeded 200 rows with encryption on, 2.20.1 then inserted 100, updated 50 (recording history), deleted 10 and wrote its streaming snapshot, and **2.17.2 booted from that 2.20.1 snapshot** with 0 WAL entries replayed, not read-only, reading 290 rows with the updated and new ones decrypting exactly; `encryption-verify` said CLEAN over 350 ciphertext values and 60 history versions. The whole server diff is 16 files and adds no boot migration, no marker-gated rewrite, no WAL op, no snapshot format version, no index key format and no schema version. 2.18.0 is query-time only (an index declines non-number, non-string range bounds); 2.19.0 maps `_expires_at` onto the `expiresAt` the server always stored; 2.20.0 is the RE2 engine; 2.20.1's snapshot is the same v4 format. The one new file, `snapshots/snapshot.in-progress`, is ignored by 2.17.2, which lists only `snapshot-*.dat` and `snapshot-*.tmp`.
+  **So "detectable before it runs", "what is its memory peak" and "does it re-run after an OOM" are all MOOT for this upgrade** - there is nothing to run, boot does the same recovery work, and the only boot-path differences are log lines plus a lower hourly snapshot peak. Worth contrasting with 2.17.x, where the first-boot at-rest migration rewrote rows and history, could not be skipped, peaked over a gigabyte and OOM-killed under a 900 MiB cap. **Two upgrades of the same product, one requiring a carefully sized window and one requiring none - which is why the question has to be asked per upgrade rather than inherited from the last one.**
+  **THE ONE CAVEAT ON GOING BACK, AND IT IS MEASURED AS INAPPLICABLE TO PROD RATHER THAN ASSUMED: a regex pattern STORED while on 2.20.x - a view `where` or a policy row predicate - using RE2-only syntax such as `(?i)` is not valid `std::regex`, so after a rollback 2.17.2 fails it CLOSED and silently, and such a view reads empty.** A pattern in a request only affects that request. Verified on prod rather than taken on "no reason to store one": `ViewManager: loaded 0 views from _views` at boot, `security disabled` and zero principals with a policy on all six projects, and **`createView` and the policy API appear NOWHERE in `src/` or `runner/src/`** - so our layer cannot create either, and the hazard cannot arrive through us. A tenant reaching it would need the CLI directly.
 - **THE DATABASE PACKAGES ARE ON APT HOLD, so an upgrade needs `--allow-change-held-packages` or it FAILS.** `apt-mark showhold` lists `smartbotic-database` and `libsmartbotic-db-client`; our three app packages are not held, which is why an ordinary vectorapi release needs nothing special. A pinned install without the flag dies with `E: Held packages were changed and -y was used without --allow-change-held-packages` - caught here by a `--dry-run` a few hours before a window, which is the only reason it was not discovered mid-outage. **Prefer the FLAG over `apt-mark unhold` plus a re-hold:** the hold is per PACKAGE rather than per version, so it survives the upgrade and keeps protecting the new version automatically, whereas the unhold route leaves the database freely upgradable if the re-hold is ever forgotten - a protection silently switched off is worse than an install that refuses.
   **AND THAT IS EXACTLY WHAT HAPPENED. THE HOLD WAS GONE, MEASURED 2026-10-15: `apt-mark showhold` printed NOTHING** and `dpkg -l` showed `ii` rather than `hi` for all three. So the 2.17.2 window took the unhold route, the re-hold was forgotten, and the protection this paragraph calls load-bearing was off for three days with nothing to show it. **`smartbotic-database 2.18.0-1` was sitting in apt at that moment**, so a routine `apt-get upgrade` TYPED BY A HUMAN would have upgraded the database, the client and the CLI, and the database postinst calls `systemctl` DIRECTLY - so it would have restarted prod and run whatever 2.18.0's first boot does, unannounced, on a box holding four tenants' data. Re-held all three (the CLI too, since it is version-matched to the client), and **verified the control actually fires rather than trusting the command's output**: `apt-get -s upgrade` now reports them under "The following packages have been kept back" with ZERO `Inst` lines. A deliberate upgrade still works with `--allow-change-held-packages`.
   Two things worth taking from it. The note PREDICTED this failure in writing and the prediction still came true, because a written warning is not a control - **check `apt-mark showhold` as part of closing any window that touched a held package**, since the evidence is one command and the failure is invisible until the day it costs an outage. And it was found by accident, while verifying something unrelated: the `ii`/`hi` column appeared in a listing I had pulled to check a version. That is the second time this exact column has carried the answer while being read past.