Index: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java (revision 1407725) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java (working copy) @@ -107,10 +107,6 @@ */ enum JournalEntry { /** - * Before creating node in splitting state. - */ - STARTED_SPLITTING, - /** * Set region as in transition, set it into SPLITTING state. */ SET_SPLITTING_IN_ZK, @@ -240,7 +236,6 @@ server.getConfiguration().getLong("hbase.regionserver.fileSplitTimeout", this.fileSplitTimeout); - this.journal.add(JournalEntry.STARTED_SPLITTING); // Set ephemeral SPLITTING znode up in zk. Mocked servers sometimes don't // have zookeeper so don't do zk stuff if server or zookeeper is null if (server != null && server.getZooKeeper() != null) { @@ -750,15 +745,9 @@ JournalEntry je = iterator.previous(); switch(je) { - case STARTED_SPLITTING: - if (server != null && server.getZooKeeper() != null) { - cleanZK(server, this.parent.getRegionInfo(), false); - } - break; - case SET_SPLITTING_IN_ZK: if (server != null && server.getZooKeeper() != null) { - cleanZK(server, this.parent.getRegionInfo(), true); + cleanZK(server, this.parent.getRegionInfo()); } break; @@ -855,15 +844,11 @@ LOG.info("Cleaned up old failed split transaction detritus: " + splitdir); } - private static void cleanZK(final Server server, final HRegionInfo hri, boolean abort) { + private static void cleanZK(final Server server, final HRegionInfo hri) { try { // Only delete if its in expected state; could have been hijacked. ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(), EventType.RS_ZK_REGION_SPLITTING); - } catch (KeeperException.NoNodeException nn) { - if (abort) { - server.abort("Failed cleanup of " + hri.getRegionNameAsString(), nn); - } } catch (KeeperException e) { server.abort("Failed cleanup of " + hri.getRegionNameAsString(), e); } @@ -883,8 +868,9 @@ * @throws KeeperException * @throws IOException */ - int createNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo region, - final ServerName serverName) throws KeeperException, IOException { + private static int createNodeSplitting(final ZooKeeperWatcher zkw, + final HRegionInfo region, final ServerName serverName) + throws KeeperException, IOException { LOG.debug(zkw.prefix("Creating ephemeral node for " + region.getEncodedName() + " in SPLITTING state")); RegionTransition rt = RegionTransition.createRegionTransition(EventType.RS_ZK_REGION_SPLITTING, @@ -951,7 +937,7 @@ * @throws KeeperException * @throws IOException */ - int transitionNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo parent, + private static int transitionNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo parent, final ServerName serverName, final int version) throws KeeperException, IOException { return ZKAssign.transitionNode(zkw, parent, serverName, EventType.RS_ZK_REGION_SPLITTING, EventType.RS_ZK_REGION_SPLITTING, version); Index: hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (revision 1407725) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (working copy) @@ -43,7 +43,6 @@ import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.zookeeper.ZKAssign; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException.NodeExistsException; import org.apache.zookeeper.data.Stat; @@ -524,25 +523,7 @@ } } - /** - * - * While transitioning node from RS_ZK_REGION_SPLITTING to - * RS_ZK_REGION_SPLITTING during region split,if zookeper went down split always - * fails for the region. HBASE-6088 fixes this scenario. - * This test case is to test the znode is deleted(if created) or not in roll back. - * - * @throws IOException - * @throws InterruptedException - * @throws KeeperException - */ @Test - public void testSplitBeforeSettingSplittingInZK() throws IOException, - InterruptedException, KeeperException { - testSplitBeforeSettingSplittingInZK(true); - testSplitBeforeSettingSplittingInZK(false); - } - - @Test public void testShouldThrowIOExceptionIfStoreFileSizeIsEmptyAndSHouldSuccessfullyExecuteRollback() throws Exception { final byte[] tableName = Bytes.toBytes("testRollBackShudBeSuccessfulIfStoreFileIsEmpty"); @@ -581,58 +562,6 @@ } } - - private void testSplitBeforeSettingSplittingInZK(boolean nodeCreated) throws IOException, - KeeperException { - final byte[] tableName = Bytes.toBytes("testSplitBeforeSettingSplittingInZK"); - HBaseAdmin admin = TESTING_UTIL.getHBaseAdmin(); - try { - // Create table then get the single region for our new table. - HTableDescriptor htd = new HTableDescriptor(tableName); - htd.addFamily(new HColumnDescriptor("cf")); - admin.createTable(htd); - - List regions = cluster.getRegions(tableName); - int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName()); - HRegionServer regionServer = cluster.getRegionServer(regionServerIndex); - SplitTransaction st = null; - if (nodeCreated) { - st = new MockedSplitTransaction(regions.get(0), null) { - @Override - int transitionNodeSplitting(ZooKeeperWatcher zkw, HRegionInfo parent, - ServerName serverName, int version) throws KeeperException, IOException { - throw new IOException(); - } - }; - } else { - st = new MockedSplitTransaction(regions.get(0), null) { - @Override - int createNodeSplitting(ZooKeeperWatcher zkw, HRegionInfo region, ServerName serverName) - throws KeeperException, IOException { - throw new IOException(); - } - }; - } - try { - st.execute(regionServer, regionServer); - } catch (IOException e) { - String node = ZKAssign.getNodeName(regionServer.getZooKeeper(), regions.get(0) - .getRegionInfo().getEncodedName()); - if (nodeCreated) { - assertFalse(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1); - } else { - assertTrue(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1); - } - assertTrue(st.rollback(regionServer, regionServer)); - assertTrue(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1); - } - } finally { - if (admin.isTableAvailable(tableName) && admin.isTableEnabled(tableName)) { - admin.disableTable(tableName); - admin.deleteTable(tableName); - } - } - } public static class MockedSplitTransaction extends SplitTransaction {