ignite-1093
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/50d32b38 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/50d32b38 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/50d32b38 Branch: refs/heads/ignite-1093 Commit: 50d32b38426dd19adcef81e7c645f95a6ff6927e Parents: 1996922 Author: Anton Vinogradov <[email protected]> Authored: Thu Aug 13 10:51:15 2015 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Thu Aug 13 10:51:15 2015 +0300 ---------------------------------------------------------------------- .../dht/preloader/GridDhtPartitionDemander.java | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/50d32b38/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java index 6c95707..16f7a61 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java @@ -357,6 +357,9 @@ public class GridDhtPartitionDemander { catch (IgniteCheckedException ex) { U.error(log, "Failed to send partition demand message to local node", ex); } + + if (log.isDebugEnabled()) + log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" + cnt + ", partitions count=" + sParts.get(cnt).size() + " (" + partitionsList(sParts.get(cnt)) + ")]"); } } } @@ -388,6 +391,54 @@ public class GridDhtPartitionDemander { } /** + * @param c Partitions. + * @return String representation of partitions list. + */ + private String partitionsList(Collection<Integer> c){ + LinkedList<Integer> s = new LinkedList<>(c); + + Collections.sort(s); + + StringBuilder sb = new StringBuilder(); + + int start = -1; + + int prev = -1; + + Iterator<Integer> sit = s.iterator(); + + while (sit.hasNext()) { + int p = sit.next(); + if (start == -1) { + start = p; + prev = p; + } + + if (prev < p - 1) { + sb.append(start); + + if (start != prev) + sb.append("-").append(prev); + + sb.append(", "); + + start = p; + } + + if (!sit.hasNext()) { + sb.append(start); + + if (start != p) + sb.append("-").append(p); + } + + prev = p; + } + + return sb.toString(); + } + + /** * @param idx Index. * @param id Node id. * @param supply Supply.
