gpt4 book ai didi

c++ - leveldb DeleteObsoleteFiles 是私有(private)的

转载 作者:行者123 更新时间:2023-11-28 07:02:36 24 4
gpt4 key购买 nike

有人知道为什么 DeleteObsoleteFiles 成员函数在 leveldb 中是私有(private)的吗?在某些情况下,我需要释放一些磁盘空间,其中一种方法是尝试删除 leveldb 过时文件。那么我可以将其公开并安全调用吗?

最佳答案

压缩后文件变得“绝对”:

DeleteObsoleteFiles() is called at the end of every compaction and at the end of recovery. It finds the names of all files in the database. It deletes all log files that are not the current log file. It deletes all table files that are not referenced from some level and are not the output of an active compaction.

如果你想减少占用的磁盘空间,你可以运行压缩

  // 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)

关于c++ - leveldb DeleteObsoleteFiles 是私有(private)的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22217942/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com