From b81224a402e8976bdd937fb70c030de0168894d6 Mon Sep 17 00:00:00 2001 From: xiyang Date: Fri, 16 Jun 2023 14:01:33 -0400 Subject: [PATCH] remove overflow buffer utils --- src/common/CMakeLists.txt | 1 - src/common/in_mem_overflow_buffer_utils.cpp | 19 ------ src/common/types/ku_string.cpp | 15 ++--- src/common/vector/auxiliary_buffer.cpp | 8 --- src/common/vector/value_vector.cpp | 63 +++++++++++++++++-- src/common/vector/value_vector_utils.cpp | 22 +++---- .../literal_evaluator.cpp | 8 +-- .../common/in_mem_overflow_buffer_utils.h | 28 --------- src/include/common/types/ku_list.h | 2 - src/include/common/types/ku_string.h | 20 ++++++ src/include/common/vector/auxiliary_buffer.h | 4 +- src/include/common/vector/value_vector.h | 11 ++-- src/include/function/aggregate/collect.h | 1 - src/include/function/cast/cast_operations.h | 1 - .../list/operations/list_append_operation.h | 1 - .../storage_structure/disk_overflow_file.h | 11 ++-- src/storage/storage_structure/column.cpp | 1 - .../storage_structure/disk_overflow_file.cpp | 29 ++++----- test/storage/disk_array_update_test.cpp | 1 - 19 files changed, 122 insertions(+), 124 deletions(-) delete mode 100644 src/common/in_mem_overflow_buffer_utils.cpp delete mode 100644 src/include/common/in_mem_overflow_buffer_utils.h diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 2aee73b2ab8..50cf13a0038 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -12,7 +12,6 @@ add_library(kuzu_common expression_type.cpp file_utils.cpp in_mem_overflow_buffer.cpp - in_mem_overflow_buffer_utils.cpp logging_level_utils.cpp metric.cpp null_mask.cpp diff --git a/src/common/in_mem_overflow_buffer_utils.cpp b/src/common/in_mem_overflow_buffer_utils.cpp deleted file mode 100644 index 9fcd8bef57b..00000000000 --- a/src/common/in_mem_overflow_buffer_utils.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "common/in_mem_overflow_buffer_utils.h" - -namespace kuzu { -namespace common { - -void InMemOverflowBufferUtils::copyString( - const char* src, uint64_t len, ku_string_t& dest, InMemOverflowBuffer& inMemOverflowBuffer) { - InMemOverflowBufferUtils::allocateSpaceForStringIfNecessary(dest, len, inMemOverflowBuffer); - dest.set(src, len); -} - -void InMemOverflowBufferUtils::copyString( - const ku_string_t& src, ku_string_t& dest, InMemOverflowBuffer& inMemOverflowBuffer) { - InMemOverflowBufferUtils::allocateSpaceForStringIfNecessary(dest, src.len, inMemOverflowBuffer); - dest.set(src); -} - -} // namespace common -} // namespace kuzu diff --git a/src/common/types/ku_string.cpp b/src/common/types/ku_string.cpp index fbedd6285c0..1f81183426b 100644 --- a/src/common/types/ku_string.cpp +++ b/src/common/types/ku_string.cpp @@ -1,7 +1,5 @@ #include "common/types/ku_string.h" -#include - namespace kuzu { namespace common { @@ -10,23 +8,18 @@ void ku_string_t::set(const std::string& value) { } void ku_string_t::set(const char* value, uint64_t length) { - this->len = length; if (length <= SHORT_STR_LENGTH) { - memcpy(prefix, value, length); + setShortString(value, length); } else { - memcpy(prefix, value, PREFIX_LENGTH); - memcpy(reinterpret_cast(overflowPtr), value, length); + setLongString(value, length); } } void ku_string_t::set(const ku_string_t& value) { - this->len = value.len; if (value.len <= SHORT_STR_LENGTH) { - memcpy(prefix, value.prefix, value.len); + setShortString(value); } else { - memcpy(prefix, value.prefix, PREFIX_LENGTH); - memcpy(reinterpret_cast(overflowPtr), reinterpret_cast(value.overflowPtr), - value.len); + setLongString(value); } } diff --git a/src/common/vector/auxiliary_buffer.cpp b/src/common/vector/auxiliary_buffer.cpp index 728d56e0654..b4fd300b818 100644 --- a/src/common/vector/auxiliary_buffer.cpp +++ b/src/common/vector/auxiliary_buffer.cpp @@ -1,18 +1,10 @@ #include "common/vector/auxiliary_buffer.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "common/vector/value_vector.h" namespace kuzu { namespace common { -void StringAuxiliaryBuffer::addString( - common::ValueVector* vector, uint32_t pos, char* value, uint64_t len) const { - assert(vector->dataType.getLogicalTypeID() == LogicalTypeID::STRING); - auto& entry = ((ku_string_t*)vector->getData())[pos]; - InMemOverflowBufferUtils::copyString(value, len, entry, *inMemOverflowBuffer); -} - StructAuxiliaryBuffer::StructAuxiliaryBuffer( const LogicalType& type, storage::MemoryManager* memoryManager) { auto fieldTypes = StructType::getFieldTypes(&type); diff --git a/src/common/vector/value_vector.cpp b/src/common/vector/value_vector.cpp index d8cf8d6facf..a96c678f853 100644 --- a/src/common/vector/value_vector.cpp +++ b/src/common/vector/value_vector.cpp @@ -51,11 +51,6 @@ void ValueVector::setValue(uint32_t pos, T val) { ((T*)valueBuffer.get())[pos] = val; } -template<> -void ValueVector::setValue(uint32_t pos, std::string val) { - StringVector::addString(this, pos, val.data(), val.length()); -} - void ValueVector::resetAuxiliaryBuffer() { switch (dataType.getPhysicalType()) { case PhysicalTypeID::STRING: { @@ -126,8 +121,64 @@ template void ValueVector::setValue(uint32_t pos, double_t val); template void ValueVector::setValue(uint32_t pos, date_t val); template void ValueVector::setValue(uint32_t pos, timestamp_t val); template void ValueVector::setValue(uint32_t pos, interval_t val); -template void ValueVector::setValue(uint32_t pos, ku_string_t val); template void ValueVector::setValue(uint32_t pos, list_entry_t val); +template<> +void ValueVector::setValue(uint32_t pos, ku_string_t val) { + StringVector::addString(this, pos, val); +} +template<> +void ValueVector::setValue(uint32_t pos, std::string val) { + StringVector::addString(this, pos, val.data(), val.length()); +} + +void StringVector::addString(ValueVector* vector, uint32_t vectorPos, ku_string_t& srcStr) { + assert(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING); + auto stringBuffer = reinterpret_cast(vector->auxiliaryBuffer.get()); + auto& dstStr = vector->getValue(vectorPos); + if (ku_string_t::isShortString(srcStr.len)) { + dstStr.setShortString(srcStr); + } else { + dstStr.overflowPtr = reinterpret_cast(stringBuffer->allocateOverflow(srcStr.len)); + dstStr.setLongString(srcStr); + } +} + +void StringVector::addString( + ValueVector* vector, uint32_t vectorPos, const char* srcStr, uint64_t length) { + assert(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING); + auto stringBuffer = reinterpret_cast(vector->auxiliaryBuffer.get()); + auto& dstStr = vector->getValue(vectorPos); + if (ku_string_t::isShortString(length)) { + dstStr.setShortString(srcStr, length); + } else { + dstStr.overflowPtr = reinterpret_cast(stringBuffer->allocateOverflow(length)); + dstStr.setLongString(srcStr, length); + } +} + +void StringVector::addString(ValueVector* vector, ku_string_t& dstStr, ku_string_t& srcStr) { + assert(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING); + auto stringBuffer = reinterpret_cast(vector->auxiliaryBuffer.get()); + if (ku_string_t::isShortString(srcStr.len)) { + dstStr.setShortString(srcStr); + } else { + dstStr.overflowPtr = reinterpret_cast(stringBuffer->allocateOverflow(srcStr.len)); + dstStr.setLongString(srcStr); + } +} + +void StringVector::addString( + ValueVector* vector, ku_string_t& dstStr, const char* srcStr, uint64_t length) { + assert(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING); + auto stringBuffer = reinterpret_cast(vector->auxiliaryBuffer.get()); + if (ku_string_t::isShortString(length)) { + dstStr.setShortString(srcStr, length); + } else { + dstStr.overflowPtr = reinterpret_cast(stringBuffer->allocateOverflow(length)); + dstStr.setLongString(srcStr, length); + } +} + } // namespace common } // namespace kuzu diff --git a/src/common/vector/value_vector_utils.cpp b/src/common/vector/value_vector_utils.cpp index fce7ce07227..fd36f81547e 100644 --- a/src/common/vector/value_vector_utils.cpp +++ b/src/common/vector/value_vector_utils.cpp @@ -1,6 +1,5 @@ #include "common/vector/value_vector_utils.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "common/null_buffer.h" #include "processor/result/factorized_table.h" @@ -46,10 +45,7 @@ void ValueVectorUtils::copyNonNullDataWithSameTypeIntoPos( } } break; case PhysicalTypeID::STRING: { - auto dstData = resultVector.getData() + - pos * processor::FactorizedTable::getDataTypeSize(resultVector.dataType); - InMemOverflowBufferUtils::copyString(*(ku_string_t*)srcData, *(ku_string_t*)dstData, - *StringVector::getInMemOverflowBuffer(&resultVector)); + StringVector::addString(&resultVector, pos, *(ku_string_t*)srcData); } break; default: { auto dataTypeSize = processor::FactorizedTable::getDataTypeSize(resultVector.dataType); @@ -107,10 +103,15 @@ void ValueVectorUtils::copyNonNullDataWithSameTypeOutFromPos(const ValueVector& memcpy(dstData, &dstList, sizeof(dstList)); } break; case PhysicalTypeID::STRING: { - auto srcData = srcVector.getData() + - pos * processor::FactorizedTable::getDataTypeSize(srcVector.dataType); - InMemOverflowBufferUtils::copyString( - *(ku_string_t*)srcData, *(ku_string_t*)dstData, dstOverflowBuffer); + auto& srcStr = srcVector.getValue(pos); + auto& dstStr = *(ku_string_t*)dstData; + if (ku_string_t::isShortString(srcStr.len)) { + dstStr.setShortString(srcStr); + } else { + dstStr.overflowPtr = + reinterpret_cast(dstOverflowBuffer.allocateSpace(srcStr.len)); + dstStr.setLongString(srcStr); + } } break; default: { auto dataTypeSize = processor::FactorizedTable::getDataTypeSize(srcVector.dataType); @@ -158,8 +159,7 @@ void ValueVectorUtils::copyValue(uint8_t* dstValue, common::ValueVector& dstVect } } break; case PhysicalTypeID::STRING: { - common::InMemOverflowBufferUtils::copyString(*(common::ku_string_t*)srcValue, - *(common::ku_string_t*)dstValue, *StringVector::getInMemOverflowBuffer(&dstVector)); + StringVector::addString(&dstVector, *(ku_string_t*)dstValue, *(ku_string_t*)srcValue); } break; default: { memcpy(dstValue, srcValue, srcVector.getNumBytesPerValue()); diff --git a/src/expression_evaluator/literal_evaluator.cpp b/src/expression_evaluator/literal_evaluator.cpp index 6389513fcd2..0781063261f 100644 --- a/src/expression_evaluator/literal_evaluator.cpp +++ b/src/expression_evaluator/literal_evaluator.cpp @@ -1,6 +1,5 @@ #include "expression_evaluator/literal_evaluator.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "common/vector/value_vector_utils.h" using namespace kuzu::common; @@ -28,7 +27,7 @@ void LiteralExpressionEvaluator::resolveResultVector( } void LiteralExpressionEvaluator::copyValueToVector( - uint8_t* dstValue, common::ValueVector* dstVector, const common::Value* srcValue) { + uint8_t* dstValue, common::ValueVector* dstVector, const Value* srcValue) { auto numBytesPerValue = dstVector->getNumBytesPerValue(); switch (srcValue->getDataType().getPhysicalType()) { case common::PhysicalTypeID::INT64: { @@ -53,9 +52,8 @@ void LiteralExpressionEvaluator::copyValueToVector( memcpy(dstValue, &srcValue->val.intervalVal, numBytesPerValue); } break; case common::PhysicalTypeID::STRING: { - common::InMemOverflowBufferUtils::copyString(srcValue->strVal.data(), - srcValue->strVal.length(), *(common::ku_string_t*)dstValue, - *common::StringVector::getInMemOverflowBuffer(dstVector)); + StringVector::addString(dstVector, *(common::ku_string_t*)dstValue, srcValue->strVal.data(), + srcValue->strVal.length()); } break; case common::PhysicalTypeID::VAR_LIST: { auto listListEntry = reinterpret_cast(dstValue); diff --git a/src/include/common/in_mem_overflow_buffer_utils.h b/src/include/common/in_mem_overflow_buffer_utils.h deleted file mode 100644 index d618682f084..00000000000 --- a/src/include/common/in_mem_overflow_buffer_utils.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "common/in_mem_overflow_buffer.h" -#include "type_utils.h" - -namespace kuzu { -namespace common { - -class InMemOverflowBufferUtils { -public: - // Currently, this function is only used in `allocateStringIfNecessary`. Make this function - // private once we remove allocateStringIfNecessary. - static inline void allocateSpaceForStringIfNecessary( - ku_string_t& result, uint64_t numBytes, InMemOverflowBuffer& buffer) { - if (ku_string_t::isShortString(numBytes)) { - return; - } - result.overflowPtr = reinterpret_cast(buffer.allocateSpace(numBytes)); - } - - static void copyString( - const char* src, uint64_t len, ku_string_t& dest, InMemOverflowBuffer& inMemOverflowBuffer); - static void copyString( - const ku_string_t& src, ku_string_t& dest, InMemOverflowBuffer& inMemOverflowBuffer); -}; - -} // namespace common -} // namespace kuzu diff --git a/src/include/common/types/ku_list.h b/src/include/common/types/ku_list.h index d608c781404..91c3761fe53 100644 --- a/src/include/common/types/ku_list.h +++ b/src/include/common/types/ku_list.h @@ -14,8 +14,6 @@ struct ku_list_t { void set(const uint8_t* values, const LogicalType& dataType) const; private: - friend class InMemOverflowBufferUtils; - void set(const std::vector& parameters, LogicalTypeID childTypeId); public: diff --git a/src/include/common/types/ku_string.h b/src/include/common/types/ku_string.h index 2e4049522df..a47e42a080c 100644 --- a/src/include/common/types/ku_string.h +++ b/src/include/common/types/ku_string.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include namespace kuzu { @@ -32,6 +33,25 @@ struct ku_string_t { void set(const std::string& value); void set(const char* value, uint64_t length); void set(const ku_string_t& value); + inline void setShortString(const char* value, uint64_t length) { + this->len = length; + memcpy(prefix, value, length); + } + inline void setLongString(const char* value, uint64_t length) { + this->len = length; + memcpy(prefix, value, PREFIX_LENGTH); + memcpy(reinterpret_cast(overflowPtr), value, length); + } + inline void setShortString(const ku_string_t& value) { + this->len = value.len; + memcpy(prefix, value.prefix, value.len); + } + void setLongString(const ku_string_t& value) { + this->len = value.len; + memcpy(prefix, value.prefix, PREFIX_LENGTH); + memcpy(reinterpret_cast(overflowPtr), reinterpret_cast(value.overflowPtr), + value.len); + } std::string getAsShortString() const; std::string getAsString() const; diff --git a/src/include/common/vector/auxiliary_buffer.h b/src/include/common/vector/auxiliary_buffer.h index da6bb1dd1e0..06b90e7c14b 100644 --- a/src/include/common/vector/auxiliary_buffer.h +++ b/src/include/common/vector/auxiliary_buffer.h @@ -21,8 +21,10 @@ class StringAuxiliaryBuffer : public AuxiliaryBuffer { } inline InMemOverflowBuffer* getOverflowBuffer() const { return inMemOverflowBuffer.get(); } + inline uint8_t* allocateOverflow(uint64_t size) { + return inMemOverflowBuffer->allocateSpace(size); + } inline void resetOverflowBuffer() const { inMemOverflowBuffer->resetBuffer(); } - void addString(common::ValueVector* vector, uint32_t pos, char* value, uint64_t len) const; private: std::unique_ptr inMemOverflowBuffer; diff --git a/src/include/common/vector/value_vector.h b/src/include/common/vector/value_vector.h index 99ac99c8880..c7d608b17b0 100644 --- a/src/include/common/vector/value_vector.h +++ b/src/include/common/vector/value_vector.h @@ -91,11 +91,12 @@ class StringVector { ->getOverflowBuffer(); } - static inline void addString(ValueVector* vector, uint32_t pos, char* value, uint64_t len) { - assert(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING); - reinterpret_cast(vector->auxiliaryBuffer.get()) - ->addString(vector, pos, value, len); - } + static void addString(ValueVector* vector, uint32_t vectorPos, ku_string_t& srcStr); + static void addString( + ValueVector* vector, uint32_t vectorPos, const char* srcStr, uint64_t length); + static void addString(ValueVector* vector, ku_string_t& dstStr, ku_string_t& srcStr); + static void addString( + ValueVector* vector, ku_string_t& dstStr, const char* srcStr, uint64_t length); }; class ListVector { diff --git a/src/include/function/aggregate/collect.h b/src/include/function/aggregate/collect.h index 4561346918b..309759a1364 100644 --- a/src/include/function/aggregate/collect.h +++ b/src/include/function/aggregate/collect.h @@ -1,6 +1,5 @@ #pragma once -#include "common/in_mem_overflow_buffer_utils.h" #include "common/vector/value_vector_utils.h" #include "processor/result/factorized_table.h" diff --git a/src/include/function/cast/cast_operations.h b/src/include/function/cast/cast_operations.h index fc427d29ccc..41b0940ad38 100644 --- a/src/include/function/cast/cast_operations.h +++ b/src/include/function/cast/cast_operations.h @@ -3,7 +3,6 @@ #include #include "common/exception.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "common/type_utils.h" #include "common/vector/value_vector.h" diff --git a/src/include/function/list/operations/list_append_operation.h b/src/include/function/list/operations/list_append_operation.h index b783dd6df9e..e7d405559b4 100644 --- a/src/include/function/list/operations/list_append_operation.h +++ b/src/include/function/list/operations/list_append_operation.h @@ -3,7 +3,6 @@ #include #include -#include "common/in_mem_overflow_buffer_utils.h" #include "common/types/ku_list.h" #include "common/vector/value_vector.h" diff --git a/src/include/storage/storage_structure/disk_overflow_file.h b/src/include/storage/storage_structure/disk_overflow_file.h index d907139e39b..db83f5a43c8 100644 --- a/src/include/storage/storage_structure/disk_overflow_file.h +++ b/src/include/storage/storage_structure/disk_overflow_file.h @@ -42,8 +42,7 @@ class DiskOverflowFile : public StorageStructure { transaction::TransactionType trxType, common::ValueVector& vector, uint64_t vectorPos) { assert(vector.dataType.getLogicalTypeID() == common::LogicalTypeID::STRING && !vector.isNull(vectorPos)); - auto& kuString = ((common::ku_string_t*)vector.getData())[vectorPos]; - lookupString(trxType, kuString, *common::StringVector::getInMemOverflowBuffer(&vector)); + lookupString(trxType, &vector, vector.getValue(vectorPos)); } void readListToVector(transaction::TransactionType trxType, common::ku_list_t& kuList, @@ -72,10 +71,10 @@ class DiskOverflowFile : public StorageStructure { common::page_idx_t pageIdx = UINT32_MAX; uint8_t* frame = nullptr; }; - void lookupString(transaction::TransactionType trxType, common::ku_string_t& kuStr, - common::InMemOverflowBuffer& inMemOverflowBuffer); - void lookupString(transaction::TransactionType trxType, common::ku_string_t& kuStr, - common::InMemOverflowBuffer& inMemOverflowBuffer, OverflowPageCache& overflowPageCache); + void lookupString(transaction::TransactionType trxType, common::ValueVector* vector, + common::ku_string_t& dstStr); + void lookupString(transaction::TransactionType trxType, common::ValueVector* vector, + common::ku_string_t& dstStr, OverflowPageCache& overflowPageCache); void addNewPageIfNecessaryWithoutLock(uint32_t numBytesToAppend); void setStringOverflowWithoutLock( const char* inMemSrcStr, uint64_t len, common::ku_string_t& diskDstString); diff --git a/src/storage/storage_structure/column.cpp b/src/storage/storage_structure/column.cpp index b59baed5e42..6b89e063008 100644 --- a/src/storage/storage_structure/column.cpp +++ b/src/storage/storage_structure/column.cpp @@ -1,6 +1,5 @@ #include "storage/storage_structure/column.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "storage/storage_structure/storage_structure_utils.h" using namespace kuzu::common; diff --git a/src/storage/storage_structure/disk_overflow_file.cpp b/src/storage/storage_structure/disk_overflow_file.cpp index 24094ea4d2e..e11d928c8d0 100644 --- a/src/storage/storage_structure/disk_overflow_file.cpp +++ b/src/storage/storage_structure/disk_overflow_file.cpp @@ -1,6 +1,5 @@ #include "storage/storage_structure/disk_overflow_file.h" -#include "common/in_mem_overflow_buffer_utils.h" #include "common/null_buffer.h" #include "common/string_utils.h" #include "common/type_utils.h" @@ -34,35 +33,34 @@ void DiskOverflowFile::scanStrings(TransactionType trxType, ValueVector& valueVe if (valueVector.isNull(pos)) { continue; } - lookupString(trxType, ((ku_string_t*)valueVector.getData())[pos], - *common::StringVector::getInMemOverflowBuffer(&valueVector), overflowPageCache); + lookupString( + trxType, &valueVector, valueVector.getValue(pos), overflowPageCache); } unpinOverflowPageCache(overflowPageCache); } void DiskOverflowFile::lookupString( - TransactionType trxType, ku_string_t& kuStr, InMemOverflowBuffer& inMemOverflowBuffer) { - if (ku_string_t::isShortString(kuStr.len)) { + TransactionType trxType, common::ValueVector* vector, common::ku_string_t& dstStr) { + if (ku_string_t::isShortString(dstStr.len)) { return; } PageByteCursor cursor; - TypeUtils::decodeOverflowPtr(kuStr.overflowPtr, cursor.pageIdx, cursor.offsetInPage); + TypeUtils::decodeOverflowPtr(dstStr.overflowPtr, cursor.pageIdx, cursor.offsetInPage); auto [fileHandleToPin, pageIdxToPin] = StorageStructureUtils::getFileHandleAndPhysicalPageIdxToPin( *fileHandle, cursor.pageIdx, *wal, trxType); bufferManager->optimisticRead(*fileHandleToPin, pageIdxToPin, [&](uint8_t* frame) { - InMemOverflowBufferUtils::copyString( - (char*)(frame + cursor.offsetInPage), kuStr.len, kuStr, inMemOverflowBuffer); + StringVector::addString(vector, dstStr, (char*)(frame + cursor.offsetInPage), dstStr.len); }); } -void DiskOverflowFile::lookupString(TransactionType trxType, ku_string_t& kuStr, - InMemOverflowBuffer& inMemOverflowBuffer, OverflowPageCache& overflowPageCache) { - if (ku_string_t::isShortString(kuStr.len)) { +void DiskOverflowFile::lookupString(TransactionType trxType, common::ValueVector* vector, + common::ku_string_t& dstStr, OverflowPageCache& overflowPageCache) { + if (ku_string_t::isShortString(dstStr.len)) { return; } PageByteCursor cursor; - TypeUtils::decodeOverflowPtr(kuStr.overflowPtr, cursor.pageIdx, cursor.offsetInPage); + TypeUtils::decodeOverflowPtr(dstStr.overflowPtr, cursor.pageIdx, cursor.offsetInPage); auto [fileHandleToPin, pageIdxToPin] = StorageStructureUtils::getFileHandleAndPhysicalPageIdxToPin( *fileHandle, cursor.pageIdx, *wal, trxType); @@ -70,8 +68,8 @@ void DiskOverflowFile::lookupString(TransactionType trxType, ku_string_t& kuStr, unpinOverflowPageCache(overflowPageCache); pinOverflowPageCache(fileHandleToPin, pageIdxToPin, overflowPageCache); } - InMemOverflowBufferUtils::copyString((char*)(overflowPageCache.frame + cursor.offsetInPage), - kuStr.len, kuStr, inMemOverflowBuffer); + StringVector::addString( + vector, dstStr, (char*)(overflowPageCache.frame + cursor.offsetInPage), dstStr.len); } void DiskOverflowFile::readListToVector( @@ -102,8 +100,7 @@ void DiskOverflowFile::readListToVector( auto kuStrings = (ku_string_t*)bufferToCopy; OverflowPageCache overflowPageCache; for (auto i = 0u; i < kuList.size; i++) { - lookupString(trxType, kuStrings[i], - *common::StringVector::getInMemOverflowBuffer(dataVector), overflowPageCache); + lookupString(trxType, dataVector, kuStrings[i], overflowPageCache); } unpinOverflowPageCache(overflowPageCache); } diff --git a/test/storage/disk_array_update_test.cpp b/test/storage/disk_array_update_test.cpp index 74e341f06e0..ebf11d6f9d3 100644 --- a/test/storage/disk_array_update_test.cpp +++ b/test/storage/disk_array_update_test.cpp @@ -1,4 +1,3 @@ -#include "common/in_mem_overflow_buffer_utils.h" #include "graph_test/graph_test.h" using namespace kuzu::common;