Skip to content

Commit

Permalink
make large lists to copy sequentially rather than one page at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Jan 2, 2023
1 parent 29967a4 commit 029750c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/include/storage/store/node_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class NodeTable {
void deleteNode(node_offset_t nodeOffset, ValueVector* primaryKeyVector, uint32_t pos) const;

private:
// TODO(Guodong): Consider moving statistics and deleted ids to catalog.
NodesStatisticsAndDeletedIDs* nodesStatisticsAndDeletedIDs;
// This is for properties.
vector<unique_ptr<Column>> propertyColumns;
Expand Down
11 changes: 5 additions & 6 deletions src/storage/storage_structure/lists/lists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ unique_ptr<vector<nodeID_t>> AdjLists::readAdjacencyListOfNode(

void AdjLists::readFromLargeList(
const shared_ptr<ValueVector>& valueVector, ListHandle& listHandle) {
uint64_t nextPartBeginElemOffset =
uint32_t nextPartBeginElemOffset =
listHandle.hasValidRangeToRead() ? listHandle.getEndElemOffset() : 0;
auto pageCursor =
PageUtils::getPageElementCursorForPos(nextPartBeginElemOffset, numElementsPerPage);
Expand All @@ -260,17 +260,16 @@ void AdjLists::readFromLargeList(
// page that's being read (nextPartBeginElemOffset above should be set to the beginning of the
// next page. Note that because of case (ii), this computation guarantees that what we read fits
// into a single page. That's why we can call copyFromAPage.
auto numValuesToCopy =
min((uint32_t)(listHandle.getNumValuesInList() - nextPartBeginElemOffset),
numElementsPerPage - (uint32_t)(nextPartBeginElemOffset % numElementsPerPage));
auto numValuesToCopy = min(listHandle.getNumValuesInList() - nextPartBeginElemOffset,
(uint32_t)DEFAULT_VECTOR_CAPACITY);
valueVector->state->initOriginalAndSelectedSize(numValuesToCopy);
listHandle.setRangeToRead(nextPartBeginElemOffset, numValuesToCopy);
// map logical pageIdx to physical pageIdx
auto physicalPageId = listHandle.mapper(pageCursor.pageIdx);
// See comments for AdjLists::readFromSmallList.
auto dummyReadOnlyTrx = Transaction::getDummyReadOnlyTrx();
readNodeIDsFromAPageBySequentialCopy(dummyReadOnlyTrx.get(), valueVector, 0, physicalPageId,
pageCursor.elemPosInPage, numValuesToCopy, nodeIDCompressionScheme, true /*isAdjLists*/);
readNodeIDsBySequentialCopy(dummyReadOnlyTrx.get(), valueVector, pageCursor, listHandle.mapper,
nodeIDCompressionScheme, true /*isAdjLists*/);
}

// Note: This function sets the original and selected size of the DataChunk into which it will
Expand Down

0 comments on commit 029750c

Please sign in to comment.