diff --git hbase-native-client/core/async-batch-rpc-retrying-caller.cc hbase-native-client/core/async-batch-rpc-retrying-caller.cc index 05290f5..a7e5c35 100644 --- hbase-native-client/core/async-batch-rpc-retrying-caller.cc +++ hbase-native-client/core/async-batch-rpc-retrying-caller.cc @@ -271,8 +271,8 @@ void AsyncBatchRpcRetryingCaller::GroupAndSend(const std::vectorserver_name().host_name() << "]; port[" << region_loc->server_name().port() << "];"; } else if (loc[i].hasException()) { - VLOG(8) << "Exception occured while locating region:- " - << loc[i].exception().getCopied()->what() << " for action index " << i; + VLOG(8) << "Exception occured while locating region:- " << loc[i].exception().what() + << " for action index " << i; // TODO Feedback needed, Java API only identifies DoNotRetryIOException // We might receive runtime error from location-cache.cc too, we are treating both same if (loc[i].exception().is_compatible_with()) { @@ -290,8 +290,7 @@ void AsyncBatchRpcRetryingCaller::GroupAndSend(const std::vector(*loc[i].exception().getCopied()), - nullptr); + AddError(action, std::make_shared(), nullptr); locate_failed.push_back(action); } } @@ -306,7 +305,6 @@ void AsyncBatchRpcRetryingCaller::GroupAndSend(const std::vector lock(multi_mutex_); - auto exc = ew.getCopied(); VLOG(8) << "GetRegionLocations() exception: " << ew.what().toStdString(); }); return; @@ -367,20 +365,18 @@ void AsyncBatchRpcRetryingCaller::Send(ActionsByServer &actions_by_server, int32 action_by_server.first, std::move(multi_response)); } } else if (completed_responses[num].hasException()) { - VLOG(8) << "Received exception: " - << completed_responses[num].exception().getCopied()->what() + VLOG(8) << "Received exception: " << completed_responses[num].exception().what() << " from server for action index " << num; // TODO: we should call OnError here as well. } } }) .onError([=](const folly::exception_wrapper &ew) { - auto exc = ew.getCopied(); VLOG(8) << "GetMultiResponse() exception: " << ew.what().toStdString(); std::lock_guard lock(multi_mutex_); for (const auto &action_by_server : actions_by_server) { OnError(action_by_server.second->actions_by_region(), tries, - std::make_shared(*exc), action_by_server.first); + std::make_shared(), action_by_server.first); } }); return; diff --git hbase-native-client/core/async-batch-rpc-retrying-caller.h hbase-native-client/core/async-batch-rpc-retrying-caller.h index 29a0e6a..77f8297 100644 --- hbase-native-client/core/async-batch-rpc-retrying-caller.h +++ hbase-native-client/core/async-batch-rpc-retrying-caller.h @@ -20,9 +20,9 @@ #pragma once #include +#include #include #include -#include #include #include #include diff --git hbase-native-client/core/async-rpc-retrying-caller.cc hbase-native-client/core/async-rpc-retrying-caller.cc index aee7d0b..cb058b1 100644 --- hbase-native-client/core/async-rpc-retrying-caller.cc +++ hbase-native-client/core/async-rpc-retrying-caller.cc @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include "connection/rpc-client.h" #include "core/async-connection.h" @@ -94,9 +94,10 @@ void AsyncSingleRequestRpcRetryingCaller::LocateThenCall() { .then([this](std::shared_ptr loc) { Call(*loc); }) .onError([this](const exception_wrapper& e) { OnError(e, - [this]() -> std::string { + [this, e]() -> std::string { return "Locate '" + row_ + "' in " + table_name_->namespace_() + "::" + - table_name_->qualifier() + " failed, tries = " + std::to_string(tries_) + + table_name_->qualifier() + " failed with e.what()=" + + e.what().toStdString() + ", tries = " + std::to_string(tries_) + ", maxAttempts = " + std::to_string(max_attempts_) + ", timeout = " + TimeUtil::ToMillisStr(operation_timeout_nanos_) + " ms, time elapsed = " + TimeUtil::ElapsedMillisStr(this->start_ns_) + " ms"; @@ -116,6 +117,12 @@ void AsyncSingleRequestRpcRetryingCaller::OnError( return; } + if (tries_ > start_log_errors_count_) { + LOG(WARNING) << err_msg(); + } else { + VLOG(1) << err_msg(); + } + int64_t delay_ns; if (operation_timeout_nanos_.count() > 0) { int64_t max_delay_ns = RemainingTimeNs() - ConnectionUtils::kSleepDeltaNs; @@ -174,21 +181,21 @@ void AsyncSingleRequestRpcRetryingCaller::Call(const RegionLocation& loc) callable_(controller_, loc_ptr, rpc_client) .then([loc_ptr, this](const RESP& resp) { this->promise_->setValue(std::move(resp)); }) .onError([&, loc_ptr, this](const exception_wrapper& e) { - OnError(e, - [&, this]() -> std::string { - return "Call to " + folly::sformat("{0}:{1}", loc_ptr->server_name().host_name(), - loc_ptr->server_name().port()) + - " for '" + row_ + "' in " + loc_ptr->DebugString() + " of " + - table_name_->namespace_() + "::" + table_name_->qualifier() + - " failed, tries = " + std::to_string(tries_) + ", maxAttempts = " + - std::to_string(max_attempts_) + ", timeout = " + - TimeUtil::ToMillisStr(this->operation_timeout_nanos_) + - " ms, time elapsed = " + TimeUtil::ElapsedMillisStr(this->start_ns_) + - " ms"; - }, - [&, this](const exception_wrapper& error) { - conn_->region_locator()->UpdateCachedLocation(*loc_ptr, error); - }); + OnError( + e, + [&, this, e]() -> std::string { + return "Call to " + folly::sformat("{0}:{1}", loc_ptr->server_name().host_name(), + loc_ptr->server_name().port()) + + " for '" + row_ + "' in " + loc_ptr->DebugString() + " of " + + table_name_->namespace_() + "::" + table_name_->qualifier() + + " failed with e.what()=" + e.what().toStdString() + ", tries = " + + std::to_string(tries_) + ", maxAttempts = " + std::to_string(max_attempts_) + + ", timeout = " + TimeUtil::ToMillisStr(this->operation_timeout_nanos_) + + " ms, time elapsed = " + TimeUtil::ElapsedMillisStr(this->start_ns_) + " ms"; + }, + [&, this](const exception_wrapper& error) { + conn_->region_locator()->UpdateCachedLocation(*loc_ptr, error); + }); }); } diff --git hbase-native-client/core/raw-async-table.h hbase-native-client/core/raw-async-table.h index ca12be6..e651f8a 100644 --- hbase-native-client/core/raw-async-table.h +++ hbase-native-client/core/raw-async-table.h @@ -18,8 +18,8 @@ */ #pragma once +#include #include -#include #include #include #include diff --git hbase-native-client/core/table.cc hbase-native-client/core/table.cc index b89c1a2..3b7a87b 100644 --- hbase-native-client/core/table.cc +++ hbase-native-client/core/table.cc @@ -120,9 +120,9 @@ std::vector> Table::Get(const std::vectorwhat() << " for " + LOG(ERROR) << "Caught exception:- " << tresult.exception().what() << " for " << gets[num++].row(); - throw tresult.exception().getCopied(); + throw tresult.exception(); } } return results; diff --git hbase-native-client/docker-files/Dockerfile hbase-native-client/docker-files/Dockerfile index d5a1eab..efd9a9d 100644 --- hbase-native-client/docker-files/Dockerfile +++ hbase-native-client/docker-files/Dockerfile @@ -84,6 +84,39 @@ RUN git clone https://github.com/google/protobuf.git /usr/src/protobuf && \ make clean && \ ldconfig +# Update folly +RUN cd /usr/src/ && \ + ver=2017.06.19.00 && \ + wget https://github.com/facebook/folly/archive/v$ver.tar.gz && \ + tar zxf v$ver.tar.gz && \ + rm -rf v$ver.tar.gz && \ + cd folly-$ver/folly/test && \ + rm -rf gtest && \ + wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \ + tar zxf release-1.8.0.tar.gz && \ + rm -f release-1.8.0.tar.gz && \ + mv googletest-release-1.8.0 gtest && \ + cd ../ && \ + ldconfig && \ + autoreconf -ivf && \ + ./configure && \ + make && \ + make check && \ + make install + +# Update wangle +RUN cd /usr/src/ && \ + ver=2017.06.26.00 && \ + wget https://github.com/facebook/wangle/archive/v$ver.tar.gz && \ + tar zxf v$ver.tar.gz && \ + rm -rf v$ver.tar.gz && \ + cd wangle-$ver/wangle && \ + ldconfig && \ + cmake . -DBUILD_TESTS=OFF && \ + make && \ + ctest && \ + make install + ENTRYPOINT /usr/sbin/krb5kdc -P /var/run/krb5kdc.pid && /bin/bash WORKDIR /usr/src/hbase/hbase-native-client