| 1365 | } |
| 1366 | |
| 1367 | void TableImpl::CommitTasksById(const std::string& server_addr, std::vector<int64_t>& task_id_list, |
| 1368 | SdkTask::TYPE task_type) { |
| 1369 | std::vector<RowMutationImpl*> mutation_list; |
| 1370 | std::vector<RowReaderImpl*> reader_list; |
| 1371 | std::vector<BatchMutationImpl*> batch_mutation_list; |
| 1372 | |
| 1373 | for (size_t i = 0; i < task_id_list.size(); i++) { |
| 1374 | int64_t task_id = task_id_list[i]; |
| 1375 | SdkTask* task = task_pool_.GetTask(task_id); |
| 1376 | if (task == NULL) { |
| 1377 | VLOG(10) << "commit task, type " << task_type << ", id " << task_id << " timeout"; |
| 1378 | continue; |
| 1379 | } |
| 1380 | perf_counter_.total_commit_cnt.Inc(); |
| 1381 | CHECK_EQ(task->Type(), task_type); |
| 1382 | if (task_type == SdkTask::MUTATION) { |
| 1383 | mutation_list.push_back((RowMutationImpl*)task); |
| 1384 | } else if (task_type == SdkTask::READ) { |
| 1385 | reader_list.push_back((RowReaderImpl*)task); |
| 1386 | } else if (task_type == SdkTask::BATCH_MUTATION) { |
| 1387 | batch_mutation_list.push_back((BatchMutationImpl*)task); |
| 1388 | } |
| 1389 | } |
| 1390 | if (task_type == SdkTask::MUTATION) { |
| 1391 | CommitMutations(server_addr, mutation_list); |
| 1392 | } else if (task_type == SdkTask::READ) { |
| 1393 | CommitReaders(server_addr, reader_list); |
| 1394 | } else if (task_type == SdkTask::BATCH_MUTATION) { |
| 1395 | CommitBatchMutations(server_addr, batch_mutation_list); |
| 1396 | } |
| 1397 | } |
| 1398 | |
| 1399 | bool TableImpl::GetTabletMetaForKey(const std::string& key, TabletMeta* meta) { |
| 1400 | MutexLock lock(&meta_mutex_); |