Skip to content

Commit 57b77ac

Browse files
committed
testcluster: remove StorageClusterConn
This is replaced by `.SystemLayer(0).SQLConn()`. Release note: None
1 parent 91976b5 commit 57b77ac

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

pkg/ccl/backupccl/backup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ func backupAndRestore(
10061006
) {
10071007
conn := tc.Conns[0]
10081008
sqlDB := sqlutils.MakeSQLRunner(conn)
1009-
storageConn := tc.StorageClusterConn()
1009+
storageConn := tc.SystemLayer(0).SQLConn(t, "")
10101010
storageSQLDB := sqlutils.MakeSQLRunner(storageConn)
10111011
storageSQLDB.Exec(t, "SET DATABASE=defaultdb")
10121012
{

pkg/sql/logictest/logic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ func (t *logicTest) newCluster(
15651565
// behavior.
15661566
if cfg.UseSecondaryTenant == logictestbase.Always || t.cluster.StartedDefaultTestTenant() {
15671567

1568-
conn := t.cluster.StorageClusterConn()
1568+
conn := t.cluster.SystemLayer(0).SQLConn(t.rootT, "")
15691569
clusterSettings := toa.clusterSettings
15701570
_, ok := clusterSettings[sql.SecondaryTenantZoneConfigsEnabled.Key()]
15711571
if ok {

pkg/testutils/serverutils/test_cluster_shim.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,6 @@ type TestClusterInterface interface {
233233
// cluster.
234234
StorageLayer(idx int) StorageLayerInterface
235235

236-
// StorageClusterConn returns a gosql.DB connection to the first server in a
237-
// storage cluster. This is useful in environments where it's not clear
238-
// whether ServerConn is returning a connection to the storage cluster or a
239-
// secondary tenant.
240-
StorageClusterConn() *gosql.DB
241-
242236
// SplitTable splits a range in the table, creates a replica for the right
243237
// side of the split on TargetNodeIdx, and moves the lease for the right
244238
// side of the split to TargetNodeIdx for each SplitPoint. This forces the

pkg/testutils/testcluster/testcluster.go

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,8 @@ type TestCluster struct {
6565
// ReusableListeners is populated if (and only if) TestClusterArgs.ReusableListeners is set.
6666
ReusableListeners map[int] /* idx */ *listenerutil.ReusableListener
6767

68-
// Connection to the storage cluster. Typically, the first connection in
69-
// Conns, but could be different if we're transparently running in a test
70-
// tenant (see the DefaultTestTenant flag of base.TestServerArgs for more
71-
// detail).
72-
storageConn *gosql.DB
73-
stopper *stop.Stopper
74-
mu struct {
68+
stopper *stop.Stopper
69+
mu struct {
7570
syncutil.Mutex
7671
serverStoppers []*stop.Stopper
7772
}
@@ -112,11 +107,6 @@ func (tc *TestCluster) ServerConn(idx int) *gosql.DB {
112107
return tc.Conns[idx]
113108
}
114109

115-
// StorageClusterConn is part of TestClusterInterface.
116-
func (tc *TestCluster) StorageClusterConn() *gosql.DB {
117-
return tc.storageConn
118-
}
119-
120110
// Stopper returns the stopper for this testcluster.
121111
func (tc *TestCluster) Stopper() *stop.Stopper {
122112
return tc.stopper
@@ -626,22 +616,9 @@ func (tc *TestCluster) startServer(idx int, serverArgs base.TestServerArgs) erro
626616
return err
627617
}
628618

629-
// For the first server started, populate the storage cluster
630-
// connection.
631-
var storageDbConn *gosql.DB
632-
if idx == 0 {
633-
storageDbConn, err = server.SystemLayer().SQLConnE("")
634-
if err != nil {
635-
return err
636-
}
637-
}
638-
639619
tc.mu.Lock()
640620
defer tc.mu.Unlock()
641621
tc.Conns = append(tc.Conns, dbConn)
642-
if idx == 0 {
643-
tc.storageConn = storageDbConn
644-
}
645622
return nil
646623
}
647624

0 commit comments

Comments
 (0)