| 1830 | } |
| 1831 | |
| 1832 | void TableImpl::WakeUpPendingRequest(const TabletMetaNode& node) { |
| 1833 | meta_mutex_.AssertHeld(); |
| 1834 | const std::string& start_key = node.meta.key_range().key_start(); |
| 1835 | const std::string& end_key = node.meta.key_range().key_end(); |
| 1836 | const std::string& server_addr = node.meta.server_addr(); |
| 1837 | int64_t meta_timestamp = node.update_time; |
| 1838 | |
| 1839 | std::vector<SdkTask*> mutation_list; |
| 1840 | std::vector<SdkTask*> reader_list; |
| 1841 | std::vector<SdkTask*> batch_mutation_list; |
| 1842 | |
| 1843 | std::map<std::string, std::list<int64_t> >::iterator it = |
| 1844 | pending_task_id_list_.lower_bound(start_key); |
| 1845 | while (it != pending_task_id_list_.end()) { |
| 1846 | if (!end_key.empty() && it->first >= end_key) { |
| 1847 | break; |
| 1848 | } |
| 1849 | std::list<int64_t>& task_id_list = it->second; |
| 1850 | for (std::list<int64_t>::iterator itask = task_id_list.begin(); itask != task_id_list.end(); |
| 1851 | ++itask) { |
| 1852 | perf_counter_.meta_update_cnt.Inc(); |
| 1853 | int64_t task_id = *itask; |
| 1854 | SdkTask* task = task_pool_.GetTask(task_id); |
| 1855 | if (task == NULL) { |
| 1856 | VLOG(10) << "task " << task_id << " timeout when update meta success"; |
| 1857 | continue; |
| 1858 | } |
| 1859 | task->SetMetaTimeStamp(meta_timestamp); |
| 1860 | |
| 1861 | switch (task->Type()) { |
| 1862 | case SdkTask::READ: { |
| 1863 | reader_list.push_back(task); |
| 1864 | } break; |
| 1865 | case SdkTask::MUTATION: { |
| 1866 | mutation_list.push_back(task); |
| 1867 | } break; |
| 1868 | case SdkTask::BATCH_MUTATION: { |
| 1869 | batch_mutation_list.push_back(task); |
| 1870 | } break; |
| 1871 | case SdkTask::SCAN: { |
| 1872 | ScanTask* scan_task = (ScanTask*)task; |
| 1873 | CommitScan(scan_task, server_addr); |
| 1874 | } break; |
| 1875 | default: |
| 1876 | CHECK(false); |
| 1877 | break; |
| 1878 | } |
| 1879 | } |
| 1880 | std::map<std::string, std::list<int64_t> >::iterator tmp = it; |
| 1881 | ++it; |
| 1882 | pending_task_id_list_.erase(tmp); |
| 1883 | } |
| 1884 | |
| 1885 | if (mutation_list.size() > 0) { |
| 1886 | PackSdkTasks(server_addr, mutation_list, SdkTask::MUTATION); |
| 1887 | } |
| 1888 | if (reader_list.size() > 0) { |
| 1889 | PackSdkTasks(server_addr, reader_list, SdkTask::READ); |
nothing calls this directly
no test coverage detected