YARN-10328. Fixed ZK Curator NodeExists exception in YARN service AM logs

Contributed by Bilwa S T via eyang
This commit is contained in:
Eric Yang 2020-06-29 09:21:24 -07:00
parent c71ce7ac33
commit 0be26811f3
1 changed files with 4 additions and 1 deletions

View File

@ -143,7 +143,10 @@ public class YarnRegistryViewForProviders {
ServiceRecord record) throws IOException { ServiceRecord record) throws IOException {
String path = RegistryUtils.componentPath( String path = RegistryUtils.componentPath(
user, serviceClass, serviceName, componentName); user, serviceClass, serviceName, componentName);
registryOperations.mknode(RegistryPathUtils.parentOf(path), true); String parentPath = RegistryPathUtils.parentOf(path);
if (!registryOperations.exists(parentPath)) {
registryOperations.mknode(parentPath, true);
}
registryOperations.bind(path, record, BindFlags.OVERWRITE); registryOperations.bind(path, record, BindFlags.OVERWRITE);
} }