This is an automated email from the ASF dual-hosted git repository.

elserj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git

commit 1698e7345b3894f26d3758bffe496443006b356e
Author: Josh Elser <[email protected]>
AuthorDate: Wed Apr 10 15:13:19 2019 -0400

    RATIS-523. Switch chatty debug to trace logging
---
 .../ratis/logservice/server/LogServiceRaftLogReader.java     | 12 +++++++-----
 .../org/apache/ratis/logservice/server/LogStateMachine.java  | 11 ++++-------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git 
a/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogServiceRaftLogReader.java
 
b/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogServiceRaftLogReader.java
index ef0eb83..da31f8f 100644
--- 
a/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogServiceRaftLogReader.java
+++ 
b/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogServiceRaftLogReader.java
@@ -56,7 +56,7 @@ public class LogServiceRaftLogReader {
    * element, but take care to check if a value is present using {@link 
#hasNext()} first.
    */
   public void seek(long recordId) throws RaftLogIOException, 
InvalidProtocolBufferException {
-    LOG.debug("Seeking to recordId={}", recordId);
+    LOG.trace("Seeking to recordId={}", recordId);
     // RaftLog starting index
     currentRaftIndex = raftLog.getStartIndex();
     currentRecordId = 0;
@@ -99,10 +99,12 @@ public class LogServiceRaftLogReader {
   private void loadNext() throws RaftLogIOException, 
InvalidProtocolBufferException {
     // Clear the old "current" record
     currentRecord = null;
-    LOG.debug("Loading next value: raftIndex={}, recordId={}, proto='{}', 
offset={}",
-        currentRaftIndex, currentRecordId,
-        currentLogEntry == null ? "null" : 
TextFormat.shortDebugString(currentLogEntry),
-            currentLogEntryOffset);
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("Loading next value: raftIndex={}, recordId={}, proto='{}', 
offset={}",
+          currentRaftIndex, currentRecordId,
+          currentLogEntry == null ? "null" : 
TextFormat.shortDebugString(currentLogEntry),
+              currentLogEntryOffset);
+    }
     // Continue iterating over the current entry.
     if (currentLogEntry != null) {
       assert currentLogEntryOffset != -1;
diff --git 
a/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogStateMachine.java
 
b/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogStateMachine.java
index 7095e44..ef6c385 100644
--- 
a/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogStateMachine.java
+++ 
b/ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogStateMachine.java
@@ -27,9 +27,6 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.TreeMap;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
@@ -271,7 +268,7 @@ public class LogStateMachine extends BaseStateMachine {
   private CompletableFuture<Message> 
processGetSizeRequest(LogServiceRequestProto proto) {
     GetLogSizeRequestProto msgProto = proto.getSizeRequest();
     Throwable t = verifyState(State.OPEN);
-    LOG.debug("QUERY: {}, RESULT: {}", msgProto, this.dataRecordsSize);
+    LOG.trace("Size query: {}, Result: {}", msgProto, this.dataRecordsSize);
     return CompletableFuture.completedFuture(Message
       
.valueOf(LogServiceProtoUtil.toGetLogSizeReplyProto(this.dataRecordsSize, 
t).toByteString()));
   }
@@ -279,7 +276,7 @@ public class LogStateMachine extends BaseStateMachine {
   private CompletableFuture<Message> 
processGetLengthRequest(LogServiceRequestProto proto) {
     GetLogLengthRequestProto msgProto = proto.getLengthQuery();
     Throwable t = verifyState(State.OPEN);
-    LOG.debug("QUERY: {}, RESULT: {}", msgProto, this.length);
+    LOG.trace("Length query: {}, Result: {}", msgProto, this.length);
     return CompletableFuture.completedFuture(Message
       .valueOf(LogServiceProtoUtil.toGetLogLengthReplyProto(this.length, 
t).toByteString()));
   }
@@ -359,9 +356,9 @@ public class LogStateMachine extends BaseStateMachine {
         CompletableFuture.completedFuture(
           Message.valueOf(LogServiceProtoUtil.toAppendLogReplyProto(ids, 
t).toByteString()));
     final RaftProtos.RaftPeerRole role = trx.getServerRole();
-    LOG.debug("{}:{}-{}: {} new length {}", role, getId(), index, proto, 
dataRecordsSize);
     if (LOG.isTraceEnabled()) {
-      LOG.trace("{}-{}: variables={}", getId(), index, dataRecordsSize);
+      LOG.trace("{}:{}-{}: {} new length {}", role, getId(), index,
+          TextFormat.shortDebugString(proto), dataRecordsSize);
     }
     return f;
   }

Reply via email to