From e46f2c69be29daa12fa77fb3c0993605a5b2d277 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 24 Jul 2018 20:44:51 +0200 Subject: [PATCH] Added debug strings to RAFT replica thread --- src/raft/ReplicaThread.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/raft/ReplicaThread.cc b/src/raft/ReplicaThread.cc index b4084cd6fa..341a8810f3 100644 --- a/src/raft/ReplicaThread.cc +++ b/src/raft/ReplicaThread.cc @@ -186,11 +186,11 @@ int RaftReplicaThread::replicate() int next_index = raftm->get_next_index(follower_id); + ostringstream ess; + if ( logdb->get_log_record(next_index, lr) != 0 ) { - ostringstream ess; - - ess << "Failed to load log record at index: " << next_index; + ess << "FAILURE load index: " << next_index; NebulaLog::log("RCM", Log::ERROR, ess); @@ -200,12 +200,20 @@ int RaftReplicaThread::replicate() if ( raftm->xmlrpc_replicate_log(follower_id, &lr, success, follower_term, error) != 0 ) { + ess << "FAILURE xmlrpc index: " << next_index << ", error: " << error; + + NebulaLog::log("RCM", Log::DEBUG, ess); + return -1; } if ( success ) { raftm->replicate_success(follower_id); + + ess << "SUCCESS index: " << next_index; + + NebulaLog::log("RCM", Log::DEBUG, ess); } else { @@ -222,6 +230,10 @@ int RaftReplicaThread::replicate() } else { + ess << "FAILURE API index: " << next_index << ", error: " << error; + + NebulaLog::log("RCM", Log::DEBUG, ess); + raftm->replicate_failure(follower_id); } }