| 422 | } |
| 423 | |
| 424 | void SortBuffer::ensureOutputFits(vector_size_t batchSize) { |
| 425 | BOLT_CHECK_GT(batchSize, 0); |
| 426 | // Check if spilling is enabled or not. |
| 427 | if (spillConfig_ == nullptr) { |
| 428 | return; |
| 429 | } |
| 430 | |
| 431 | // Test-only spill path. |
| 432 | if (testingTriggerSpill()) { |
| 433 | spill(); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | if (estimatedOutputRowSize_.has_value() || spiller_ != nullptr) { |
| 438 | const uint64_t outputBufferSizeToReserve = |
| 439 | estimatedOutputRowSize_.value() * batchSize * 1.2; |
| 440 | { |
| 441 | memory::ReclaimableSectionGuard guard(nonReclaimableSection_); |
| 442 | if (pool_->maybeReserve(outputBufferSizeToReserve)) { |
| 443 | return; |
| 444 | } |
| 445 | } |
| 446 | LOG(WARNING) << "Failed to reserve " |
| 447 | << succinctBytes(outputBufferSizeToReserve) |
| 448 | << " for memory pool " << pool_->name() |
| 449 | << ", usage: " << succinctBytes(pool_->usedBytes()) |
| 450 | << ", reservation: " << succinctBytes(pool_->reservedBytes()); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | void SortBuffer::updateEstimatedOutputRowSize() { |
| 455 | const auto optionalRowSize = hybridSortEnabled_ |
nothing calls this directly
no test coverage detected