YARN-9714. ZooKeeper connection in ZKRMStateStore leaks after RM transitioned to standby. Contributed by Tao Yang.

This commit is contained in:
Rohith Sharma K S 2019-08-30 10:35:09 +05:30
parent d59fc59c9f
commit 5b557de721
2 changed files with 3 additions and 1 deletions

View File

@ -453,7 +453,7 @@ protected synchronized void closeInternal() throws Exception {
verifyActiveStatusThread.join(1000);
}
if (!HAUtil.isHAEnabled(getConfig())) {
if (resourceManager.getZKManager() == null) {
CuratorFramework curatorFramework = zkManager.getCurator();
IOUtils.closeStream(curatorFramework);
}

View File

@ -453,6 +453,7 @@ public void testZKRootPathAcls() throws Exception {
rm = new MockRM(conf);
rm.start();
rm.getRMContext().getRMAdminService().transitionToActive(req);
stateStore = (ZKRMStateStore) rm.getRMContext().getStateStore();
acls = stateStore.getACL(rootPath);
assertEquals(acls.size(), 1);
verifyZKACL("world", "anyone", Perms.ALL, acls);
@ -463,6 +464,7 @@ public void testZKRootPathAcls() throws Exception {
rm = new MockRM(conf);
rm.start();
rm.getRMContext().getRMAdminService().transitionToActive(req);
stateStore = (ZKRMStateStore) rm.getRMContext().getStateStore();
acls = stateStore.getACL(rootPath);
assertThat(acls).hasSize(2);
verifyZKACL("digest", "localhost", Perms.CREATE | Perms.DELETE, acls);