| 347 | } |
| 348 | |
| 349 | void DiskArrayInternal::WriteIterator::pushBack(PageAllocator& pageAllocator, |
| 350 | const Transaction* transaction, std::span<std::byte> val) { |
| 351 | idx = diskArray.headerForWriteTrx.numElements; |
| 352 | auto oldPageIdx = apCursor.pageIdx; |
| 353 | apCursor = getAPIdxAndOffsetInAP(diskArray.storageInfo, idx); |
| 354 | // If this would add a new page, pin new page and update PIP |
| 355 | auto [apPageIdx, isNewlyAdded] = |
| 356 | diskArray.getAPPageIdxAndAddAPToPIPIfNecessaryForWriteTrxNoLock(pageAllocator, transaction, |
| 357 | apCursor.pageIdx); |
| 358 | diskArray.lastAPPageIdx = apPageIdx; |
| 359 | // Used to calculate the number of APs, so it must be updated after the PIPs are. |
| 360 | diskArray.headerForWriteTrx.numElements++; |
| 361 | if (isNewlyAdded || shadowPageAndFrame.originalPage == INVALID_PAGE_IDX || |
| 362 | apCursor.pageIdx != oldPageIdx) { |
| 363 | getPage(apPageIdx, isNewlyAdded); |
| 364 | } |
| 365 | memcpy(operator*().data(), val.data(), val.size()); |
| 366 | } |
| 367 | |
| 368 | void DiskArrayInternal::WriteIterator::unpin() { |
| 369 | if (shadowPageAndFrame.shadowPage != INVALID_PAGE_IDX) { |
no test coverage detected