Skip to content

Commit

Permalink
roachtest: lower descriptor lease duration in acceptance/version-upgr…
Browse files Browse the repository at this point in the history
…ade.

The `acceptance/version-upgrade` test uncovered a descriptor lease
leak that can lead to the test timing out due to waiting a full lease
duration (5 minutes by default), making it flaky.

Once the bug is fixed, we should be able to use the default duration
again.

Relates to cockroachdb#84382.

Release note: None.
  • Loading branch information
renatolabs committed Jul 15, 2022
1 parent 4f965c6 commit 547aca5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/cmd/roachtest/tests/versionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ func runVersionUpgrade(ctx context.Context, t test.Test, c cluster.Cluster) {
//
// See the comment on createCheckpoints for details on fixtures.
uploadAndStartFromCheckpointFixture(c.All(), predecessorVersion),

// lower descriptor lease duration to 1 minute, working around a
// lease leak that can occasionally make this test time out (flake
// rate ~3%).
//
// TODO(renato): remove this call and function definition when
// https://github.com/cockroachdb/cockroach/issues/84382 is
// closed.
lowerLeaseDuration(1),

uploadAndInitSchemaChangeWorkload(),
waitForUpgradeStep(c.All()),
testFeaturesStep,
Expand Down Expand Up @@ -403,6 +413,18 @@ func enableTracingGloballyStep(ctx context.Context, t test.Test, u *versionUpgra
}
}

// lowerLeaseDuration sets the `sql.catalog.descriptor_lease_duration`
// setting to 1 minute.
func lowerLeaseDuration(node int) versionStep {
return func(ctx context.Context, t test.Test, u *versionUpgradeTest) {
db := u.conn(ctx, t, node)
_, err := db.ExecContext(ctx, `SET CLUSTER SETTING sql.catalog.descriptor_lease_duration = '1m'`)
if err != nil {
t.Fatal(err)
}
}
}

func preventAutoUpgradeStep(node int) versionStep {
return func(ctx context.Context, t test.Test, u *versionUpgradeTest) {
db := u.conn(ctx, t, node)
Expand Down

0 comments on commit 547aca5

Please sign in to comment.