Skip to content

Commit bfb45ae

Browse files
authored
Merge pull request #145476 from cockroachdb/blathers/backport-release-25.2-145429
release-25.2: roachtest: deflake lease-preferences roachtest
2 parents f538b25 + 6c61c78 commit bfb45ae

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

pkg/cmd/roachtest/tests/lease_preferences.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,16 @@ func runLeasePreferences(
172172
// waitForLessPreferred=false). This duration is used to ensure the lease
173173
// preference satisfaction is reasonably permanent.
174174
const stableDuration = 30 * time.Second
175+
// initialWaitDuration is how long the test will wait for initial lease
176+
// preference conformance. This duration is approx. a replica scanner cycle.
177+
const initialWaitDuration = 10 * time.Minute
175178

176179
numNodes := c.Spec().NodeCount
177180
allNodes := make([]int, 0, numNodes)
178181
for i := 1; i <= numNodes; i++ {
179182
allNodes = append(allNodes, i)
180183
}
181184

182-
// TODO(kvoli): temporary workaround for
183-
// https://github.com/cockroachdb/cockroach/issues/105274
184-
settings := install.MakeClusterSettings()
185-
settings.ClusterSettings["server.span_stats.span_batch_limit"] = "4096"
186-
settings.ClusterSettings["kv.enqueue_in_replicate_queue_on_span_config_update.enabled"] = "true"
187-
188185
startNodes := func(nodes ...int) {
189186
for _, node := range nodes {
190187
// Don't start a backup schedule because this test is timing sensitive.
@@ -198,7 +195,7 @@ func runLeasePreferences(
198195
// dc=N: n2N-1 n2N
199196
fmt.Sprintf("--locality=region=fake-region,zone=fake-zone,dc=%d", (node-1)/2+1),
200197
"--vmodule=replica_proposal=2,lease_queue=3,lease=3")
201-
c.Start(ctx, t.L(), opts, settings, c.Node(node))
198+
c.Start(ctx, t.L(), opts, install.MakeClusterSettings(), c.Node(node))
202199

203200
}
204201
}
@@ -215,9 +212,13 @@ func runLeasePreferences(
215212
conn := c.Conn(ctx, t.L(), numNodes)
216213
defer conn.Close()
217214

218-
checkLeasePreferenceConformance := func(ctx context.Context) {
215+
checkLeasePreferenceConformance := func(ctx context.Context, initial bool) {
216+
duration := spec.postEventWaitDuration
217+
if initial {
218+
duration = initialWaitDuration
219+
}
219220
result, err := waitForLeasePreferences(
220-
ctx, t, c, spec.checkNodes, spec.waitForLessPreferred, stableDuration, spec.postEventWaitDuration)
221+
ctx, t, c, spec.checkNodes, spec.waitForLessPreferred, stableDuration, duration)
221222
require.NoError(t, err, result)
222223
require.Truef(t, !result.violating(), "violating lease preferences %s", result)
223224
if spec.waitForLessPreferred {
@@ -260,7 +261,7 @@ func runLeasePreferences(
260261
leasePreference: spec.preferences,
261262
})
262263
t.L().Printf("waiting for initial lease preference conformance")
263-
checkLeasePreferenceConformance(ctx)
264+
checkLeasePreferenceConformance(ctx, true /* initial */)
264265

265266
// Run the spec event function. The event function will move leases to
266267
// non-conforming localities.
@@ -273,7 +274,7 @@ func runLeasePreferences(
273274
// Wait for the preference conformance with some leases in non-conforming
274275
// localities.
275276
t.L().Printf("waiting for post-event lease preference conformance")
276-
checkLeasePreferenceConformance(ctx)
277+
checkLeasePreferenceConformance(ctx, false /* initial */)
277278
}
278279

279280
type leasePreferencesResult struct {

0 commit comments

Comments
 (0)