FrankChen021 commented on code in PR #18547:
URL: https://github.com/apache/druid/pull/18547#discussion_r2367377266


##########
server/src/main/java/org/apache/druid/server/DruidNode.java:
##########
@@ -89,6 +90,9 @@ public class DruidNode
       "unknown"
   );
 
+  @JsonProperty
+  private Map<String, String> labels = new HashMap<>();

Review Comment:
   I think the labels is always assigned in ctor, there's no need to assign a 
default value here.



##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -687,18 +704,24 @@ private static Object[] buildRowForDiscoverableDataServer(
       } else {
         currentSize = serverFromInventoryView.getCurrSize();
       }
-      return new Object[]{
-          node.getHostAndPortToUse(),
-          node.getHost(),
-          (long) node.getPlaintextPort(),
-          (long) node.getTlsPort(),
-          StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
-          druidServerToUse.getTier(),
-          currentSize,
-          druidServerToUse.getMaxSize(),
-          null,
-          toStringOrNull(discoveryDruidNode.getStartTime())
-      };
+      try {
+        return new Object[]{
+            node.getHostAndPortToUse(),
+            node.getHost(),
+            (long) node.getPlaintextPort(),
+            (long) node.getTlsPort(),
+            
StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
+            druidServerToUse.getTier(),
+            currentSize,
+            druidServerToUse.getMaxSize(),
+            null,
+            toStringOrNull(discoveryDruidNode.getStartTime()),
+            node.getLabels() == null ? null : 
jsonMapper.writeValueAsString(node.getLabels())

Review Comment:
   I'm wondering if we can cache the string value of labels in the node to 
avoid serialization everytime the sys.servers table is accessed.
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to