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

fix wrong alloc size when do heavy gc for blob file #5693

Merged
merged 3 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion dbms/src/Storages/Page/V3/BlobStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,10 @@ PageEntriesEdit BlobStore::gc(std::map<BlobFileId, PageIdAndVersionedEntries> &
}
alloc_size = std::max(alloc_size, biggest_page_size);
}
else
{
alloc_size = total_page_size;
}

BlobFileOffset remaining_page_size = total_page_size - alloc_size;

Expand Down Expand Up @@ -1531,7 +1535,7 @@ void BlobStore::BlobStats::BlobStat::restoreSpaceMap(BlobFileOffset offset, size
if (!smap->markUsed(offset, buf_size))
{
smap->logDebugString();
throw Exception(fmt::format("Restore postion from BlobStat failed, the space/subspace is already being used [offset={}] [buf_size={}] [blob_id={}]",
throw Exception(fmt::format("Restore position from BlobStat failed, the space/subspace is already being used [offset={}] [buf_size={}] [blob_id={}]",
offset,
buf_size,
id),
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Storages/Page/V3/tests/gtest_blob_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ TEST_F(BlobStoreTest, GC)
ASSERT_TRUE(file1.exists());
ASSERT_TRUE(file2.exists());
ASSERT_EQ(file1.getSize(), file2.getSize());
ASSERT_EQ(blob_store.blob_stats.blobIdToStat(2)->sm_total_size, file2.getSize());
}


Expand Down