@kedem/okdb 3.1.7 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,67 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
5
|
Dates are release dates.
|
|
6
6
|
|
|
7
|
+
## [3.1.9] - 2026-11-06
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **A second process no longer takes over a view build that `views.create()` / `rebuild()` is running.** 3.1.7–3.1.8 ran an explicit
|
|
12
|
+
build without the cross-process `view-rebuild:<name>` lease the view boot takes: a peer processing node that booted (at open, on
|
|
13
|
+
a `~views` poke, or reopening the env after a compaction) while the build ran found the view unbuilt, got the lease uncontested
|
|
14
|
+
and resumed the build, and the creator's `create()` rejected `VIEW_BOOTSTRAP_CANCELLED` ("build taken over by another builder").
|
|
15
|
+
store-oasis then dropped its views and retried, and two workers restarted the `commerce` view from zero after every compaction.
|
|
16
|
+
Every builder now holds the lease (taken before the `~views` row is written, so a poked peer defers); `create()` / `rebuild()` /
|
|
17
|
+
`start()` / `resetView()` retry for ~2 s when a peer holds it (`VIEW_REBUILD_IN_PROGRESS`, e.g. a view removed and re-created
|
|
18
|
+
while its build was still stopping), and an index-ready rebuild or a queued reset that meets it is retried, not dropped. A build
|
|
19
|
+
a peer does take over (our lease lapsed in a >10 min loop stall) carries `details.reason: 'taken-over'`: `create()` then waits
|
|
20
|
+
for the peer to finish the view instead of failing, and takes the build back if that peer dies.
|
|
21
|
+
|
|
22
|
+
## [3.1.8] - 2026-11-05
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **Compaction no longer blocks the event loop or parks writers for the length of the copy.** 3.0–3.1.7 compacted an env inside one
|
|
27
|
+
call on the owner thread with every writer of the env (in every process) parked until the copy finished: a multi-GB env held a
|
|
28
|
+
process's loop for minutes (store-oasis: its loop watchdog killed the worker 60 s into each auto-compaction, the next worker
|
|
29
|
+
started over, and every attempt left a partial copy on disk for an hour). Compaction is now a job the owner loop steps:
|
|
30
|
+
- the env is copied from a pinned snapshot into a fresh file on a worker thread while writers keep writing (a logical, sorted bulk
|
|
31
|
+
copy: as compact as `mdb_env_copy2` or more, and it goes through the env's cipher, so encrypted envs compact the same way);
|
|
32
|
+
- catch-up rounds on a worker thread re-sync, key by key, only the sub-DBs whose root changed since the last snapshot;
|
|
33
|
+
- writers are parked only for the final round (bounded by `OKDB_COMPACT_MAX_PARK_MS`, default 10 s; past it the round is
|
|
34
|
+
abandoned, the writers resume and it retries) and the swap, whose close grace now ends as soon as no peer holds the env.
|
|
35
|
+
`env.compact()` / `repair()` in JS await the job; `Env::compact` (Rust) runs it to completion. Also:
|
|
36
|
+
- the compaction lease is renewed every step (its 60 s TTL used to lapse mid-copy, letting a second process compact the same env);
|
|
37
|
+
- a synchronous write that meets a drain parks at most `OKDB_SYNC_WRITE_PARK_MS` (default 15 s; 250 ms inside a processor
|
|
38
|
+
quantum) and then fails with the retryable `ENV_DRAINING` (it parked up to 120 s); a write of the compacting process itself
|
|
39
|
+
drives its own compaction to the end instead of waiting on it; the pump skips an env's processors and views while a drain is
|
|
40
|
+
live;
|
|
41
|
+
- automatic compaction records each attempt in `~system` (`~compact_attempts`): one that died with its process, or failed, backs
|
|
42
|
+
the next automatic one off (cooldown x 2^failures, at most 24 h) instead of restarting it at every boot;
|
|
43
|
+
- leftovers are reaped at open and before each compaction: a temp dir whose owner process is gone at once (temp dirs carry an
|
|
44
|
+
owner file), an ownerless one after 10 quiet minutes (was 1 h), a stale `data.mdb.pre-compact`; logical-rebuild temp dirs now
|
|
45
|
+
live beside the env (no cross-filesystem copy inside the drain); the free-space check needs 1.2 x the live data, not 1.1 x the
|
|
46
|
+
file;
|
|
47
|
+
- `open()` no longer waits out another process's copy-phase drain (only a swap); its "blocked" warning names compaction.
|
|
48
|
+
Automatic compaction leaves the FTS storage pass to an explicit `compact()`, which still runs it inside the swap: peers'
|
|
49
|
+
reads of the env wait for that pass. `OKDB_COMPACT_TRACE=1` logs each phase transition of a compaction to stderr.
|
|
50
|
+
- **A live-map `$ref` change re-files the view doc everywhere.** When the doc a `map: { f: { $ref: [...], live: true } }` reads
|
|
51
|
+
changed, the view moved only its global scalar reducers and wrote grouped rows under a `_` bucket: per-bucket scalar, grouped,
|
|
52
|
+
items and `$min` / `$max` state kept the old mapped value (flat views: items and sorted state), and a bucketed view grew a
|
|
53
|
+
phantom `_` bucket. It now runs the same effects as a write of the doc itself. **Storage version 9**: views with a live map ref
|
|
54
|
+
rebuild once on open (non-blocking, resumable); every other view is restamped.
|
|
55
|
+
- **A parent entering / leaving a `$ref` view no longer scans every child.** The enter cascade read the whole ref type to find
|
|
56
|
+
the parent's children; leave and bucket moves scanned the whole ref tracking DB. Enter now reads the ref type's index on the
|
|
57
|
+
ref key when it is registered and ready (in the writing transaction); leave and bucket moves read a parent -> children inverse
|
|
58
|
+
of the tracking DB that every build since this release populates (views built before it keep the scan until their next
|
|
59
|
+
rebuild; the processing node fills theirs in the background on open). 300 000 line items: ~177 ms -> ~1 ms per order
|
|
60
|
+
cancelled / re-opened. **Upgrade every process to 3.1.8**: an older process writes `$ref` tracking without the inverse; the
|
|
61
|
+
cascades cross-check tracking and the next open refills an inverse that disagrees with it, but only 3.1.8 keeps it current.
|
|
62
|
+
- **Live-map refs are exact under concurrency and during builds.** A live-map update read the doc's current primary value and the
|
|
63
|
+
other live fields' current values, not what the view had applied: two live fields mapped from one doc and changed in one write
|
|
64
|
+
(bucket on one of them), or an async view's undrained primary write, filed rows the view never had. A build registered the
|
|
65
|
+
live-map handlers only at its end, so a mapped-from doc changed mid-build was never applied. Updates now start from the doc as
|
|
66
|
+
applied (prevDb / the build's bprev / the stored live values), and a build replays live-map ref changes since its start.
|
|
67
|
+
|
|
7
68
|
## [3.1.7] - 2026-11-05
|
|
8
69
|
|
|
9
70
|
### Fixed
|
|
Binary file
|