| 571 | } |
| 572 | |
| 573 | bool GroupingAggregator::AddRowToSpilledStream(BufferedTupleStream* stream, |
| 574 | TupleRow* __restrict__ row, Status* status) { |
| 575 | DCHECK(!stream->is_pinned()); |
| 576 | if (LIKELY(stream->AddRow(row, status))) return true; |
| 577 | if (!status->ok()) return false; |
| 578 | // We fail to add a large row due to run out of unused reservation and fail to increase |
| 579 | // the reservation. If we don't have the serialize stream, spilling partitions don't |
| 580 | // need extra reservation so we can restore the large write page reservation and try |
| 581 | // again. The same if we have the serialize stream but all partitions are spilled. |
| 582 | if ((!needs_serialize_ || GetNumPinnedPartitions() == 0) |
| 583 | && large_write_page_reservation_.GetReservation() > 0) { |
| 584 | RestoreLargeWritePageReservation(); |
| 585 | if (LIKELY(stream->AddRow(row, status))) { |
| 586 | // 'stream' is spilled so the large write page should already be spilled after it's |
| 587 | // written. |
| 588 | SaveLargeWritePageReservation(); |
| 589 | return true; |
| 590 | } |
| 591 | DCHECK(!status->ok()) << "Extra reservation not used by AddRow in " |
| 592 | << DebugString() << ":\n" << buffer_pool_client()->DebugString(); |
| 593 | } |
| 594 | return false; |
| 595 | } |
| 596 | |
| 597 | template <bool AGGREGATED_ROWS> |
| 598 | Status GroupingAggregator::AppendSpilledRow( |
nothing calls this directly
no test coverage detected