Package com.alibaba.wasp.fserver

Examples of com.alibaba.wasp.fserver.FServer$ScannerListener


   */
  public static JVMClusterUtil.FServerThread createFServerThread(
      final Configuration c, final Class<? extends FServer> hrsc,
      final int index)
  throws IOException {
    FServer server;
    try {
      Constructor<? extends FServer> ctor = hrsc.getConstructor(Configuration.class);
      ctor.setAccessible(true);
      server = ctor.newInstance(c);
    } catch (InvocationTargetException ite) {
View Full Code Here


  public void testShouldCloseTheEntityGroupBasedOnTheEncodedEntityGroupName()
      throws Exception {
    byte[] TABLENAME = Bytes.toBytes("TestWASPCloseEntityGroup");
    createTableWithDefaultConf(TABLENAME);
    EntityGroup eg = null;
    FServer fs = TEST_UTIL.getFSForFirstEntityGroupInTable(TABLENAME);
    for (EntityGroup entityGroup : fs.getOnlineEntityGroups()) {
      eg = entityGroup;
      admin.closeEntityGroupWithEncodedEntityGroupName(entityGroup
          .getEntityGroupInfo().getEncodedName(), fs.getServerName()
          .getServerName());
    }
    Thread.sleep(1000);
    assertFalse(
        "The entityGroup should not be present in online entityGroups list.",
        fs.getOnlineEntityGroups().contains(eg));
  }
View Full Code Here

  public void testCloseEntityGroupIfInvalidEntityGroupNameIsPassed()
      throws Exception {
    byte[] TABLENAME = Bytes.toBytes("TestWASPCloseEntityGroup1");
    createTableWithDefaultConf(TABLENAME);
    EntityGroup eg = null;
    FServer fs = TEST_UTIL.getFSForFirstEntityGroupInTable(TABLENAME);
    for (EntityGroup entityGroup : fs.getOnlineEntityGroups()) {
      if (entityGroup.getEntityGroupNameAsString().contains(
          "TestWASPCloseEntityGroup1")) {
        eg = entityGroup;
        try {
          admin.closeEntityGroup("sample", fs.getServerName().getServerName());
        } catch (UnknownEntityGroupException nsege) {
          // expected, ignore it
        }
      }
    }
    assertTrue(
        "The entityGroup should be present in online entityGroups list.", fs
            .getOnlineEntityGroups().contains(eg));
  }
View Full Code Here

  @Test
  public void testCloseEntityGroupThatFetchesTheEGIFromMeta() throws Exception {
    byte[] TABLENAME = Bytes.toBytes("TestWASPCloseEntityGroup2");
    createTableWithDefaultConf(TABLENAME);
    EntityGroup eg = null;
    FServer fs = TEST_UTIL.getFSForFirstEntityGroupInTable(TABLENAME);
    for (EntityGroup entityGroup : fs.getOnlineEntityGroups()) {
      if (entityGroup.getEntityGroupNameAsString().contains(
          "TestWASPCloseEntityGroup2")) {
        eg = entityGroup;
        admin.closeEntityGroup(entityGroup.getEntityGroupNameAsString(), fs
            .getServerName().getServerName());
      }
    }
    boolean isInList = fs.getOnlineEntityGroups().contains(eg);
    long timeout = System.currentTimeMillis() + 2000;
    while ((System.currentTimeMillis() < timeout) && (isInList)) {
      Thread.sleep(100);
      isInList = fs.getOnlineEntityGroups().contains(eg);
    }
    assertFalse(
        "The EntityGroup should not be present in online EntityGroups list.",
        isInList);
  }
View Full Code Here

  @Test
  public void testCloseEntityGroupWhenServerNameIsEmpty() throws Exception {
    byte[] TABLENAME = Bytes
        .toBytes("TestWASPCloseEntityGroupWhenServerNameIsEmpty");
    createTableWithDefaultConf(TABLENAME);
    FServer fs = TEST_UTIL.getFSForFirstEntityGroupInTable(TABLENAME);
    try {
      for (EntityGroup entityGroup : fs.getOnlineEntityGroups()) {
        if (entityGroup.getEntityGroupNameAsString().contains(
            "TestWASPCloseEntityGroupWhenServerNameIsEmpty")) {
          admin.closeEntityGroup(entityGroup.getEntityGroupInfo()
              .getEncodedName(), " ");
        }
View Full Code Here

    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");
View Full Code Here

  public void testCloseEntityGroupWhenEncodedEntityGroupNameIsNotGiven()
      throws Exception {
    byte[] TABLENAME = Bytes.toBytes("TestWASPCloseEntityGroup4");
    createTableWithDefaultConf(TABLENAME);
    EntityGroup eg = null;
    FServer fs = TEST_UTIL.getFSForFirstEntityGroupInTable(TABLENAME);

    for (EntityGroup entityGroup : fs.getOnlineEntityGroups()) {
      if (entityGroup.getEntityGroupNameAsString().contains(
          "TestWASPCloseEntityGroup4")) {
        eg = entityGroup;
        try{
          admin.closeEntityGroupWithEncodedEntityGroupName(entityGroup.getEntityGroupNameAsString(), fs
              .getServerName().getServerName());
        } catch (NotServingEntityGroupException nseg) {
          // expected, ignore it.
        }
      }
    }
    assertTrue(
        "The entityGroup should be present in online entityGroups list.", fs
            .getOnlineEntityGroups().contains(eg));
  }
View Full Code Here

      EntityGroupStates entityGroupStates = TEST_UTIL.getWaspCluster()
          .getMaster().getAssignmentManager().getEntityGroupStates();
      ServerName serverName = entityGroupStates.getFServerOfEntityGroup(egInfo);
      ServerName destServerName = null;
      for (int i = 0; i < 3; i++) {
        FServer destServer = TEST_UTIL.getWaspCluster().getFServer(i);
        if (!destServer.getServerName().equals(serverName)) {
          destServerName = destServer.getServerName();
          break;
        }
      }
      assertTrue(destServerName != null && !destServerName.equals(serverName));
      TEST_UTIL.getWaspAdmin().move(egInfo.getEncodedNameAsBytes(),
View Full Code Here

    this.startFServer();
  }

  @Override
  public void killFServer(ServerName serverName) throws IOException {
    FServer server = getFServer(getFServerIndex(serverName));
    if (server instanceof MiniWaspClusterFServer) {
      LOG.info("Killing " + server.toString());
      ((MiniWaspClusterFServer) server).kill();
    } else {
      abortFServer(getFServerIndex(serverName));
    }
  }
View Full Code Here

   *
   * @param serverNumber
   *          Used as index into a list.
   */
  public String abortFServer(int serverNumber) {
    FServer server = getFServer(serverNumber);
    LOG.info("Aborting " + server.toString());
    server.abort("Aborting for tests", new Exception("Trace info"));
    return server.toString();
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.fserver.FServer$ScannerListener

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.