org.apache.hadoop.hbase.zookeeper.ZKUtil#getDataNoWatch ( )源码实例Demo

下面列出了org.apache.hadoop.hbase.zookeeper.ZKUtil#getDataNoWatch ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hbase   文件: ZKReplicationQueueStorage.java
/**
 * 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());
}
 
源代码2 项目: hbase   文件: ZKReplicationQueueStorage.java
@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();
}
 
源代码3 项目: hbase   文件: ZKReplicationQueueStorage.java
@VisibleForTesting
protected int getQueuesZNodeCversion() throws KeeperException {
  Stat stat = new Stat();
  ZKUtil.getDataNoWatch(this.zookeeper, this.queuesZNode, stat);
  return stat.getCversion();
}