Migration hangs when --attempt-instant-ddl succeeds
Mantenedores costumam responder em até 10 dias
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 30/100
Direção de pesquisa
Start with Migrate() in go/logic/migrator.go, where the instant-DDL branch returns without reading ghostTableMigrated, then follow onChangelogStateEvent and notifyListeners to see where listenersMutex is held during the blocking send. The binlog side is shouldDecodeRowsEvent in the event streamer, reached through BinlogSyncer.Close() in finalCleanup. Done means the instant-DDL success path returns without hanging, with a test covering that short-circuit.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Overview
A migration run with --attempt-instant-ddl against a server that can apply the
ALTER instantly applies it, logs Success! table ... migrated instantly, and then
never returns. gh-ost hangs until it is killed.
Reproduced on master (dd44453f) and on v1.1.11.
Why
Migrate() short-circuits on the instant-DDL path: on success it calls
finalCleanup(), runs the OnSuccess hook and returns, so it never reads
<-mgtr.ghostTableMigrated.
Three goroutines then form a cycle:
-
The changelog listener parks on the
GhostTableMigratedsend in
onChangelogStateEvent.ghostTableMigratedis unbuffered and the
instant-DDL path never reads it, so the send blocks. It is wrapped in
base.SendWithContext, which only unblocks on context cancellation — and
nothing cancels the context here, precisely becauseMigrate()has not
returned. The listener is invoked fromnotifyListeners, which holds
listenersMutexacross the synchronous call, so the mutex stays held for as
long as the send is parked. -
The binlog parser goroutine (go-mysql's
BinlogSyncer.onStream) calls
EventsStreamer.shouldDecodeRowsEventthroughRowsEventDecodeFuncand
blocks taking that samelistenersMutex. -
BinlogSyncer.Close(), reached fromfinalCleanup()→
EventsStreamer.Close(), ends inb.wg.Wait()and waits for that parser
goroutine, which is never coming back.
Step 2 is what makes the cycle reachable. shouldDecodeRowsEvent was introduced
by #1699 ("Don't parse binlog events of unrelated tables", first released in
v1.1.11); it put listenersMutex on the binlog parser's goroutine, so a listener
parked while holding that mutex now stalls the parser directly, and with it
BinlogSyncer.Close().
--attempt-instant-ddl defaults to off and the short-circuit has no test
coverage, which is presumably why this has not been reported before. We hit it in
a downstream consumer that passes the flag for every migration, where every ALTER
MySQL could apply instantly hung.
Reproduction
Any instant-applicable ALTER on MySQL 8.0 with the flag set, e.g.
gh-ost --host=... --database=test --table=testing \
--alter='ADD COLUMN author varchar(255)' \
--attempt-instant-ddl --allow-on-master --execute
The column is added, Success! ... migrated instantly is logged, and the process
does not exit.
Fix
PR to follow: scope listenersMutex to the listener lookup in notifyListeners,
and give ghostTableMigrated a one-slot buffer.
- Linguagem predominante
- Go
- Estrelas
- 13.6k
- Forks
- 1.4k
- Merge médio
- 9d 19h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/gh-ost
-
`--resume` without `--execute` drops the ghost table it correctly skipped alteringTalvez já em andamento @ajm188 assumiu há 56 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 10 dias
-
[Suggestion] Apply simple validation to alter commandTalvez já em andamento @drkemp187 assumiu há 106 dias. Abertaenhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
github/gh-ost#1431 · 4 comentários ·
Mantenedores costumam responder em até 10 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
Mantenedores costumam responder em até 10 dias
-
Atomic cut-over always fails on MySQL 9.1+: information_schema.processlist errors out (3854) while another session runs a non-BMP utf8mb4 statementTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
github/gh-ost#1780 · 1 comentário ·
Mantenedores costumam responder em até 10 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 10 dias
Todas as issues de github/gh-ost
Issues semelhantes
-
[Docs] Four internal links return 404 (Models concept, Contributing to Docs, Providers reference)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
meshery/meshery#23520 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
flaky: execenv TestRelayControlledCancelAndDirectParentDeath reads an empty pid file under loadAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
SocialGouv/iterion#3263 ·
Mantenedores costumam responder em até 1 dia
-
Container registry refuses image names with "__" or "--" (NAME_INVALID), which the OCI distribution spec allows since v1.1.0Talvez já em andamento @lazerg assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Unsupported language versionAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
itadori26/trisse-home#226 ·
Mantenedores costumam responder em até 1 dia