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

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


The following commit(s) were added to refs/heads/master by this push:
     new ee1fc93  fix exception in Supervisor.start causing overlord unable to 
become leader (#6516)
ee1fc93 is described below

commit ee1fc93f9793900b8917bd7e40c3397d276b6293
Author: Clint Wylie <[email protected]>
AuthorDate: Thu Oct 25 15:44:04 2018 -0700

    fix exception in Supervisor.start causing overlord unable to become leader 
(#6516)
    
    * fix exception thrown by Supervisor.start causing overlord unable to 
become leader
    
    * fix style
---
 .../overlord/supervisor/SupervisorManager.java       |  7 ++++++-
 .../overlord/supervisor/SupervisorManagerTest.java   | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git 
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java
 
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java
index cfca0de..f2c78a6 100644
--- 
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java
+++ 
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java
@@ -133,7 +133,12 @@ public class SupervisorManager
       for (String id : supervisors.keySet()) {
         SupervisorSpec spec = supervisors.get(id);
         if (!(spec instanceof NoopSupervisorSpec)) {
-          createAndStartSupervisorInternal(spec, false);
+          try {
+            createAndStartSupervisorInternal(spec, false);
+          }
+          catch (Exception ex) {
+            log.error(ex, "Failed to start supervisor: [%s]", spec.getId());
+          }
         }
       }
 
diff --git 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManagerTest.java
 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManagerTest.java
index 85cfd95..7ae3b99 100644
--- 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManagerTest.java
+++ 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManagerTest.java
@@ -229,6 +229,26 @@ public class SupervisorManagerTest extends EasyMockSupport
   }
 
   @Test
+  public void testStartIndividualSupervisorsFailStart()
+  {
+    Map<String, SupervisorSpec> existingSpecs = ImmutableMap.of(
+        "id1", new TestSupervisorSpec("id1", supervisor1),
+        "id3", new TestSupervisorSpec("id3", supervisor3)
+    );
+
+
+    
EasyMock.expect(metadataSupervisorManager.getLatest()).andReturn(existingSpecs);
+    supervisor3.start();
+    supervisor1.start();
+    EasyMock.expectLastCall().andThrow(new RuntimeException("supervisor 
explosion"));
+    replayAll();
+
+    manager.start();
+
+    // if we get here, we are properly insulated from exploding supervisors
+  }
+
+  @Test
   public void testStopThrowsException()
   {
     Map<String, SupervisorSpec> existingSpecs = ImmutableMap.of(


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

Reply via email to