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

chore(tiering): Faster small bins serialization #2 #3396

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
Prev Previous commit
chore: delete pages on load finish
dranikpg committed Aug 24, 2024
commit 20df3bef6eb583bac67f1f7eb56827343c463455
13 changes: 12 additions & 1 deletion src/server/rdb_load.cc
Original file line number Diff line number Diff line change
@@ -485,7 +485,7 @@ void RdbLoaderBase::OpaqueObjLoader::operator()(const RdbSBF& src) {
}

void RdbLoaderBase::OpaqueObjLoader::operator()(const RdbTieredSegment& src) {
CHECK(false) << "unreachable";
LOG(FATAL) << "unrechable";
}

void RdbLoaderBase::OpaqueObjLoader::CreateSet(const LoadTrace* ltrace) {
@@ -2163,6 +2163,7 @@ error_code RdbLoader::Load(io::Source* src) {

// Flush all small items
HandleSmallItems(true);
DeleteTieredPages();

FlushAllShards();

@@ -2682,6 +2683,16 @@ void RdbLoader::HandleSmallItems(bool flush) {
}
}

void RdbLoader::DeleteTieredPages() {
auto& store = EngineShard::tlocal()->tiered_storage()->BorrowStorage();
for (auto& [offset, page] : small_items_pages_) {
if (!holds_alternative<tiering::DiskSegment>(page))
continue;
auto segment = get<tiering::DiskSegment>(page);
store.MarkAsFree(segment);
}
}

void RdbLoader::LoadSearchIndexDefFromAux(string&& def) {
facade::CapturingReplyBuilder crb{};
ConnectionContext cntx{nullptr, nullptr, &crb};
3 changes: 3 additions & 0 deletions src/server/rdb_load.h
Original file line number Diff line number Diff line change
@@ -277,7 +277,10 @@ class RdbLoader : protected RdbLoaderBase {

void LoadScriptFromAux(std::string&& value);

// Materialize small items pages with most hits until a limited amount of entries is left.
// When flush is set, all pages are materialized.
void HandleSmallItems(bool flush);
void DeleteSmallItemsPages(); // Delete all small items pages
std::error_code LoadTieredPage();

// Load index definition from RESP string describing it in FT.CREATE format,