/** * Deletes an existing unassigned node that is in the OFFLINE state for the * specified entityGroup. * * <p> * If a node does not already exist for this entityGroup, a * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown. * * <p> * No watcher is set whether this succeeds or not. * * <p> * Returns false if the node was not in the proper state but did exist. * * <p> * This method is used during master failover when the entityGroups on an RS * that has died are all set to OFFLINE before being processed. * * @param zkw zk reference * @param entityGroupName closed entityGroup to be deleted from zk * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist */ public static boolean deleteOfflineNode(ZooKeeperWatcher zkw, String entityGroupName) throws KeeperException, KeeperException.NoNodeException { return deleteNode(zkw, entityGroupName, EventType.M_ZK_ENTITYGROUP_OFFLINE); }
/** * Deletes an existing unassigned node that is in the CLOSED state for the * specified entityGroup. * * <p> * If a node does not already exist for this entityGroup, a * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown. * * <p> * No watcher is set whether this succeeds or not. * * <p> * Returns false if the node was not in the proper state but did exist. * * <p> * This method is used during table disables when a entityGroup finishes * successfully closing. This is the Master acknowledging completion of the * specified entityGroups transition to being closed. * * @param zkw zk reference * @param entityGroupName closed entityGroup to be deleted from zk * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist */ public static boolean deleteClosedNode(ZooKeeperWatcher zkw, String entityGroupName) throws KeeperException, KeeperException.NoNodeException { return deleteNode(zkw, entityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_CLOSED); }
/** * Deletes an existing unassigned node that is in the OPENED state for the * specified entityGroup. * * <p> * If a node does not already exist for this entityGroup, a * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown. * * <p> * No watcher is set whether this succeeds or not. * * <p> * Returns false if the node was not in the proper state but did exist. * * <p> * This method is used during normal entityGroup transitions when a * entityGroup finishes successfully opening. This is the Master acknowledging * completion of the specified entityGroups transition. * * @param zkw zk reference * @param entityGroupName opened entityGroup to be deleted from zk * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist */ public static boolean deleteOpenedNode(ZooKeeperWatcher zkw, String entityGroupName) throws KeeperException, KeeperException.NoNodeException { return deleteNode(zkw, entityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_OPENED); }
EventType expectedState) throws KeeperException, KeeperException.NoNodeException { return deleteNode(zkw, entityGroupName, expectedState, -1);
/** * Deletes an existing unassigned node that is in the CLOSING state for the * specified entityGroup. * * <p> * If a node does not already exist for this entityGroup, a * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown. * * <p> * No watcher is set whether this succeeds or not. * * <p> * Returns false if the node was not in the proper state but did exist. * * <p> * This method is used during table disables when a entityGroup finishes * successfully closing. This is the Master acknowledging completion of the * specified entityGroups transition to being closed. * * @param zkw zk reference * @param entityGroup closing entityGroup to be deleted from zk * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist */ public static boolean deleteClosingNode(ZooKeeperWatcher zkw, EntityGroupInfo entityGroup) throws KeeperException, KeeperException.NoNodeException { String entityGroupName = entityGroup.getEncodedName(); return deleteNode(zkw, entityGroupName, EventType.M_ZK_ENTITYGROUP_CLOSING); }
/** * * @param entityGroup * entityGroupinfo of znode to be deleted. */ public void deleteClosingOrClosedNode(EntityGroupInfo entityGroup) { try { if (!ZKAssign.deleteNode(watcher, entityGroup.getEncodedName(), EventHandler.EventType.M_ZK_ENTITYGROUP_CLOSING)) { boolean deleteNode = ZKAssign.deleteNode(watcher, entityGroup.getEncodedName(), EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_CLOSED); // TODO : We don't abort if the delete node returns false. Is there any // such corner case? if (!deleteNode) { LOG.error("The deletion of the CLOSED node for the entityGroup " + entityGroup.getEncodedName() + " returned " + deleteNode); } } } catch (NoNodeException e) { LOG.debug("CLOSING/CLOSED node for the entityGroup " + entityGroup.getEncodedName() + " already deleted"); } catch (KeeperException ke) { server.abort( "Unexpected ZK exception deleting node CLOSING/CLOSED for the entityGroup " + entityGroup.getEncodedName(), ke); return; } }
successful = ZKAssign.deleteNode(this.server.getZooKeeper(), encodedEntityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_SPLIT);
private static void cleanZK(final Server server, final EntityGroupInfo egi, boolean abort) { try { // Only delete if its in expected state; could have been hijacked. ZKAssign.deleteNode(server.getZooKeeper(), egi.getEncodedName(), EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLITTING); } catch (KeeperException.NoNodeException nn) { if (abort) { server.abort("Failed cleanup of " + egi.getEntityGroupNameAsString(), nn); } } catch (KeeperException e) { server.abort("Failed cleanup of " + egi.getEntityGroupNameAsString(), e); } }
private boolean deleteOpenedNode(int expectedVersion) { debugLog(entityGroupInfo, "Handling OPENED event for " + this.entityGroupInfo.getEntityGroupNameAsString() + " from " + this.sn.toString() + "; deleting unassigned node"); try { // delete the opened znode only if the version matches. return ZKAssign.deleteNode(server.getZooKeeper(), entityGroupInfo.getEncodedName(), EventType.FSERVER_ZK_ENTITYGROUP_OPENED, expectedVersion); } catch (KeeperException.NoNodeException e) { // Getting no node exception here means that already the entityGroup has been // opened. LOG.warn("The znode of the entityGroup " + entityGroupInfo.getEntityGroupNameAsString() + " would have already been deleted"); return false; } catch (KeeperException e) { server.abort( "Error deleting OPENED node in ZK (" + entityGroupInfo.getEntityGroupNameAsString() + ")", e); } return false; }
private void openEntityGroup(Server server, FServerServices rss, FTable ftd, EntityGroupInfo egi) throws IOException, NodeExistsException, KeeperException, DeserializationException { // Create it OFFLINE node, which is what Master set before sending OPEN RPC ZKAssign.createNodeOffline(server.getZooKeeper(), egi, server.getServerName()); OpenEntityGroupHandler openHandler = new OpenEntityGroupHandler(server, rss, egi, ftd); openHandler.process(); // This parse is not used? EntityGroupTransaction.parseFrom(ZKAssign.getData(server.getZooKeeper(), egi.getEncodedName())); // delete the node, which is what Master do after the entityGroup is opened ZKAssign.deleteNode(server.getZooKeeper(), egi.getEncodedName(), EventType.FSERVER_ZK_ENTITYGROUP_OPENED); } }