Skip to content

Commit

Permalink
server: name sqlmigrations.Manager vars more appropriately
Browse files Browse the repository at this point in the history
We intend to use "migration manager" for the more general purpose
migration infrastructure we're introducing as part of long running
migrations.

Release note: None
  • Loading branch information
irfansharif committed Nov 10, 2020
1 parent 2850729 commit 9a7a35c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions pkg/server/server_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,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 @@ -744,7 +744,7 @@ func (s *sqlServer) preStart(
DistSQLMode: sessiondata.DistSQLOff,
},
})
migMgr := sqlmigrations.NewManager(
sqlmigrationsMgr := sqlmigrations.NewManager(
stopper,
s.execCfg.DB,
s.execCfg.Codec,
Expand All @@ -755,7 +755,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 @@ -790,7 +790,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 @@ -812,7 +812,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

0 comments on commit 9a7a35c

Please sign in to comment.