Skip to content

Commit

Permalink
logictest: check for nil SystemConfig before purging zone config cache
Browse files Browse the repository at this point in the history
Fixes #88398

This fixes a panic which can occur duing cluster startup in a logic test
or during retry of a test case in a logic test when an attempt is made
to purge the zone config cache and no SystemConfig is available.

Release note: None
  • Loading branch information
Mark Sirek committed Oct 27, 2022
1 parent 6e3f98a commit 3019488
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,9 @@ func (t *logicTest) purgeZoneConfig() {
for i := 0; i < t.cluster.NumServers(); i++ {
sysconfigProvider := t.cluster.Server(i).SystemConfigProvider()
sysconfig := sysconfigProvider.GetSystemConfig()
sysconfig.PurgeZoneConfigCache()
if sysconfig != nil {
sysconfig.PurgeZoneConfigCache()
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/testutils/serverutils/test_cluster_shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ func StartNewTestCluster(
for i := 0; i < cluster.NumServers(); i++ {
sysconfigProvider := cluster.Server(i).SystemConfigProvider()
sysconfig := sysconfigProvider.GetSystemConfig()
sysconfig.PurgeZoneConfigCache()
if sysconfig != nil {
sysconfig.PurgeZoneConfigCache()
}
}
return cluster
}
Expand Down

0 comments on commit 3019488

Please sign in to comment.