| 259 | } |
| 260 | |
| 261 | void BufferedTupleStream::Close(RowBatch* batch, FlushMode flush) { |
| 262 | for (Page& page : pages_) { |
| 263 | if (page.attached_to_output_batch) continue; // Already returned. |
| 264 | if (batch != nullptr && page.retrieved_buffer.Load()) { |
| 265 | // Subtle: We only need to attach buffers from pages that we may have returned |
| 266 | // references to. |
| 267 | page.AttachBufferToBatch(this, batch, flush); |
| 268 | } else { |
| 269 | buffer_pool_->DestroyPage(buffer_pool_client_, &page.handle); |
| 270 | } |
| 271 | } |
| 272 | read_page_reservation_.Close(); |
| 273 | large_read_page_reservation_.Close(); |
| 274 | write_page_reservation_.Close(); |
| 275 | pages_.clear(); |
| 276 | num_pages_ = 0; |
| 277 | bytes_pinned_ = 0; |
| 278 | bytes_unpinned_ = 0; |
| 279 | closed_ = true; |
| 280 | } |
| 281 | |
| 282 | int64_t BufferedTupleStream::CalcBytesPinned() const { |
| 283 | int64_t result = 0; |
no test coverage detected