|
|
@@ -156,6 +156,11 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
|
|
|
- **The apt repo now indexes EVERY published version, so a rollback is an ordinary apt command.** It used to list only the newest, which made `pkg=<old version>` uninstallable the moment anything newer was published - and that was never retention, only indexing: `dpkg-scanpackages` emits one version per package unless given `-m`, while the pool had kept every `.deb` all along (a publish reported "3 added, 309 unchanged"). Fixed 2026-10-08 in the deb-repo tooling; the trixie index went from 33 stanzas to 1191. **A downgrade needs `--allow-downgrades`** (`apt-get install --allow-downgrades pkg=0.7.1-1 ...`), and downgrade the three app packages TOGETHER or apt resolves a split version set. A plain `apt install pkg` still picks the newest, so ordinary installs are unaffected. The backup step still stages the installed `.deb`s out of `/var/cache/apt/archives/`, which stays the right belt-and-braces for a rollback when the repo itself is unreachable.
|
|
|
- **"The dev host cannot build the C++" was a misdiagnosis - it was a stale `protoc`.** The host builds everything natively; use `scripts/host-build.sh`. The old symptom was real: generated protos wanted `google/protobuf/map_field_inl.h`, a header protobuf 35 removed. But nothing in the database's tree includes that header - an **old protoc emits the include**. The host had libprotobuf 35.1 and gRPC 1.83 from the distro, and a hand-dropped static **protoc 25.2 in `~/.local/bin`** shadowing everything, while the distro's compiler package (`protobuf-35.1`, separate from `protobuf-devel`, which ships no protoc) was never installed. `find_program(PROTOC protoc REQUIRED)` took the 25.2 binary from PATH, generated code for a protobuf 25 runtime and compiled it against 35 headers. With a matching protoc the client and all of vectorapi compile and link natively. `host-build.sh` therefore picks protoc **by version rather than PATH order** and refuses to run on a mismatch, because the failure otherwise surfaces as a missing header deep in generated code rather than as a version complaint.
|
|
|
- **`encrypted_field` (422) is its own slug, not `validation`.** Database 2.17.0 encrypts any field named `password`, `secret`, `token`, `api_key`, `apiKey` or `credentials` at ANY depth in EVERY collection, and then REFUSES a filter, sort, index, unique constraint, relation or increment on one. It needs its own slug because the remedy is unlike every other validation failure: the request is well formed, the field name is correct, and no correction of the body helps - the caller must stop querying that field, storing a non-sensitive duplicate (a hash, or a boolean "set") or renaming it if it was never a credential. Folding it into `validation` would send them hunting a typo. Note what it REPLACES is worse than itself: before 2.17.0 a top-level field of those names was plaintext and filterable, and a NESTED one compared ciphertext and **silently matched nothing** - so the refusal turns a silently empty result into a visible error. **Our `/documents` filter grammar, `?sort=` and the index route all accept ANY field name with no validation, so a TENANT can trigger this; we cannot.** Our own tests use `password` only as a `ctx.mail` option key, never as a stored field being queried.
|
|
|
+- **WE CREATE EVERY COLLECTION WITH UNLIMITED VERSION HISTORY, and most of prod's history is therefore our own operational churn.** `createCollection(..., maxVersions = 0, ...)` and 0 means "keep unlimited history", not "keep none" - so every code push to a function has appended a full copy of the script forever. Measured on prod: `justice-pa:vectorapi_functions.hlog` 114 MB (the function REGISTRY, a handful of rows), `default:vectorapi_function_jobs.hlog` 14 MB, `justice-pa:vectorapi_function_runs.hlog` 4.7 MB - about 133 MB of the box's 192 MB of history, roughly 69%, none of it data anyone would ever read. A consumer's 47 MB of `kb_chunks` history is retention of the same kind on a collection that has not changed size in days.
|
|
|
+ **It is not just disk: history bytes dominate the database's at-rest encryption migration**, in both duration and its memory pass, so our retention default sets the length of a window three consumers have to approve.
|
|
|
+ **PRUNING IS NOT BACKGROUND HYGIENE. It takes a GLOBAL lock.** From database 2.17.1, `createCollection(existing, maxVersions = N)` with a lower N rewrites that collection's history keeping the newest N per document - but it runs synchronously while holding the store's global collection lock exclusively AND the global history-append lock, so essentially every operation that resolves a collection waits, **in every collection**, for its whole duration. Expect seconds to tens of seconds on a 100 MB file (unmeasured). So: never loop it under live traffic, give it a quiet moment or put it inside a window, and prune the big one alone. Moving it out of that lock is an upstream follow-up and is NOT in 2.17.1.
|
|
|
+ **And it cannot be done BEFORE the encryption migration.** There is no mode that boots 2.17.1 without migrating - it runs before the listener opens - so "prune first to shorten the migration" is unreachable. Just as well: the prune path has no test against an unmigrated store (its test runs on a fresh 2.17.1 store and asserts only counts, not that surviving versions decrypt), so the escape hatch would have exercised new code against old on-disk format in a configuration nobody upgrades into. **The consumer who would have gained most from it was the one who decomposed the question correctly - "can it be deferred" is the easy half, "is the prune path safe against an unmigrated store" is the half that bites - and said they would rather have the long window.** Worth remembering as a pattern: when an optimisation needs a state that only the optimisation produces, the question is never whether you can get into that state.
|
|
|
+ **What disabling versioning costs**, confirmed from their code rather than assumed, because the plan is to turn it OFF for the queue and the run log and keep a small N (5-10) on the registry: version history and `restoreVersion`/`restoreToDate` stop working for new writes, and **a DELETED row can no longer be restored**, because restore-after-delete reads the pre-delete state from history. That is why the REGISTRY keeps versions - an accidentally deleted function is exactly the row worth recovering - while a claimed-and-deleted queue row has no reader. It does NOT touch the WAL, replication, the event stream (actor included) or `_version`, which still increments; none of them read history, and recovery is snapshots plus WAL.
|
|
|
- **`FailedPrecondition` means three different things** and must be branched on `FailureDetail.reason`: `missing_parent` and `delete_restricted` are 422, `read_only` is **503**, and an absent or unrecognised reason is **500**, never a guessed 422. Mapping the bare code to 422 told a caller that a read-only database was its own validation mistake, so it would fix its payload and retry forever instead of waiting. Use the `FailureDetail&` overloads wherever a call offers one - the reason-less `Failure` form cannot tell these apart.
|
|
|
- **A version conflict is `ErrorCode::Aborted`** (client 2.12.0) carrying `currentVersion`, and maps to **409** `version_conflict`. It used to arrive as `Unknown` and fold into 503 "retry as-is", which is the opposite of the required instruction: re-read first. Never match on the message text for this.
|
|
|
- **`patch` with a field set to null REMOVES the field** (RFC 7396 merge), it does not store null. Use `update` for an explicit null.
|