Faust with auto.offset.reset=latest gets stuck in Recovery when Kafka deletes changelog segments during recovery
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 15/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- kafka, python
- Ambito
- distributed-systems, stream-processing
Direzione di ricerca
Start with faust/tables/recovery.py around lines 888-890, where recovery waits for a changelog record, and faust/transport/drivers/aiokafka.py around lines 1010-1030, where auto.offset.reset is applied to changelog topics. The aiokafka fetcher's out-of-range offset handling is the other place to read. Done means recovery finishes when changelog segments are deleted mid-recovery with auto.offset.reset=latest. Reproducing it needs a test that shortens changelog retention during recovery.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Checklist
- I have included information about relevant versions - all versions
- I have verified that the issue persists when using the
masterbranch of Faust.
Steps to reproduce
The problem is that faust can get stuck in recovery forever when auto.offset.reset is "latest" (https://faust-streaming.github.io/faust/userguide/settings.html#consumer-auto-offset-reset). In recovery, the fetcher keeps fetching records from the changelog topics to rebuild its in-memory state. Say these changelog topic partitions are so large that recovery will take some time. During this recovery time, Kafka may independently remove some topic partition segments in line with the retention policy of the changelog topic. All this while the faust client is still fetching records from the changelog topic partitions. For example:
time t - changelog segments: earliest |----------------------------|----------------------| latest offset
time t+1 - recovery progress: earliest |............R
time t+2 - changelog segments: new earliest |----------------------| latest offset
time t+3 - recovery has offset R, but offset R+1 no longer exists in the changelog topic
Therefore at time t+3 since offset R no longer exists in the changelog topic the fetcher will jump to an offset as configured by auto.offset.reset. This is the normal Kafka consumer behavior when the offset of a consumer group is no longer in the topic. See: https://github.com/aio-libs/aiokafka/blob/49a557334584b5a09e96e78609b111777e14b2fb/aiokafka/consumer/fetcher.py#L794-L796
If auto.offset.reset=latest the fetcher jumps to latest offset + 1, instead of the new earliest. Therefore, the fetcher will wait for one more record to be published to the changelog topic. But we're still in recovery mode, so, by construction, nothing is publishing to the changelog. Recovery cannot finish and faust is stuck in recovery forever. See: https://github.com/faust-streaming/faust/blob/ff75c0be3d784d28b9f69ba3ea94be769b151b89/faust/tables/recovery.py#L888-L890
Remember that, faust applies the same auto.offset.reset to all input topics (including changelogs), and does not make any distinction while fetching.
https://github.com/faust-streaming/faust/blob/ff75c0be3d784d28b9f69ba3ea94be769b151b89/faust/transport/drivers/aiokafka.py#L1010-L1030
This behavior is difficult to reproduce. If we set auto.offset.reset to latest. One would need to modify the retention policy of a changelog topic during recovery (maybe adding some asyncio.sleep in the recovery task to buy some time).
Expected behavior
Recovery should eventually finish.
Actual behavior
Faust is stuck in recovery.
- Lingua principale
- Python
- Stelle
- 1.9k
- Fork
- 205
- Merge medio
- 2h 2m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di faust-streaming/faust
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
faust-streaming/faust#804 ·
-
scripts/install script forces use of ./venv virtualenv, impossible to use with virtualenvwrapperAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
faust-streaming/faust#28 · 1 commento ·
-
[BUG] SASL PLAINTEXT producer initialization fails : missing sasl_plain_username/passwordForse già presa @wbarnha l’ha presa 56 giorni fa. Aperta
faust-streaming/faust#794 · 2 commenti · 1 reazione · 2 assegnatari ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
faust-streaming/faust#670 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
faust-streaming/faust#666 ·
Tutte le issue di faust-streaming/faust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Maintainer] task area:visualizer
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
RailtownAI/railtracks#1824 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
apache/datafusion#27688 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
mloda-ai/mloda-registry#1664 ·
I maintainer di solito rispondono entro 1 giorno