WIP: Add API and implementation for compacting the Baloo database
The Baloo database can grow significantly on a large file system with a lot of files. If there is a lot of churn, the database can also grow to include a lot of slack - where a large part of the database is empty.
In one example, mdb_stat
reports ~10GB of unused space in the database: https://bugs.kde.org/show_bug.cgi?id=354636#c10
This branch implements a Database
API and appropriate D-Bus and balooctl integration to allow manual - and in the future maybe automatic - compaction of the database file by invoking mdb_env_copy2
with the MDB_CP_COMPACT
flag and then replacing the old database with the copy.
Still missing test code and I'm also a bit worried about concurrency.
This is a work in progress and a suggestion to Baloo developers to implement functionality that I believe is missing from the current code base that is required for a modern file indexer. It is definitely not ready for release.
I would appreciate it if Baloo developers can review the code and offer suggestions and discuss the applicability of this change. Thanks in advance!