Repository: kudu Updated Branches: refs/heads/master 3e59fd7b1 -> 034b2af86
consensus: fix reporting of errors in CANNOT_PREPARE case This fixes the handling of CANNOT_PREPARE on the leader side to properly extract the correct error status from the response protobuf. A small typo resulted in calling StatusFromPB() on an uninitialized PB rather than on the actual place where the error was being set, causing a warning like: W1120 20:52:37.124464 38069 consensus_peers.cc:422] T 560e48bbfb8b4bcaad64f68af7a260d8 P f943a8757adf425f85915366458b0b7f -> Peer abc22956e2884b1db7baa1ca276a06f9 (127.36.112.129:42951): Couldn't send request to peer abc22956e2884b1db7baa1ca276a06f9 for tablet 560e48bbfb8b4bcaad64f68af7a260d8. Status: Runtime error: (unknown error code). Retrying in the next heartbeat period. Already tried 1 times. Now, it properly reports: W1120 20:55:46.801003 41186 consensus_peers.cc:422] T d076ba9e671843fc81080f39bdedc881 P 5c8b928b87c5450bb5e7486f1447a4eb -> Peer 02eeb46a805a4de282263fa9805cb25a (127.39.194.66:35783): Couldn't send request to peer 02eeb46a805a4de282263fa9805cb25a for tablet d076ba9e671843fc81080f39bdedc881. Status: Illegal state: Rejecting Update request from peer 5c8b928b87c5450bb5e7486f1447a4eb for term 1. Could not prepare a single transaction due to: Illegal state: Not initializing new transaction; the tablet is stopped. Retrying in the next heartbeat period. Already tried 9 times. Additionally, this improves the logging on the follower side to be slightly more clear about the CANNOT_PREPARE case. Change-Id: I93d232c3a65502bf5120f955cbedc4d1e5f394da Reviewed-on: http://gerrit.cloudera.org:8080/8615 Tested-by: Kudu Jenkins Reviewed-by: Mike Percy <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/034b2af8 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/034b2af8 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/034b2af8 Branch: refs/heads/master Commit: 034b2af860eca7a88d52a77f6d9cd4a1f0ec10f7 Parents: 3e59fd7 Author: Todd Lipcon <[email protected]> Authored: Mon Nov 20 20:56:12 2017 -0800 Committer: Mike Percy <[email protected]> Committed: Tue Nov 21 19:58:42 2017 +0000 ---------------------------------------------------------------------- src/kudu/consensus/consensus_peers.cc | 2 +- src/kudu/consensus/raft_consensus.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/034b2af8/src/kudu/consensus/consensus_peers.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/consensus_peers.cc b/src/kudu/consensus/consensus_peers.cc index 9019e60..ffa373d 100644 --- a/src/kudu/consensus/consensus_peers.cc +++ b/src/kudu/consensus/consensus_peers.cc @@ -304,7 +304,7 @@ void Peer::ProcessResponse() { // this path is responsible for KUDU-1779. if (response_.status().has_error() && response_.status().error().code() == consensus::ConsensusErrorPB::CANNOT_PREPARE) { - Status response_status = StatusFromPB(response_.error().status()); + Status response_status = StatusFromPB(response_.status().error().status()); queue_->UpdatePeerStatus(peer_pb_.permanent_uuid(), PeerStatus::CANNOT_PREPARE, response_status); ProcessResponseError(response_status); http://git-wip-us.apache.org/repos/asf/kudu/blob/034b2af8/src/kudu/consensus/raft_consensus.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc index 99ecefe..ce4ba54 100644 --- a/src/kudu/consensus/raft_consensus.cc +++ b/src/kudu/consensus/raft_consensus.cc @@ -1285,9 +1285,9 @@ Status RaftConsensus::UpdateReplica(const ConsensusRequestPB* request, iter = deduped_req.messages.erase(iter); if (need_to_warn) { need_to_warn = false; - LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Could not prepare transaction for op: " - << msg->get()->id() << ". Suppressed " << deduped_req.messages.size() << - " other warnings. Status for this op: " << prepare_status.ToString(); + LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Could not prepare transaction for op " + << msg->get()->id() << " and following " << deduped_req.messages.size() << + " ops. Status for this op: " << prepare_status.ToString(); } }
