[InterNetNews/inn] bce5f3: ovsqlite: Add direct reader mode for nnrpd with WAL
Kevin Bowling
noreply at github.com
Thu May 21 21:59:52 UTC 2026
Branch: refs/heads/main
Home: https://github.com/InterNetNews/inn
Commit: bce5f302e504c7c0d8cf4f0b290fba7a87ea0268
https://github.com/InterNetNews/inn/commit/bce5f302e504c7c0d8cf4f0b290fba7a87ea0268
Author: Kevin Bowling <kevin.bowling at kev009.com>
Date: 2026-05-21 (Thu, 21 May 2026)
Changed paths:
M .gitignore
M MANIFEST
M Makefile.global.in
M doc/pod/ovsqlite.pod
M samples/ovsqlite.conf
M storage/Makefile
M storage/ovsqlite/ovmethod.config
M storage/ovsqlite/ovmethod.mk
M storage/ovsqlite/ovsqlite-server.c
M storage/ovsqlite/ovsqlite.c
A storage/ovsqlite/sql-read.sql
M support/mkmanifest
M tests/Makefile
M tests/TESTS
A tests/overview/ovsqlite-integ.t
A tests/overview/ovsqlite-read-t.c
A tests/overview/ovsqlite-t.c
A tests/overview/ovsqlite-write-t.c
Log Message:
-----------
ovsqlite: Add direct reader mode for nnrpd with WAL
When WAL mode is enabled, nnrpd processes now open the overview database
directly with SQLITE_OPEN_READONLY instead of routing reads through
ovsqlite-server. This eliminates the IPC round-trip and the
single-threaded server bottleneck for read operations, allowing read
performance to scale with the number of concurrent readers.
Direct reader mode activates automatically when walmode is true in
ovsqlite.conf AND the database is actually in WAL mode (verified via
pragma journal_mode). Without WAL, behavior is unchanged -- readers
connect to ovsqlite-server as before to avoid EXCLUSIVE lock contention.
Key changes:
- ovsqlite.c: direct_open() opens the database read-only with schema
version validation, journal mode verification, decompression support,
and goto-based cleanup. Read functions (groupstats, getartinfo,
search) branch on direct_reader flag. Write operations return errors
in direct reader mode. Falls back to server path gracefully.
- ovsqlite-server.c: WAL checkpoint at shutdown uses PASSIVE first
(non-blocking, safe with readers connected) then TRUNCATE only if no
readers hold pins. Prevents server shutdown from hanging.
- ovsqlite.c: Fix pre-existing buffer leak in ovsqlite_close():
request and response buffers from server_connect() were never freed.
- sql-read.sql: read-only prepared statements with busy_timeout=10000
and query_only=1.
- New readercachesize config parameter (default 8 MB per reader).
Includes unit tests (WAL gating, write rejection) and integration tests
that start a real ovsqlite-server, write compressed data through it,
kill the server, and verify the direct reader can read it back correctly
including a server restart cycle.
see #338
To unsubscribe from these emails, change your notification settings at https://github.com/InterNetNews/inn/settings/notifications
More information about the inn-committers
mailing list