Repository: incubator-ratis
Updated Branches:
  refs/heads/master 2ce10dc1a -> 6369d4e65


RATIS-253. Segmented Raft log rolls over segment frequently.  Contributed by 
Rajeshbabu Chintaguntla


Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/6369d4e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/6369d4e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/6369d4e6

Branch: refs/heads/master
Commit: 6369d4e65eb3d733d101786b6c79ca600bdace77
Parents: 2ce10dc
Author: Tsz Wo Nicholas Sze <[email protected]>
Authored: Tue Sep 11 12:03:57 2018 -0700
Committer: Tsz Wo Nicholas Sze <[email protected]>
Committed: Tue Sep 11 12:03:57 2018 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/ratis/server/storage/LogSegment.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6369d4e6/ratis-server/src/main/java/org/apache/ratis/server/storage/LogSegment.java
----------------------------------------------------------------------
diff --git 
a/ratis-server/src/main/java/org/apache/ratis/server/storage/LogSegment.java 
b/ratis-server/src/main/java/org/apache/ratis/server/storage/LogSegment.java
index 827e2e3..2550855 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/storage/LogSegment.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/storage/LogSegment.java
@@ -42,7 +42,10 @@ import java.util.function.Consumer;
  */
 class LogSegment implements Comparable<Long> {
   static long getEntrySize(LogEntryProto entry) {
-    final int serialized = entry.getSerializedSize();
+    final int serialized =
+        entry.getSerializedSize()
+            - (entry.getSmLogEntry().getStateMachineDataAttached() ? 
CodedOutputStream
+                
.computeBytesSizeNoTag(entry.getSmLogEntry().getStateMachineData()) : 0);
     return serialized + CodedOutputStream.computeUInt32SizeNoTag(serialized) + 
4;
   }
 

Reply via email to