in src/hbase/client/async-batch-rpc-retrying-caller.cc [444:484]
void AsyncBatchRpcRetryingCaller<REQ, RESP>::OnComplete(
const std::shared_ptr<Action> &action, const std::shared_ptr<RegionRequest> ®ion_request,
int32_t tries, const std::shared_ptr<ServerName> &server_name,
const std::shared_ptr<RegionResult> ®ion_result,
std::vector<std::shared_ptr<Action>> &failed_actions) {
std::string err_msg;
try {
auto result_or_exc = region_result->ResultOrException(action->original_index());
auto result = std::get<0>(*result_or_exc);
auto exc = std::get<1>(*result_or_exc);
if (exc != nullptr) {
LogException(tries, region_request, *exc, server_name);
if (tries >= max_attempts_ || !ExceptionUtil::ShouldRetry(*exc)) {
FailOne(action, tries, *exc, TimeUtil::GetNowNanos(), GetExtraContextForError(server_name));
} else {
failed_actions.push_back(action);
}
} else if (result != nullptr) {
action2promises_[action->original_index()].setValue(std::move(result));
} else {
std::string err_msg = "Invalid response: Server " + server_name->ShortDebugString() +
" sent us neither results nor exceptions for request @ index " +
std::to_string(action->original_index()) + ", row " +
action->action()->row() + " of " +
region_request->region_location()->region_name();
VLOG(1) << err_msg;
auto ew = folly::make_exception_wrapper<std::runtime_error>(err_msg);
AddError(action, ew, server_name);
failed_actions.push_back(action);
}
} catch (const std::out_of_range &oor) {
// This should never occur. Error in logic. Throwing std::runtime_error from here. Will be
// retried or failed
std::string err_msg = "ResultOrException not present @ index " +
std::to_string(action->original_index()) + ", row " +
action->action()->row() + " of " +
region_request->region_location()->region_name();
throw std::runtime_error(err_msg);
}
return;
}