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

Method OperDone

be/src/runtime/io/request-context.cc:232–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void RequestContext::OperDone(RequestRange* range, const Status& status) {
233 DCHECK(range != nullptr);
234
235 // Copy disk_id before running callback: the callback may modify range.
236 int disk_id = range->disk_id();
237
238 // Execute the callback before decrementing the thread count. Otherwise
239 // RequestContext::Cancel() that waits for the disk ref count to be 0 will
240 // return, creating a race, e.g. see IMPALA-1890.
241 // The status of the operation does not affect the status of the request context.
242 if (range->request_type() == RequestType::WRITE) {
243 (static_cast<WriteRange*>(range))->callback()(status);
244 } else {
245 DCHECK(range->request_type() == RequestType::FILE_UPLOAD
246 || range->request_type() == RequestType::FILE_FETCH);
247 (static_cast<RemoteOperRange*>(range))->callback()(status);
248 }
249 {
250 unique_lock<mutex> lock(lock_);
251 DCHECK(Validate()) << endl << DebugString();
252 RequestContext::PerDiskState& state = disk_states_[disk_id];
253 state.DecrementDiskThread(lock, this);
254 --state.num_remaining_ranges();
255 }
256}
257
258// Cancellation of a RequestContext requires coordination from multiple threads that may
259// hold references to the context:

Callers 2

DiskThreadLoopMethod · 0.80
WriteMethod · 0.80

Calls 7

request_typeMethod · 0.80
DecrementDiskThreadMethod · 0.80
num_remaining_rangesMethod · 0.80
ValidateFunction · 0.50
DebugStringFunction · 0.50
disk_idMethod · 0.45
callbackMethod · 0.45

Tested by

no test coverage detected