Skip to content

Commit 930e2ef

Browse files
craig[bot]yuzefovich
andcommitted
Merge #157801
157801: sql: fix TestSessionMigration r=yuzefovich a=yuzefovich In `TestSessionMigration/max_size` we're changing SystemVisible cluster setting via the system layer, so if we're running in a secondary tenant, we must block until that change is picked up by the settings-watcher rangefeed. Fixes: #157042. Release note: None Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
2 parents 8ee050d + a112173 commit 930e2ef

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pkg/sql/session_migration_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ import (
1414

1515
"github.com/cockroachdb/cockroach/pkg/base"
1616
"github.com/cockroachdb/cockroach/pkg/security/username"
17+
"github.com/cockroachdb/cockroach/pkg/testutils"
1718
"github.com/cockroachdb/cockroach/pkg/testutils/datapathutils"
1819
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
1920
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
2021
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
2122
"github.com/cockroachdb/cockroach/pkg/util/log"
2223
"github.com/cockroachdb/cockroach/pkg/util/stop"
2324
"github.com/cockroachdb/datadriven"
25+
"github.com/cockroachdb/errors"
2426
"github.com/jackc/pgx/v5"
2527
"github.com/stretchr/testify/require"
2628
)
@@ -206,6 +208,21 @@ WHERE dump.variable IS NULL OR dump2.variable IS NULL OR dump.variable != dump2.
206208
if err != nil {
207209
return err.Error()
208210
}
211+
// Block until the application layer observes the change.
212+
testutils.SucceedsSoon(t, func() error {
213+
row := dbConn.QueryRow(ctx, `SHOW CLUSTER SETTING sql.session_transfer.max_session_size;`)
214+
var sessionSize string
215+
err := row.Scan(&sessionSize)
216+
if err != nil {
217+
return err
218+
}
219+
// Remove spaces to match format from the test file.
220+
sessionSize = strings.ReplaceAll(sessionSize, " ", "")
221+
if sessionSize != d.CmdArgs[0].Key {
222+
return errors.Newf("expected session size to be %s, got %s", d.CmdArgs[0].Key, sessionSize)
223+
}
224+
return nil
225+
})
209226
return ""
210227

211228
case "error":

pkg/sql/testdata/session_migration/max_size

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
change_session_size 2KB
1+
change_session_size 2.0KiB
22
----
33

44
let $large_string

0 commit comments

Comments
 (0)