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

Method EnqueueWriteRange

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

Source from the content-addressed store, hash-verified

2311}
2312
2313Status TmpFileBufferPool::EnqueueWriteRange(io::WriteRange* range, TmpFile* tmp_file) {
2314 Status status = Status::OK();
2315 {
2316 unique_lock<mutex> write_range_list_lock(lock_);
2317 DCHECK(range != nullptr);
2318 DCHECK(range->disk_file() != nullptr);
2319 DCHECK(range->io_ctx() != nullptr);
2320 if (range->disk_file()->IsSpaceReserved()) {
2321 // If the space is reserved, send the range to the DiskQueue.
2322 return range->io_ctx()->AddWriteRange(range);
2323 } else if (range->io_ctx()->IsCancelled()) {
2324 // If the io_ctx is cancelled, nofity the caller to cancel the query.
2325 return TMP_FILE_BUFFER_POOL_CONTEXT_CANCELLED;
2326 } else {
2327 io_ctx_to_file_set_map_[range->io_ctx()].insert(range->disk_file());
2328 write_ranges_to_add_[range->disk_file()].emplace_back(range);
2329 }
2330 // Put the first range of a file to the queue for waiting for the available space,
2331 // the ranges in the queue would be popped one by one, when the space is reserved,
2332 // all ranges of the file are added to the DiskQueue by io_ctx.
2333 if (range->offset() == 0) {
2334 write_ranges_.emplace_back(range);
2335 DCHECK(tmp_file != nullptr);
2336 write_ranges_iterator_[range] =
2337 std::make_pair(prev(write_ranges_.cend()), tmp_file);
2338 }
2339 }
2340 work_available_.NotifyAll();
2341 return status;
2342}
2343
2344void TmpFileBufferPool::RemoveWriteRangesInternal(
2345 RequestContext* io_ctx, vector<TmpFileMgr::WriteDoneCallback>* write_callbacks) {

Callers 1

AsyncWriteRangeMethod · 0.80

Calls 10

OKFunction · 0.85
disk_fileMethod · 0.80
io_ctxMethod · 0.80
IsSpaceReservedMethod · 0.80
cendMethod · 0.80
NotifyAllMethod · 0.80
AddWriteRangeMethod · 0.45
IsCancelledMethod · 0.45
insertMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected