Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.TableDescriptor


    if (this.fs.exists(tabledir)) {
      if (!this.fs.delete(tabledir, true)) {
        throw new IOException("Failed delete of " + tabledir.toString());
      }
    }
    TableDescriptor descriptor = this.cache.remove(tablename);
    if (descriptor == null) {
      return null;
    } else {
      return descriptor.getHTableDescriptor();
    }
  }
View Full Code Here


    try {
      fsDataInputStream.readFully(content);
    } finally {
      fsDataInputStream.close();
    }
    TableDescriptor td = null;
    try {
      td = TableDescriptor.parseFrom(content);
    } catch (DeserializationException e) {
      // we have old HTableDescriptor here
      try {
        HTableDescriptor htd = HTableDescriptor.parseFrom(content);
        LOG.warn("Found old table descriptor, converting to new format for table " +
            htd.getTableName() + "; NOTE table will be in ENABLED state!");
        td = new TableDescriptor(htd, TableState.State.ENABLED);
        if (rewritePb) rewriteTableDescriptor(fs, status, td);
      } catch (DeserializationException e1) {
        throw new IOException("content=" + Bytes.toShort(content), e);
      }
    }
View Full Code Here

   * Create new HTableDescriptor in HDFS. Happens when we are creating table.
   * Used by tests.
   * @return True if we successfully created file.
   */
  public boolean createTableDescriptor(HTableDescriptor htd) throws IOException {
    return createTableDescriptor(new TableDescriptor(htd), false);
  }
View Full Code Here

   * Create tables descriptor for given HTableDescriptor. Default TableDescriptor state
   * will be used (typically ENABLED).
   */
  public boolean createTableDescriptor(HTableDescriptor htd, boolean forceCreation)
      throws IOException {
    return createTableDescriptor(new TableDescriptor(htd), forceCreation);
  }
View Full Code Here

        "Second region cells can not be null");
    HRegionInfo info2 = HRegionInfo.getHRegionInfo(result2);
    if (info2 == null) {
      throw new NullPointerException("info2 is null using key " + meta);
    }
    TableDescriptor htd = FSTableDescriptors.getTableDescriptorFromFs(FileSystem.get(getConf()),
      this.rootdir, this.tableName);
    HRegion merged = merge(htd.getHTableDescriptor(), meta, info1, info2);

    LOG.info("Adding " + merged.getRegionInfo() + " to " +
        meta.getRegionInfo());

    HRegion.addRegionToMETA(meta, merged);
View Full Code Here

    verifyTableDescriptor(htd, tableName, families);

    // Verify descriptor from HDFS
    MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem();
    Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName);
    TableDescriptor td =
        FSTableDescriptors.getTableDescriptorFromFs(mfs.getFileSystem(), tableDir);
    verifyTableDescriptor(td.getHTableDescriptor(), tableName, families);
  }
View Full Code Here

    private RegionData[] createTable(final HTableDescriptor htd, final int nregions)
        throws IOException {
      Path tableDir = FSUtils.getTableDir(rootDir, htd.getTableName());
      new FSTableDescriptors(conf).createTableDescriptorForTableDirectory(tableDir,
          new TableDescriptor(htd), false);

      assertTrue(nregions % 2 == 0);
      RegionData[] regions = new RegionData[nregions];
      for (int i = 0; i < regions.length; i += 2) {
        byte[] startKey = Bytes.toBytes(0 + i * 2);
 
View Full Code Here

        this.desc = desc;
        this.tableRegions = tableRegions;
        this.snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);
        new FSTableDescriptors(conf)
          .createTableDescriptorForTableDirectory(snapshotDir,
              new TableDescriptor(htd), false);
      }
View Full Code Here

    htd.addFamily(new HColumnDescriptor("f"));
    return htd;
  }

  private TableDescriptor createTableDescriptor() {
    TableDescriptor htd = new TableDescriptor(createHTableDescriptor(), TableState.State.ENABLED);
    return htd;
  }
View Full Code Here

      if (modTInfo == null) {
        // only executed once per table.
        modTInfo = new TableInfo(tableName);
        tablesInfo.put(tableName, modTInfo);
        try {
          TableDescriptor htd =
              FSTableDescriptors.getTableDescriptorFromFs(fs, hbaseRoot, tableName);
          modTInfo.htds.add(htd.getHTableDescriptor());
        } catch (IOException ioe) {
          if (!orphanTableDirs.containsKey(tableName)) {
            LOG.warn("Unable to read .tableinfo from " + hbaseRoot, ioe);
            //should only report once for each table
            errors.reportError(ERROR_CODE.NO_TABLEINFO_FILE,
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.TableDescriptor

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.