| 796 | } |
| 797 | |
| 798 | static void fillCSRGaps(CheckpointReadCursor& readCursor, CheckpointWriteCursor& writeCursor, |
| 799 | ColumnChunkData* dummyChunkForNulls, length_t numOldGaps, length_t numGaps) { |
| 800 | auto numOldGapsRemaining = numOldGaps; |
| 801 | auto numGapsRemaining = numGaps; |
| 802 | if (readCursor.getCSROffset() < writeCursor.getCSROffset()) { |
| 803 | // Try to advance read cursor to write cursor (if num old gaps is large enough) |
| 804 | const auto numGapsToAdvance = |
| 805 | std::min(numOldGapsRemaining, writeCursor.getCSROffset() - readCursor.getCSROffset()); |
| 806 | readCursor.advance(numGapsToAdvance); |
| 807 | numOldGapsRemaining -= numGapsToAdvance; |
| 808 | } |
| 809 | |
| 810 | // We can skip writes for any new gaps whose CSR offset also corresponds to an old gap |
| 811 | if (readCursor.getCSROffset() == writeCursor.getCSROffset()) { |
| 812 | auto numSkippableGaps = std::min(numGapsRemaining, numOldGapsRemaining); |
| 813 | numGapsRemaining -= numSkippableGaps; |
| 814 | writeCursor.advance(numSkippableGaps); |
| 815 | } |
| 816 | |
| 817 | while (numGapsRemaining > 0) { |
| 818 | const auto numGapsToFill = |
| 819 | std::min(numGapsRemaining, static_cast<length_t>(DEFAULT_VECTOR_CAPACITY)); |
| 820 | dummyChunkForNulls->setNumValues(numGapsToFill); |
| 821 | writeCursor.appendToCurrentSegment(dummyChunkForNulls, 0, numGapsToFill); |
| 822 | writeCursor.advance(numGapsToFill); |
| 823 | numGapsRemaining -= numGapsToFill; |
| 824 | } |
| 825 | |
| 826 | readCursor.advance(numOldGapsRemaining); |
| 827 | } |
| 828 | |
| 829 | std::vector<ChunkCheckpointState> CSRNodeGroup::checkpointColumnInRegion(const UniqLock& lock, |
| 830 | column_id_t columnID, const CSRNodeGroupCheckpointState& csrState, |
no test coverage detected