ClickhouseMigrator records migrations as done before running them, so a failed migration is skipped on the next run
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Hello,
Follow-up to #5440, now closed by #9248. That PR fixed the SQLite ledger DDL and removed BEGIN TRANSACTION for ClickHouse. One problem is left: the migrator writes every pending migration to the history table before running any of them. Without a transaction on ClickHouse, nothing undoes those rows when a migration fails.
Found by reading the source of effect 4.0.6. The same steps are still on main (16fe800):
- Migrator.ts#L269-L272 skips every migration with
currentId <= latestMigrationId. - Migrator.ts#L282-L293 inserts all
requiredmigrations into the history table. - Migrator.ts#L296-L305 only then runs each migration.
- Migrator.ts#L327-L332 runs all of this outside a transaction for ClickHouse.
Scenario I expect from that code, with pending migrations 1, 2 and 3:
- all three are recorded
- migration 1 runs a
CREATE TABLEthat ClickHouse rejects,runfails - 2 and 3 never run
- on the next start,
latestMigrationIdis 3, so all three are skipped and the app starts against a schema that never got them
No DROP or partial DDL needed, one rejected CREATE is enough.
I'm not asking for atomic DDL on ClickHouse. I'd just expect a migration to be recorded only once it succeeded, for example by inserting each row right after its own migration completes.
Separate thing that blocked my end-to-end repro
I couldn't confirm the scenario above in practice because of a different failure. With the real ClickhouseClient 4.0.6 against a local ClickHouse 26.9.22.3:
ClickhouseMigrator.run({
loader: ClickhouseMigrator.fromRecord({
"1_create_product_event": /* ... */
})
})
with ClickhouseClient.make providing SqlClient.SqlClient. effect_sql_migrations gets created (SHOW TABLES lists it), then the run fails right away with SqlError "Failed to parse result", cause SyntaxError: JSON Parse error: Unexpected EOF. The application migration never ran. I didn't isolate which statement returns the empty body.
So I never got to the point of seeing a history row left behind by a failed migration. The ordering issue comes from reading the code, not from an observed run.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 10h 13m
- PR unite (30g)
- 800
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 Effect-TS/effect
-
RpcTest.makeClient: accept disableFatalDefectsForse già presa @effect-bot l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Effect-TS/effect#9893 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
@effect/ai-anthropic: responses whose usage has only input_tokens and output_tokens fail to decode (Anthropic-compatible gateways)Forse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#9963 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
McpClient rejects McpServer's method-not-found response and fails later stdio requestsForse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#9958 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
SQLite withTransaction: interrupting a queued transaction as it gets the connection leaks the connectionForse già presa @effect-bot l’ha presa oggi. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
HttpApi drops nested object fields in query and form-urlencoded payloadsForse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#9953 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
outline/outline#14348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Agent import retains quotes in .env API keys followed by inline commentsForse già presa @yxr-2025 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
elie222/rakazo#2322 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
awslabs/visual-asset-management-system#804 ·
I maintainer di solito rispondono entro 1 giorno
-
用户目录有单引号时,热加载时YAML解析崩溃Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
dsh-market/dsh-market#1027 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno