MCPcopy Create free account
hub / github.com/apache/impala / RoundUpToScratchRangeSize

Function RoundUpToScratchRangeSize

be/src/runtime/tmp-file-mgr.cc:1395–1404  ·  view source on GitHub ↗

Rounds up to the smallest unit of allocation in a scratch file that will fit 'bytes'.

Source from the content-addressed store, hash-verified

1393// Rounds up to the smallest unit of allocation in a scratch file
1394// that will fit 'bytes'.
1395static int64_t RoundUpToScratchRangeSize(bool punch_holes, int64_t bytes) {
1396 if (punch_holes) {
1397 // Round up to a typical disk block size - 4KB that that hole punching can always
1398 // free the backing storage for the entire range.
1399 return BitUtil::RoundUpToPowerOf2(bytes, TmpFileMgr::HOLE_PUNCH_BLOCK_SIZE_BYTES);
1400 } else {
1401 // We recycle scratch ranges, which must be positive power-of-two sizes.
1402 return max<int64_t>(1L, BitUtil::RoundUpToPowerOfTwo(bytes));
1403 }
1404}
1405
1406void TmpFileGroup::UpdateScratchSpaceMetrics(int64_t num_bytes, bool is_remote) {
1407 scratch_space_bytes_used_counter_->Add(num_bytes);

Callers 2

AllocateLocalSpaceMethod · 0.85
RecycleFileRangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected