-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42376: sql/pgwire: send down parameter status updates r=otan a=otan Resolves #40854. Server parameters such as `application_name` and `timezone` require updates over pgwire when they are changed. This was previously not done. In this PR, we introduce a listener-esque object on `sessionDataMutator` that pgwire will add itself onto to send updates on these changes. Coincidentally, this means a few logic tests changes because lib/pq will encode this into the string. Release note (sql change): This PR introduces a new pgwire update that sends ParameterStatus messages when certain server parameters are changed for the given session over pgwire. Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
- Loading branch information
Showing
11 changed files
with
143 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Change the application name. | ||
|
||
send | ||
Parse {"Query": "SET application_name = 'pgtest'"} | ||
Bind | ||
Execute | ||
Sync | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"ParameterStatus","Name":"application_name","Value":"pgtest"} | ||
{"Type":"CommandComplete","CommandTag":"SET"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
# Change the time zone using an offset. | ||
# TODO(#42404): postgres has a different output. This is what we have right now | ||
# as code, but we need to dig into what/why we use this format in param status. | ||
# postgres: {"Type":"ParameterStatus","Name":"TimeZone","Value":"\u003c+06\u003e-06"} | ||
|
||
send | ||
Parse {"Query": "SET TIME ZONE +6"} | ||
Bind | ||
Execute | ||
Sync | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"ParameterStatus","Name":"TimeZone","Value":"6"} | ||
{"Type":"CommandComplete","CommandTag":"SET"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
send | ||
Parse {"Query": "SET TIME ZONE -11.5"} | ||
Bind | ||
Execute | ||
Sync | ||
---- | ||
|
||
# postgres: {"Type":"ParameterStatus","Name":"TimeZone","Value":"\u003c-11:30\u003e+11:30"} | ||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"ParameterStatus","Name":"TimeZone","Value":"-11.5"} | ||
{"Type":"CommandComplete","CommandTag":"SET"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
# Change the time zone using a real string. | ||
|
||
send | ||
Parse {"Query": "SET TIME ZONE 'America/New_York'"} | ||
Bind | ||
Execute | ||
Sync | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"ParameterStatus","Name":"TimeZone","Value":"America/New_York"} | ||
{"Type":"CommandComplete","CommandTag":"SET"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} |
This file contains 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
This file contains 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