You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sanpwc (via GitHub)" <gi...@apache.org> on 2025/07/18 08:25:36 UTC

[PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

sanpwc opened a new pull request, #6278:
URL: https://github.com/apache/ignite-3/pull/6278

   https://issues.apache.org/jira/browse/IGNITE-25948


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "denis-chudov (via GitHub)" <gi...@apache.org>.
denis-chudov commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215932466


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -3068,7 +3062,7 @@ public void run(final Status status) {
     private void preVote() {
         long preVoteTerm;
         try {
-            LOG.info("Node {} term {} start preVote.", getNodeId(), this.currTerm);
+            LOG.debug("Node {} term {} start preVote.", getNodeId(), this.currTerm);

Review Comment:
   the same about group id



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -3019,7 +3013,7 @@ public void handlePreVoteResponse(final PeerId peerId, final long term, final Re
                     "Raft node receives higher term pre_vote_response."));
                 return;
             }
-            LOG.info("Node {} received PreVoteResponse from {}, term={}, granted={}.", getNodeId(), peerId,
+            LOG.debug("Node {} received PreVoteResponse from {}, term={}, granted={}.", getNodeId(), peerId,

Review Comment:
   the same about group id



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1187,19 +1190,10 @@ private boolean initBallotBox() {
         // TODO: uncomment when backport related change https://issues.apache.org/jira/browse/IGNITE-22923
         //ballotBoxOpts.setNodeId(getNodeId());
          // Try to initialize the last committed index in BallotBox to be the last snapshot index.
-        long lastCommittedIndex = 0;
-        if (this.snapshotExecutor != null) {
-            lastCommittedIndex = this.snapshotExecutor.getLastSnapshotIndex();
-        }
-        if (this.getQuorum() == 1) {
-            // It is safe to initiate lastCommittedIndex as last log one because in case of single peer no one will discard
-            // log records on leader election.
-            // Fix https://github.com/sofastack/sofa-jraft/issues/1049
-            lastCommittedIndex = Math.max(lastCommittedIndex, this.logManager.getLastLogIndex());
-        }
+        long lastCommittedIndex = getLastCommittedIndex();
 
         ballotBoxOpts.setLastCommittedIndex(lastCommittedIndex);
-        LOG.info("Node {} init ballot box's lastCommittedIndex={}.", getNodeId(), lastCommittedIndex);
+        LOG.debug("Node {} init ballot box's lastCommittedIndex={}.", getNodeId(), lastCommittedIndex);

Review Comment:
   also useless without group id



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1608,7 +1602,7 @@ else if (this.state.compareTo(State.STATE_TRANSFERRING) <= 0) {
             this.electionTimer.restart();
         }
         else {
-            LOG.info("Node {} is a learner, election timer is not started.", this.nodeId);
+            LOG.debug("Node {} is a learner, election timer is not started.", this.nodeId);

Review Comment:
   also useless without group id



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1066,7 +1068,7 @@ public boolean init(final NodeOptions opts) {
             Requires.requireTrue(this.conf.isValid(), "Invalid conf: %s", this.conf);
         }
         else {
-            LOG.info("Init node {} with empty conf.", this.serverId);
+            LOG.info("Init node {} with empty conf, lastCommittedIndex={}.", this.serverId, getLastCommittedIndex());

Review Comment:
   this doesn't contain group id



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#issuecomment-3702274044

   @sanpwc Hi Alexander, I see that the ticket is resolved, but the patch has not been merged. Should I resolve the conflicts and merge the patch?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215968383


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1608,7 +1602,7 @@ else if (this.state.compareTo(State.STATE_TRANSFERRING) <= 0) {
             this.electionTimer.restart();
         }
         else {
-            LOG.info("Node {} is a learner, election timer is not started.", this.nodeId);
+            LOG.debug("Node {} is a learner, election timer is not started.", this.nodeId);

Review Comment:
   this.nodeId contains groupId
   `this.nodeId = new NodeId(this.groupId, this.serverId);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215970307


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -3068,7 +3062,7 @@ public void run(final Status status) {
     private void preVote() {
         long preVoteTerm;
         try {
-            LOG.info("Node {} term {} start preVote.", getNodeId(), this.currTerm);
+            LOG.debug("Node {} term {} start preVote.", getNodeId(), this.currTerm);

Review Comment:
   Same about getNodeId()



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215969226


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1187,19 +1190,10 @@ private boolean initBallotBox() {
         // TODO: uncomment when backport related change https://issues.apache.org/jira/browse/IGNITE-22923
         //ballotBoxOpts.setNodeId(getNodeId());
          // Try to initialize the last committed index in BallotBox to be the last snapshot index.
-        long lastCommittedIndex = 0;
-        if (this.snapshotExecutor != null) {
-            lastCommittedIndex = this.snapshotExecutor.getLastSnapshotIndex();
-        }
-        if (this.getQuorum() == 1) {
-            // It is safe to initiate lastCommittedIndex as last log one because in case of single peer no one will discard
-            // log records on leader election.
-            // Fix https://github.com/sofastack/sofa-jraft/issues/1049
-            lastCommittedIndex = Math.max(lastCommittedIndex, this.logManager.getLastLogIndex());
-        }
+        long lastCommittedIndex = getLastCommittedIndex();
 
         ballotBoxOpts.setLastCommittedIndex(lastCommittedIndex);
-        LOG.info("Node {} init ballot box's lastCommittedIndex={}.", getNodeId(), lastCommittedIndex);
+        LOG.debug("Node {} init ballot box's lastCommittedIndex={}.", getNodeId(), lastCommittedIndex);

Review Comment:
   getNodeId() contains groupId



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -3019,7 +3013,7 @@ public void handlePreVoteResponse(final PeerId peerId, final long term, final Re
                     "Raft node receives higher term pre_vote_response."));
                 return;
             }
-            LOG.info("Node {} received PreVoteResponse from {}, term={}, granted={}.", getNodeId(), peerId,
+            LOG.debug("Node {} received PreVoteResponse from {}, term={}, granted={}.", getNodeId(), peerId,

Review Comment:
   Same about getNodeId()



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2216036585


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -4061,6 +4055,23 @@ private void logConfigurationChange(final Configuration newConfiguration) {
         }
     }
 
+    private long getLastCommittedIndex() {

Review Comment:
   Both fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215965942


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1066,7 +1068,7 @@ public boolean init(final NodeOptions opts) {
             Requires.requireTrue(this.conf.isValid(), "Invalid conf: %s", this.conf);
         }
         else {
-            LOG.info("Init node {} with empty conf.", this.serverId);
+            LOG.info("Init node {} with empty conf, lastCommittedIndex={}.", this.serverId, getLastCommittedIndex());

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "alievmirza (via GitHub)" <gi...@apache.org>.
alievmirza commented on code in PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278#discussion_r2215957653


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -4061,6 +4055,23 @@ private void logConfigurationChange(final Configuration newConfiguration) {
         }
     }
 
+    private long getLastCommittedIndex() {

Review Comment:
   Confusing method name, it seems to me that this method is valid only on init, but name says nothing about that. 
   
   Somebody could use this method wrongly, thinking that it will return last committed index at any moment 



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -4061,6 +4055,23 @@ private void logConfigurationChange(final Configuration newConfiguration) {
         }
     }
 
+    private long getLastCommittedIndex() {

Review Comment:
   I also would be glad if you change serverId to getNodeId in a single left place, where we do not provide group Id, this place is `org.apache.ignite.raft.jraft.core.NodeImpl#initMetaStorage`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25948 Reduce amount of raft logs. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 merged PR #6278:
URL: https://github.com/apache/ignite-3/pull/6278


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org