Skip to content

Commit 70c8f4a

Browse files
author
Tianli Feng
committed
Remove duplicate m in node.role of cat nodes API
Signed-off-by: Tianli Feng <ftianli@amazon.com>
1 parent f06766e commit 70c8f4a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,13 @@ Table buildTable(
419419
if (node.getRoles().isEmpty()) {
420420
roles = "-";
421421
} else {
422-
roles = node.getRoles().stream().map(DiscoveryNodeRole::roleNameAbbreviation).sorted().collect(Collectors.joining());
422+
// TODO: Remove '.distinct()' after removing DiscoveryNodeRole.MASTER_ROLE, because the role abbr name should be unique.
423+
roles = node.getRoles()
424+
.stream()
425+
.map(DiscoveryNodeRole::roleNameAbbreviation)
426+
.sorted()
427+
.distinct()
428+
.collect(Collectors.joining());
423429
}
424430
table.addCell(roles);
425431
table.addCell(masterId == null ? "x" : masterId.equals(node.getId()) ? "*" : "-");

0 commit comments

Comments
 (0)