sql: add troubleshooting mode session variable#84452
sql: add troubleshooting mode session variable#84452craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
8bc0d6e to
e247f90
Compare
knz
left a comment
There was a problem hiding this comment.
Since the value is already on/off you could name this troubleshooting_mode - the suffix _enabled is unnecessary in this case.
Also, it would be useful to hook this up to the behavior of cockroach sql --debug-sql-cli (see DebugMode in cli/clisqlclient/context.go)
Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @THardy98)
e247f90 to
eab31a2
Compare
THardy98
left a comment
There was a problem hiding this comment.
Renamed to troubleshooting_mode.
I've added a conditional to enable troubleshooting_mode if the DebugMode flag is set to true at configurePreShellDefaults, once we've parsed the CLI flags. Not sure if this is the best place to do this.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz)
knz
left a comment
There was a problem hiding this comment.
Reviewed 9 of 9 files at r2, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @THardy98)
pkg/cli/clisqlshell/sql.go line 2107 at r2 (raw file):
} if c.sqlConnCtx.DebugMode {
you can put this logic inside a function alongside the others in clisqlcfg/context.go (maybeSetSafeUpdates etc) then call it from Run.
Then you can also add a test for this inside cli/interactive_tests/test_client_side_checking.tcl alongside the others that test the CLI flag.
For example, below the existing prompt expect:
send "show troubleshooting_mode\r"
eexpect "on"
eexpect "root@"
eab31a2 to
1e2030a
Compare
THardy98
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz)
pkg/cli/clisqlshell/sql.go line 2107 at r2 (raw file):
Previously, knz (kena) wrote…
you can put this logic inside a function alongside the others in
clisqlcfg/context.go(maybeSetSafeUpdates etc) then call it fromRun.Then you can also add a test for this inside
cli/interactive_tests/test_client_side_checking.tclalongside the others that test the CLI flag.
For example, below the existing prompt expect:send "show troubleshooting_mode\r" eexpect "on" eexpect "root@"
moved logic to maybeSetTroubleshootingMode, called from Run
added the suggested test to cli/interactive_tests/test_client_side_checking.tcl
knz
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @THardy98)
pkg/cli/clisqlcfg/context.go line 259 at r3 (raw file):
func (c *Context) maybeSetTroubleshootingMode(conn clisqlclient.Conn) error { // If we are in debug mode, enable "troubleshooting mode". if c.ConnCtx.DebugMode {
easier on the eye:
if !cond { return nil }
return dothething()
pkg/cli/interactive_tests/test_client_side_checking.tcl line 100 at r3 (raw file):
# Check that troubleshooting mode is enabled in debug mode. send "show troubleshooting_mode\r"
this is not the correct place - the test has exited the sql client already above.
1e2030a to
ebbda5b
Compare
THardy98
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz)
pkg/cli/clisqlcfg/context.go line 259 at r3 (raw file):
Previously, knz (kena) wrote…
easier on the eye:
if !cond { return nil } return dothething()
Done.
pkg/cli/interactive_tests/test_client_side_checking.tcl line 100 at r3 (raw file):
Previously, knz (kena) wrote…
this is not the correct place - the test has exited the sql client already above.
Oops, moved earlier.
knz
left a comment
There was a problem hiding this comment.
Reviewed 1 of 2 files at r4, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @knz and @THardy98)
pkg/cli/interactive_tests/test_client_side_checking.tcl line 91 at r4 (raw file):
# Check that troubleshooting mode is enabled in debug mode. send "show troubleshooting_mode\r"
you still need to wait for the prompt before sending the command (eexpect "root@" just before)
ebbda5b to
0326230
Compare
THardy98
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @knz)
pkg/cli/interactive_tests/test_client_side_checking.tcl line 91 at r4 (raw file):
Previously, knz (kena) wrote…
you still need to wait for the prompt before sending the command (
eexpect "root@"just before)
Done.
|
TYFR :) |
Resolves: cockroachdb#84429 This change introduces a `troubleshooting_mode_enabled` session variable. When enabled, this session variable is intended to be used as a way to avoid performing additional work on queries, particularly when the cluster is experiencing issues/unavailability/failure. By default, this session variable is disabled. Currently, this session variable is only used to avoid collecting/emitting telemetry data. Release note (sql change): Introduce new `troubleshooting_mode_enabled` session variable, to avoid doing additional work on queries when possible (i.e. collection telemetry data). By default, this session variable is disabled.
0326230 to
fd39cd3
Compare
|
bors r+ |
|
Build succeeded: |
|
blathers backport 22.1 21.2 |
|
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from fd39cd3 to blathers/backport-release-22.1-84452: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.1 failed. See errors above. error creating merge commit from fd39cd3 to blathers/backport-release-21.2-84452: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 21.2 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Resolves: #84429
This change introduces a
troubleshooting_mode_enabledsessionvariable. When enabled, this session variable is intended to be used as
a way to avoid performing additional work on queries, particularly when
the cluster is experiencing issues/unavailability/failure. By default,
this session variable is disabled. Currently, this session variable is
only used to avoid collecting/emitting telemetry data.
Release note (sql change): Introduce new
troubleshooting_mode_enabledsession variable, to avoid doing additional work on queries when
possible (i.e. collection telemetry data). By default, this session
variable is disabled.