rocksdb cache adjustments
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "rocksdb/table.h"
|
||||
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
@ -38,12 +40,9 @@ void calculate_allocation_size(bool directory, std::uint64_t file_size,
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_size > allocation_size) {
|
||||
allocation_size = file_size;
|
||||
}
|
||||
|
||||
allocation_size =
|
||||
utils::divide_with_ceiling(allocation_size, WINFSP_ALLOCATION_UNIT) *
|
||||
utils::divide_with_ceiling(std::max(file_size, allocation_size),
|
||||
WINFSP_ALLOCATION_UNIT) *
|
||||
WINFSP_ALLOCATION_UNIT;
|
||||
allocation_meta_size = std::to_string(allocation_size);
|
||||
}
|
||||
@ -51,8 +50,8 @@ void calculate_allocation_size(bool directory, std::uint64_t file_size,
|
||||
auto create_rocksdb(
|
||||
const app_config &cfg, const std::string &name,
|
||||
const std::vector<rocksdb::ColumnFamilyDescriptor> &families,
|
||||
std::vector<rocksdb::ColumnFamilyHandle *> &handles,
|
||||
bool clear) -> std::unique_ptr<rocksdb::TransactionDB> {
|
||||
std::vector<rocksdb::ColumnFamilyHandle *> &handles, bool clear)
|
||||
-> std::unique_ptr<rocksdb::TransactionDB> {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto db_dir = utils::path::combine(cfg.get_data_directory(), {"db"});
|
||||
@ -67,11 +66,18 @@ auto create_rocksdb(
|
||||
"failed to remove " + name + " db|" + path);
|
||||
}
|
||||
|
||||
rocksdb::BlockBasedTableOptions table_options{};
|
||||
table_options.block_cache =
|
||||
rocksdb::NewLRUCache(2ULL * 1024ULL * 1024LL * 1024LL);
|
||||
table_options.cache_index_and_filter_blocks = true;
|
||||
|
||||
rocksdb::Options options{};
|
||||
options.create_if_missing = true;
|
||||
options.create_missing_column_families = true;
|
||||
options.db_log_dir = cfg.get_log_directory();
|
||||
options.keep_log_file_num = 10;
|
||||
options.table_factory.reset(
|
||||
rocksdb::NewBlockBasedTableFactory(table_options));
|
||||
|
||||
rocksdb::TransactionDB *ptr{};
|
||||
auto status = rocksdb::TransactionDB::Open(
|
||||
|
Reference in New Issue
Block a user