Package com.alibaba.wasp

Examples of com.alibaba.wasp.EntityGroupInfo


    // 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.
View Full Code Here


    // 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 split.
      split(egi, "2", server, entityGroupCount);
      // Get daughters
      List<EntityGroup> daughters = cluster.getEntityGroups(tableName);
      assertTrue(daughters.size() >= 2);
      // Now split one of the daughters.
      entityGroupCount = server.getOnlineEntityGroups().size();
      EntityGroupInfo daughter = null;
      for (EntityGroup entityGroup : daughters) {
        if (!entityGroup.getEntityGroupInfo().isSplit()) {
          try {
            entityGroup.checkRow(Bytes.toBytes("1"), "find eg");
            daughter = entityGroup.getEntityGroupInfo();
View Full Code Here

    // 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) {
View Full Code Here

    }
    for (FTable ftable : table) {
      TableSchemaCacheReader.getInstance(conf).refreshSchema(
          ftable.getTableName());
    }
    EntityGroupInfo egi = new EntityGroupInfo(table[0].getTableName(), null,
        null);
    // MockFServerServices service = new MockFServerServices();
    eg = new EntityGroup(conf, egi, table[0], TEST_UTIL.getMiniWaspCluster()
        .getFServer(0));
    eg.initialize();
View Full Code Here

   * interfere with each other. This allows us to use just a single ZK cluster
   * for the whole suite.
   */
  @Before
  public void setupEGI() {
    TEST_EGI = new EntityGroupInfo(TEST_FTD.getTableName(),
        Bytes.toBytes(testIndex), Bytes.toBytes(testIndex + 1));
    testIndex++;
  }
View Full Code Here

      NodeExistsException, KeeperException {
    final Server server = new MockServer(WTU);
    final FServerServices rss = new MockFServerServices();

    FTable htd = TEST_FTD;
    final EntityGroupInfo egi = TEST_EGI;
    EntityGroup entityGroup = EntityGroup.createEntityGroup(egi,
        WTU.getConfiguration(), htd, rss);
    assertNotNull(entityGroup);
    try {
      OpenEntityGroupHandler handler = new OpenEntityGroupHandler(server, rss,
          egi, htd) {
        @Override
        EntityGroup openEntityGroup() {
          // Open entityGroup first, then remove znode as though it'd been
          // hijacked.
          EntityGroup entityGroup = super.openEntityGroup();

          // Don't actually open entityGroup BUT remove the znode as though it'd
          // been hijacked on us.
          ZooKeeperWatcher zkw = this.server.getZooKeeper();
          String node = ZKAssign.getNodeName(zkw, egi.getEncodedName());
          try {
            ZKUtil.deleteNodeFailSilent(zkw, node);
          } catch (KeeperException e) {
            throw new RuntimeException("Ugh failed delete of " + node, e);
          }
View Full Code Here

    LinkedHashMap<String, Field> finalFields = new LinkedHashMap<String, Field>();
    for (Field field : fields) {
      finalFields.put(field.getName(), field);
    }
    table.setColumns(finalFields);
    EntityGroupInfo info = new EntityGroupInfo(Bytes.toBytes(table
        .getTableName()), startKey, stopKey, false);

    if (FMetaReader.exists(TEST_UTIL.getConfiguration(), info)) {
      throw new IOException("All ready has a entityGroupInfo "
          + info.getEntityGroupNameAsString());
    }
    return EntityGroup.openEntityGroup(info, table, conf, TEST_UTIL
        .getWaspCluster().getFServer(0), null);
  }
View Full Code Here

   * interfere with each other. This allows us to use just a single ZK cluster
   * for the whole suite.
   */
  @Before
  public void setupEGI() {
    TEST_EGI = new EntityGroupInfo(Bytes.toBytes(TEST_FTD.getTableName()),
        Bytes.toBytes(testIndex), Bytes.toBytes(testIndex + 1));
    testIndex++;
  }
View Full Code Here

  public void testFailedCommitAborts() throws IOException, NodeExistsException,
      KeeperException {
    final Server server = new MockServer(WTU, false);
    final FServerServices rss = new MockFServerServices();
    FTable wtd = TEST_FTD;
    final EntityGroupInfo egi = new EntityGroupInfo(wtd.getTableName(),
        FConstants.EMPTY_END_ROW, FConstants.EMPTY_END_ROW);
    EntityGroup entityGroup = EntityGroup.createEntityGroup(egi,
        WTU.getConfiguration(), wtd, rss);
    try {
      assertNotNull(entityGroup);
View Full Code Here

      NodeExistsException, KeeperException, DeserializationException {
    final Server server = new MockServer(WTU);
    final MockFServerServices rss = new MockFServerServices();

    FTable ftd = TEST_FTD;
    final EntityGroupInfo egi = TEST_EGI;

    // open a entityGroup first so that it can be closed later
    openEntityGroup(server, rss, ftd, egi);

    int versionOfClosingNode = ZKAssign.createNodeClosing(
        server.getZooKeeper(), egi, server.getServerName());

    CloseEntityGroupHandler handler = new CloseEntityGroupHandler(server, rss,
        egi, false, true, versionOfClosingNode + 1,
        EventType.M_FSERVER_CLOSE_ENTITYGROUP);
    handler.process();

    EntityGroupTransaction rt = EntityGroupTransaction.parseFrom(ZKAssign
        .getData(server.getZooKeeper(), egi.getEncodedName()));
    assertTrue(rt.getEventType().equals(EventType.M_ZK_ENTITYGROUP_CLOSING));
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.EntityGroupInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.