| 956 | } |
| 957 | |
| 958 | Status TmpFile::PunchHole(int64_t offset, int64_t len) { |
| 959 | DCHECK(file_group_->tmp_file_mgr_->punch_holes()); |
| 960 | // Because of RAII, the file is automatically closed when this function returns. |
| 961 | RWFileOptions opts; |
| 962 | opts.mode = Env::CREATE_OR_OPEN; |
| 963 | unique_ptr<RWFile> file; |
| 964 | KUDU_RETURN_IF_ERROR(Env::Default()->NewRWFile(opts, path_, &file), |
| 965 | "Failed to open scratch file for hole punching"); |
| 966 | KUDU_RETURN_IF_ERROR( |
| 967 | file->PunchHole(offset, len), "Failed to punch hole in scratch file"); |
| 968 | bytes_reclaimed_.Add(len); |
| 969 | GetDir()->bytes_used_metric()->Increment(-len); |
| 970 | VLOG(3) << "Punched hole in " << path_ << " " << offset << " " << len; |
| 971 | return Status::OK(); |
| 972 | } |
| 973 | |
| 974 | string TmpFile::DebugString() { |
| 975 | return Substitute( |
no test coverage detected