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 1daab9b7516 Fix NPE in PinotLeadControllerRestletResource when
partition state map is null (#18713)
1daab9b7516 is described below
commit 1daab9b7516add96bb4c6177483d0ee8ba68a0e2
Author: Akanksha kedia <[email protected]>
AuthorDate: Wed Jun 10 09:22:56 2026 +0530
Fix NPE in PinotLeadControllerRestletResource when partition state map is
null (#18713)
ExternalView.getStateMap(partitionName) can return null when a partition
has not yet been assigned in the lead controller resource external view
(e.g. during controller initialisation or a leader transition). The
existing code guards against a null ExternalView but then dereferences
the result of getStateMap() directly, causing a NullPointerException.
Add a null check with a WARN log before iterating the partition state
map, consistent with the existing guard for a null ExternalView.
---
.../controller/api/resources/PinotLeadControllerRestletResource.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotLeadControllerRestletResource.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotLeadControllerRestletResource.java
index 709bd39a2fc..2fd9ec976fd 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotLeadControllerRestletResource.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotLeadControllerRestletResource.java
@@ -172,6 +172,11 @@ public class PinotLeadControllerRestletResource {
Map<String, String> partitionStateMap =
leadControllerResourceExternalView.getStateMap(partitionName);
// Gets master host from partition map. Returns null if no master found.
+ if (partitionStateMap == null) {
+ LOGGER.warn("Partition state map for partition: {} is null in lead
controller resource external view",
+ partitionName);
+ return null;
+ }
for (Map.Entry<String, String> entry : partitionStateMap.entrySet()) {
if (MasterSlaveSMD.States.MASTER.name().equals(entry.getValue())) {
// Found the controller in master state.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]