From 43fef1050485d22dd0ff44a36afc82d696640fea Mon Sep 17 00:00:00 2001 From: Tomasz Szymczyszyn Date: Thu, 15 Oct 2026 12:01:14 +0200 Subject: [PATCH 1/2] Add live checks for the namespace store Scripts under libsql-server/scripts/namespace-live-checks that run a built sqld locally and exercise the namespace store against a real server: a load tool, two focused scenarios (eviction churn and SIGTERM under load), a 65-check regression matrix over the admin and user APIs including a primary plus replica pair and mixed versions, and a side-by-side comparison of two runs. The races in this area (an entry emptied under a request, a shutdown with requests in flight, a destroy racing a lookup) are pinned by unit tests; these scripts show the same races on a running server and let two binaries be compared before and after a change. --- .../scripts/namespace-live-checks/README.md | 76 ++++++ .../scripts/namespace-live-checks/compare.py | 36 +++ .../scripts/namespace-live-checks/load.py | 154 ++++++++++++ .../scripts/namespace-live-checks/regress.sh | 232 ++++++++++++++++++ .../scripts/namespace-live-checks/scenario.sh | 67 +++++ 5 files changed, 565 insertions(+) create mode 100644 libsql-server/scripts/namespace-live-checks/README.md create mode 100755 libsql-server/scripts/namespace-live-checks/compare.py create mode 100755 libsql-server/scripts/namespace-live-checks/load.py create mode 100755 libsql-server/scripts/namespace-live-checks/regress.sh create mode 100755 libsql-server/scripts/namespace-live-checks/scenario.sh diff --git a/libsql-server/scripts/namespace-live-checks/README.md b/libsql-server/scripts/namespace-live-checks/README.md new file mode 100644 index 0000000000..843fcc6241 --- /dev/null +++ b/libsql-server/scripts/namespace-live-checks/README.md @@ -0,0 +1,76 @@ +# Namespace live checks + +Scripts that run a built `sqld` locally and check how the namespace store +behaves under load, during shutdown, and across the admin API. They exist +because the interesting failures here are races: an entry emptied under a +request, a shutdown while requests are in flight, a destroy racing a lookup. +Unit tests pin each race deterministically; these scripts show the same +races against a real server, and let two binaries be compared. + +Nothing here touches a remote system. Everything listens on `127.0.0.1`. + +## Requirements + +`bash` 3.2 or newer, `curl`, `python3`, `lsof`. A debug build is fine and +widens the race windows, which is what you want. + +``` +cargo build -p libsql-server --bin sqld +``` + +## Scripts + +| Script | What it does | +|---|---| +| `load.py` | Keep-alive clients driving `POST /v2/pipeline`; tallies status codes per phase, with an optional SIGTERM or shell action at a given time. | +| `scenario.sh` | One focused scenario: `evict` (cache capacity far below the hot set) or `sigterm` (signal under load). Prints the tally, the namespace-store counters and the grouped store log lines. | +| `regress.sh` | A 65-check matrix across the admin and user APIs, one primary and one primary plus replica, optionally mixed versions. Writes `results.tsv`. | +| `compare.py` | Side-by-side diff of two `results.tsv` files. | + +## Comparing two binaries + +``` +S=libsql-server/scripts/namespace-live-checks +$S/scenario.sh target/debug/sqld evict # expect 0 non-200 answers +$S/scenario.sh target/debug/sqld sigterm # expect 503s after the signal, no 404s + +$S/regress.sh /path/to/old/sqld old /path/to/new/sqld +$S/regress.sh /path/to/new/sqld new /path/to/old/sqld +$S/compare.py namespace-live-checks-out/old/results.tsv namespace-live-checks-out/new/results.tsv old new +``` + +`regress.sh` writes server logs next to the results (`