mneme.db:shrink

mneme

db:shrink() -> pages, err

Give the free tail of the file back to the filesystem

Returns the number of pages the file lost, 0 when its tail is not free.

Every commit already cuts a free run of 64 pages or more off the file tail, out of the 3840 oldest retired pages. shrink() looks at every retired page no reader still needs, so it reaches what a bulk delete or a dropped keyspace left. It runs up to 8 write transactions and costs a walk of the retired-batch tree.

No data page moves. A live page at the tail keeps everything under it in the file; db:compact() rewrites the database in that case.