DeleteObsoleteFiles メンバー関数が leveldb でプライベートである理由を知っている人はいますか? いくつかのディスク領域を解放する必要がある状況があり、それを行う方法の 1 つは、leveldb の古いファイルを削除することです。それで、公開して安全に呼び出すことができますか?
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 に答える