Finish streams that error. Don't histogram failed ops.

Fail on failed write
pull/9807/head
Vijay Pai 8 years ago
parent cd232f64c6
commit 24992060c8
  1. 4
      test/cpp/qps/client_async.cc
  2. 15
      test/cpp/qps/client_sync.cc
  3. 4
      test/cpp/qps/server_sync.cc

@ -112,7 +112,9 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
next_state_ = State::RESP_DONE;
return true;
case State::RESP_DONE:
entry->set_value((UsageTimer::Now() - start_) * 1e9);
if (status_.ok()) {
entry->set_value((UsageTimer::Now() - start_) * 1e9);
}
callback_(status_, &response_, entry);
next_state_ = State::INVALID;
return false;

@ -129,7 +129,9 @@ class SynchronousUnaryClient final : public SynchronousClient {
grpc::ClientContext context;
grpc::Status s =
stub->UnaryCall(&context, request_, &responses_[thread_idx]);
entry->set_value((UsageTimer::Now() - start) * 1e9);
if (s.ok()) {
entry->set_value((UsageTimer::Now() - start) * 1e9);
}
entry->set_status(s.error_code());
return true;
}
@ -154,7 +156,7 @@ class SynchronousStreamingClient final : public SynchronousClient {
(*stream)->WritesDone();
Status s = (*stream)->Finish();
if (!s.ok()) {
gpr_log(GPR_ERROR, "Stream %zu received an error %s", i,
gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i,
s.error_message().c_str());
}
}
@ -170,8 +172,17 @@ class SynchronousStreamingClient final : public SynchronousClient {
if (stream_[thread_idx]->Write(request_) &&
stream_[thread_idx]->Read(&responses_[thread_idx])) {
entry->set_value((UsageTimer::Now() - start) * 1e9);
// don't set the status since there isn't one yet
return true;
}
stream_[thread_idx]->WritesDone();
Status s = stream_[thread_idx]->Finish();
// don't set the value since the stream is failed and shouldn't be timed
entry->set_status(s.error_code());
if (!s.ok()) {
gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", thread_idx,
s.error_message().c_str());
}
auto* stub = channels_[thread_idx % channels_.size()].get_stub();
context_[thread_idx].~ClientContext();
new (&context_[thread_idx]) ClientContext();

@ -74,7 +74,9 @@ class BenchmarkServiceImpl final : public BenchmarkService::Service {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
}
}
stream->Write(response);
if (!stream->Write(response)) {
return Status(StatusCode::INTERNAL, "Server couldn't respond");
}
}
return Status::OK;
}

Loading…
Cancel
Save