Package com.alibaba.wasp

Examples of com.alibaba.wasp.MiniWaspCluster$MiniWaspClusterFServer


      // ;
    }
  }

  private int getTableEntityGroupIndex(WaspAdmin admin, EntityGroupInfo egi) {
    MiniWaspCluster cluster = TESTING_UTIL.getMiniWaspCluster();
    int tableEntityGroupIndex = cluster.getServerWith(egi.getEntityGroupName());
    assertTrue(tableEntityGroupIndex != -1);
    cluster.getFServer(tableEntityGroupIndex);

    tableEntityGroupIndex = cluster.getServerWith(egi.getEntityGroupName());
    assertTrue(tableEntityGroupIndex != -1);
    return tableEntityGroupIndex;
  }
View Full Code Here


    final int NUM_RS = 3;

    // Start the cluster
    WaspTestingUtility TEST_UTIL = new WaspTestingUtility(conf);
    TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS);
    MiniWaspCluster cluster = TEST_UTIL.getWaspCluster();

    // get all the master threads
    List<MasterThread> masterThreads = cluster.getMasterThreads();

    // wait for each to come online
    for (MasterThread mt : masterThreads) {
      assertTrue(mt.isAlive());
    }

    // find the active master
    FMaster active = null;
    for (int i = 0; i < masterThreads.size(); i++) {
      if (masterThreads.get(i).getMaster().isActiveMaster()) {
        active = masterThreads.get(i).getMaster();
        break;
      }
    }
    assertNotNull(active);
    // make sure the other two are backup masters
    ClusterStatus status = active.getClusterStatus();
    assertEquals(2, status.getBackupMastersSize());
    assertEquals(2, status.getBackupMasters().size());

    // tell the active master to shutdown the cluster
    active.shutdown();

    for (int i = NUM_MASTERS - 1; i >= 0; --i) {
      cluster.waitOnMaster(i);
    }
    // make sure all the masters properly shutdown
    assertEquals(0, masterThreads.size());

    TEST_UTIL.shutdownMiniCluster();
View Full Code Here

        "wasp.master.assignment.timeoutmonitor.period", 2000);
    TEST_UTIL.getConfiguration().setInt(
        "wasp.master.assignment.timeoutmonitor.timeout", 5000);
    TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_FServer);
    String tableName = "testOpenedEntityGroupHandlerOnMasterRestart";
    MiniWaspCluster cluster = createEntityGroups(tableName);
    abortMaster(cluster);

    FServer entityGroupServer = cluster.getFServer(0);
    EntityGroup entityGroup = getEntityGroupBeingServed(cluster,
        entityGroupServer);

    // forcefully move a entityGroup to OPENED state in zk
    // Create a ZKW to use in the test
    zkw = WaspTestingUtility.createAndForceNodeToOpenedState(TEST_UTIL,
        entityGroup, entityGroupServer.getServerName());

    // Start up a new master
    log("Starting up a new master");
    cluster.startMaster().getMaster();
    log("Waiting for master to be ready");
    cluster.waitForActiveAndReadyMaster();
    log("Master is ready");

    // Failover should be completed, now wait for no RIT
    log("Waiting for no more RIT");
    ZKAssign.blockUntilNoRIT(zkw);
View Full Code Here

  }

  private MiniWaspCluster createEntityGroups(String tableName)
      throws InterruptedException, ZooKeeperConnectionException, IOException,
      KeeperException {
    MiniWaspCluster cluster = TEST_UTIL.getWaspCluster();
    log("Waiting for active/ready master");
    cluster.waitForActiveAndReadyMaster();
    zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
        "testOpenedEntityGroupHandler", null);

    // Create a table with entityGroups
    byte[] table = Bytes.toBytes(tableName);
View Full Code Here

    TEST_UTIL.shutdownMiniCluster();
  }

  @Test
  public void testMasterOpsWhileSplitting() throws Exception {
    MiniWaspCluster cluster = TEST_UTIL.getWaspCluster();
    FMaster m = cluster.getMaster();

    FTable ft = TEST_UTIL.createTable(TABLENAME);
    assertTrue(m.assignmentManager.getZKTable().isEnabledTable(
        Bytes.toString(TABLENAME)));
    TEST_UTIL.loadTable(ft);

    List<Pair<EntityGroupInfo, ServerName>> tableEntityGroups = FMetaReader
        .getTableEntityGroupsAndLocations(TEST_UTIL.getConfiguration(),
            TABLENAME);
    LOG.info("EntityGroups after load: "
        + Joiner.on(',').join(tableEntityGroups));
    assertEquals(1, tableEntityGroups.size());
    assertArrayEquals(FConstants.EMPTY_START_ROW, tableEntityGroups.get(0)
        .getFirst().getStartKey());
    assertArrayEquals(FConstants.EMPTY_END_ROW, tableEntityGroups.get(0)
        .getFirst().getEndKey());

    // Now trigger a split and stop when the split is in progress
    CountDownLatch split = new CountDownLatch(1);
    CountDownLatch proceed = new CountDownLatch(1);
    EntityGroupSplitListener list = new EntityGroupSplitListener(split, proceed);
    cluster.getMaster().executorService.registerListener(
        EventType.FSERVER_ZK_ENTITYGROUP_SPLIT, list);

    LOG.info("Splitting table");
    TEST_UTIL.getWaspAdmin().split(TABLENAME, Bytes.toBytes("1234"));
    LOG.info("Waiting for split result to be about to open");
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.MiniWaspCluster$MiniWaspClusterFServer

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.