tursodatabase / libsql

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

Swap segment strategy #1727

Closed MarinPostma closed 2 weeks ago

MarinPostma commented 2 weeks ago

This PR proposes a mecanism to configure when the current segment should be swapped with more control.

For this end, the SegmentSwapTrait is introduced that let's us define and compose strategies for when to swap the current segment

Two base strategies are also implemented:

those strategy are then composed and used in SharedWal, with the following hardcoded setting: