This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new e086bbf48c GH-41780: [C++][Flight][Benchmark] Ensure waiting server
ready (#41793)
e086bbf48c is described below
commit e086bbf48cf625e6fa2a7990efba8b9c5a99d09f
Author: Sutou Kouhei <[email protected]>
AuthorDate: Fri May 24 08:11:16 2024 +0900
GH-41780: [C++][Flight][Benchmark] Ensure waiting server ready (#41793)
### Rationale for this change
We should read from result stream to get an error of this RPC. If we don't
read from result stream, we can't detect an error of this RPC.
### What changes are included in this PR?
Call `Drain()` to detect an error.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #41780
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/src/arrow/flight/flight_benchmark.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cpp/src/arrow/flight/flight_benchmark.cc
b/cpp/src/arrow/flight/flight_benchmark.cc
index f53b1c6dce..057ef15c3c 100644
--- a/cpp/src/arrow/flight/flight_benchmark.cc
+++ b/cpp/src/arrow/flight/flight_benchmark.cc
@@ -131,7 +131,8 @@ struct PerformanceStats {
Status WaitForReady(FlightClient* client, const FlightCallOptions&
call_options) {
Action action{"ping", nullptr};
for (int attempt = 0; attempt < 10; attempt++) {
- if (client->DoAction(call_options, action).ok()) {
+ auto result_stream_result = client->DoAction(call_options, action);
+ if (result_stream_result.ok() && (*result_stream_result)->Drain().ok()) {
return Status::OK();
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));