Package com.alibaba.wasp.meta

Examples of com.alibaba.wasp.meta.FTable


  /**
   * @param tablename
   * @return
   */
  public FTable createTable(String tablename) throws IOException {
    FTable desc = FMetaTestUtil.makeTable(tablename);
    getWaspAdmin().createTable(desc);
    return desc;
  }
View Full Code Here


  /**
   * @param tablename
   * @return
   */
  public FTable createChildTable(String tablename, String childTablename) throws IOException {
    FTable desc = FMetaTestUtil.makeChildTable(tablename, childTablename);
    getWaspAdmin().createTable(desc);
    return desc;
  }
View Full Code Here

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

   *         {@link com.alibaba.wasp.fserver.EntityGroup#closeEntityGroup(com.alibaba.wasp.fserver.EntityGroup)} when done.
   */
  private static EntityGroup initEntityGroup(byte[] tableName, byte[] startKey,
      byte[] stopKey, String callingMethod, Configuration conf,
      List<Field> fields) throws IOException {
    FTable table = new FTable();
    table.setTableName(Bytes.toString(tableName));
    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());
View Full Code Here

   *         {@link com.alibaba.wasp.fserver.EntityGroup#closeEntityGroup(com.alibaba.wasp.fserver.EntityGroup)} when done.
   */
  private static EntityGroup initEntityGroup(byte[] tableName, byte[] startKey,
      byte[] stopKey, String callingMethod, Configuration conf,
      List<Field> fields) throws IOException {
    FTable table = new FTable();
    table.setTableName(Bytes.toString(tableName));
    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());
View Full Code Here

      context.setSql(createTable);
      druidParser.generatePlan(context);
      Plan plan = context.getPlan();
      if (plan instanceof CreateTablePlan) {
        CreateTablePlan createPlan = (CreateTablePlan) plan;
        FTable table = createPlan.getTable();
        TableSchemaCacheReader.getService(conf).createTable(table);
      }
      // insert
      context.setSql(insert);
      druidParser.generatePlan(context);
View Full Code Here

            .getKeepAliveMasterAdmin();

        if(executePlan instanceof NotingTodoPlan) {
          return ResponseConverter.buildNotExecuteResponse();
        } else if (executePlan instanceof AlterTablePlan) {
          FTable hTableDesc = ((AlterTablePlan) executePlan).getNewTable();
          return modifyTable(masterAdminKeepAliveConnection, hTableDesc);
        } else if (executePlan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) executePlan;
          MasterAdminProtos.CreateTableResponse response = masterAdminKeepAliveConnection
              .createTable(
View Full Code Here

  private void handleTruncateTable(String tableName) throws IOException,
      ServiceException, KeeperException {
    FMetaServices fmetaServices = FMetaReader.getService(server
        .getConfiguration());
    FTable ftable = FMetaReader.getTable(server.getConfiguration(),
        tableNameStr);
    // 1. delete storage table in HBase
    String htablename = StorageTableNameBuilder.buildEntityTableName(ftable
        .getTableName());
    fmetaServices.deleteStorageTable(htablename);

    // 2. create storage table in HBase
    HTableDescriptor desc = fmetaServices.getStorageTableDesc(ftable);
    fmetaServices.createStorageTable(desc);

    // 3. delete Transaction table in HBase
    List<EntityGroupInfo> eginfos = FMetaReader.getTableEntityGroups(
        server.getConfiguration(), table);
    for (EntityGroupInfo eginfo : eginfos) {
      String tTableName = StorageTableNameBuilder
          .buildTransactionTableName(eginfo.getEncodedName());
      if (fmetaServices.storageTableExists(tTableName)) {
        fmetaServices.deleteStorageTable(tTableName);
      }
    }

    // 4. clean Index table in HBase
    LinkedHashMap<String, Index> indexs = ftable.getIndex();
    Iterator<Index> iter = indexs.values().iterator();
    while (iter.hasNext()) {
      Index index = iter.next();
      String htable = StorageTableNameBuilder.buildIndexTableName(index);
      HTableDescriptor htableDesc = fmetaServices.getStorageTableDesc(htable);
View Full Code Here

    this.retainAssignment = skipTableStateCheck;
    // Check if table exists
    if (!FMetaReader.tableExists(server.getConfiguration(), this.tableNameStr)) {
      throw new TableNotFoundException(tableNameStr);
    }
    FTable ftable = FMetaReader.getTable(server.getConfiguration(),
        tableNameStr);
    // Child Table
    if (ftable.isChildTable()) {
      isChild = true;
    }
    // There could be multiple client requests trying to disable or enable
    // the table at the same time. Ensure only the first request is honored
    // After that, no other requests can be accepted until the table reaches
View Full Code Here

  /**
   * @return Table Info for this table
   * @throws java.io.IOException
   */
  FTable getTable() throws IOException {
    FTable table = FMetaReader
        .getTable(server.getConfiguration(), tableNameStr);
    if (table == null) {
      throw new IOException("Table missing for " + tableNameStr);
    }
    return table;
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.meta.FTable

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.