@Override public String toString() { return node + " (" + RegionTransitionData.fromBytes(data) + ")"; } public boolean isEmpty() {
private static void logRetrievedMsg(final ZooKeeperWatcher zkw, final String znode, final byte [] data, final boolean watcherSet) { if (!LOG.isDebugEnabled()) return; LOG.debug(zkw.prefix("Retrieved " + ((data == null)? 0: data.length) + " byte(s) of data from znode " + znode + (watcherSet? " and set watcher; ": "; data=") + (data == null? "null": data.length == 0? "empty": ( znode.startsWith(zkw.assignmentZNode) ? RegionTransitionData.fromBytes(data).toString() : StringUtils.abbreviate(Bytes.toStringBinary(data), 32))))); }
/** * Gets the current data in the unassigned node for the specified region name * or fully-qualified path. * * <p>Returns null if the region does not currently have a node. * * <p>Sets a watch on the node if the node exists. * * @param zkw zk reference * @param pathOrRegionName fully-specified path or region name * @return data for the unassigned node * @throws KeeperException if unexpected zookeeper exception */ public static RegionTransitionData getData(ZooKeeperWatcher zkw, String pathOrRegionName) throws KeeperException { String node = pathOrRegionName.startsWith("/") ? pathOrRegionName : getNodeName(zkw, pathOrRegionName); byte [] data = ZKUtil.getDataAndWatch(zkw, node); if(data == null) { return null; } return RegionTransitionData.fromBytes(data); }
/** * Gets the current data in the unassigned node for the specified region name * or fully-qualified path. * * <p>Returns null if the region does not currently have a node. * * <p>Does not set a watch. * * @param zkw zk reference * @param pathOrRegionName fully-specified path or region name * @param stat object to store node info into on getData call * @return data for the unassigned node or null if node does not exist * @throws KeeperException if unexpected zookeeper exception */ public static RegionTransitionData getDataNoWatch(ZooKeeperWatcher zkw, String pathOrRegionName, Stat stat) throws KeeperException { String node = pathOrRegionName.startsWith("/") ? pathOrRegionName : getNodeName(zkw, pathOrRegionName); byte [] data = ZKUtil.getDataNoWatch(zkw, node, stat); if (data == null) { return null; } return RegionTransitionData.fromBytes(data); }
/** * Gets the current data in the unassigned node for the specified region name * or fully-qualified path. * * <p>Returns null if the region does not currently have a node. * * <p>Sets a watch on the node if the node exists. * * @param zkw zk reference * @param pathOrRegionName fully-specified path or region name * @param stat object to populate the version. * @return data for the unassigned node * @throws KeeperException if unexpected zookeeper exception */ public static RegionTransitionData getDataAndWatch(ZooKeeperWatcher zkw, String pathOrRegionName, Stat stat) throws KeeperException { String node = pathOrRegionName.startsWith("/") ? pathOrRegionName : getNodeName(zkw, pathOrRegionName); byte [] data = ZKUtil.getDataAndWatch(zkw, node, stat); if(data == null) { return null; } return RegionTransitionData.fromBytes(data); }
RegionTransitionData data = RegionTransitionData.fromBytes(bytes); if (!data.getEventType().equals(expectedState)) { LOG.warn(zkw.prefix("Attempting to delete unassigned " +
RegionTransitionData.fromBytes(existingBytes); if (existingData.getEventType() == expectedState){ return true;
RegionTransitionData.fromBytes(existingBytes);