Archive: a segment damaged before its first event reads as an empty one
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- backend-api-design
Direzione di ricerca
Start by tracing how readRecordsWith in core/session/archive/reader.go reports truncation through Page and Earlier in core/session/archive/read.go, then check replay callers in core/session/archive/replay.go and the pre-first-record branch in core/sessionapi/export.go. The issue leaves open whether to propagate the flag or return an error for damage before the first event, so check the compatibility implications for callers outside this repo. Add the garbage-first-bytes test expecting HTTP 500, and update the export comments and docs/session-export.md once the behavior is settled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Split out of the #1830 review.
What happens
readRecordsWith (core/session/archive/reader.go) reports a torn tail or an
undecodable line as truncated=true, err=nil — a property of the data, not a
failure. Page then discards that flag (_, err := readSegment(...) in
core/session/archive/read.go:57), so no caller above it can tell a damaged
segment from a complete one.
For the paging endpoints that is the intended, documented behaviour: serve the
readable prefix. But a segment damaged before its first event has no readable
prefix, so it contributes nothing and is indistinguishable from an empty archive:
segment -> 39 bytes of non-zstd garbage GET /v1/export 200 application/x-ndjson ""
segment -> symlink loop (ELOOP) GET /v1/export 500 {"error":"archive read failed"}
Only a segment that cannot be opened produces an error today. GET /v1/export
(#1830) documents this as the tolerated case, and docs/session-export.md says an
export is not a way to detect a corrupt archive — but "nothing happened this month"
and "this month will not decode" really are different answers, and a backup/export
consumer is exactly who wants to tell them apart.
What to do
Hand truncated up from Page/Earlier, or distinguish "torn before the first
event in a non-empty file" from "torn tail" and return that as an error. Then
handleExport's pre-first-record branch catches it and answers 500, and the
claims in core/sessionapi/export.go and docs/session-export.md can be
strengthened back.
This is an archive-package change with paging and replay as callers, which is why
it is not in #1830. core/ is consumed outside this repo, so a signature change
needs the usual care.
Scope
core/session/archive/{reader,read,replay}.gocore/sessionapi/export.gocomments +docs/session-export.mdonce it lands- a test with a segment whose first bytes are garbage, asserting 500 rather than an empty 200
Refs #1810, #1830
Assisted-By: Claude (Anthropic AI) [email protected]
- Lingua principale
- Go
- Stelle
- 31
- Fork
- 49
- Merge medio
- 9h 43m
- PR unite (30g)
- 367
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 rossoctl/cortex
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug laptop
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rossoctl/cortex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
taskmanager: a failed v1alpha1 backup leaves the partial backup behindForse già presa @arshil42 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ether/etherpad-go#571 ·
I maintainer di solito rispondono entro 1 giorno
-
labeler: read a limit above math.MaxInt as math.MaxInt in nonNegative (CodeQL alerts #20 and #21)Apertacost:approved factory:queued factory:tracking priority:p2 rank:12 ready-for-doing task:approved tokens:50k
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sisaku-security/sisakulint#860 · 2 commenti ·