Skip to content

v1.15.0 — transaction functions everywhere; DuckDB correctness fix + connection pool

Choose a tag to compare

@github-actions github-actions released this 15 Oct 12:04
· 345 commits to master since this release
v1.15.0
88ee547

mentat 1.15.0: transaction functions everywhere, a DuckDB correctness fix, and a DuckDB connection pool

DuckDB users: upgrade

In 1.11.0–1.14.0 the DuckDB extension could silently return no rows. This
happened once a mentat database had been opened by a plain duckdb CLI (or any
client without the extension) after a mentat session. From then on, every
[?e :attr _] query came back empty, and retractions failed with
FATAL ... Failed to delete all rows from index.

The cause is a DuckDB 1.4.0–1.5.6 bug,
duckdb/duckdb#26828: the
first checkpoint after a WAL replay loses rows from secondary indexes. The
upstream fix (#26814) isn't released yet.

1.15.0 stores have no secondary indexes. DuckDB 1.5.6 never used them, and
inserts are 8.5x faster without them. Opening an existing store with 1.15.0
drops the old indexes, which also repairs a store that was already hit.
We
verified this on a store that the 1.14.0 extension had corrupted.

New

  • Transaction functions on the embedded SQLite store and the DuckDB
    extension
    (mozilla#333). The :db/fn functions that 1.14.0 added to PostgreSQL
    now run on every backend that has the scripting interpreter, with the same
    semantics:

    • the embedded store with the mino feature, the SQLite extension and the
      CLI;
    • the DuckDB extension.
    [{:db/ident :person/birthday
      :db/fn "(fn [db who]
                (let [a (ffirst (mentat.store/q db '[:find ?a :in $ ?n
                                                     :where [?e :person/name ?n] [?e :person/age ?a]] who))]
                  [[:db/cas [:person/name who] :person/age a (inc a)]]))"}]
    [[:person/birthday "Alice"]]

    The function sees the database as of the start of the transaction and runs
    in the edn_eval sandbox. Its tx-data is spliced into the same transaction.
    MENTAT_TXFN_MAX_DEPTH (default 16) bounds recursion; on PostgreSQL it is
    mentat.txfn_max_depth. Existing stores need no migration.

Faster (DuckDB)

  • Concurrent mentat calls now run in parallel. The extension opens a pool
    of connections when it is loaded (MENTAT_DUCKDB_POOL, default one per core,
    at most 8). Writes to one store still take turns; reads, and writes to
    different stores, run concurrently.

    • Point lookups at 8 client threads: ~320 → ~1500 ops/s.
    • Writes from 8 threads, one store each: 65 → 291 tx/s.
    • Single-client latency is unchanged.

    Benchmarks: benchmarks/results/duckdb-perf-2026-10-15T010700Z/findings.md.

Other

Upgrading

  • PostgreSQL: ALTER EXTENSION pg_mentat UPDATE TO '1.15.0'; is a no-op
    edge, with no schema change.
  • Embedded / crates.io: mentatdb = "1.15.0".
  • DuckDB: FORCE INSTALL mentat FROM community; LOAD mentat; once the
    registry update merges. Until then, use the mentat-duckdb-v1.5.6-linux_amd64
    asset attached to this release, loaded with -unsigned.

Full details: CHANGELOG.