MCPcopy Create free account
hub / github.com/apache/impala / TransmitDataCompleteCb

Method TransmitDataCompleteCb

be/src/runtime/krpc-data-stream-sender.cc:513–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513void KrpcDataStreamSender::Channel::TransmitDataCompleteCb() {
514 std::unique_lock<SpinLock> l(lock_);
515 DCHECK(rpc_in_flight_);
516 DCHECK_NE(rpc_start_time_ns_, 0);
517 int64_t total_time = MonotonicNanos() - rpc_start_time_ns_;
518 const kudu::Status controller_status = rpc_controller_.status();
519 if (LIKELY(controller_status.ok())) {
520 DCHECK(rpc_in_flight_batch_ != nullptr);
521 // 'receiver_latency_ns' is calculated with MonoTime, so it must be non-negative.
522 DCHECK_GE(resp_.receiver_latency_ns(), 0);
523 DCHECK_GE(total_time, resp_.receiver_latency_ns());
524 int64_t row_batch_size = RowBatch::GetSerializedSize(*rpc_in_flight_batch_);
525 int64_t network_time = total_time - resp_.receiver_latency_ns();
526 COUNTER_ADD(parent_->bytes_sent_counter_, row_batch_size);
527 if (LIKELY(network_time > 0)) {
528 // 'row_batch_size' is bounded by FLAGS_rpc_max_message_size which shouldn't exceed
529 // max 32-bit signed value so multiplication below should not overflow.
530 DCHECK_LE(row_batch_size, numeric_limits<int32_t>::max());
531 int64_t network_throughput = row_batch_size * NANOS_PER_SEC / network_time;
532 parent_->network_throughput_counter_->UpdateCounter(network_throughput);
533 parent_->network_time_stats_->UpdateCounter(network_time);
534 }
535 parent_->recvr_time_stats_->UpdateCounter(resp_.receiver_latency_ns());
536 if (IsSlowRpc(total_time)) LogSlowRpc("TransmitData", total_time, resp_);
537 Status rpc_status = Status::OK();
538 int32_t status_code = resp_.status().status_code();
539 if (status_code == TErrorCode::DATASTREAM_RECVR_CLOSED) {
540 remote_recvr_closed_ = true;
541 } else {
542 rpc_status = StatusFromProto(resp_.status());
543 }
544 MarkDone(rpc_status);
545 } else {
546 if (IsSlowRpc(total_time)) {
547 LogSlowFailedRpc("TransmitData", total_time, controller_status);
548 }
549 DoRpcFn rpc_fn =
550 boost::bind(&KrpcDataStreamSender::Channel::DoTransmitDataRpc, this);
551 const string& prepend =
552 Substitute("TransmitData() to $0 failed", NetworkAddressPBToString(address_));
553 HandleFailedRPC(rpc_fn, controller_status, prepend);
554 }
555}
556
557Status KrpcDataStreamSender::Channel::DoTransmitDataRpc() {
558 DCHECK(rpc_in_flight_batch_ != nullptr);

Callers

nothing calls this directly

Calls 10

MonotonicNanosFunction · 0.85
maxFunction · 0.85
OKFunction · 0.85
StatusFromProtoFunction · 0.85
bindFunction · 0.85
SubstituteFunction · 0.85
NetworkAddressPBToStringFunction · 0.85
statusMethod · 0.45
okMethod · 0.45
UpdateCounterMethod · 0.45

Tested by

no test coverage detected