Repository: hbase Updated Branches: refs/heads/0.98 21215a2ae -> ecf09fd02
HBASE-12150 Backport replication changes from HBASE-12145 Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ecf09fd0 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ecf09fd0 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ecf09fd0 Branch: refs/heads/0.98 Commit: ecf09fd02b8489716383053fc5ba6ea2283fbb2c Parents: 21215a2 Author: Andrew Purtell <[email protected]> Authored: Thu Oct 2 18:02:32 2014 -0700 Committer: Andrew Purtell <[email protected]> Committed: Thu Oct 2 18:02:32 2014 -0700 ---------------------------------------------------------------------- .../hbase/replication/ReplicationPeersZKImpl.java | 10 ++++++++-- .../hadoop/hbase/zookeeper/RecoverableZooKeeper.java | 12 +++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/ecf09fd0/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java index df0e385..022aa93 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java @@ -250,8 +250,14 @@ public class ReplicationPeersZKImpl extends ReplicationStateZKBase implements Re if (peer == null) { return false; } - ((ConcurrentMap<String, ReplicationPeer>) peerClusters).putIfAbsent(peerId, peer); - LOG.info("Added new peer cluster " + peer.getClusterKey()); + ReplicationPeer previous = + ((ConcurrentMap<String, ReplicationPeer>) peerClusters).putIfAbsent(peerId, peer); + if (previous == null) { + LOG.info("Added new peer cluster=" + peer.getClusterKey()); + } else { + LOG.info("Peer already present, " + previous.getClusterKey() + ", new cluster=" + + peer.getClusterKey()); + } return true; } http://git-wip-us.apache.org/repos/asf/hbase/blob/ecf09fd0/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java index 737ea8a..6883a6a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java @@ -98,6 +98,8 @@ public class RecoverableZooKeeper { private static final int ID_LENGTH_OFFSET = MAGIC_SIZE; private static final int ID_LENGTH_SIZE = Bytes.SIZEOF_INT; + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DE_MIGHT_IGNORE", + justification="None. Its always been this way.") public RecoverableZooKeeper(String quorumServers, int sessionTimeout, Watcher watcher, int maxRetries, int retryIntervalMillis) throws IOException { @@ -691,23 +693,23 @@ public class RecoverableZooKeeper { return newData; } - public long getSessionId() { + public synchronized long getSessionId() { return zk == null ? null : zk.getSessionId(); } - public void close() throws InterruptedException { + public synchronized void close() throws InterruptedException { if (zk != null) zk.close(); } - public States getState() { + public synchronized States getState() { return zk == null ? null : zk.getState(); } - public ZooKeeper getZooKeeper() { + public synchronized ZooKeeper getZooKeeper() { return zk; } - public byte[] getSessionPasswd() { + public synchronized byte[] getSessionPasswd() { return zk == null ? null : zk.getSessionPasswd(); }
