kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject incubator-kudu git commit: Include error code in log message when consensus peer gets an error from the remote
Date Tue, 08 Mar 2016 21:11:44 GMT
Repository: incubator-kudu
Updated Branches:
  refs/heads/master ebb371335 -> 044b2c1bd


Include error code in log message when consensus peer gets an error from the remote

Currently we only log the Status. We should also log the
TabletServerErrorPB::Code.

Change-Id: I4db3ca666aee0202b3e4a024bfbad70f80b144ce
Reviewed-on: http://gerrit.cloudera.org:8080/2487
Reviewed-by: Todd Lipcon <todd@apache.org>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/044b2c1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/044b2c1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/044b2c1b

Branch: refs/heads/master
Commit: 044b2c1bd34f61f84d740549a888f79a4b609342
Parents: ebb3713
Author: Mike Percy <mpercy@apache.org>
Authored: Mon Mar 7 15:08:45 2016 +0200
Committer: Mike Percy <mpercy@apache.org>
Committed: Tue Mar 8 21:11:12 2016 +0000

----------------------------------------------------------------------
 src/kudu/consensus/consensus_peers.cc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/044b2c1b/src/kudu/consensus/consensus_peers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_peers.cc b/src/kudu/consensus/consensus_peers.cc
index 2d49939..76f82da 100644
--- a/src/kudu/consensus/consensus_peers.cc
+++ b/src/kudu/consensus/consensus_peers.cc
@@ -72,6 +72,7 @@ using std::shared_ptr;
 using rpc::Messenger;
 using rpc::RpcController;
 using strings::Substitute;
+using tserver::TabletServerErrorPB;
 
 Status Peer::NewRemotePeer(const RaftPeerPB& peer_pb,
                            const string& tablet_id,
@@ -245,7 +246,7 @@ void Peer::ProcessResponse() {
   // Pass through errors we can respond to, like not found, since in that case
   // we will need to remotely bootstrap. TODO: Handle DELETED response once implemented.
   if ((response_.has_error() &&
-      response_.error().code() != tserver::TabletServerErrorPB::TABLET_NOT_FOUND) ||
+      response_.error().code() != TabletServerErrorPB::TABLET_NOT_FOUND) ||
       (response_.status().has_error() &&
           response_.status().error().code() == consensus::ConsensusErrorPB::CANNOT_PREPARE))
{
     // Again, let the queue know that the remote is still responsive, since we
@@ -304,7 +305,7 @@ void Peer::ProcessRemoteBootstrapResponse() {
   if (controller_.status().ok() && rb_response_.has_error()) {
     // ALREADY_INPROGRESS is expected, so we do not log this error.
     if (rb_response_.error().code() ==
-        kudu::tserver::TabletServerErrorPB::TabletServerErrorPB::ALREADY_INPROGRESS) {
+        TabletServerErrorPB::TabletServerErrorPB::ALREADY_INPROGRESS) {
       queue_->NotifyPeerIsResponsiveDespiteError(peer_pb_.permanent_uuid());
     } else {
       LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Unable to begin remote bootstrap on peer:
"
@@ -316,9 +317,17 @@ void Peer::ProcessRemoteBootstrapResponse() {
 
 void Peer::ProcessResponseError(const Status& status) {
   failed_attempts_++;
+  string resp_err_info;
+  if (response_.has_error()) {
+    resp_err_info = Substitute(" Error code: $0 ($1).",
+                               TabletServerErrorPB::Code_Name(response_.error().code()),
+                               response_.error().code());
+  }
   LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Couldn't send request to peer " << peer_pb_.permanent_uuid()
-      << " for tablet " << tablet_id_
-      << " Status: " << status.ToString() << ". Retrying in the next heartbeat
period."
+      << " for tablet " << tablet_id_ << "."
+      << resp_err_info
+      << " Status: " << status.ToString() << "."
+      << " Retrying in the next heartbeat period."
       << " Already tried " << failed_attempts_ << " times.";
   sem_.Release();
 }


Mime
View raw message