ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] Mmuzaf commented on a change in pull request #6785: IGNITE-12080 Add extended logging for rebalance.
Date Tue, 20 Aug 2019 18:28:13 GMT
Mmuzaf commented on a change in pull request #6785: IGNITE-12080 Add extended logging for rebalance.
URL: https://github.com/apache/ignite/pull/6785#discussion_r315839314
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
 ##########
 @@ -1514,4 +1536,74 @@ private void sendRebalanceFinishedEvent() {
             return S.toString(RebalanceFuture.class, this);
         }
     }
+
+    /**
+     * Collect demander per cache groups. For print statistics.
+     *
+     * @return List demanders.
+     * */
+    private List<GridDhtPartitionDemander> demanders(){
+        return ctx.cacheContexts().stream()
+            .map(GridCacheContext::preloader)
+            .filter(GridDhtPreloader.class::isInstance)
+            .map(GridDhtPreloader.class::cast)
+            .map(GridDhtPreloader::demander)
+            .collect(toList());
+    }
+
+    /**
+     * Print rebalance statistics into log.
+     * Statistic will print if
+     * {@link RebalanceStatisticsUtils#printRebalanceStatistics()
+     * printRebalanceStatistics()} == true.
+     * To use correctly you need to call this method exactly once right after
+     * {@code RebalanceFuture} was completed (successfully or not).
+     * <p/>
+     * If {@link #rebalanceFut} was done successfully, prints statistics
+     * for cache group.
+     * <p/>
+     * If the whole rebalance is over, print statistics for all cache groups.
+     * The end of the rebalance is determined by the successful done all
+     * {@code RebalanceFuture}'s.
+     *
+     * @throws IgniteCheckedException when get result {@code RebalanceFuture}
+     * @see RebalanceFuture RebalanceFuture
+     */
+    private void printRebalanceStatistics() throws IgniteCheckedException {
+        if (!RebalanceStatisticsUtils.printRebalanceStatistics())
+            return;
+
+        RebalanceFuture currRebFut = rebalanceFut;
+        assert currRebFut.isDone() : "RebalanceFuture should be done.";
+
+        currRebFut.stat.endTime(currentTimeMillis());
 
 Review comment:
   Is it correct to set the time at the moment of this method called but not at the time then
the rebalance future actually ends?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message