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

Aberta Para iniciantes
#1,769 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 10 dias

@ajm188 já está trabalhando nisso.

Desde 18/9/2026.

  • #1770 de @ajm188 — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
86/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go, mysql
Domínio
databases

Direção de pesquisa

Comece em go/logic/migrator.go, em finalCleanup, e acompanhe o estado Noop e Resume durante a sequência documentada de checkpoint e resume. Reproduza um dry-run de resume após uma migração execute interrompida e, em seguida, verifique se a tabela fantasma existente continua disponível para uma execução posterior com --resume --execute.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Go
Estrelas
13.6k
Forks
1.4k
Merge médio
9d 19h
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/gh-ost

Todas as issues de github/gh-ost

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.