This is an automated email from the ASF dual-hosted git repository.
xiangfu0 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 cc13457c7a2 Fix NPE in BaseServerStarter when
IdealState.getInstanceStateMap returns null (#18714)
cc13457c7a2 is described below
commit cc13457c7a226df035397103543134eb4ffbd590
Author: Akanksha kedia <[email protected]>
AuthorDate: Wed Jun 10 09:23:03 2026 +0530
Fix NPE in BaseServerStarter when IdealState.getInstanceStateMap returns
null (#18714)
IdealState.getInstanceStateMap(partitionName) can return null when a
partition exists in the ideal-state partition set but has no instance
assignments yet. Two call-sites in BaseServerStarter dereference this
result directly to check for CONSUMING state, causing a NPE during
server startup or consuming-segment queries.
Guard both call-sites with a null check before accessing the instance
state, consistent with how the same pattern is handled elsewhere (e.g.
ShowClusterInfoCommand, ZKOperator).
---
.../apache/pinot/server/starter/helix/BaseServerStarter.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java
b/pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java
index 46682cc4a4f..71c4e6539f8 100644
---
a/pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java
+++
b/pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java
@@ -409,8 +409,9 @@ public abstract class BaseServerStarter implements
ServiceStartable {
}
if (checkRealtime &&
TableNameBuilder.isRealtimeTableResource(resourceName)) {
for (String partitionName : idealState.getPartitionSet()) {
- if (StateModel.SegmentStateModel.CONSUMING.equals(
- idealState.getInstanceStateMap(partitionName).get(_instanceId)))
{
+ Map<String, String> instanceStateMap =
idealState.getInstanceStateMap(partitionName);
+ if (instanceStateMap != null &&
StateModel.SegmentStateModel.CONSUMING.equals(
+ instanceStateMap.get(_instanceId))) {
consumingSegments.computeIfAbsent(resourceName, k -> new
HashSet<>()).add(partitionName);
}
}
@@ -473,8 +474,9 @@ public abstract class BaseServerStarter implements
ServiceStartable {
}
Set<String> consumingSegments = new HashSet<>();
for (String partitionName : idealState.getPartitionSet()) {
- if (StateModel.SegmentStateModel.CONSUMING.equals(
- idealState.getInstanceStateMap(partitionName).get(_instanceId))) {
+ Map<String, String> instanceStateMap =
idealState.getInstanceStateMap(partitionName);
+ if (instanceStateMap != null &&
StateModel.SegmentStateModel.CONSUMING.equals(
+ instanceStateMap.get(_instanceId))) {
consumingSegments.add(partitionName);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]