cockroach: github.com/cockroachdb/cockroach/pkg/sqlmigrations Index | Files

package sqlmigrations

import "github.com/cockroachdb/cockroach/pkg/sqlmigrations"

Index

Package Files

migrations.go

Variables

var SettingsDefaultOverrides = map[string]string{
    "diagnostics.reporting.enabled": "true",
    "trace.debug.enable":            "false",
    "cluster.secret":                "<random>",
}

SettingsDefaultOverrides documents the effect of several migrations that add an explicit value for a setting, effectively changing the "default value" from what was defined in code.

func ExpectedDescriptorIDs Uses

func ExpectedDescriptorIDs(
    ctx context.Context,
    db db,
    defaultZoneConfig *config.ZoneConfig,
    defaultSystemZoneConfig *config.ZoneConfig,
) (sqlbase.IDs, error)

ExpectedDescriptorIDs returns the list of all expected system descriptor IDs, including those added by completed migrations. This is needed for certain tests, which check the number of ranges and system tables at node startup.

NOTE: This value may be out-of-date if another node is actively running migrations, and so should only be used in test code where the migration lifecycle is tightly controlled.

type Manager Uses

type Manager struct {
    // contains filtered or unexported fields
}

Manager encapsulates the necessary functionality for handling migrations of data in the cluster.

func NewManager Uses

func NewManager(
    stopper *stop.Stopper,
    db *client.DB,
    executor *sql.InternalExecutor,
    clock *hlc.Clock,
    testingKnobs MigrationManagerTestingKnobs,
    clientID string,
) *Manager

NewManager initializes and returns a new Manager object.

func (*Manager) EnsureMigrations Uses

func (m *Manager) EnsureMigrations(ctx context.Context, filter MigrationFilter) error

EnsureMigrations should be run during node startup to ensure that all required migrations have been run (and running all those that are definitely safe to run).

type MigrationFilter Uses

type MigrationFilter bool

MigrationFilter is used to indicate to EnsureMigrations what to run.

const (
    // AllMigrations means run all the migrations.
    AllMigrations MigrationFilter = true
    // ExcludeMigrationsIncludedInBootstrap means don't run migrations with the
    // includedInBootstrap field set.
    ExcludeMigrationsIncludedInBootstrap MigrationFilter = false
)

type MigrationManagerTestingKnobs Uses

type MigrationManagerTestingKnobs struct {
    // DisableBackfillMigrations stops applying migrations once
    // a migration with 'doesBackfill == true' is encountered.
    // TODO(mberhault): we could skip only backfill migrations and dependencies
    // if we had some concept of migration dependencies.
    DisableBackfillMigrations bool
}

MigrationManagerTestingKnobs contains testing knobs.

func (*MigrationManagerTestingKnobs) ModuleTestingKnobs Uses

func (*MigrationManagerTestingKnobs) ModuleTestingKnobs()

ModuleTestingKnobs is part of the base.ModuleTestingKnobs interface.

Package sqlmigrations imports 23 packages (graph) and is imported by 4 packages. Updated 2019-09-21. Refresh now. Tools for package owners.