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

Offen Anfängerfreundlich
#1,769 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 10 Tagen

@ajm188 arbeitet bereits daran.

Seit 18.9.2026.

  • #1770 von @ajm188 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
86/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go, mysql
Bereich
databases

Rechercherichtung

Beginne in go/logic/migrator.go bei finalCleanup und verfolge den Noop- und Resume-Zustand während der dokumentierten Checkpoint- und Resume-Sequenz. Führe nach einer unterbrochenen Execute-Migration einen Resume-Dry-Run durch und überprüfe anschließend, dass die vorhandene Ghost-Tabelle für einen späteren --resume --execute-Lauf weiterhin verfügbar ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Go
Sterne
13.6k
Forks
1.4k
Ø Merge
9 T. 19 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus github/gh-ost

Alle Issues in github/gh-ost

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.