Skip to content

Commit

Permalink
Merge #40567
Browse files Browse the repository at this point in the history
40567: sqlmigrations: really skip baked-in migrations when asked to skip them r=andreimatei a=andreimatei

EnsureMigrations() optinally can be told to skip the migrations that are
included in the bootstrap schema when the node running the migrations
has just bootstraped the cluster. Except the mechanism wasn't actually
skipping them. This patch fixes that. There are two places in that
function where we check if we can skip a migration, and only one of them
was correct.

The whole idea of skipping these migrations is arguable because the
check only applies to the node that bootstrapped the cluster. All the
other nodes will still run them. So I can also get rid of the thing if
reviewers ask.

Release note: None

Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
  • Loading branch information
craig[bot] and andreimatei committed Sep 7, 2019
2 parents a651440 + 4b2b434 commit 08455ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/sqlmigrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,10 @@ func (m *Manager) EnsureMigrations(ctx context.Context, filter MigrationFilter)
sqlExecutor: m.sqlExecutor,
}
for _, migration := range backwardCompatibleMigrations {
if migration.workFn == nil {
// Migration has been baked in. Ignore it.
if migration.workFn == nil || // has the migration been baked in?
// is the migration unnecessary?
(migration.includedInBootstrap &&
filter == ExcludeMigrationsIncludedInBootstrap) {
continue
}

Expand Down

0 comments on commit 08455ac

Please sign in to comment.