Skip to content

Conversation

@olavloite
Copy link
Collaborator

@olavloite olavloite commented Oct 23, 2025

Add a statement_timeout connection property that is used as the default timeout
for all statements that are executed on a connection. If both a context timeout
and a statement_timeout is specified, then the lower of the two will be used.

Also adds a transaction_timeout property that is additionally used for all
statements in a read/write transaction. The deadline of the transaction is
calculated at the start of the transaction, and all statements in the transaction
get this deadline, unless the statement already has an earlier deadline from
for example a statement_timeout or a context deadline.

Fixes #574
Fixes #575

@olavloite olavloite requested a review from a team as a code owner October 23, 2025 15:59
@olavloite olavloite force-pushed the statement-timeout branch 2 times, most recently from 80dbaa0 to 0d69f22 Compare October 24, 2025 14:00
@olavloite olavloite changed the title feat: support statement_timeout property feat: support statement_timeout and transaction_timeout property Oct 24, 2025
@olavloite olavloite force-pushed the statement-timeout branch 8 times, most recently from 1791559 to 4667c42 Compare October 27, 2025 13:30
@olavloite olavloite force-pushed the statement-timeout branch 2 times, most recently from 1b7b5f0 to 1fc9908 Compare October 27, 2025 13:42
Add a statement_timeout connection property that is used as the default timeout
for the execution of all statements that are executed on a connection. The
timeout is only used for the actual execution, and not attached to the iterator
that is returned for a query. This also means that a query that is executed
without the DirectExecuteQuery option, will ignore the statement_timeout value.

Also adds a transaction_timeout property that is additionally used for all
statements in a read/write transaction. The deadline of the transaction is
calculated at the start of the transaction, and all statements in the transaction
get this deadline, unless the statement already has an earlier deadline from
for example a statement_timeout or a context deadline.

This change also fixes some issues with deadlines when using the gRPC API of
SpannerLib. The context that is used for an RPC invocation is cancelled after
the RPC has finished. This context should therefore not be used as the context
for any query execution, as the context is attached to the row iterator, and
would cancel the query execution halfway.

Fixes #574
Fixes #575
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.

Add support for transaction_timeout connection variable Support statement_timeout connection variable

2 participants