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

Method RecycleFileRange

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

Source from the content-addressed store, hash-verified

1600}
1601
1602void TmpFileGroup::RecycleFileRange(unique_ptr<TmpWriteHandle> handle) {
1603 TmpFile* file = handle->file_;
1604 int64_t space_used_bytes =
1605 RoundUpToScratchRangeSize(tmp_file_mgr_->punch_holes(), handle->on_disk_len());
1606 if (tmp_file_mgr_->punch_holes()) {
1607 Status status = file->PunchHole(handle->write_range_->offset(), space_used_bytes);
1608 if (!status.ok()) {
1609 // Proceed even in the hole punching fails - we will use extra disk space but
1610 // functionally we can continue to spill.
1611 LOG_EVERY_N(WARNING, 100) << "Failed to punch hole in scratch file, couldn't "
1612 << "reclaim space: " << status.GetDetail();
1613 return;
1614 }
1615 scratch_space_bytes_used_counter_->Add(-space_used_bytes);
1616 tmp_file_mgr_->scratch_bytes_used_metric_->Increment(-space_used_bytes);
1617 current_bytes_allocated_.Add(-space_used_bytes);
1618 } else {
1619 // For the remote files, we don't recycle the file and range because the remote file
1620 // is not allowed to in-place modification.
1621 if (file->DiskFile()->disk_type() == io::DiskFileType::LOCAL) {
1622 int free_ranges_idx = BitUtil::Log2Ceiling64(space_used_bytes);
1623 lock_guard<SpinLock> lock(lock_);
1624 free_ranges_[free_ranges_idx].emplace_back(file, handle->write_range_->offset());
1625 }
1626 }
1627}
1628
1629Status TmpFileGroup::Write(MemRange buffer, WriteDoneCallback cb,
1630 unique_ptr<TmpWriteHandle>* handle, const BufferPoolClientCounters* counters) {

Callers

nothing calls this directly

Calls 11

punch_holesMethod · 0.80
on_disk_lenMethod · 0.80
GetDetailMethod · 0.80
PunchHoleMethod · 0.45
offsetMethod · 0.45
okMethod · 0.45
AddMethod · 0.45
IncrementMethod · 0.45
disk_typeMethod · 0.45
DiskFileMethod · 0.45

Tested by

no test coverage detected