Skip to content

perf(telemetry): cut commit allocation; fix(query): cancelled reads poisoning the pool; pin DuckDB v2.0.0-alpha46057 - #310

Merged
vishr merged 4 commits into
mainfrom
perf/commit-allocation
Oct 15, 2026
Merged

vishr merged 4 commits into
mainfrom
perf/commit-allocation

Conversation

@vishr

@vishr vishr commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

What changed

Four commits, intended to be rebase-merged:

  • build(duckdb): pin DuckDB v2.0.0-alpha46057 (upstream b15358c371). The new built-in read_single_parquet_file reads files, so the telemetry SQL boundary blocks it, with rejection tests and a regenerated function snapshot. SELECT version() returns v2.0.0-alpha46057; the release duckdb-v2.0.0-alpha46057 mirrors the upstream archives and checksums.

  • chore(ci): drop renovate[bot] from the CLA allowlist.

  • perf(telemetry): Parquet pages are compressed with a 1 MiB zstd window. At the library's default 4 MiB window every new encoder allocated 8 MiB of match history, and that history was most of what a commit allocated. A 50,000-span commit now allocates 116–121 MB instead of 369–383 MB and takes 293–322 ms instead of 472–509 ms (BenchmarkCommitBatch, three runs each, measured back to back), and the allocation ratchet drops from 7.0x to 3.0x. The commit also buffers trace-index writes, measures request bytes once, caches each Parquet schema, dictionary-encodes span kind and status, bounds every dictionary column at 1 MiB, and explains an empty panel with one scan.

  • fix(query): keep cancelled reads from poisoning pooled connections. A read transaction begun with the request context was rolled back by database/sql on another goroutine when the context was cancelled, as a dashboard refresh does to superseded requests; DuckDB could deliver the cancelled statement's interrupt to that ROLLBACK, leaving the transaction open and the pooled connection failing every later read ("Current transaction is aborted", "cannot start a transaction within a transaction"). This surfaced as a failed browser smoke run on this PR. Cancelling reads in a loop poisoned the pool in 4 of 7 runs on the new engine and 1 of 7 on the old one; with the fix, 6 of 6 passed. Read transactions now begin with a non-cancellable context and are rolled back by their owner, and a connection whose BEGIN or ROLLBACK fails is discarded.

The file format and physical schema are unchanged: encodings are page layout, and existing batches stay readable and mergeable. Client-supplied span names (namespace, service, operation) stay plain. No configuration, API or migration changes.

Verification

  • just check (pre-push hook)
  • just test-race (ingest and query paths changed)
  • User-facing behavior and configuration docs are current (storage-model and contributing docs name the new engine)
  • No credentials, private telemetry, host details, or enterprise-only source are included
  • API, migration, ingest, MCP/AG-UI, or release-contract changes are called out (none; engine pin noted above)

Read-path speedups are not claimed here: they have not been measured on this final code.

vishr added 4 commits October 14, 2026 17:51
Move the embedded engine from v2.0.0-alpha43763 (96063b9e39) to
v2.0.0-alpha46057 (b15358c371), the newest completed DuckDB 2 build. The
duckdb-v2.0.0-alpha46057 release mirrors DuckDB's staging archives byte for
byte, and the wrapper pins their SHA-256 values.

The engine adds one built-in, read_single_parquet_file. It reads files, so the
telemetry SQL boundary blocks it like read_parquet, and the function snapshot
is regenerated. No built-in was removed or retyped, and no code change was
needed. SELECT version() reports v2.0.0-alpha46057.
Fanout uses Dependabot for dependency updates; Renovate is not configured,
so its bot no longer needs a CLA exemption.
Every new zstd encoder at the library's fastest level allocated 8 MiB of
match history, and the garbage collector empties the encoder pool, so that
history was most of what a commit allocated. Parquet pages are compressed
with a 1 MiB window instead, which covers a whole page. A 50,000-span commit
now allocates 116-121 MB instead of 369-383 MB and takes 293-322 ms instead
of 472-509 ms; the allocation ratchet drops from 7.0x to 3.0x.

- Buffer trace-index entries instead of one write call per trace.
- Measure a request's bytes once at submission rather than on admission,
  grouping and release.
- Build each telemetry Parquet schema once per row type.
- Dictionary-encode span kind and status, which come from fixed OTLP enums;
  client-supplied names stay plain. Bound every dictionary column at 1 MiB,
  after which it continues in plain pages.
- Explain an empty panel with one scan that counts every omitted-filter
  rerun, falling back to separate counts when a predicate fails.
A read transaction begun with the request context was rolled back by
database/sql on its own goroutine when that context was cancelled, as a
dashboard refresh does to the requests it supersedes. DuckDB could deliver
the cancelled statement's interrupt to that ROLLBACK, so the transaction
stayed open and the pooled connection failed every later read with
"Current transaction is aborted" or "cannot start a transaction within a
transaction". Cancelling reads in a loop poisoned the pool in 4 of 7 runs
on DuckDB v2.0.0-alpha46057 and 1 of 7 on alpha43763.

Read transactions now begin with a context that cannot be cancelled and
are rolled back by their owner; statements inside still run under the
request context. A connection whose BEGIN or ROLLBACK fails is discarded
instead of returned to the pool. The same loop then passed 6 of 6 runs.
@vishr vishr changed the title perf(telemetry): cut commit allocation and dashboard scan work; pin DuckDB v2.0.0-alpha46057 perf(telemetry): cut commit allocation; fix(query): cancelled reads poisoning the pool; pin DuckDB v2.0.0-alpha46057 Oct 15, 2026
@vishr
vishr merged commit 6892d81 into main Oct 15, 2026
25 of 32 checks passed
@vishr
vishr deleted the perf/commit-allocation branch October 15, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant