You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2020/08/06 14:23:58 UTC
[ignite] branch master updated: IGNITE-13292 Remove unnecessary zk
pinger. - Fixes #8081.
This is an automated email from the ASF dual-hosted git repository.
sergeychugunov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new ee7d136 IGNITE-13292 Remove unnecessary zk pinger. - Fixes #8081.
ee7d136 is described below
commit ee7d1369e4008c346c06bad46cb4c2261dc976df
Author: Ivan Daschinskiy <iv...@gmail.com>
AuthorDate: Thu Aug 6 17:05:26 2020 +0300
IGNITE-13292 Remove unnecessary zk pinger. - Fixes #8081.
Signed-off-by: Sergey Chugunov <sc...@gridgain.com>
---
.../ignite/spi/discovery/zk/internal/ZkPinger.java | 88 ----------------------
.../spi/discovery/zk/internal/ZookeeperClient.java | 29 -------
.../zk/internal/ZookeeperDiscoveryImpl.java | 13 ----
3 files changed, 130 deletions(-)
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkPinger.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkPinger.java
deleted file mode 100644
index 964b8fc..0000000
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkPinger.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.discovery.zk.internal;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.zookeeper.ZooKeeper;
-
-/**
- * Periodically pings ZK server with simple request. Prevents connection abort on timeout from ZK side.
- */
-public class ZkPinger extends TimerTask {
- /** Ping interval milliseconds. */
- private static final int PING_INTERVAL_MS = 2000;
-
- /** Logger. */
- private final IgniteLogger log;
-
- /** Zk client. */
- private final ZooKeeper zkClient;
-
- /** Paths. */
- private final ZkIgnitePaths paths;
-
- /** Scheduler. */
- private final Timer scheduler = new Timer("ignite-zk-pinger");
-
- /**
- * @param log Logger.
- * @param zkClient Zk client.
- * @param paths Paths.
- */
- public ZkPinger(IgniteLogger log, ZooKeeper zkClient, ZkIgnitePaths paths) {
- this.log = log;
- this.zkClient = zkClient;
- this.paths = paths;
- }
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- zkClient.exists(paths.clusterDir, false);
- }
- catch (Throwable t) {
- if (zkClient.getState().isAlive())
- U.warn(log, "Failed to ping Zookeeper.", t);
- else
- scheduler.cancel();
- }
-
- }
-
- /**
- * Starts ping process.
- */
- public void start() {
- scheduler.scheduleAtFixedRate(this, 0, PING_INTERVAL_MS);
- }
-
- /**
- * Stops ping process.
- */
- public void stop() {
- try {
- scheduler.cancel();
- }
- catch (Exception e) {
- log.warning("Failed to cancel Zookeeper Pinger scheduler.", e);
- }
- }
-}
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClient.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClient.java
index b6d1493..7e1bb9a 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClient.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClient.java
@@ -55,10 +55,6 @@ public class ZookeeperClient implements Watcher {
private static final int DFLT_MAX_RETRY_COUNT = 10;
/** */
- private static final boolean PINGER_ENABLED =
- IgniteSystemProperties.getBoolean("IGNITE_ZOOKEEPER_DISCOVERY_PINGER_ENABLED", false);
-
- /** */
private final AtomicInteger retryCount = new AtomicInteger();
/** */
@@ -100,9 +96,6 @@ public class ZookeeperClient implements Watcher {
/** */
private volatile boolean closing;
- /** */
- private volatile ZkPinger pinger;
-
/**
* @param log Logger.
* @param connectString ZK connection string.
@@ -172,13 +165,6 @@ public class ZookeeperClient implements Watcher {
}
}
- /**
- * @return {@code True} if pinger is enabled
- */
- boolean pingerEnabled() {
- return PINGER_ENABLED;
- }
-
/** */
String state() {
synchronized (stateMux) {
@@ -825,13 +811,6 @@ public class ZookeeperClient implements Watcher {
*
*/
public void close() {
- if (PINGER_ENABLED) {
- ZkPinger pinger0 = pinger;
-
- if (pinger0 != null)
- pinger0.stop();
- }
-
closeClient();
}
@@ -971,14 +950,6 @@ public class ZookeeperClient implements Watcher {
}
/**
- * @param pinger Pinger.
- */
- void attachPinger(ZkPinger pinger) {
- if (PINGER_ENABLED)
- this.pinger = pinger;
- }
-
- /**
*
*/
interface ZkAsyncOperation {
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
index 4461305..204f477 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
@@ -804,19 +804,6 @@ public class ZookeeperDiscoveryImpl {
}
startJoin(rtState, prevState, joinDataBytes);
-
- try {
- if (rtState.zkClient.pingerEnabled() && !locNode.isClient() && !locNode.isDaemon()) {
- ZkPinger pinger = new ZkPinger(log, rtState.zkClient.zk(), zkPaths);
-
- rtState.zkClient.attachPinger(pinger);
-
- pinger.start();
- }
- }
- catch (Exception e) {
- log.error("Failed to create and attach Zookeeper pinger", e);
- }
}
finally {
busyLock.leaveBusy();