Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: name sqlmigrations.Manager vars more appropriately #56474

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/server/server_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type sqlServer struct {
// shared between the sql.Server and the statusServer.
sessionRegistry *sql.SessionRegistry
jobRegistry *jobs.Registry
migMgr *sqlmigrations.Manager
sqlmigrationsMgr *sqlmigrations.Manager
statsRefresher *stats.Refresher
temporaryObjectCleaner *sql.TemporaryObjectCleaner
internalMemMetrics sql.MemoryMetrics
Expand Down Expand Up @@ -726,7 +726,7 @@ func (s *sqlServer) preStart(
DistSQLMode: sessiondata.DistSQLOff,
},
})
migMgr := sqlmigrations.NewManager(
sqlmigrationsMgr := sqlmigrations.NewManager(
stopper,
s.execCfg.DB,
s.execCfg.Codec,
Expand All @@ -737,7 +737,7 @@ func (s *sqlServer) preStart(
s.execCfg.Settings,
s.jobRegistry,
)
s.migMgr = migMgr // only for testing via TestServer
s.sqlmigrationsMgr = sqlmigrationsMgr // only for testing via TestServer

if err := s.jobRegistry.Start(
ctx, stopper, jobs.DefaultCancelInterval, jobs.DefaultAdoptInterval,
Expand Down Expand Up @@ -772,7 +772,7 @@ func (s *sqlServer) preStart(
}

// Run startup migrations (note: these depend on jobs subsystem running).
if err := migMgr.EnsureMigrations(ctx, bootstrapVersion); err != nil {
if err := sqlmigrationsMgr.EnsureMigrations(ctx, bootstrapVersion); err != nil {
return errors.Wrap(err, "ensuring SQL migrations")
}

Expand All @@ -794,7 +794,7 @@ func (s *sqlServer) preStart(
}
// Start the async migration to upgrade namespace entries from the old
// namespace table (id 2) to the new one (id 30).
if err := migMgr.StartSystemNamespaceMigration(ctx, bootstrapVersion); err != nil {
if err := sqlmigrationsMgr.StartSystemNamespaceMigration(ctx, bootstrapVersion); err != nil {
return err
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ func (ts *TestServer) JobRegistry() interface{} {
return nil
}

// MigrationManager returns the *sqlmigrations.Manager as an interface{}.
func (ts *TestServer) MigrationManager() interface{} {
// SQLMigrationsManager returns the *sqlmigrations.Manager as an interface{}.
func (ts *TestServer) SQLMigrationsManager() interface{} {
if ts != nil {
return ts.sqlServer.migMgr
return ts.sqlServer.sqlmigrationsMgr
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/testutils/serverutils/test_server_shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ type TestServerInterface interface {
// JobRegistry returns the *jobs.Registry as an interface{}.
JobRegistry() interface{}

// MigrationManager returns the *jobs.Registry as an interface{}.
MigrationManager() interface{}
// SQLMigrationsManager returns the *sqlmigrations.Manager as an interface{}.
SQLMigrationsManager() interface{}

// NodeLiveness exposes the NodeLiveness instance used by the TestServer as an
// interface{}.
Expand Down