Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Dump a new snapshot if persistent index keep too many WAL #22140

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,8 @@ CONF_String(block_cache_engine, "starcache");

CONF_mInt64(l0_l1_merge_ratio, "10");
CONF_mInt64(l0_max_file_size, "209715200"); // 200MB
sevev marked this conversation as resolved.
Show resolved Hide resolved
CONF_mInt64(l0_max_mem_usage, "67108864"); // 64MB
CONF_mInt32(max_l0_wal_version_num, "200");
sevev marked this conversation as resolved.
Show resolved Hide resolved
CONF_mInt64(l0_max_mem_usage, "67108864"); // 64MB
CONF_mInt64(max_tmp_l1_num, "10");

// Used by query cache, cache entries are evicted when it exceeds its capacity(500MB in default)
Expand Down
3 changes: 2 additions & 1 deletion be/src/storage/persistent_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,7 @@ Status ShardByLengthMutableIndex::load(const MutableIndexMetaPB& meta) {
return Status::InternalError(err_msg);
}
}
_snapshot_version = start_version;
ASSIGN_OR_RETURN(auto read_file, fs->new_random_access_file(index_file_name));
// if mutable index is empty, set _offset as 0, otherwise set _offset as snapshot size
_offset = snapshot_off + snapshot_size;
Expand Down Expand Up @@ -2765,7 +2766,7 @@ Status PersistentIndex::commit(PersistentIndexMetaPB* index_meta) {
RETURN_IF_ERROR(_flush_l0());
}
}
_dump_snapshot |= !_flushed && _l0->file_size() > config::l0_max_file_size;
_dump_snapshot |= !_flushed && _version.major() - _l0->_snapshot_version.major() > config::max_l0_wal_version_num;
sevev marked this conversation as resolved.
Show resolved Hide resolved
// for case1 and case2
if (_flushed) {
// update PersistentIndexMetaPB
Expand Down
1 change: 1 addition & 0 deletions be/src/storage/persistent_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class ShardByLengthMutableIndex {
uint32_t _fixed_key_size = -1;
uint64_t _offset = 0;
uint64_t _page_size = 0;
EditVersion _snapshot_version;
std::string _path;
std::unique_ptr<WritableFile> _index_file;
std::shared_ptr<FileSystem> _fs;
Expand Down