You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mp...@apache.org on 2023/06/14 08:42:08 UTC

[ignite] branch master updated: IGNITE-19164 Improved message about requested partitions during snapshot restore (#10638)

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

mpetrov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 2fbd3a3329f IGNITE-19164 Improved message about requested partitions during snapshot restore (#10638)
2fbd3a3329f is described below

commit 2fbd3a3329f061de3c9f6214aa49d3b7448b192c
Author: Julia Bakulina <96...@users.noreply.github.com>
AuthorDate: Wed Jun 14 11:41:53 2023 +0300

    IGNITE-19164 Improved message about requested partitions during snapshot restore (#10638)
---
 .../snapshot/SnapshotRestoreProcess.java           | 27 ++++++++++++++--------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
index 08f2c127c48..3fb904755c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
@@ -1021,12 +1021,16 @@ public class SnapshotRestoreProcess {
             Map<Integer, Set<PartitionRestoreFuture>> rmtLoadParts = new HashMap<>();
             ClusterNode locNode = ctx.cache().context().localNode();
             List<SnapshotMetadata> locMetas = opCtx0.metasPerNode.get(locNode.id());
+            Map<Integer, String> cacheGrpNames = new HashMap<>();
 
             // First preload everything from the local node.
             for (File dir : opCtx0.dirs) {
                 String cacheOrGrpName = cacheGroupName(dir);
                 int grpId = CU.cacheId(cacheOrGrpName);
 
+                if (log.isInfoEnabled())
+                    cacheGrpNames.put(grpId, cacheOrGrpName);
+
                 File tmpCacheDir = formatTmpDirName(dir);
                 tmpCacheDir.mkdir();
 
@@ -1117,15 +1121,16 @@ public class SnapshotRestoreProcess {
                     rmtLoadParts.get(grpId).remove(new PartitionRestoreFuture(partId, opCtx0.processedParts)));
 
             try {
-                if (log.isInfoEnabled() && !snpAff.isEmpty()) {
-                    log.info("Trying to request partitions from remote nodes " +
-                        "[reqId=" + reqId +
-                        ", snapshot=" + opCtx0.snpName +
-                        ", map=" + snpAff.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
-                            e -> partitionsMapToString(e.getValue()))) + ']');
-                }
-
                 for (Map.Entry<UUID, Map<Integer, Set<Integer>>> m : snpAff.entrySet()) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Trying to request partitions from remote node " +
+                            "[reqId=" + reqId +
+                            ", snapshot=" + opCtx0.snpName +
+                            ", nodeId=" + m.getKey() +
+                            ", consistentId=" + ctx.discovery().node(m.getKey()).consistentId() +
+                            ", grpParts=" + partitionsMapToString(m.getValue(), cacheGrpNames) + "]");
+                    }
+
                     ctx.cache().context().snapshotMgr()
                         .requestRemoteSnapshotFiles(m.getKey(),
                             opCtx0.reqId,
@@ -1849,12 +1854,14 @@ public class SnapshotRestoreProcess {
 
     /**
      * @param map Map of partitions and cache groups.
+     * @param cacheGrpNames Map of cache group ids and names.
      * @return String representation.
      */
-    private static String partitionsMapToString(Map<Integer, Set<Integer>> map) {
+    private String partitionsMapToString(Map<Integer, Set<Integer>> map, Map<Integer, String> cacheGrpNames) {
         return map.entrySet()
             .stream()
-            .collect(Collectors.toMap(Map.Entry::getKey, e -> S.toStringSortedDistinct(e.getValue())))
+            .collect(Collectors.toMap(e -> String.format("{grpId=%d, grpName=%s}", e.getKey(), cacheGrpNames.get(e.getKey())),
+                e -> S.toStringSortedDistinct(e.getValue())))
             .toString();
     }