Java Code Examples for org.apache.hadoop.hbase.zookeeper.ZKUtil#getDataNoWatch()

The following examples show how to use org.apache.hadoop.hbase.zookeeper.ZKUtil#getDataNoWatch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZKReplicationQueueStorage.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Return the {lastPushedSequenceId, ZNodeDataVersion} pair. if ZNodeDataVersion is -1, it means
 * that the ZNode does not exist.
 */
@VisibleForTesting
protected Pair<Long, Integer> getLastSequenceIdWithVersion(String encodedRegionName,
    String peerId) throws KeeperException {
  Stat stat = new Stat();
  String path = getSerialReplicationRegionPeerNode(encodedRegionName, peerId);
  byte[] data = ZKUtil.getDataNoWatch(zookeeper, path, stat);
  if (data == null) {
    // ZNode does not exist, so just return version -1 to indicate that no node exist.
    return Pair.newPair(HConstants.NO_SEQNUM, -1);
  }
  try {
    return Pair.newPair(ZKUtil.parseWALPositionFrom(data), stat.getVersion());
  } catch (DeserializationException de) {
    LOG.warn("Failed to parse log position (region=" + encodedRegionName + ", peerId=" + peerId
        + "), data=" + Bytes.toStringBinary(data));
  }
  return Pair.newPair(HConstants.NO_SEQNUM, stat.getVersion());
}
 
Example 2
Source File: ZKReplicationQueueStorage.java    From hbase with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected int getHFileRefsZNodeCversion() throws ReplicationException {
  Stat stat = new Stat();
  try {
    ZKUtil.getDataNoWatch(zookeeper, hfileRefsZNode, stat);
  } catch (KeeperException e) {
    throw new ReplicationException("Failed to get stat of replication hfile references node.", e);
  }
  return stat.getCversion();
}
 
Example 3
Source File: ZKReplicationQueueStorage.java    From hbase with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected int getQueuesZNodeCversion() throws KeeperException {
  Stat stat = new Stat();
  ZKUtil.getDataNoWatch(this.zookeeper, this.queuesZNode, stat);
  return stat.getCversion();
}