Skip to content

Commit 2c3fed6

Browse files
Wldc4rdclaude
andcommitted
Teach the debugging skill the DoltLite backend-plugin (not just Dolt)
The pack modeled the data plane as the Dolt mysql sql-server (PROCESSLIST, a TCP port, DOLT_GC over the wire) and treated doltlite as a generic raw SQLite file. It had no notion of the current DoltLite *backend-plugin* deployment: bd/gc run plain (unlinked) and speak to `bd-backend-doltlite serve` (over stdio) + `gc-doltlite-fastpath serve`, with the store at `.beads/doltlite/*.db` and no TCP server at all. Make the skill backend-aware: - gas-stack-map: add a "detect the backend FIRST" recipe (`.beads/metadata.json` is ground truth) and split the data plane into three real deployments — dolt sql-server, doltlite linked, doltlite backend-plugin. Note backends can coexist per-city on a shared box. - gc-diagnostic-toolkit: tag the sql-server section as dolt-only; rewrite the doltlite section for the plugin model — query through `bd sql` (not a raw `sqlite3` open, which bypasses the working-set/commit model), inspect the `…serve` procs and store dir, and use DoltLite SQL maintenance functions. Point to the authoritative `beads-doltlite` skill for dolt_gc/flatten/locks. - SKILL: reflect the pluggable backend in the stack tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 82d5ee9 commit 2c3fed6

3 files changed

Lines changed: 29 additions & 11 deletions

File tree

