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
- Start a migration with
--checkpoint and --execute.
- Interrupt it partway through row copy.
- Resume with
--resume but omit --execute (dry-run resume).
- 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.
Description
Running a checkpoint/resume migration with
gh-ost --resumebut without--execute(i.e. a dry-run resume) correctly skips re-applying the ALTER to the ghost table, but
finalCleanupstill drops the ghost table at the end, destroying the progress from theinterrupted real migration.
Steps to reproduce
--checkpointand--execute.--resumebut omit--execute(dry-run resume).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 --executeshould still be able to use it.
Root cause
In
finalCleanup(go/logic/migrator.go), the ghost table drop is gated only onmigrationContext.Noop, not on whether this is a resume:This doesn't account for
Resume=true, where the ghost table was not created bythis invocation and represents real, previously-copied data.
Workaround
Skip the dry-run resume step; go straight to
--resume --execute.