Continues pulling scan ranges from the io mgr until they are all done. Updates num_ranges_processed with the number of ranges seen by this thread.
| 274 | // Continues pulling scan ranges from the io mgr until they are all done. |
| 275 | // Updates num_ranges_processed with the number of ranges seen by this thread. |
| 276 | static void ScanRangeThread(DiskIoMgr* io_mgr, RequestContext* reader, |
| 277 | BufferPool::ClientHandle* client, const char* expected_result, int expected_len, |
| 278 | const Status& expected_status, int max_ranges, AtomicInt32* num_ranges_processed) { |
| 279 | int num_ranges = 0; |
| 280 | while (max_ranges == 0 || num_ranges < max_ranges) { |
| 281 | ScanRange* range; |
| 282 | bool needs_buffers; |
| 283 | Status status = reader->GetNextUnstartedRange(&range, &needs_buffers); |
| 284 | ASSERT_TRUE(status.ok() || status.code() == expected_status.code()); |
| 285 | if (range == nullptr) break; |
| 286 | if (needs_buffers) { |
| 287 | ASSERT_OK(io_mgr->AllocateBuffersForRange( |
| 288 | client, range, io_mgr->max_buffer_size() * 3)); |
| 289 | } |
| 290 | ValidateScanRange(io_mgr, range, expected_result, expected_len, expected_status); |
| 291 | num_ranges_processed->Add(1); |
| 292 | ++num_ranges; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | static void SetReaderStub(ScanRange* scan_range, unique_ptr<FileReader> reader_stub) { |
| 297 | scan_range->SetFileReader(move(reader_stub)); |
nothing calls this directly
no test coverage detected