On MSVC targets, the `turso_sdk_kit` build script looks for `rc.exe`
only in `PATH` and under `%ProgramFiles(x86)%\Windows Kits\10\bin`. If
the Windows SDK is installed anywhere else (mine is in `D:\Windows
Kits\10`), the build panics:
```
rc.exe was not found in PATH and Windows SDK bin directory C:\Program Files (x86)\Windows Kits\10\bin could not be read: The system cannot find the path specified. (os error 3)
```
This breaks any project that pulls in `turso` on Windows, even as a
transitive dependency. I ran into it through `cubecl` (used by `burn`),
which uses `turso` for its on-disk cache.
This change keeps the `PATH` lookup. If that fails, the script now gets
the SDK location from `find_msvc_tools::find_windows_sdk`, which reads
it from the registry the same way `cc` does, and looks for `rc.exe` in
the SDK's bin directories for the host architecture. The registry also
points to the default install location, so I removed the old Program
Files lookup. `find-msvc-tools` is already in `Cargo.lock` through `cc`,
so nothing new gets downloaded. I added its licenses and a NOTICE entry
as described in CONTRIBUTING.md.
This doesn't touch the `windres` path for GNU targets, which is a
separate problem (#8689).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Closes#9500
rustls 0.23.13 through 0.23.44 accepted TLS 1.3 handshake messages sent
at the wrong encryption level when they followed a key-changing message
in the same record. A peer could pack a plaintext EncryptedExtensions
into the same record as the ServerHello and rustls would accept it
instead of closing the connection with an unexpected_message alert as
RFC 8446 section 5.1 requires. The handshake transcript is still
authenticated, so the handshake cannot be altered or completed by a
network-position attacker, but plaintext handshake messages that should
have been encrypted were not rejected.
The lock file pinned 0.23.35, which is inside the affected range. rustls
reaches the workspace through reqwest in the serverless driver and
through pgwire in the PostgreSQL server. 0.23.45 requires aws-lc-rs 1.18,
so aws-lc-rs and aws-lc-sys move with it.
Tests: cargo check and cargo test for turso_serverless and turso_pg_server
Use named privilege sets for acldefault policy and format PostgreSQL ACL letters in one place. Preserve existing defaults, output ordering, null handling, and errors without adding permission enforcement.
Tests: 434 PostgreSQL integration tests; cargo check --all-targets --locked; formatting; before/after compiler check for privilege bitflags.
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
Parse parameter names with Strum and search_path lists with Chumsky 0.13.
Preserve case, quoting, whitespace, and error behavior.
Use a shared type alias for injected session state. Explain why SET updates
state during execution and returns no rows.
Tests: 26 frontend and 424 PostgreSQL integration tests pass. CLI build,
formatting, and diff checks pass.
Amp-Thread-ID: https://ampcode.com/threads/T-01a11786-6662-751d-925e-4ec4fecf16b3
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
The SQLite VLDB paper (Gaffney et al., "SQLite: Past, Present, and
Future", PVLDB 15) uses TATP as the benchmark for online transaction
processing so let's add that to the tree. The reference TATP is a C
program that talks to the database over ODBC, which Turso does not have,
so we created a Rust version of it to make running it simpler. The
commit also includes a vendored copy of the original TATP sources
(release 1.1.1, Common Public License 1.0, without the prebuilt solidDB
binaries).
The Rust version follows the TATP specification and, where the
specification leaves something open, the reference code: the same
schema, population, non-uniform subscriber keys and 80/20 read/write
transaction mix. It runs SQLite in WAL mode and Turso in MVCC mode with
`BEGIN CONCURRENT`.
`perf/tatp/scripts/run.sh` follows the paper's setup: 10K, 100K and 1M
subscribers, a 10 s warmup and 60 s measured, and a 1 GB page cache per
connection. It runs the paper's single client and also 4 and 16
connections, three runs each, in about two hours plus population. The
main figure draws MQTh (TATP's throughput number) against database size,
one panel per connection count and one bar per engine; the panel for one
connection is the paper's Figure 2. A second figure shows the response
time of each transaction against connections at 100K subscribers.
Each engine's database is populated once per size, and every run starts
from its own copy with the database file in the operating system's
cache. The script asks for the sudo password up front and keeps it
fresh, so a long sweep never stops at a password prompt.
Some things worth knowing:
- SQLite write transactions can wait tens of seconds for the write lock,
because SQLite's busy handler is not fair to a waiting writer. A write
that times out starts over, counts as a restart, and keeps the whole
wait in its response time.
- Populating 1M subscribers takes about 1 minute for SQLite and about 7
minutes for Turso on a RAM disk.
- The specification says GET_NEW_DESTINATION finds a row 23.9% of the
time, but its own rules give about 15%, which is what both engines
measure. The README explains this.
- `perf/tatp/upstream/` is excluded from aristo, which fails on the
vendored C source because it is not UTF-8.
Closes#9549
Register PostgreSQL scalar functions through the native extension API
alongside the catalogs. Reuse the existing opaque per-call state instead
of adding a second dialect callback system.
Pass the executing connection and borrowed arguments on each step, and
support exact, multiple, and variadic argument counts. Keep timestamp
behavior unchanged and omit connection-local state injection.
Tests: 2554 core, 416 PostgreSQL integration, 22 frontend unit, and 13 C
extension API tests passed. Four PostgreSQL regressions fail before the
migration and pass after it. Formatting and CLI serde checks passed.
Amp-Thread-ID: https://ampcode.com/threads/T-01a11786-6662-751d-925e-4ec4fecf16b3
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
The SQLite VLDB paper (Gaffney et al., PVLDB 15) uses TATP to measure
online transaction processing, and there was no benchmark in the tree to
put Turso next to those results.
Vendor release 1.1.1 of the reference TATP suite into upstream/, without
its prebuilt solidDB binaries, and keep it out of aristo's scan, which
fails on its non-UTF-8 C source. The reference is an ODBC client, which
Turso cannot run, so add a Rust harness that implements the same schema,
population, key distribution and transaction mix.
scripts/run.sh runs the paper's setup: 10K, 100K and 1M subscribers,
a 10 s warmup and 60 s measured, and a 1 GB page cache per connection.
It adds 4 and 16 connections to the paper's single client, and draws
throughput against database size with one panel per connection count.
Each engine's database is populated once per size and every run starts
from its own copy. The script asks for the sudo password before it
starts and keeps sudo's cached login fresh, so the sweep never stops to
wait for a password.
SQLite's busy handler is not fair: a waiting writer can keep missing the
short gaps between other connections' writes and wait out the whole busy
timeout. Such a write starts over and counts as a restart, with the whole
wait in its response time, so the starvation shows in the results instead
of ending the run.
Tests: SIZES="5000 20000 50000" REPEATS=2 sweep through scripts/run.sh,
run with a no-op sudo
The build script looked for rc.exe only in PATH and under
%ProgramFiles(x86)%\Windows Kits\10\bin. When the Windows SDK is
installed somewhere else, for example on another drive, every MSVC build
of turso_sdk_kit fails, including builds where turso is only a
transitive dependency.
Read the SDK location from the registry with find-msvc-tools, the crate
cc uses to locate MSVC and the Windows SDK, and look for rc.exe in the
SDK bin directories for the host architecture. The registry also points
to the default install location, so the Program Files lookup is removed.
find-msvc-tools is already in Cargo.lock through cc.
Tests: built turso_sdk_kit on Windows with the SDK at D:\Windows Kits\10
and rc.exe not in PATH; it failed before this change and now produces a
DLL with the expected version info
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
csv01.test starts with `load_static_extension db csv`, but the TCL
binding ignored every name except randomjson, so each CREATE VIRTUAL
TABLE ... USING csv failed and all 467 tests in the file failed with it.
Add a `csv` feature to turso_sqlite3 that links limbo_csv in statically
and registers it on every new connection, and build the TCL binding with
that feature. Loading limbo_csv at run time does not work here: loadable
extensions bring their own mimalloc global allocator, and
turso_sqlite3 uses the system allocator, so the first free of memory
allocated by the other side aborts the process.
With this, 453 of the 467 tests in csv01.test pass. The rest need
changes to the csv extension itself (bare `header`, column names, error
messages) or use the test-only csv_wr module, so csv01 stays on the
known-bad list.
Tests: new probe in bindings/tcl/test_probes.tcl, csv01.test
Part of #9422
Add focused merge, snapshot, and recovery workloads that compare FTS row counts against table scans, including duplicate matches. Exercise savepoint restoration, cache eviction, abandoned statements, and recovery from file copies captured while statements are suspended.
Propagate property failures during the final statement drain so a failed check cannot produce a successful run. Recovery snapshots contain complete issued writes and do not simulate torn writes or power loss.
Tests: 64 Whopper tests, 13 core FTS tests, Clippy with warnings denied, and 12 seeded workload runs totaling 408,000 steps.
Amp-Thread-ID: https://ampcode.com/threads/T-01a0a156-5af2-71de-9f86-f1581a314e33
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
## Summary
FTS now keeps completed index files in the same byte buffers that held
their contents during writing. This avoids copying entire files after
writing them. Tantivy reads these shared bytes without another copy.
When FTS loads file pieces from storage, it reserves memory through the
database allocator. If that reservation fails, FTS returns an out-of-
memory error. Snapshot metadata and delete files are now written
directly into the same shared byte type as segment files. Their
allocations can fail cleanly, and the delete files no longer need a
full-buffer copy after construction. Copies made for Tantivy’s atomic
reads check their memory reservation and return a read error if it
fails. The cache counts each buffer’s full size, including unused space.
This PR also records the license for the Tantivy helper library.
I had to change the use from `Arc<[u8]>` to `Arc<DynVec<u8>>`, because
of a lack of fallible allocations in the Nightly api for `Arc<[u8]>`.
This introduces an additional indirection, but I believe it's fine for
the necessity of fallible allocations.
Amp thread:
https://ampcode.com/threads/T-01a0d4af-1efd-76cf-8464-179667c3f200
Reviewed-by: Mikaël Francoeur (@LeMikaelF)
Closes#9343
inferno is licensed under CDDL-1.0, which is not allowed in the source
tree. It was pulled in only by the flamegraph feature of pprof, which
the core and SQL parser benches used to write a flamegraph during
cargo bench --profile-time.
Drop the profiler from those benches and remove pprof from the core
and parser dev-dependencies. The FTS benchmark tool keeps pprof
without the flamegraph feature, since it writes collapsed stacks
itself and does not depend on inferno.
The codspeed and non-codspeed criterion groups in most benches
differed only by the profiler, so they are merged into one group
where the result is identical.
Declare pprof once in the workspace dependency table so core, the SQL
parser, and the FTS benchmark tool all use the same version. The core
and parser benches were on 0.14.0 while perf/fts was on 0.15.0, so the
lockfile had two copies. Unify on 0.15.0, which still uses criterion
0.5 for its criterion feature.
Move captured and assembled segment files into shared DynVec buffers so Tantivy reads them without a full-file copy. Assemble chunks with fallible reservation and count spare vector capacity in the segment cache.
Tests: cargo test -p turso_core --features fts --lib index_method::fts::; RUSTFLAGS="--cfg nightly" cargo +nightly-2025-12-17 test -p turso_core --features fts --lib index_method::fts::
Amp-Thread-ID: https://ampcode.com/threads/T-01a0d4af-1efd-76cf-8464-179667c3f200
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
Add a dedicated leak_tests binary (separate target because it installs
a counting #[global_allocator]) that models a server creating and
dropping many databases: repeated open/workload/drop cycles in one
process — a fresh database file each cycle — in both WAL and MVCC
journal modes, failing if the heap grows beyond a computed budget.
The budget pre-computes accepted retention: the database registry keeps
a dead entry (whose Weak pins the Database allocation) per unique file
identity, sized via size_of::<Database>() so struct growth doesn't
require retuning; MVCC is granted two entries per cycle. crossbeam-epoch
garbage from the MVCC skiplists is drained before measuring so deferred
reclamation is not mistaken for a leak. The completion-group leak blows
through this budget on every platform.
Also add a reference-retention regression test: after dropping every
handle to an MVCC database, Weak handles to the Database and MvStore
must fail to upgrade.
The leak tests run in the workspace nextest job and as an explicit
named step in the Rust workflow.
https://claude.ai/code/session_0171ou6qAsxxvCtaWDKFk9sK
## Purpose
Add an FTS benchmark workflow under `perf/fts`.
The goal is to compare search performance, inspect CPU costs, and
measure query memory use.
The figures follow the style of `perf/throughput`, `perf/latency`, and
`perf/tpc-h`, as Pekka requested.
This PR changes benchmark tools, not the database engine.
It reuses the existing FTS workload and document generator in
`perf/memory`.
It does not depend on the unmerged workload-runner foundation in #9030
or include its broader migrations.
## Workload and engines
The timing benchmarks compare three targets:
- SQLite FTS5 with WAL.
- Turso with WAL.
- Turso with MVCC, the alternative transaction mode.
Each sample uses a fresh temporary database with 10,000 synthetic
documents by default.
The document count is configurable.
The six query cases cover rare terms, common terms, AND, OR, ordered
phrases, and BM25-ranked top ten results.
BM25 is the search score used to rank results.
Both engines receive the same documents.
SQLite uses an external-content FTS5 index and the `unicode61`
tokenizer.
Result tests compare row counts and document IDs where result order
permits comparison.
Ranked tests account for ties and the different score directions.
Setup, index creation, and cleanup are outside timing measurements.
Each timed query includes preparation, execution, and reading all
returned rows.
Warm runs execute an unmeasured query per connection first.
First-query runs skip that warm-up, but they do not clear the OS cache.
## Separate latency and throughput measurements
The search benchmark measures individual query durations.
It reports p50, p95, and p99, the durations below which 50%, 95%, and
99% of measured queries fall.
These values are not total elapsed time divided by query count.
Each connection gets one OS worker thread.
Workers start together, then run independently.
The default 10,000-query budget is shared across workers, and their
individual durations are combined within each run.
Each worker waits for its current query before starting another, so
latency excludes delays before an external request is submitted.
The throughput benchmark measures completed searches per second over a
minimum duration.
It does not collect latency samples.
It retains the shared workload's synchronized batches: each connection
runs one query, then the next batch waits for every connection.
This preserves the existing workload behavior and makes its scheduling
cost explicit.
## Readable figures
The plots use serif text, the existing orange/blue palette, and PNG,
PDF, and SVG output.
Turso MVCC uses dashed hollow markers or striped bars to distinguish it
from WAL.
Connection sweeps default to 1, 2, 4, 8, 16, and 32 connections.
Line plots use linear measurement axes starting at zero.
Each query panel includes a table of values, with thousands separators
for large numbers.
Separate speedup figures compare Turso with SQLite: 1× means equal, 2×
means faster, and 0.5× means slower.
Latency and throughput use opposite ratio directions so that larger
speedup values always mean better results.
Figures show medians across runs and ranges across those runs.
The ranges are not confidence intervals.
Speedup ranges use a fixed SQLite median, not paired observations.
The plotter rejects mixed measurements, incomplete runs, and CPU-
profiled timing results.
## CPU flamegraphs
A flamegraph shows which call stacks consume sampled CPU time.
The optional `FLAMEGRAPH=1` mode uses `pprof` 0.15 at 99 Hz on Linux or
macOS.
The Rust binary writes stack paths with sample counts for each case,
engine, and run.
The script then calls the external `inferno-flamegraph` command to
render interactive SVGs.
Install that developer tool separately with `cargo install inferno
--locked`.
Inferno is not an FTS dependency because its CDDL license is outside the
repository's allowlist.
The separate pprof version prevents Cargo from combining features with
older benchmarks that enable Inferno.
Sampling starts after setup and warm-up and stops before cleanup.
It includes worker activity and query scheduling.
Profiled timings go into a separate CSV and cannot enter the comparison
plots.
The optional dependency stays out of normal benchmark builds.
Short sample captures point to per-row statement cloning and mutex
operations under `Rows::next` for common-term searches.
Ranked searches show substantial CPU work in Tantivy's top-k scoring
path.
These are investigation leads, not confirmed lock contention or engine
fixes.
CPU sampling does not measure blocked time, and the profiler excludes or
drops some samples.
## Peak heap measurements
The memory script reuses `fts-memory` and its dhat allocator tracker.
It measures all six cases under Turso WAL and MVCC, with configurable
connections, repetitions, and first-query or warm states.
Each sample runs in a fresh process.
The plotted value is the largest amount of live memory allocated during
the query phase, across all threads.
It is not cumulative allocated bytes, a per-query average, or total
process memory.
Setup, opening, warm-up, and their existing caches are outside tracking.
Memory runs use synchronized workload batches, not the independent
latency worker loops.
SQLite is absent from the heap figures because Rust allocator tracking
does not capture its C allocations.
The output retains raw allocation records, JSON reports, CSV summaries,
and logs for analysis.
Allocation tracking changes scheduling and adds overhead, so its elapsed
times are not performance measurements.
## Reproduce the runs
Run these commands from the repository root with Rust, Python 3, and
`uv` installed.
Use new output directories for each run.
The scripts retain the machine details, source revision, arguments, and
logs with the results.
```sh
# Individual query latency, including p99 and SQLite-relative figures
BENCHMARK=search CONNECTIONS="1 2 4 8 16 32" QUERIES=10000 RUNS=3 \
bash perf/fts/scripts/sweep.sh /tmp/fts-latency
# Completed searches per second
bash perf/fts/scripts/sweep.sh /tmp/fts-throughput
# CPU profiles for selected queries
cargo install inferno --locked
FLAMEGRAPH=1 bash perf/fts/scripts/run.sh /tmp/fts-cpu \
--benchmark throughput --targets turso-wal,turso-mvcc \
--cases common,ranked --documents 10000 --connections 4 --seconds 30 --runs 1
# Peak query-phase heap
python3 perf/fts/scripts/memory.py /tmp/fts-heap \
--documents 10000 --connections 1 2 4 8 16 32 --queries 3 --runs 3
```
The default build uses optimized `bench-profile`, which inherits release
settings but disables link-time optimization and retains debug
information.
No command uses `--release`, in accordance with repository guidance.
No command needs privileged cache clearing.
## Tests and local runs
The focused automated tests pass:
- `cargo test -p fts-benchmark --features flamegraph`: 9 tests.
- `cargo test -p fts-benchmark`: 8 tests in the earlier feature-disabled
run.
- `cargo test -p memory-benchmark --features fts --lib`: 10 tests.
- `uv run --with numpy python -m unittest discover -s perf/fts/plot -v`:
13 tests.
- Package-only Clippy with the flamegraph feature, formatting, shell
syntax, and whitespace checks pass.
- Full workspace `cargo deny check licenses`: `licenses ok` after
separating the SVG renderer.
- `uv run ruff check perf/fts`: all checks pass after fixing the new
scripts' lint errors.
- The Windows all-features normal dependency graph excludes pprof and
Inferno; a native Windows build is not tested locally.
Local run evidence includes:
- An optimized latency sweep with 108 measurements and 1,080,000
individually timed queries across all three targets and six connection
counts.
- End-to-end search and throughput script tests, including absolute and
speedup figures.
- 24 nonempty CPU profiles with matching SVG and stack-file sample
counts, plus a browser test of SVG zoom.
- The external-renderer workflow also passed an optimized four-
connection common-term test with 10,000 documents under WAL and MVCC,
including SVG rendering and browser zoom.
- 72 optimized warm heap measurements with 10,000 documents, two queries
per connection, and one repetition at each connection count.
- 12 first-query heap tests with 203 documents and three connections.
- Agreement between every heap CSV peak and the raw allocator records at
the global peak.
- Rendered figure inspection for readable labels, tables, scales, and
legends.
## Limits before publication
The measurements ran in an orb with four logical CPUs, reported as two
cores with two threads each.
The larger worker counts exceed available CPUs and include CPU
scheduling effects.
The example performance sweeps use one repetition and are not release-
performance evidence.
The workload is synthetic and read-only.
It does not measure ingestion, concurrent writes, real-text relevance,
or a cold OS cache.
The README lists FiQA, SciFact, and Rally workloads as possible real-
text extensions, but this PR does not implement them.
Collect repeated runs on a dedicated machine before publishing
performance comparisons.
Linux x86-64 is tested here.
CPU profiling support on macOS is not tested here, and Windows CPU
profiling is unsupported.
Generated measurements, charts, and local machine records are not
committed.
Closes#9133
Keep Inferno out of the FTS dependency graph because its license is not allowed. Export folded stacks and let the run script invoke an independently installed inferno-flamegraph.
Use pprof 0.15 without renderer features to prevent feature combination with existing 0.14 benchmark dependencies. Limit the profiler dependency and code to Linux and macOS so Windows all-features builds exclude it.
Tests: full workspace license check, nine FTS tests, package Clippy, and optimized WAL/MVCC external-renderer smoke runs with matching sample counts and browser zoom.
Amp-Thread-ID: https://ampcode.com/threads/T-01a0ac34-f93d-7693-9947-ee9ec864450f
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
Compare SQLite FTS5 with Turso WAL and MVCC using shared documents and separate latency and throughput measurements.
Add CPU profiles and query-phase peak heap measurements so regressions can be investigated without mixing instrumentation overhead into timing comparisons. Match existing benchmark plot styles and show absolute values and SQLite-relative speedups.
Document workload limits, reproducible commands, and test coverage.
Amp-Thread-ID: https://ampcode.com/threads/T-01a0ac34-f93d-7693-9947-ee9ec864450f
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
Review feedback on the pull request asked for the asserting crate, which the
integration tests already use. asserting is a workspace dependency, so this
only adds it to the dev-dependencies of turso_core.
described_as builds its message for every payload instead of only on failure,
so read_text_agrees_with_the_standard_library now takes 8.2s instead of 3.6s.
Tests: cargo test -p turso_core --lib, cargo clippy -p turso_core --all-targets
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GSqj1nPsejuU6mjbR9Fvu
Some test files build by hand what a fluent assertion library already gives:
catch_unwind plus downcast code to tell an error from a panic, several
`msg.contains(..)` calls joined inside one `assert!`, and a custom failure
message on every call because `assert!` prints no values. When one of these
assertions fails, the reader gets "assertion failed" and must add a print
statement to see what the value was.
Add `asserting` as a workspace dev-dependency and convert the two test files
that gain the most from it:
* `tests/integration/integrity_check.rs`: 15 blocks that matched on
`Result<String, String>` and called `panic!` in the error arm are now
`assert_that!(..).ok().contains(..)`. Three tests that ran their own
`std::panic::catch_unwind` now assert `is_err()` directly and let a panic
through, which keeps the true panic location and backtrace.
* `tests/integration/assert_details.rs`: `msg.contains(a) && msg.contains(b)`
is now `assert_that!(msg).contains(a).contains(b)`.
A failure prints the source expression and the full actual value, so the
custom messages are no longer necessary:
expected run_integrity_check_catching_panic(&conn) to contain "out of RANGE"
but was: "*** in database main ***
Cell 0 in page 2 is out of range. cell_range=10..28, content_area=596, ...
Page 2 cell overlap detected at position=10 with previous_end=596, ..."
expected: "out of RANGE"
Every corruption test in integrity_check.rs is `cfg(not(feature =
"checksum"))`, so the prelude import carries the same cfg as the `std::fs`
and `std::io` imports beside it. Without that, `--all-features` leaves the
import unused.
The crate is MIT OR Apache-2.0, and so is each crate it adds
(sdiff, float-cmp, num-bigint, critical-section, hashbrown), so
`cargo deny check licenses` stays happy.
Tests: `cargo test -p core_tester --test integration_tests` (1147 passed),
`cargo clippy --workspace --all-features --all-targets --locked
--exclude memory-benchmark -- --deny=warnings`, `cargo fmt --all --check`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ynUhvScuyLGgokLZDtwNC
## Purpose
Add shared FTS query workloads for dhat allocation-stack investigations
and Divan/CodSpeed memory tracking without changing the existing
Criterion profiles.
- Measure query-only cases separately from complete BEGIN
CONCURRENT/query/COMMIT lifecycles, including repeated overlapping
transactions on multiple connections.
- Emit explicit workload-phase events and query-phase heap reports.
- Add a deterministic high-vocabulary corpus, configurable page cache,
and actual stored segment-byte verification before measurement.
- Run FTS workload/CLI tests in CI, with separate fts-queries and fts-
large-index CodSpeed shards. The large case requires at least 256 MiB of
segment data and uses a 200-page cache.
## Measurement limits
Warm dhat runs exclude allocations made during setup and warm-up. Local
Divan does not count Tokio worker-thread allocations; use dhat for
complete concurrent totals. Exceeding the 192 MiB retained-segment
budget does not prove eviction or bounded live memory, and read-only
transactions do not exercise the four-searcher limit across changing
snapshots.
## Validation
- Focused FTS unit tests passed locally (4 tests before the final
additional segment-boundary test).
- Earlier small-corpus harness validation passed before the large-index
extension.
- cargo fmt and git diff --check completed.
- Final local build/test runs were cancelled at pedrocarlo’s request to
run validation in PR CI instead. The optimized large-index measurement
has not completed locally; its minimum-byte assertion and CI results
remain to be verified.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#8866
Count constant filters that share a compound lookup with a join key. Keep unmatched outer rows and price common outer-join null tests.
Continue through unavailable duplicate constraints until an index prefix has a real gap.
Tests: cargo test -p core_tester --test integration_tests test_eqp_json
Share FTS workloads between dhat investigations and Divan/CodSpeed allocation tracking, with explicit profiling phases and complete transaction lifecycles.
Add a high-vocabulary corpus with verified segment-byte minimums and configurable page caches to investigate indexes larger than the retained FTS cache budget. Run the large case in a separate CI shard.
Tests: focused FTS unit tests passed; final local runs cancelled at user request in favor of PR CI.
Amp-Thread-ID: https://ampcode.com/threads/T-01a082f1-7e71-76bb-92f5-34f1cfd8691a
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
The join-benchmark branch was cut before the 0.8.0-pre.9 version bump, so
its new Cargo.lock entry kept 0.8.0-pre.8. The merge combined both without
regenerating the lock, which left the workspace version and the lock out of
step. Every CI job that passes --locked stops at once with "the lock file
needs to be updated but --locked was passed".
Tests: cargo metadata --locked
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcSd4ia7Q9mbwcaLoBgK22
## What changed and why
This PR adds a join benchmark that runs SQL files and consumes every
result row. It records elapsed time, VM steps, rows read, B-tree seeks,
and hash probes.
Plan estimates do not prove that a plan is faster. These counters
measure the execution work behind each plan.
## Example
The runner can measure one TPC-H query, print its JSON plan, and report
separate table, index, deferred, and hash probe counts.
## Result
The study measured all 21 supported single-statement TPC-H queries and
all eight graph queries. The runner makes later optimizer changes
measurable and repeatable without storing dated results in the
repository.
This PR is layer 2 of 7. It depends on #8831. The next PR is #8833.
## Tests
- `CI=1 make -C sqlite/conformance run-rust` (1,589 passed)
- `cargo fmt --all --check`
## Description of AI usage
Codex helped design the measurements, run the benchmarks, implement the
tooling, and organize the commit stack.
Closes#8832
Run SQL files without printing result rows. Report elapsed time and stable statement work counters as JSON.
Document the TPC-H and graph baseline study.
Tests: cargo clippy -p turso-join-benchmark --all-targets
This rewrites the concurrent write throughput benchmark. First, instead
of having two different drivers, unify them into one, with separate
Turso and SQLite engines, so both run the same experiment with the same
durability settings. Second, switch to a closed-loop model where every
connection is one thread with one long-lived connection that starts its
next transaction the moment the previous one commits, so the connection
count is the number of transactions in flight, and sweep it well past
the core count. Also, run checkpointing from a separate thread on both
engines, and sample the CPU the process uses once a second, so
throughput is never reported without what it cost. Finally, improve the
plotting to show transactions per second and CPU utilization against
connections, with error bars over repeated runs.
This rewrites the transaction latency benchmark. First, instead of
having two different drivers, unify them into one, with separate Turso
and SQLite engines, to minimize differences between the runs. Second,
switch to open-loop model where transactions start independenty of
execution, to capture the transaction wait time, which is a big problem
in SQLite, better. Also, isolate checkpointing latency by running it in
a separate thread. Finally, improve the plotting to better visualize the
tail latency.
The v1 format serialized a whole-index manifest per commit, making every
write rewrite global state and serializing same-index writers. Format v2
stores per-segment descriptor, chunk, and tombstone rows directly in the
backing B-tree: the visible registry rows are the manifest, so MVCC row
visibility is the index's snapshot isolation, appends by different
transactions commute, and rollback is automatic. Deletes insert
MVCC-versioned tombstone rows per (segment, doc), enforced at the reader
level through synthesized alive-bitsets; merges are the only operation
that retires other transactions' rows and are serialized by the
per-index maintenance lease plus the deleter-admissibility registry.
Stores written by the pre-registry implementation (a whole Tantivy
directory keyed by file name, as the 0.8.0 pre-releases wrote it) are
not converted: FTS is an experimental, flag-gated feature, so the open
path detects the old layout and fails with a message asking the user to
DROP INDEX and CREATE INDEX. DROP INDEX never opens the store, so the
rebuild always works and the base table is unaffected. This keeps a
second on-disk format and an MVCC migration transaction out of the
reader and writer.
Carries forward the WITH-clause key validation, configurable ngram
window, and lowercased ngram matching that landed on the v1
implementation upstream; their tests keep passing across the rewrite.
The full design, including limitations and future work, is
docs/internals/mvcc/FTS_REDESIGN.md, added by the docs PR later in this
stack; the PRs in between add the write-path merge policy, format
hardening, and the performance work the design describes.
update_data and the sibling MCP tools only checked that the SQL string
started with UPDATE/INSERT/DELETE/SELECT/CREATE. Connection::execute()
then ran the whole batch, so a trailing DELETE executed and the tool
still reported success.
Parse with turso_parser, require exactly one statement of the claimed
family, and leave the database unchanged on reject.
Fixes#8414Closes#8416
update_data and the sibling MCP tools only checked that the SQL string
started with UPDATE/INSERT/DELETE/SELECT/CREATE. Connection::execute()
then ran the whole batch, so a trailing DELETE executed and the tool
still reported success.
Parse with turso_parser, require exactly one statement of the claimed
family, and leave the database unchanged on reject.
Tests: cargo test -p turso_cli mcp_server::tests
Fixes#8414