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

Abierto
#685 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
22
Forks
4
Merge medio
2 d 4 h
PR fusionados (30 d)
43

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ava-labs/Simplex

Todos los issues de ava-labs/Simplex

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.