You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ib...@apache.org on 2023/08/31 10:43:45 UTC

[ignite-3] branch main updated: IGNITE-20318 Fix logging for raft log truncation (#2522)

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

ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new b75485057c IGNITE-20318 Fix logging for raft log truncation (#2522)
b75485057c is described below

commit b75485057ca6ac609293e6e8252fc68e573d71cf
Author: Ivan Bessonov <be...@gmail.com>
AuthorDate: Thu Aug 31 13:43:40 2023 +0300

    IGNITE-20318 Fix logging for raft log truncation (#2522)
---
 .../ignite/raft/jraft/storage/impl/LogManagerImpl.java     | 14 +++++++++++---
 .../main/java/org/apache/ignite/raft/jraft/util/Utils.java |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogManagerImpl.java b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogManagerImpl.java
index 82198b7c93..49e72c4f1f 100644
--- a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogManagerImpl.java
+++ b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogManagerImpl.java
@@ -532,7 +532,11 @@ public class LogManagerImpl implements LogManager {
                         long startMs = Utils.monotonicMs();
                         try {
                             final TruncatePrefixClosure tpc = (TruncatePrefixClosure) done;
-                            LOG.debug("Truncating storage to firstIndexKept={}.", tpc.firstIndexKept);
+                            LOG.info(
+                                    "Truncating log storage prefix [groupId={}, firstIndexKept={}]",
+                                    nodeId.getGroupId(),
+                                    tpc.firstIndexKept
+                            );
                             ret = LogManagerImpl.this.logStorage.truncatePrefix(tpc.firstIndexKept);
                         }
                         finally {
@@ -544,7 +548,11 @@ public class LogManagerImpl implements LogManager {
                         startMs = Utils.monotonicMs();
                         try {
                             final TruncateSuffixClosure tsc = (TruncateSuffixClosure) done;
-                            LOG.warn("Truncating storage to lastIndexKept={}.", tsc.lastIndexKept);
+                            LOG.warn(
+                                    "Truncating log storage suffix [groupId={}, lastIndexKept={}]",
+                                    nodeId.getGroupId(),
+                                    tsc.lastIndexKept
+                            );
                             ret = LogManagerImpl.this.logStorage.truncateSuffix(tsc.lastIndexKept);
                             if (ret) {
                                 this.lastId.setIndex(tsc.lastIndexKept);
@@ -559,7 +567,7 @@ public class LogManagerImpl implements LogManager {
                         break;
                     case RESET:
                         final ResetClosure rc = (ResetClosure) done;
-                        LOG.info("Resetting storage to nextLogIndex={}.", rc.nextLogIndex);
+                        LOG.info("Resetting log storage [groupId={}, nextLogIndex={}]", nodeId.getGroupId(), rc.nextLogIndex);
                         ret = LogManagerImpl.this.logStorage.reset(rc.nextLogIndex);
                         break;
                     default:
diff --git a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
index 078e64252c..33ab5dd673 100644
--- a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
+++ b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
@@ -321,7 +321,7 @@ public final class Utils {
      * Gets the current monotonic time in milliseconds.
      */
     public static long monotonicMs() {
-        return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
+        return IgniteUtils.monotonicMs();
     }
 
     /**