| 413 | } |
| 414 | |
| 415 | bool RemoteTabletNode::DoQuotaScanRpcRetry(RpcTask* rpc) { |
| 416 | CHECK(rpc->rpc_type == RPC_SCAN); |
| 417 | ScanRpc* scan_rpc = (ScanRpc*)rpc; |
| 418 | std::string table_name = scan_rpc->request->table_name(); |
| 419 | if (!quota_entry_->CheckAndConsume(table_name, |
| 420 | quota::OpTypeAmountList{std::make_pair(kQuotaScanReqs, 1)})) { |
| 421 | if ((quota_retry_rpc_schedule_->GetPendingTaskCount() < |
| 422 | FLAGS_tera_quota_max_retry_queue_length) && |
| 423 | (++scan_rpc->retry_time < FLAGS_tera_quota_scan_max_retry_times)) { |
| 424 | quota_retry_rpc_schedule_->EnqueueRpc(table_name, rpc); |
| 425 | scan_thread_pool_->DelayTask(FLAGS_tera_quota_scan_retry_delay_interval, // default 100ms |
| 426 | std::bind(&RemoteTabletNode::DoQuotaRetryScheduleRpc, this, |
| 427 | quota_retry_rpc_schedule_.get())); |
| 428 | } else { |
| 429 | scan_rpc->response->set_sequence_id(scan_rpc->request->sequence_id()); |
| 430 | scan_rpc->response->set_status(kQuotaLimited); |
| 431 | scan_quota_reject_counter.Inc(); |
| 432 | VLOG(20) << "quota_entry check failed for ScanTablet"; |
| 433 | scan_rpc->done->Run(); |
| 434 | delete rpc; |
| 435 | } |
| 436 | return false; |
| 437 | } |
| 438 | return true; |
| 439 | } |
| 440 | |
| 441 | void RemoteTabletNode::DoQuotaRetryScheduleRpc(RpcSchedule* rpc_schedule) { |
| 442 | RpcTask* rpc = NULL; |
nothing calls this directly
no test coverage detected