Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
125687: upgrade/upgrades: TestLeasingClusterVersionStarvation flake r=fqazi a=fqazi

Previously, the TestLeasingClusterVersionStarvation could fail because session based leasing migration with a lease duration of 0. This is because leases will expire instantly on the range feed, because of the zero duration. So, during the migration the system.lease descriptor is upgraded and expired instantly, and the clean up of the new lease is asynchronous. After the descriptor update a WaitForOneVersion is run on the system.lease table, which will now need to acquire the new version, which will run into trouble (because the old entry is not cleaned). To address this, this patch uses the default lease duration for this test, since production environments will never have this set to 0, and this scenario is unsupported.

Fixes: cockroachdb#123618

Release note: None

Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
  • Loading branch information
craig[bot] and fqazi committed Jun 14, 2024
2 parents 7426c8e + 42967ef commit 5521253
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/upgrade/upgrades/version_starvation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package upgrades_test
import (
"context"
"testing"
"time"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
Expand Down Expand Up @@ -58,18 +59,16 @@ func TestLeasingClusterVersionStarvation(t *testing.T) {
},
}

// Disable lease renewals intentionally, so that we validate
// no deadlock risk exists with the settings table.
st := clustersettings.MakeTestingClusterSettingsWithVersions(
clusterversion.Latest.Version(),
clusterversion.MinSupported.Version(),
false)

clusterArgs.ServerArgs.Settings = st

// Encourage continuous lease renewals intentionally, so that we validate
// no deadlock risk exists with the settings table. By setting a higher number
// the expiration will be less than the renewal interval.g
lease.LeaseRenewalDuration.Override(ctx, &st.SV, time.Hour)
tc := testcluster.StartTestCluster(t, 1, clusterArgs)
lease.LeaseDuration.Override(ctx, &st.SV, 0)
lease.LeaseRenewalDuration.Override(ctx, &st.SV, 0)

defer tc.Stopper().Stop(ctx)
db := tc.ServerConn(0)
Expand Down

0 comments on commit 5521253

Please sign in to comment.