Skip to content

Commit

Permalink
server: don't pass full Config to SQL Server
Browse files Browse the repository at this point in the history
Only pass BothConfig union SQLConfig. This is possible now thanks to the
preceding commits.

Release note: None
  • Loading branch information
tbg committed May 28, 2020
1 parent 4f5fd84 commit 807dc36
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
7 changes: 2 additions & 5 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,8 @@ func NewServer(cfg Config, stopper *stop.Stopper) (*Server, error) {
externalStorageFromURI: externalStorageFromURI,
isMeta1Leaseholder: node.stores.IsMeta1Leaseholder,
},
// NB: s.cfg has a populated AmbientContext.
Config: &cfg,
// TODO(tbg): use this once we get rid of Config
// SQLConfig: &cfg.SQLConfig,
// BothConfig: &cfg.BothConfig,
SQLConfig: &cfg.SQLConfig,
BothConfig: &cfg.BothConfig,
stopper: stopper,
clock: clock,
runtime: runtimeSampler,
Expand Down
8 changes: 3 additions & 5 deletions pkg/server/server_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ type sqlServerOptionalArgs struct {
type sqlServerArgs struct {
sqlServerOptionalArgs

*Config
// TODO(tbg): replace Config with:
// *SQLConfig
// *BothConfig
*SQLConfig
*BothConfig

stopper *stop.Stopper

Expand Down Expand Up @@ -493,7 +491,7 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*sqlServer, error) {
sqlMemMetrics := sql.MakeMemMetrics("sql", cfg.HistogramWindowInterval())
pgServer := pgwire.MakeServer(
cfg.AmbientCtx,
cfg.Config.Config,
cfg.Config,
cfg.Settings,
sqlMemMetrics,
&rootSQLMemoryMonitor,
Expand Down
7 changes: 3 additions & 4 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,8 @@ func testSQLServerArgs(ts *TestServer) sqlServerArgs {
return nil, errors.New("fake external uri storage")
},
},
Config: &cfg,
// SQLConfig: &cfg.SQLConfig,
// BothConfig: &cfg.BothConfig,
SQLConfig: &cfg.SQLConfig,
BothConfig: &cfg.BothConfig,
stopper: stopper,
clock: clock,
runtime: status.NewRuntimeStatSampler(context.Background(), clock),
Expand Down Expand Up @@ -583,7 +582,7 @@ func (ts *TestServer) StartTenant(params base.TestTenantArgs) (pgAddr string, _

if err := s.start(ctx,
args.stopper,
args.Config.TestingKnobs,
args.TestingKnobs,
connManager,
pgL,
socketFile,
Expand Down

0 comments on commit 807dc36

Please sign in to comment.