tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
11.22k stars 286 forks source link

fix bug for case when S3 has more than 1 page of data #1694

Closed sivukhin closed 2 months ago

sivukhin commented 2 months ago

Context

During recovery from WAL bottomless has bug in case when S3 has more than 1 page of frames.

The code is written in such a way that it tracks last injected frame number and abort recovery process of frame range from S3 doesn't match current next expected frame. This procedure is OK but the code reset last_injected_frame_no to zero for every S3 page which will lead to mismatch between expected and real frame number for every second page (if it will be) from S3.

This PR fixes this issue and just preserve frame number across S3 pages.