Roman Titov 291be89400 Extend SerdeWal to better track the last truncated-to WAL index (#1815) (#1868)
* Skip applied WAL operations on shard load

* fixup! Skip applied WAL operations on shard load

- Skip WAL operation up to the *minimal* persisted version
- Add explanation comment

* fixup! Skip applied WAL operations on shard load

- "beautify" `skip_while` expression
- handle version `0` corner case (and add explanation)

* Update `Segment::handle_version` comment

* Simplify `Segment::handle_version` a bit

* Refactor `check_unprocessed_points`

* fixup! Refactor `check_unprocessed_points`

Optimized `check_unprocessed_points`

* Revert `LocalShard::load_from_wal` and `check_unprocessed_points` changes

* Downgrade failure in `check_unprocessed_points` to a warning

* Persist/track the first un-truncated index in `SerdeWal`...

...and use it as first index for WAL operations

* fixup! Downgrade failure in `check_unprocessed_points` to a warning

Downgrade failure in `check_unprocessed_points` to a warning *during `LocalShard::load_from_wal`* 馃檲

* fixup! Persist/track the first un-truncated index in `SerdeWal`...

Words...

* Fix a bug in `SerdeWal::truncated_prefix_entries_num` and add explanation comment

* Fix a bug in `SerdeWal::ack`

* prevent unnesessary savings, use json, never decrease ack index

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-06-19 14:52:43 +02:00
..