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 reading strings from the hash index overflow file #2918

Merged
merged 1 commit into from
Feb 20, 2024
Merged
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
7 changes: 5 additions & 2 deletions src/storage/storage_structure/disk_overflow_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ std::string DiskOverflowFile::readString(TransactionType trxType, const ku_strin
auto numBytesToReadInPage = std::min(
static_cast<uint32_t>(remainingLength), END_OF_PAGE - cursor.elemPosInPage);
page_idx_t nextPage;
auto startPosInSrc = retVal.size();
bufferManager->optimisticRead(*fileHandleToPin, pageIdxToPin, [&](uint8_t* frame) {
retVal +=
// Replace rather than append, since optimistic read may call the function multiple
// times
retVal.replace(startPosInSrc, numBytesToReadInPage,
std::string_view(reinterpret_cast<const char*>(frame) + cursor.elemPosInPage,
numBytesToReadInPage);
numBytesToReadInPage));
nextPage = *(page_idx_t*)(frame + END_OF_PAGE);
});
remainingLength -= numBytesToReadInPage;
Expand Down
Loading