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

Method ensureOutputFits

bolt/exec/GroupingSet.cpp:1040–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1038 const auto targetIncrementBytes = std::max<int64_t>(
1039 incrementBytes * 2,
1040 currentUsage * spillConfig_->spillableReservationGrowthPct / 100);
1041 {
1042 memory::ReclaimableSectionGuard guard(nonReclaimableSection_);
1043 if (pool_.maybeReserve(targetIncrementBytes)) {
1044 return;
1045 }
1046 }
1047 LOG(WARNING) << "Failed to reserve " << succinctBytes(targetIncrementBytes)
1048 << " for memory pool " << pool_.name()
1049 << ", usage: " << succinctBytes(pool_.currentBytes())
1050 << ", reservation: " << succinctBytes(pool_.reservedBytes())
1051 << ", flatBytes: " << succinctBytes(flatBytes)
1052 << ", input numRows = " << input->size()
1053 << ", outOfLineBytes = " << outOfLineBytes;
1054}
1055
1056void GroupingSet::ensureOutputFits() {
1057 // If spilling has already been triggered on this operator, then we don't need
1058 // to reserve memory for the output as we can't reclaim much memory from this
1059 // operator itself. The output processing can reclaim memory from the other
1060 // operator or query through memory arbitration.
1061 if ((isPartial_ && preferPartialSpill_ == false) || spillConfig_ == nullptr ||
1062 hasSpilled()) {
1063 return;
1064 }
1065
1066 // Test-only spill path.
1067 if (spillConfig_->testSpillPct > 0 &&
1068 (folly::hasher<uint64_t>()(++spillTestCounter_)) % 100 <=
1069 spillConfig_->testSpillPct) {
1070 spill(RowContainerIterator{});
1071 return;
1072 }
1073
1074 const uint64_t outputBufferSizeToReserve =

Callers

nothing calls this directly

Calls 6

succinctBytesFunction · 0.85
maybeReserveMethod · 0.45
nameMethod · 0.45
currentBytesMethod · 0.45
reservedBytesMethod · 0.45

Tested by

no test coverage detected