diff --git a/src/include/storage/store/csr_node_group.h b/src/include/storage/store/csr_node_group.h index 93d1ce9f64e..87e29ff9dce 100644 --- a/src/include/storage/store/csr_node_group.h +++ b/src/include/storage/store/csr_node_group.h @@ -114,7 +114,7 @@ struct CSRNodeGroupScanState final : NodeGroupScanState { std::unique_ptr csrHeader; std::vector persistentCSRLists; NodeCSRIndex inMemCSRList; - // position in vector of either csr list/index vector + // position in vector of csr list vector uint32_t nextCSRToScan; bool persistentInitialized = false; diff --git a/src/storage/store/csr_node_group.cpp b/src/storage/store/csr_node_group.cpp index 9d839dc0a89..84f246e39ff 100644 --- a/src/storage/store/csr_node_group.cpp +++ b/src/storage/store/csr_node_group.cpp @@ -156,13 +156,15 @@ NodeGroupScanResult CSRNodeGroup::scanCommittedPersistent(const Transaction* tra while (nodeGroupScanState.nextCSRToScan < nodeGroupScanState.persistentCSRLists.size()) { auto& csrList = nodeGroupScanState.persistentCSRLists[nodeGroupScanState.nextCSRToScan]; const auto startRow = csrList.startRow + nodeGroupScanState.nextRowToScan; - const auto numToScan = std::min(csrList.length - nodeGroupScanState.nextRowToScan, - DEFAULT_VECTOR_CAPACITY - result.numRows); if (result.startRow == INVALID_ROW_IDX) { result.startRow = startRow; + } else if (startRow - result.startRow >= DEFAULT_VECTOR_CAPACITY) { + break; } - persistentChunkGroup->scan(transaction, tableState, nodeGroupScanState, startRow, - numToScan); + // accomodate for any gaps in between the current and previous csr + result.numRows = startRow - result.startRow; + const auto numToScan = std::min(csrList.length - nodeGroupScanState.nextRowToScan, + DEFAULT_VECTOR_CAPACITY - result.numRows); result.numRows += numToScan; if (numToScan == csrList.length - nodeGroupScanState.nextRowToScan) { nodeGroupScanState.nextCSRToScan++; @@ -173,6 +175,8 @@ NodeGroupScanResult CSRNodeGroup::scanCommittedPersistent(const Transaction* tra break; } } + persistentChunkGroup->scan(transaction, tableState, nodeGroupScanState, result.startRow, + result.numRows); return result; } diff --git a/src/storage/store/rel_table.cpp b/src/storage/store/rel_table.cpp index 9ef50b49761..f2d8f149d8e 100644 --- a/src/storage/store/rel_table.cpp +++ b/src/storage/store/rel_table.cpp @@ -100,7 +100,7 @@ bool RelTable::scanInternal(Transaction* transaction, TableScanState& scanState) if (relScanState.currNodeIdx == relScanState.totalNodeIdx) { return false; } - // We need to reinitialize per node group + // We reinitialize per node for in memory and local table data if (relScanState.currNodeIdx == relScanState.endNodeIdx) { if (relScanState.resetCommitted) { // reset to read committed, in memory data