Skip to content

Commit 51a6a4c

Browse files
committed
sql: improve stmt bundles a bit
This commit addresses two minor issues around the stmt bundles: - previously, we would always include the value of `direct_columnar_scans_enabled` session variable even when it's not changed from the default. This was a bug where we overrode the value of `skip` boolean based on whether crdb_test build tag was set. - it also hardens `debug sb recreate` command to ignore `cluster.preserve_downgrade_option` if it's set - it has no effect on the execution, yet it can break recreation on a new enough binary. Release note: None
1 parent 1e2f0e2 commit 51a6a4c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/cli/statement_bundle.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ func runBundleRecreate(cmd *cobra.Command, args []string) (resErr error) {
179179
initStmts := strings.Split(strings.Join(lines, "\n"), "SET CLUSTER SETTING")
180180
for i := 1; i < len(initStmts); i++ {
181181
initStmts[i] = "SET CLUSTER SETTING " + initStmts[i]
182+
if strings.Contains(initStmts[i], "cluster.preserve_downgrade_option") {
183+
// This cluster setting can prevent the bundle from being
184+
// recreated on a new enough binary, so we'll skip it.
185+
initStmts = append(initStmts[:i], initStmts[i+1:]...)
186+
i--
187+
}
182188
}
183189
// All stmts before the first SET CLUSTER SETTING are SET stmts. We need
184190
// to handle 'SET database = ' stmt separately if found - the target

pkg/sql/explain_bundle.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,9 @@ func (c *stmtEnvCollector) PrintSessionSettings(w io.Writer, sv *settings.Values
11321132
case "direct_columnar_scans_enabled":
11331133
// In test builds we might randomize some setting defaults, so
11341134
// we need to ignore them to make the tests deterministic.
1135-
skip = buildutil.CrdbTestBuild
1135+
if buildutil.CrdbTestBuild {
1136+
skip = true
1137+
}
11361138
case "role":
11371139
// If a role is set, we comment it out in env.sql. Otherwise, running
11381140
// 'debug sb recreate' will fail with a non-existent user/role error.

0 commit comments

Comments
 (0)