Skip to content

--resume without --execute drops the ghost table it correctly skipped altering #1769

Description

@ajm188

Description

Running a checkpoint/resume migration with gh-ost --resume but without --execute
(i.e. a dry-run resume) correctly skips re-applying the ALTER to the ghost table, but
finalCleanup still drops the ghost table at the end, destroying the progress from the
interrupted real migration.

Steps to reproduce

  1. Start a migration with --checkpoint and --execute.
  2. Interrupt it partway through row copy.
  3. Resume with --resume but omit --execute (dry-run resume).
  4. Observe the ghost table is dropped even though no data was copied or altered in this run.

Expected behavior

A dry-run resume should not destroy the ghost table produced by the previous real run,
since it did none of the work that produced it and a subsequent --resume --execute
should still be able to use it.

Root cause

In finalCleanup (go/logic/migrator.go), the ghost table drop is gated only on
migrationContext.Noop, not on whether this is a resume:

if mgtr.migrationContext.Noop {
    mgtr.applier.DropGhostTable()
}

This doesn't account for Resume=true, where the ghost table was not created by
this invocation and represents real, previously-copied data.

Workaround

Skip the dry-run resume step; go straight to --resume --execute.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions