Remove newlines from raft_consensus.cc state logging
Removes an explicit newline from ReplicaState::ToStringUnlocked, which
was causing split log lines in raft_consensus.cc.
Before:
I0930 15:01:06.197114 292159488 raft_consensus.cc:505] T
00000000000000000000000000000000 P a65e9f463a254ae1a7e34a1a8e4cc7cc [term 0
FOLLOWER]: Becoming Follower/Learner. State: Replica:
a65e9f463a254ae1a7e34a1a8e4cc7cc, State: 1, Role: FOLLOWER
Watermarks: {Received: term: 0 index: 0 Committed: term: 0 index: 0}
After:
I0930 14:51:09.334908 360529920 raft_consensus.cc:505] T
00000000000000000000000000000000 P d2878bd460384b8ab58dd3aaf2c8f52d [term 0
FOLLOWER]: Becoming Follower/Learner. State: Replica:
d2878bd460384b8ab58dd3aaf2c8f52d, State: 1, Role: FOLLOWER, Watermarks:
{Received: term: 0 index: 0, Committed: term: 0 index: 0}
Change-Id: If1f3db96ece79e81b42bce4db51d37f14df14f50
Reviewed-on: http://gerrit.cloudera.org:8080/4580
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/e0c6ced3
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/e0c6ced3
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/e0c6ced3
Branch: refs/heads/master
Commit: e0c6ced3e848e490f24780488bebd0c46c6804a1
Parents: ddaf9b3
Author: Dan Burkert <[email protected]>
Authored: Fri Sep 30 14:59:25 2016 -0700
Committer: Todd Lipcon <[email protected]>
Committed: Tue Oct 4 00:59:19 2016 +0000
----------------------------------------------------------------------
src/kudu/consensus/raft_consensus_state.cc | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/e0c6ced3/src/kudu/consensus/raft_consensus_state.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus_state.cc
b/src/kudu/consensus/raft_consensus_state.cc
index 7763cb6..a212fad 100644
--- a/src/kudu/consensus/raft_consensus_state.cc
+++ b/src/kudu/consensus/raft_consensus_state.cc
@@ -696,15 +696,10 @@ string ReplicaState::ToString() const {
string ReplicaState::ToStringUnlocked() const {
DCHECK(update_lock_.is_locked());
- string ret;
- SubstituteAndAppend(&ret, "Replica: $0, State: $1, Role: $2\n",
- peer_uuid_, state_,
- RaftPeerPB::Role_Name(GetActiveRoleUnlocked()));
-
- SubstituteAndAppend(&ret, "Watermarks: {Received: $0 Committed: $1}\n",
- last_received_op_id_.ShortDebugString(),
- last_committed_op_id_.ShortDebugString());
- return ret;
+ return Substitute("Replica: $0, State: $1, Role: $2, Watermarks: {Received:
$3, Committed: $4}",
+ peer_uuid_, state_,
RaftPeerPB::Role_Name(GetActiveRoleUnlocked()),
+ last_received_op_id_.ShortDebugString(),
+ last_committed_op_id_.ShortDebugString());
}
Status ReplicaState::CheckOpInSequence(const OpId& previous, const OpId&
current) {