Add flag --skip-metadata-lock-check by meiji163 · Pull Request #1616 · github/gh-ost

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new command-line flag --skip-metadata-lock-checks to allow users to bypass metadata lock validation during cut-over when performance_schema.metadata_locks cannot be enabled (e.g., on Aurora RDS). This addresses environments where enabling performance_schema may be infeasible while acknowledging a small risk of data loss.

Changes:

  • Added --skip-metadata-lock-checks flag to bypass metadata lock checks at cut-over
  • Enhanced StateMetadataLockInstrument() to handle cases where performance_schema is disabled
  • Added validation logic in initiateApplier() to conditionally bail out or warn based on flag

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go/cmd/gh-ost/main.go Added --skip-metadata-lock-checks flag definition and updated description for --allow-setup-metadata-lock-instruments flag
go/base/context.go Added SkipMetadataLockChecks boolean field to MigrationContext
go/logic/applier.go Modified StateMetadataLockInstrument() to handle ErrNoRows when performance_schema is disabled
go/logic/migrator.go Added conditional logic to check SkipMetadataLockChecks flag and bail out or warn accordingly
doc/command-line-flags.md Added documentation for both skip-metadata-lock-check and allow-setup-metadata-lock-instruments flags
Comments suppressed due to low confidence (1)

doc/command-line-flags.md:257

  • Inconsistent flag name in documentation text. The flag is defined as --skip-metadata-lock-checks (plural) but the documentation refers to --skip-metadata-lock-check (singular). Update to use --skip-metadata-lock-checks.
By default `gh-ost` performs a check before the cut-over to ensure the rename session holds the exclusive metadata lock on the table. In case `performance_schema.metadata_locks` cannot be enabled on your setup, this check can be skipped with `--skip-metadata-lock-check`. 

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.