Skip to content

Commit 883c363

Browse files
committed
roachtest: metamorphically enable lead_for_global_reads_auto_tune
This commit metamorphically enables lead_for_global_reads_auto_tune for follower reads roachtests. Release note: none Epic: none
1 parent fd9aa49 commit 883c363

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

pkg/cmd/roachtest/tests/follower_reads.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,19 @@ func runFollowerReadsTest(
219219
require.NoError(t, func() error {
220220
db := c.Conn(ctx, l, 1)
221221
defer db.Close()
222-
err := enableIsolationLevels(ctx, t, db)
222+
err := enableClosedTsAutoTune(ctx, rng, db, t)
223+
if err != nil && strings.Contains(err.Error(), "unknown cluster setting") {
224+
// Versions v25.1 and earlier do not support these cluster settings and
225+
// should ignore them. The cluster will continue operating normally, with
226+
// old-version nodes ignoring the settings and newer-version nodes
227+
// continuing to run. Auto-tuning of closed timestamps should only start
228+
// taking effect when the entire cluster has been upgraded to v25.2.
229+
err = nil
230+
}
231+
if err != nil {
232+
return err
233+
}
234+
err = enableIsolationLevels(ctx, t, db)
223235
if err != nil && strings.Contains(err.Error(), "unknown cluster setting") {
224236
// v23.1 and below does not have these cluster settings. That's fine, as
225237
// all isolation levels will be transparently promoted to "serializable".
@@ -1080,3 +1092,20 @@ func enableTenantMultiRegion(l *logger.Logger, r *rand.Rand, h *mixedversion.Hel
10801092
err := setTenantSetting(l, r, h, setting, true)
10811093
return errors.Wrapf(err, "setting %s", setting)
10821094
}
1095+
1096+
// enableClosedTsAutoTune metamorphically enables closed timestamp auto-tuning.
1097+
func enableClosedTsAutoTune(ctx context.Context, rng *rand.Rand, db *gosql.DB, t test.Test) error {
1098+
if rng.Intn(2) == 0 {
1099+
for _, cmd := range []string{
1100+
`SET CLUSTER SETTING kv.closed_timestamp.lead_for_global_reads_auto_tune.enabled = 'true';`,
1101+
`SET CLUSTER SETTING kv.closed_timestamp.policy_refresh_interval = '5s';`,
1102+
`SET CLUSTER SETTING kv.closed_timestamp.policy_latency_refresh_interval = '4s';`,
1103+
} {
1104+
if _, err := db.ExecContext(ctx, cmd); err != nil {
1105+
return err
1106+
}
1107+
}
1108+
t.L().Printf("metamorphically enabled closed timestamp auto-tuning")
1109+
}
1110+
return nil
1111+
}

0 commit comments

Comments
 (0)