有谁知道为什么 DeleteObsoleteFiles 成员函数在 leveldb 中是私有的?在某些情况下,我需要释放一些磁盘空间,其中一种方法是尝试删除 leveldb 过时的文件。那么我可以将其公开并安全调用吗?
问问题
343 次
1 回答
1
压缩后文件变得“过时”:
DeleteObsoleteFiles()
在每次压缩结束和恢复结束时调用。它查找数据库中所有文件的名称。它删除所有不是当前日志文件的日志文件。它会删除所有未从某个级别引用且不是活动压缩的输出的表文件。
如果要减少占用的磁盘空间,可以运行压缩
// Compact the underlying storage for the key range [*begin,*end].
// In particular, deleted and overwritten versions are discarded,
// and the data is rearranged to reduce the cost of operations
// needed to access the data. This operation should typically only
// be invoked by users who understand the underlying implementation.
//
// begin==NULL is treated as a key before all keys in the database.
// end==NULL is treated as a key after all keys in the database.
// Therefore the following call will compact the entire database:
// db->CompactRange(NULL, NULL);
virtual void CompactRange(const Slice* begin, const Slice* end)
于 2014-03-16T16:22:56.533 回答