Skip to content

Commit

Permalink
Merge #56474
Browse files Browse the repository at this point in the history
56474: server: name sqlmigrations.Manager vars more appropriately r=irfansharif a=irfansharif

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

Co-authored-by: irfan sharif <[email protected]>
  • Loading branch information
craig[bot] and irfansharif committed Nov 11, 2020
2 parents 6a1d8c7 + 3f5fe03 commit 9c67b26
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 @@ -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

0 comments on commit 9c67b26

Please sign in to comment.