HBASE-5848 Addendum, try 2

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1330349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2012-04-25 15:35:47 +00:00
parent 13f1e3acff
commit bbd5306d27
2 changed files with 9 additions and 3 deletions

View File

@ -1775,7 +1775,11 @@ public class AssignmentManager extends ZooKeeperListener {
ZKAssign.asyncCreateNodeOffline(master.getZooKeeper(), state.getRegion(),
this.master.getServerName(), cb, ctx);
} catch (KeeperException e) {
master.abort("Unexpected ZK exception creating/setting node OFFLINE", e);
if (e instanceof NodeExistsException) {
LOG.warn("Node for " + state.getRegion() + " already exists");
} else {
master.abort("Unexpected ZK exception creating/setting node OFFLINE", e);
}
return false;
}
return true;

View File

@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.logging.Log;
@ -78,7 +79,8 @@ public class TestRegionRebalancing {
public void testRebalanceOnRegionServerNumberChange()
throws IOException, InterruptedException {
HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
admin.createTable(this.desc, HBaseTestingUtility.KEYS);
admin.createTable(this.desc, Arrays.copyOfRange(HBaseTestingUtility.KEYS,
1, HBaseTestingUtility.KEYS.length));
this.table = new HTable(UTIL.getConfiguration(), this.desc.getName());
CatalogTracker ct = new CatalogTracker(UTIL.getConfiguration());
ct.start();
@ -88,7 +90,7 @@ public class TestRegionRebalancing {
ct.stop();
}
assertEquals("Test table should have right number of regions",
HBaseTestingUtility.KEYS.length + 1/*One extra to account for start/end keys*/,
HBaseTestingUtility.KEYS.length,
this.table.getStartKeys().length);
// verify that the region assignments are balanced to start out