adapter: make DISCARD ALL reset session vars durably (SQL-529)#37790
Open
mtabebe wants to merge 1 commit into
Open
adapter: make DISCARD ALL reset session vars durably (SQL-529)#37790mtabebe wants to merge 1 commit into
mtabebe wants to merge 1 commit into
Conversation
Problem: Over the extended query protocol, `DISCARD ALL` did not reset session variables to their defaults. It ended the transaction first and then staged the resets, but with no transaction left to commit the staged values were never promoted. Under the simple protocol the next implicit transaction happened to commit them, so the bug was invisible to the existing simple-protocol coverage. Solution: Add `SessionVar::reset_durable`, which clears the local, staged, and session values immediately, leaving `default_value` (the system/role/ startup default) intact so `value_dyn` falls through to it. Switch `SessionVars::reset_all` (the sole path used by `DISCARD ALL`) to use it, so the reset no longer depends on a later transaction commit and behaves identically across the simple and extended protocols. Tests: - test/sqllogictest/discard.slt: extended-protocol reset-to-default case. - src/sql/src/session/vars.rs: unit tests for durable reset and for falling back to an installed (startup/role) default. - src/environmentd/tests/pgwire.rs: extended-protocol integration test driving DISCARD ALL via the extended protocol. Fixes SQL-529
mtabebe
marked this pull request as ready for review
July 21, 2026 19:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Over the extended query protocol,
DISCARD ALLdid not reset session variables to their defaults. It ended the transaction first and then staged the resets, but with no transaction left to commit the staged values were never promoted. Under the simple protocol the next implicit transaction happened to commit them, so the bug was invisible to the existing simple-protocol coverage.Solution:
Add
SessionVar::reset_durable, which clears the local, staged, and session values immediately, leavingdefault_value(the system/role/ startup default) intact sovalue_dynfalls through to it. SwitchSessionVars::reset_all(the sole path used byDISCARD ALL) to use it, so the reset no longer depends on a later transaction commit and behaves identically across the simple and extended protocols.Tests:
Fixes SQL-529