Package com.alibaba.wasp.fserver

Examples of com.alibaba.wasp.fserver.EntityGroup


    Configuration conf = TEST_UTIL.getConfiguration(); // initSplit();
    // Setting up entityGroup
    String method1 = "TestSubscriber1";
    String method2 = "TestSubscriber2";
    String method3 = "TestSubscriber3";
    EntityGroup entityGroup1 = initEntityGroup(tableName1, method1, conf, fileds);
    EntityGroup entityGroup2 = initEntityGroup(tableName2, method2, conf, fileds);
    EntityGroup entityGroup3 = initEntityGroup(tableName3, method3, conf, fileds);
    entityGroups.add(entityGroup1);
    entityGroups.add(entityGroup2);
    entityGroups.add(entityGroup3);

    PublisherBuilder builder = new PublisherBuilder();
    Publisher publisher1 = builder.build(conf, entityGroup1.getEntityGroupInfo());
    Publisher publisher2 = builder.build(conf, entityGroup2.getEntityGroupInfo());
    Publisher publisher3 = builder.build(conf, entityGroup3.getEntityGroupInfo());

    Message message1 = new InsertAction("testtable1", Bytes.toBytes("PK1"));
    Message message2 = new InsertAction("testtable2", Bytes.toBytes("PK2"));
    Message message3 = new InsertAction("testtable3", Bytes.toBytes("PK3"));
View Full Code Here


        return;
      }
      final String encodedName = entityGroupInfo.getEncodedName();

      // Check that this entityGroup is not already online
      EntityGroup entityGroup = this.fsServices
          .getFromOnlineEntityGroups(encodedName);

      // If fails, just return. Someone stole the entityGroup from under us.
      // Calling transitionZookeeperOfflineToOpening initalizes this.version.
      if (!transitionZookeeperOfflineToOpening(encodedName,
View Full Code Here

  /**
   * @return Instance of EntityGroup if successful open else null.
   */
  EntityGroup openEntityGroup() {
    EntityGroup entityGroup = null;
    try {
      // Instantiate the entityGroup. This also periodically tickles our zk
      // OPENING
      // state so master doesn't timeout this entityGroup in transition.
      entityGroup = EntityGroup.openEntityGroup(this.entityGroupInfo,
View Full Code Here

    try {
      String name = entityGroupInfo.getEntityGroupNameAsString();
      LOG.debug("Processing close of " + name);
      String encodedEntityGroupName = entityGroupInfo.getEncodedName();
      // Check that this entityGroup is being served here
      EntityGroup entityGroup = this.fsServices
          .getFromOnlineEntityGroups(encodedEntityGroupName);
      if (entityGroup == null) {
        LOG.warn("Received CLOSE for entityGroup " + name
            + " but currently not serving");
        return;
      }

      // Close the entityGroup
      try {
        // If we need to keep updating CLOSING stamp to prevent against
        // a timeout if this is long-running, need to spin up a thread?
        if (!entityGroup.close(abort)) {
          // This entityGroup got closed. Most likely due to a split. So instead
          // of doing the setClosedState() below, let's just ignore cont
          // The split message will clean up the master state.
          LOG.warn("Can't close entityGroup: was already closed during close(): "
              + entityGroupInfo.getEntityGroupNameAsString());
          return;
        }
      } catch (Throwable t) {
        // A throwable here indicates that we couldn't successfully flush the
        // memstore before closing. So, we need to abort the server and allow
        // the master to split our logs in order to recover the data.
        server.abort("Unrecoverable exception while closing entityGroup "
            + entityGroupInfo.getEntityGroupNameAsString()
            + ", still finishing close", t);
        throw new RuntimeException(t);
      }

      this.fsServices.removeFromOnlineEntityGroups(entityGroupInfo
          .getEncodedName());

      // Remove it from RIT before set ZK data
      this.fsServices.getEntityGroupsInTransitionInFS().remove(
          this.entityGroupInfo.getEncodedNameAsBytes());
      removedFromRIT = true;

      if (this.zk) {
        if (setClosedState(this.expectedVersion, entityGroup)) {
          LOG.debug("set entityGroup closed state in zk successfully for entityGroup "
              + name + " sn name: " + this.server.getServerName());
        } else {
          LOG.debug("set entityGroup closed state in zk unsuccessfully for entityGroup "
              + name + " sn name: " + this.server.getServerName());
        }
      }

      // Done! EntityGroup is closed on this FS
      LOG.debug("Closed entityGroup "
          + entityGroup.getEntityGroupNameAsString());
    } finally {
      if (!removedFromRIT) {
        this.fsServices.getEntityGroupsInTransitionInFS().remove(
            this.entityGroupInfo.getEncodedNameAsBytes());
      }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.fserver.EntityGroup

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.