Browse Source

[Improvement][Server] Must restart master if Zk reconnect (#5210) (#5879)

issue #5210
  pr #5211
Wenjun Ruan 3 years ago committed by GitHub
parent
commit
95539436d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java

9
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java

@ -185,13 +185,10 @@ public class ZookeeperOperator implements InitializingBean {
public void persistEphemeral(final String key, final String value) { public void persistEphemeral(final String key, final String value) {
try { try {
if (isExisted(key)) { if (isExisted(key)) {
try { update(key, value);
zkClient.delete().deletingChildrenIfNeeded().forPath(key); } else {
} catch (NoNodeException ignore) {
//NOP
}
}
zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(key, value.getBytes(StandardCharsets.UTF_8)); zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(key, value.getBytes(StandardCharsets.UTF_8));
}
} catch (final Exception ex) { } catch (final Exception ex) {
logger.error("persistEphemeral key : {} , value : {}", key, value, ex); logger.error("persistEphemeral key : {} , value : {}", key, value, ex);
} }

Loading…
Cancel
Save