mirror of https://github.com/apache/druid.git
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
This commit is contained in:
parent
aef1b39762
commit
ee1fc93f97
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,6 +228,26 @@ public class SupervisorManagerTest extends EasyMockSupport
|
|||
manager.start();
|
||||
}
|
||||
|
||||
@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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue