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 @@ public class ZKRMStateStore extends RMStateStore {
verifyActiveStatusThread.join(1000); verifyActiveStatusThread.join(1000);
} }
if (!HAUtil.isHAEnabled(getConfig())) { if (resourceManager.getZKManager() == null) {
CuratorFramework curatorFramework = zkManager.getCurator(); CuratorFramework curatorFramework = zkManager.getCurator();
IOUtils.closeStream(curatorFramework); IOUtils.closeStream(curatorFramework);
} }

View File

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