From dd461056ac66de54e5845dd1b7b14c8a340aa417 Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Mon, 7 Feb 2022 10:05:43 +0000 Subject: [PATCH] migrations: remove unused testing knobs These testing knobs are currently unused. Release note: None --- pkg/migration/BUILD.bazel | 1 - pkg/migration/migrations/schema_changes.go | 9 --------- pkg/migration/testing_knobs.go | 18 ------------------ 3 files changed, 28 deletions(-) diff --git a/pkg/migration/BUILD.bazel b/pkg/migration/BUILD.bazel index 07f351984708..910c7527c0e7 100644 --- a/pkg/migration/BUILD.bazel +++ b/pkg/migration/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//pkg/base", "//pkg/clusterversion", "//pkg/jobs", - "//pkg/jobs/jobspb", "//pkg/keys", "//pkg/kv", "//pkg/kv/kvclient/kvcoord", diff --git a/pkg/migration/migrations/schema_changes.go b/pkg/migration/migrations/schema_changes.go index fefab1dc4b4e..cd8448ca96d8 100644 --- a/pkg/migration/migrations/schema_changes.go +++ b/pkg/migration/migrations/schema_changes.go @@ -17,7 +17,6 @@ import ( "strings" "github.com/cockroachdb/cockroach/pkg/clusterversion" - "github.com/cockroachdb/cockroach/pkg/jobs/jobspb" "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/migration" "github.com/cockroachdb/cockroach/pkg/security" @@ -92,11 +91,6 @@ func migrateTable( if mutations := storedTable.GetMutationJobs(); len(mutations) > 0 { for _, mutation := range mutations { log.Infof(ctx, "waiting for the mutation job %v to complete", mutation.JobID) - // TODO(cameron): Remove this knob conditional once the related migration code has been removed. - // See pkg/migration/testing_knobs.go for more details. - if d.TestingKnobs.BeforeWaitInRetryJobsWithExponentialBackoffMigration != nil { - d.TestingKnobs.BeforeWaitInRetryJobsWithExponentialBackoffMigration(jobspb.JobID(mutation.JobID)) - } if _, err := d.InternalExecutor.Exec(ctx, "migration-mutations-wait", nil, "SHOW JOB WHEN COMPLETE $1", mutation.JobID); err != nil { return err @@ -122,9 +116,6 @@ func migrateTable( } if exists { log.Infof(ctx, "skipping %s operation as the schema change already exists.", op.name) - if d.TestingKnobs != nil && d.TestingKnobs.SkippedMutation != nil { - d.TestingKnobs.SkippedMutation() - } return nil } diff --git a/pkg/migration/testing_knobs.go b/pkg/migration/testing_knobs.go index bfe6566b01ab..db5920eb106f 100644 --- a/pkg/migration/testing_knobs.go +++ b/pkg/migration/testing_knobs.go @@ -13,7 +13,6 @@ package migration import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/clusterversion" - "github.com/cockroachdb/cockroach/pkg/jobs/jobspb" ) // TestingKnobs are knobs to inject behavior into the migration manager which @@ -27,23 +26,6 @@ type TestingKnobs struct { // RegistryOverride is used to inject migrations for specific cluster versions. RegistryOverride func(cv clusterversion.ClusterVersion) (Migration, bool) - - // BeforeWaitInRetryJobsWithExponentialBackoffMigration is called before - // waiting for a mutation job to complete in retryJobsWithExponentialBackoff - // migration. - // TODO(sajjad): Remove this knob when the related migration code is removed. - // This knob is used only in exponential backoff migration and related tests. See - // pkg/migration/retry_jobs_with_exponential_backoff.go and - // pkg/migration/retry_jobs_with_exponential_backoff_external_test.go - BeforeWaitInRetryJobsWithExponentialBackoffMigration func(jobspb.JobID) - - // SkippedMutation is called if a mutation job is skipped as part of the - // retryJobsWithExponentialBackoff migration. - // TODO(sajjad): Remove this knob when the related migration code is removed. - // This knob is used only in exponential backoff migration and related tests. See - // pkg/migration/retry_jobs_with_exponential_backoff.go and - // pkg/migration/retry_jobs_with_exponential_backoff_external_test.go - SkippedMutation func() } // ModuleTestingKnobs makes TestingKnobs a base.ModuleTestingKnobs.