sanpwc commented on a change in pull request #8351:
URL: https://github.com/apache/ignite/pull/8351#discussion_r504781269
##########
File path:
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/BaselineCommand.java
##########
@@ -166,13 +192,34 @@ else if (res.getRemainingTimeToBaselineAdjust() < 0)
Map<String, VisorBaselineNode> srvs = res.getServers();
// if task runs on a node with VisorBaselineNode of old version (V1)
we'll get order=null for all nodes.
+ Function<VisorBaselineNode, String> extractFormattedAddrs = node -> {
+ Stream<String> sortedByIpHosts =
+ Optional.ofNullable(node)
+ .map(addrs -> node.getAddrs())
+ .orElse(Collections.emptyList())
+ .stream()
+ .sorted(Comparator.comparing(tuple -> new
VisorTaskUtils.SortableAddress(tuple.getKey())))
+ .map(addr -> {
+ if (!addr.getKey().equals(addr.getValue()))
+ return addr.getValue() + "/" + addr.getKey();
+ else return addr.getKey();
+ });
+
+ if (verbose) {
+ String hosts = String.join(",",
sortedByIpHosts.collect(Collectors.toList()));
+ if (!hosts.isEmpty())
+ return ", Addresses=" + hosts;
+ else return "";
+ } else
+ return sortedByIpHosts.findFirst().map(ip -> ", Address=" +
ip).orElse("");
+ };
String crdStr = srvs.values().stream()
// check for not null
.filter(node -> node.getOrder() != null)
.min(Comparator.comparing(VisorBaselineNode::getOrder))
// format
- .map(crd -> " (Coordinator: ConsistentId=" + crd.getConsistentId()
+ ", Order=" + crd.getOrder() + ")")
+ .map(crd -> " (Coordinator: ConsistentId=" + crd.getConsistentId()
+ extractFormattedAddrs.apply(crd) + ", Order=" + crd.getOrder() + ")")
Review comment:
Tooooo long line.
----------------------------------------------------------------
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:
[email protected]