Package com.alibaba.wasp.meta

Examples of com.alibaba.wasp.meta.FMetaServices


    }
  }

  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);
      fmetaServices.deleteStorageTable(htable);
      fmetaServices.createStorageTable(htableDesc);
    }

    // unlock table
    tableLockManager.unlockTable(tableNameStr);
  }
View Full Code Here

TOP

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

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.