void AsyncScanRpcRetryingCaller::Call()

in src/hbase/client/async-scan-rpc-retrying-caller.cc [379:415]


void AsyncScanRpcRetryingCaller::Call() {
  VLOG(5) << "Scan: Call";
  auto self(shared_from_this());
  // As we have a call sequence for scan, it is useless to have a different rpc timeout which is
  // less than the scan timeout. If the server does not respond in time(usually this will not
  // happen as we have heartbeat now), we will get an OutOfOrderScannerNextException when
  // resending the next request and the only way to fix this is to close the scanner and open a
  // new one.
  int64_t call_timeout_nanos;
  if (scan_timeout_nanos_.count() > 0) {
    int64_t remaining_nanos = scan_timeout_nanos_.count() - (TimeUtil::GetNowNanos() - start_ns_);
    if (remaining_nanos <= 0) {
      CompleteExceptionally(true);
      return;
    }
    call_timeout_nanos = remaining_nanos;
  } else {
    call_timeout_nanos = 0L;
  }

  ResetController(controller_, call_timeout_nanos);

  auto req =
      RequestConverter::ToScanRequest(scanner_id_, scan_->Caching(), false, next_call_seq_, false);

  // do the RPC call
  rpc_client_
      ->AsyncCall(region_location_->server_name().host_name(),
                  region_location_->server_name().port(), std::move(req),
                  security::User::defaultUser(), "ClientService")
      .via(conn_->cpu_executor().get())
      .then([self, this](const std::unique_ptr<Response>& resp) {
        auto scan_resp = std::static_pointer_cast<pb::ScanResponse>(resp->resp_msg());
        return OnComplete(controller_, scan_resp, resp->cell_scanner());
      })
      .onError([self, this](const folly::exception_wrapper& e) { OnError(e); });
}