Skip to content

Replace per-connection execution lock with statement-level interrupts#226

Merged
penberg merged 1 commit into
mainfrom
query-timeout-overhead
Jun 2, 2026
Merged

Replace per-connection execution lock with statement-level interrupts#226
penberg merged 1 commit into
mainfrom
query-timeout-overhead

Conversation

@penberg
Copy link
Copy Markdown
Contributor

@penberg penberg commented Jun 2, 2026

Query timeouts previously relied on a per-connection execution lock that
serialized every operation so the timer wheel's connection.interrupt() would
unambiguously hit the timed-out operation. This serialized all concurrent work
on a connection and added a mutex acquisition to every call.

Use libsql_stmt_interrupt() instead: the timer wheel now interrupts the
specific statement that timed out (via a new Interruptible trait, so the wheel
can target either a statement or a connection), leaving other concurrent
operations on the same connection untouched. This removes execution_lock
entirely, along with acquire_execution_lock and the deadline/remaining
plumbing it required.

Depends on: tursodatabase/libsql#2248

@penberg penberg force-pushed the query-timeout-overhead branch 2 times, most recently from b6e1f9b to 24be2ba Compare June 2, 2026 06:49
Query timeouts previously relied on a per-connection execution lock that
serialized every operation so the timer wheel's connection.interrupt() would
unambiguously hit the timed-out operation. This serialized all concurrent work
on a connection and added a mutex acquisition to every call.

Use libsql_stmt_interrupt() instead: the timer wheel now interrupts the
specific statement that timed out (via a new Interruptible trait, so the wheel
can target either a statement or a connection), leaving other concurrent
operations on the same connection untouched. This removes execution_lock
entirely, along with acquire_execution_lock and the deadline/remaining
plumbing it required.

Depends on: tursodatabase/libsql#2248
@penberg penberg force-pushed the query-timeout-overhead branch from 24be2ba to 368a962 Compare June 2, 2026 07:06
@penberg penberg merged commit 9785584 into main Jun 2, 2026
13 checks passed
@penberg penberg deleted the query-timeout-overhead branch June 2, 2026 07:56
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