Browse Source

docs: pruning history - the default-TTL trap, measured timings, versioning off vs maxVersions

Answering smartbotic-vectorapi before a production prune: createCollection on
an existing collection re-applies defaultTtlSeconds (0 clears it), the prune
never touches current documents, and measured on 2.18.0 a 230 MB history file
prunes in 10.3 s while only that collection's history-recording writes wait.
ROADMAP: a dedicated pruneHistory/discardHistory call.
fszontagh 1 tháng trước cách đây
mục cha
commit
0609d2fcb6
2 tập tin đã thay đổi với 25 bổ sung và 0 xóa
  1. 6 0
      docs/ROADMAP.md
  2. 19 0
      docs/integration-guide.md

+ 6 - 0
docs/ROADMAP.md

@@ -393,6 +393,12 @@ joins; see 5c), which does not fit in 10 s. Run the container with
   `EXISTS false` excludes them. A paginated, sorted and filtered list view can
   surface rows its filter would reject at the edges. Decide one rule for both
   (e.g. absent sorts like null, first ascending) - a behaviour change.
+- **History administration has no dedicated call.** Pruning rides on
+  `createCollection(existing, maxVersions=N)`, which also re-applies the TTL
+  and other options (a TTL of 0 clears an existing default - a trap a consumer
+  nearly hit on prod), and nothing can discard a live collection's history or
+  the history of deleted documents. A `pruneHistory(collection, keep)` /
+  `discardHistory(collection)` RPC would close both.
 - Collection schemas cannot be declared in a migration file yet (the
   existing-row check lives in the SetCollectionSchema handler).
 - ~~**Bogus index declarations on a production instance (found 2026-10-09, predates 2.14.0):**~~ removed

+ 19 - 0
docs/integration-guide.md

@@ -1343,6 +1343,25 @@ collection's operations waited: on 2.17.1 run it at a quiet moment, one
 collection at a time. Before 2.17.1 the call changed the setting and trimmed nothing,
 and no supported call could cut back history kept with `maxVersions = 0`.
 
+- **⚠ Pass the collection's current `defaultTtlSeconds`.** `createCollection` on
+  an existing collection applies every argument that differs, and a default TTL
+  of 0 is a real value ("no default expiry"): a prune call written as
+  `createCollection(name, 0, false, N, 0)` clears an existing default TTL for
+  every later insert. Read it first with `getCollectionInfo(name)->defaultTtlSeconds`.
+  (`encrypted=false` never downgrades and `vectorDimension=0` is ignored.)
+- **The current documents are never touched:** only the history file is
+  rewritten (tmp + atomic rename), records are copied as stored, and every
+  document keeps its newest N versions (N >= 1).
+- **Measured (2.18.0):** a 56 MB history file pruned in 3.9 s, a 230 MB one in
+  10.3 s. Writes that record history in THAT collection waited for the whole
+  prune; writes to other collections stayed under 120 ms.
+- **To stop recording history** use `configureCollection(versioningEnabled=false)`,
+  not `maxVersions=0` (which means unlimited). It only flips a config flag and
+  needs no window; it does not reclaim history already written. There is no
+  call that discards a live collection's history outright: the floor is
+  `maxVersions=1`, which keeps the newest version of every document id ever
+  written, deleted ones included.
+
 #### Relation enforcement on/off (2.11.0+)
 
 Whether declared relations are enforced is a per-collection setting. It