// Create table then get the single entityGroup for our new table.
FTable t = TESTING_UTIL.createTable(tableName);
TESTING_UTIL.waitTableEnabled(tableName, 5000);
List<EntityGroup> entityGroups = cluster.getEntityGroups(tableName);
EntityGroupInfo egi = getAndCheckSingleTableEntityGroup(entityGroups);
int tableEntityGroupIndex = getTableEntityGroupIndex(admin, egi);
try {
// Add a bit of load up into the table so splittable.
TESTING_UTIL.loadTable(t);
// Get entityGroup pre-split.
FServer server = cluster.getFServer(tableEntityGroupIndex);
printOutEntityGroups(server, "Initial entityGroups: ");
int entityGroupCount = server.getOnlineEntityGroups().size();
// Now, before we split, set special flag in master, a flag that has
// it FAIL the processing of split.
SplitEntityGroupHandler.TEST_SKIP = true;
// Now try splitting and it should work.
split(egi, "1", server, entityGroupCount);
// Get daughters
List<EntityGroup> daughters = cluster.getEntityGroups(tableName);
assertTrue(daughters.size() >= 2);
// Assert the ephemeral node is up in zk.
String path = ZKAssign.getNodeName(zkw, egi.getEncodedName());
Stat stats = zkw.getRecoverableZooKeeper().exists(path, false);
LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
+ stats);
EntityGroupTransaction rtd = EntityGroupTransaction.parseFrom(ZKAssign
.getData(zkw, egi.getEncodedName()));
// State could be SPLIT or SPLITTING.
assertTrue(rtd.getEventType().equals(
EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLIT)
|| rtd.getEventType().equals(
EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLITTING));
// abort and wait for new master.
FMaster master = abortAndWaitForMaster();
admin = new WaspAdmin(TESTING_UTIL.getConfiguration());
// update the egi to be offlined and splitted.
egi.setOffline(true);
egi.setSplit(true);
EntityGroupPlan egPlan = master.getAssignmentManager()
.getEntityGroupReopenPlan(egi);
assertTrue(egPlan != null);
} catch (Exception e) {