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

FrankChen021 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 18610a7a825 fix: Address issue where Broker upgrade before Overlord 
causes NPE (#19425)
18610a7a825 is described below

commit 18610a7a825947f63ae3dc74aedf4f4674270126
Author: Virushade <[email protected]>
AuthorDate: Fri May 8 09:56:16 2026 +0800

    fix: Address issue where Broker upgrade before Overlord causes NPE (#19425)
    
    * Fix bug where Broker upgrade before Overlord causes NPE
    
    * Add comment explaining backward compatibility
---
 .../overlord/supervisor/SupervisorStatus.java         |  3 ++-
 .../overlord/supervisor/SupervisorStatusTest.java     | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatus.java
 
b/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatus.java
index b2cdcdeaf2f..1402fa824b4 100644
--- 
a/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatus.java
+++ 
b/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatus.java
@@ -57,7 +57,8 @@ public class SupervisorStatus
   )
   {
     this.id = Preconditions.checkNotNull(builder.id, "id");
-    this.dataSource = builder.dataSource;
+    // Fallback to id for rolling upgrade purposes. See 
https://github.com/apache/druid/pull/19425
+    this.dataSource = builder.dataSource != null ? builder.dataSource : 
this.id;
     this.state = builder.state;
     this.detailedState = builder.detailedState;
     this.healthy = builder.healthy;
diff --git 
a/server/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatusTest.java
 
b/server/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatusTest.java
index f8ef902c2fa..6d07c5d8694 100644
--- 
a/server/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatusTest.java
+++ 
b/server/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStatusTest.java
@@ -46,6 +46,25 @@ public class SupervisorStatusTest
     Assert.assertEquals(supervisorStatus, deserialized);
   }
 
+  @Test
+  public void testGetDataSourceFallsBackToIdWhenNull() throws IOException
+  {
+    // Simulate an old Overlord response that does not include the 
"dataSource" field
+    String json = "{"
+                  + "\"id\":\"wikipedia\","
+                  + "\"state\":\"RUNNING\","
+                  + "\"detailedState\":\"RUNNING\","
+                  + "\"healthy\":true,"
+                  + "\"type\":\"kafka\","
+                  + "\"source\":\"wikipedia\","
+                  + "\"suspended\":false"
+                  + "}";
+    final ObjectMapper mapper = new ObjectMapper();
+    final SupervisorStatus deserialized = mapper.readValue(json, 
SupervisorStatus.class);
+    Assert.assertEquals("wikipedia", deserialized.getId());
+    Assert.assertEquals("wikipedia", deserialized.getDataSource());
+  }
+
   @Test
   public void testJsonAttr() throws IOException
   {


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

Reply via email to