MCPcopy Create free account
hub / github.com/bytedance/bolt / ensureOutputFits

Method ensureOutputFits

bolt/exec/SortBuffer.cpp:424–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422}
423
424void 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
454void SortBuffer::updateEstimatedOutputRowSize() {
455 const auto optionalRowSize = hybridSortEnabled_

Callers

nothing calls this directly

Calls 8

testingTriggerSpillFunction · 0.85
succinctBytesFunction · 0.85
has_valueMethod · 0.80
valueMethod · 0.45
maybeReserveMethod · 0.45
nameMethod · 0.45
usedBytesMethod · 0.45
reservedBytesMethod · 0.45

Tested by

no test coverage detected