| 202 | }; |
| 203 | |
| 204 | void RequestContext::ReadDone(int disk_id, ReadOutcome outcome, ScanRange* range) { |
| 205 | // TODO: IMPALA-4249: it is safe to touch 'range' until DecrementDiskThread() is |
| 206 | // called because all clients of DiskIoMgr keep ScanRange objects alive until they |
| 207 | // unregister their RequestContext. |
| 208 | unique_lock<mutex> lock(lock_); |
| 209 | RequestContext::PerDiskState* disk_state = &disk_states_[disk_id]; |
| 210 | DCHECK_GT(disk_state->num_threads_in_op(), 0); |
| 211 | if (outcome == ReadOutcome::SUCCESS_EOSR) { |
| 212 | // No more reads to do. |
| 213 | --disk_state->num_remaining_ranges(); |
| 214 | } else if (outcome == ReadOutcome::SUCCESS_NO_EOSR) { |
| 215 | // Schedule the next read. |
| 216 | if (state_ != RequestContext::Cancelled) { |
| 217 | ScheduleScanRange(lock, range); |
| 218 | } |
| 219 | } else if (outcome == ReadOutcome::BLOCKED_ON_BUFFER) { |
| 220 | // Do nothing - the caller must add a buffer to the range or cancel it. |
| 221 | } else { |
| 222 | DCHECK(outcome == ReadOutcome::CANCELLED) << static_cast<int>(outcome); |
| 223 | // No more reads - clean up the scan range. |
| 224 | --disk_state->num_remaining_ranges(); |
| 225 | RemoveActiveScanRangeLocked(lock, range); |
| 226 | } |
| 227 | // Release refcount that was taken in IncrementDiskThreadAfterDequeue(). |
| 228 | disk_state->DecrementDiskThread(lock, this); |
| 229 | DCHECK(Validate()) << endl << DebugString(); |
| 230 | } |
| 231 | |
| 232 | void RequestContext::OperDone(RequestRange* range, const Status& status) { |
| 233 | DCHECK(range != nullptr); |
no test coverage detected