This is an automated email from the ASF dual-hosted git repository.

Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new afe95e3c4eb Fix NPE in DebugResource.debugBrokers when externalView or 
idealState is null (#18697)
afe95e3c4eb is described below

commit afe95e3c4ebdcf657f565d32e833765813ee73f9
Author: Akanksha kedia <[email protected]>
AuthorDate: Mon Jun 8 23:55:26 2026 +0530

    Fix NPE in DebugResource.debugBrokers when externalView or idealState is 
null (#18697)
---
 .../apache/pinot/controller/api/resources/DebugResource.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/DebugResource.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/DebugResource.java
index 106bb3a4aef..e87d27abab1 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/DebugResource.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/DebugResource.java
@@ -419,10 +419,16 @@ public class DebugResource {
     ExternalView externalView =
         
helixDataAccessor.getProperty(helixDataAccessor.keyBuilder().externalView(BROKER_RESOURCE_INSTANCE));
 
-    for (Map.Entry<String, String> entry : 
idealState.getInstanceStateMap(tableNameWithType).entrySet()) {
+    Map<String, String> isStateMap = idealState != null ? 
idealState.getInstanceStateMap(tableNameWithType) : null;
+    if (isStateMap == null) {
+      return brokerDebugInfos;
+    }
+    Map<String, String> evStateMap =
+        externalView != null ? externalView.getStateMap(tableNameWithType) : 
null;
+    for (Map.Entry<String, String> entry : isStateMap.entrySet()) {
       String brokerName = entry.getKey();
       String isState = entry.getValue();
-      String evState = 
externalView.getStateMap(tableNameWithType).get(brokerName);
+      String evState = evStateMap != null ? evStateMap.get(brokerName) : null;
       if (verbosity > 0 || !isState.equals(evState)) {
         brokerDebugInfos.add(new TableDebugInfo.BrokerDebugInfo(brokerName, 
isState, evState));
       }


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

Reply via email to