Skip to content

Commit

Permalink
Merge pull request #2918 from kuzudb/string_read_fix
Browse files Browse the repository at this point in the history
Fix reading strings from the hash index overflow file
  • Loading branch information
benjaminwinger committed Feb 20, 2024
2 parents 351ea0c + e091497 commit fb860a6
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit fb860a6

Please sign in to comment.