-
Notifications
You must be signed in to change notification settings - Fork 3.9k
sql: ignore some session variables in RESET ALL #148770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Looking at `src/backend/utils/misc/guc_tables.c` in PG source code, there are a few session variables flagged with `GUC_NO_RESET_ALL` that should not be affected by RESET ALL. This commit adds a `NoResetAll` flag to the following session variables that overlap with PG: - `is_superuser` - `role` - `session_authorization` - `transaction_isolation` - `transaction_read_only` This commit also adds the flag to a couple CRDB-only session variables that seem similar: - `transaction_priority` - `transaction_status` Most of these variables are read-only, and so were not affected by RESET ALL, but the new flag makes the intended behavior clear in case any of them do become writable in the future. By fixing RESET ALL, this change also makes DISCARD ALL work correctly when `default_transaction_use_follower_reads` is enabled. Fixes: cockroachdb#124150 Release note (bug fix): The RESET ALL statement is fixed to no longer affect the following session variables: - `is_superuser` - `role` - `session_authorization` - `transaction_isolation` - `transaction_priority` - `transaction_status` - `transaction_read_only` This better matches PostgreSQL behavior for RESET ALL. By fixing RESET ALL, the DISCARD ALL statement is also fixed to work correctly when `default_transaction_use_follower_reads` is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch!
CREATE SEQUENCE discard_seq2 START WITH 10 | ||
|
||
statement ok | ||
CREATE TEMP TABLE tempy (a int); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the DISCARD ALL
from line 199 is breaking this, since it resets experimental_enable_temp_tables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Exactly right. Running into a different problem now, will update in a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @michae2)
Looking at
src/backend/utils/misc/guc_tables.c
in PG source code, there are a few session variables flagged withGUC_NO_RESET_ALL
that should not be affected by RESET ALL. This commit adds aNoResetAll
flag to the following session variables that overlap with PG:is_superuser
role
session_authorization
transaction_isolation
transaction_read_only
This commit also adds the flag to a couple CRDB-only session variables that seem similar:
transaction_priority
transaction_status
Most of these variables are read-only, and so were not affected by RESET ALL, but the new flag makes the intended behavior clear in case any of them do become writable in the future.
By fixing RESET ALL, this change also makes DISCARD ALL work correctly when
default_transaction_use_follower_reads
is enabled.Fixes: #124150
Release note (bug fix): The RESET ALL statement is fixed to no longer affect the following session variables:
is_superuser
role
session_authorization
transaction_isolation
transaction_priority
transaction_status
transaction_read_only
This better matches PostgreSQL behavior for RESET ALL.
By fixing RESET ALL, the DISCARD ALL statement is also fixed to work correctly when
default_transaction_use_follower_reads
is enabled.