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

Abierto Apto para principiantes
#1,769 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 10 días

@ajm188 ya está trabajando en esto.

Desde el 18/9/2026.

  • #1770 de @ajm188 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, mysql
Área
databases

Línea de trabajo

Comienza en go/logic/migrator.go, en finalCleanup, y sigue el estado Noop y Resume durante la secuencia documentada de checkpoint y resume. Reproduce un dry-run de resume después de una migración execute interrumpida y verifica después que la tabla fantasma existente siga disponible para una ejecución posterior con --resume --execute.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
13.6k
Forks
1.4k
Merge medio
9 d 19 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/gh-ost

Todos los issues de github/gh-ost

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.