skills/debugging-gas-issues/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gc gastownhall/gascity · gastownhall/gastown
3333
├─ dolt dolthub/dolt (mysql-protocol, sql-server, port-based)
3434
│ └─ gms dolthub/go-mysql-server (the SQL engine — planning, indexes)
3535
│ └─ vitess dolthub/vitess (MySQL protocol/parser)
36-
├─ doltlite dolthub/doltlite (SQLite-backed — different diagnostics, no sql-server)
36+
├─ doltlite dolthub/doltlite (SQLite-backed; linked OR backend-plugin = bd-backend-doltlite + gc-doltlite-fastpath — no sql-server/port)
3737
└─ driver dolthub/driver
3838
```
3939

skills/debugging-gas-issues/references/gas-stack-map.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The symptom surfaces high in the stack (a `gc` command feels slow, an agent stal
1313
| go-mysql-server (gms) | `dolthub/go-mysql-server` | The SQL engine embedded in dolt: query planning, index selection, joins, expression eval | a dolt dependency (check dolt's `go.mod`) |
1414
| vitess | `dolthub/vitess` | MySQL wire protocol + SQL parser used by gms | a gms dependency |
1515
| driver | `dolthub/driver` | The Go `database/sql` driver gc/bd use to talk to a dolt server | a gc/bd dependency |
16-
| doltlite | `dolthub/doltlite` (`doltlite-python`) | SQLite-backed version-controlled store — an alternative to dolt; **no mysql sql-server, no port** | the consumer's build cache; an on-disk SQLite file |
16+
| doltlite | `dolthub/doltlite` + the beads **backend plugin** (`bd-backend-doltlite`) & gc **fastpath** (`gc-doltlite-fastpath`) | SQLite-backed version-controlled store — an alternative to dolt; **no mysql sql-server, no port**. In the *plugin* deployment bd/gc are plain (unlinked) and talk to a `…serve` subprocess over stdio | `.beads/doltlite/*.db`; the co-located plugin binaries (e.g. `~/.local/lib/beads-plugin/`); `.beads/metadata.json` names them |
1717

1818
## Ground-truth sources (consult before tracing or changing behavior)
1919

@@ -43,9 +43,20 @@ git -C <source> log -1 --format='%H %ci %s' # source HEAD
4343
# mismatch -> your trace may not reflect the binary; rebuild or check out the right commit
4444
```
4545

46-
## dolt vs doltlite (don't assume mysql)
46+
## Which data plane? — detect the backend FIRST (don't assume mysql)
4747

48-
- **dolt**: a MySQL-protocol `sql-server` on a TCP port. Diagnose with `SHOW PROCESSLIST`, `information_schema.processlist`, global status, `ss`/`lsof` on the port. Port resolution: `--port` flag > city `dolt.port` config > `<rig>/.beads/dolt-server.port` file > legacy default.
49-
- **doltlite**: a version-controlled **SQLite** file. **No server, no port, no PROCESSLIST.** Diagnose with SQLite tooling against the file (`.dolt`/`.doltlite` dir), file size on disk, and the consuming process's own profiling. The CPU-vs-load, binary-grep, bead-store-layout, and dogfood techniques still apply; the *server* techniques do not. Check which backend the city/store actually uses before reaching for `SHOW PROCESSLIST`.
48+
There are now **three** beads data-plane deployments and their diagnostics differ completely. `.beads/metadata.json` is the ground truth — read it *before* reaching for `SHOW PROCESSLIST`:
49+
50+
```bash
51+
jq -r '.backend, (.backend_plugin_command // "—")' .beads/metadata.json # backend + plugin cmd (or —)
52+
ls -d .beads/dolt .beads/doltlite 2>/dev/null # which store dir exists
53+
pgrep -af 'dolt sql-server|bd-backend-doltlite|gc-doltlite-fastpath' # which serve procs are live
54+
```
55+
56+
- **dolt (sql-server)**`backend: dolt`; a MySQL-protocol server on a TCP port, store under `.beads/dolt`. Diagnose with `SHOW PROCESSLIST`, `information_schema.processlist`, global status, `ss`/`lsof` on the port. Port resolution: `--port` > city `dolt.port` > `<rig>/.beads/dolt-server.port` > legacy default.
57+
- **doltlite, linked**`backend: doltlite`, **no** `backend_plugin_command`; DoltLite compiled *into* bd/gc. Version-controlled, SQLite-backed; **no server, no port, no PROCESSLIST.**
58+
- **doltlite, backend-plugin** *(current on house-staff)*`backend: doltlite` **with** `backend_plugin_command` set. bd/gc are plain (unlinked) and launch `bd-backend-doltlite serve` (bd storage, over stdio, per-invocation) + `gc-doltlite-fastpath serve` (gc's always-on read fastpath). Store is `.beads/doltlite/*.db`; the plugin binaries are co-located (metadata names them). **No TCP server** — you cannot `SHOW PROCESSLIST` or `ss` a port. Inspect via `bd sql` (routed through the plugin), the `…serve` processes, the store dir on disk, and the DoltLite SQL maintenance functions. Deep commands + gotchas (`dolt_gc`, flatten, maintenance, locks, native read fastpath): the **`beads-doltlite`** skill is authoritative.
59+
60+
On a shared box the backends can coexist **per city** (one city on the plugin, a throwaway on a dolt sql-server) — so detect per store, never assume per host.
5061

5162
See `gc-diagnostic-toolkit.md` for the concrete commands per backend.

skills/debugging-gas-issues/references/gc-diagnostic-toolkit.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ pidstat 3 1 | awk '/^Average:/ && $3 ~ /^[0-9]+$/ {cpu[$NF]+=$8} END{for(c in cp
4040
```
4141
Aggregates sustained CPU by command. (`ps` %CPU is lifetime-average — misleading for "now".)
4242

43-
## dolt server introspection
43+
## dolt server introspection (backend: dolt only — confirm first)
44+
45+
Applies to the **dolt sql-server** backend. On a doltlite backend there is no server/port/PROCESSLIST — skip to the doltlite section. Confirm with `jq -r .backend .beads/metadata.json`.
4446

4547
```bash
4648
PORT=$(cat <rig>/.beads/dolt-server.port 2>/dev/null || echo 3307) # resolution: --port > city dolt.port > port-file > legacy
@@ -68,11 +70,16 @@ gc dolt-cleanup --probe --json # orphan dbs / stale procs (NEVER --force wit
6870
```
6971
Disk reclaim after deleting rows is a **dolt** GC: `CALL DOLT_GC('--full')` (online-safe; quiesce writers first). `gc dolt compact` gates on commit count and skips low-commit/high-churn dbs.
7072

71-
## doltlite (SQLite backend)
73+
## doltlite (embedded backend — linked or plugin)
7274

73-
No server/port/PROCESSLIST. Inspect the file:
75+
No server/port/PROCESSLIST. First confirm which doltlite deployment (see `gas-stack-map.md` → "Which data plane?"):
76+
```bash
77+
jq -r '.backend, (.backend_plugin_command // "—")' .beads/metadata.json # doltlite + (plugin cmd | —)
78+
pgrep -af 'bd-backend-doltlite|gc-doltlite-fastpath' # plugin serve procs (plugin model)
79+
du -sh .beads/doltlite 2>/dev/null # store size on disk
80+
```
81+
Query **through bd** (routed to the backend — works for linked and plugin), not a raw `sqlite3` open of the `.db` (that bypasses the working-set/commit model and can read a stale or locked view):
7482
```bash
75-
du -sh <store>/.doltlite 2>/dev/null
76-
sqlite3 <store-file> 'SELECT issue_type, COUNT(*) FROM issues GROUP BY issue_type;' # adapt to the actual schema/path
83+
bd sql -q "SELECT issue_type, COUNT(*) n, SUM(status='closed') closed FROM issues GROUP BY issue_type ORDER BY n DESC"
7784
```
78-
The CPU-vs-load, binary-grep, store-layout, and dogfood techniques still apply; the server techniques do not. **Check the backend before reaching for `SHOW PROCESSLIST`.**
85+
Disk reclaim / maintenance is a **DoltLite** operation, not `CALL DOLT_GC` over a wire — use the DoltLite SQL functions (`SELECT dolt_gc();`, flatten, maintenance) and mind the store locks. The **`beads-doltlite`** skill is the authoritative reference for those, the native read fastpath, and DoltLite lock/maintenance gotchas. The CPU-vs-load, binary-grep, store-layout, and dogfood techniques still apply; the server techniques (`PROCESSLIST`, `ss` on a port, `DOLT_GC('--full')` over the wire) do not. **Check the backend before reaching for `SHOW PROCESSLIST`.**

0 commit comments

Comments
 (0)