WAL ReadAll() truncates the file even upon transient I/O error

Aperta
#685 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Read the WAL's ReadAll() method and the readRecord call shown in the issue. Trace how readRecord reports transient I/O errors versus CRC corruption, then check the WAL tests for coverage of both cases. Done means transient read errors cause the process to fail without truncating the file, while corrupted records retain their intended handling.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In the WAL's ReadAll() method, we have the following code:

	var payloads [][]byte
	for bytesToRead > 0 {
		payload, bytesRead, err := readRecord(w.file, bytesToRead)
		// record was corrupted in wal
		if err != nil {
			return payloads, w.truncateAt(fileInfo.Size() - bytesToRead)
		}

readRecord reads a record and checks its CRC. The readRecord therefore can fail due to two reasons:

  1. A transient read error
  2. A corruption of the records inside the file.

The handling in ReadAll doesn't distinguish between the two, and truncates the file anyway.

We therefore need to crash upon a transient read error instead of truncating the file.

Lingua principale
Go
Stelle
22
Fork
4
Merge medio
2g 4h
PR unite (30g)
43

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ava-labs/Simplex

Tutte le issue di ava-labs/Simplex

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.