Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Conversation

psarna
Copy link
Contributor

@psarna psarna commented Oct 5, 2023

This commit adds an optional VACUUM operation before our
periodic checkpoint -- since VACUUM should always be followe
by a checkpoint.
The are two criteria to qualify for vacuuming:

  1. We have at least 32MiB of data
  2. There are more free pages in the db than regular ones

If that's the case, we keep the db file more than 2x larger
than it could be, and that calls for a vacuum.
Also, for small databases, we entirely skip vacuuming.

Fixes #734

For a transaction that spans multiple xFrames calls, it's ok
if our last_valid_frame doesn't match the one that came with xFrames.
As long as our last_valid_frame is *not greater* than the one reported,
we're good. If it's greater, we're in trouble and we report a bug.
@psarna psarna requested review from penberg and MarinPostma October 5, 2023 12:36
This commit adds an optional VACUUM operation before our
periodic checkpoint -- since VACUUM should always be followe
by a checkpoint.
The are two criteria to qualify for vacuuming:
1. We have at least 32MiB of data
2. There are more free pages in the db than regular ones

If that's the case, we keep the db file more than 2x larger
than it could be, and that calls for a vacuum.
Also, for small databases, we entirely skip vacuuming.

Fixes libsql#734
@MarinPostma MarinPostma enabled auto-merge October 5, 2023 12:52
@MarinPostma MarinPostma added this pull request to the merge queue Oct 5, 2023
Merged via the queue into libsql:main with commit 6d72aca Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add trigger to VACCUM
2 participants