Append is not cancel safe

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

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
rust
Área
databases

Línea de trabajo

Start by tracing append_record through the in-memory updates described in the issue, then inspect mem/queue.rs:87 and the record_metas and concatenated_records updates. Reproduce cancellation with a tokio timeout or task cancellation. Done means cancellation cannot leave disk and RAM inconsistent, cause the reported panic, or make reloading identify corruption.

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

Descripción

If append_record is not "polled to its end", for instance if it is wrapped in tokio timeout, or if the task running it is cancelled,
then we can end up in a corrupted state.

The code looks as follows

- get next record position by looking at the last record in RAM.
- write on disk
- (C) write on RAM

If the task is stopped in the middle of (C), we end up in a state where what is on disk does not match what is in RAM.
In particular, on the next add, we will use a record position that might actually already be on disk.

As we reload the mrecordlog from disk, this is identified as a corruption.
This has been observed in prod.

A second case also observed is a straight panic.
Here the cause the preemption is assumed to have happened after we appended the record metas
and before we had populated the concatenated_records rolling buffer.

        self.record_metas.push(record_meta);
        self.concatenated_records.extend(payload);

The panic reported is

2024-02-28T23:41:54Z app[7816406b969758] iad [info]thread 'tokio-runtime-worker' panicked at /usr/local/cargo/git/checkouts/mrecordlog-34aad39ce3e0e659/bc6a998/src/mem/queue.rs:87:46:
2024-02-28T23:41:54Z app[7816406b969758] iad [info]slice index starts at 928 but ends at 0
Lenguaje dominante
Rust
Estrellas
33
Forks
11
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

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 quickwit-oss/mrecordlog

Todos los issues de quickwit-oss/mrecordlog

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.