Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Admin.deleteTable()


      FileSystem fs = HFileSystem.get(conf);
      Admin admin = new HBaseAdmin(conf);

      if (admin.tableExists(tableName)) {
        admin.disableTable(tableName);
        admin.deleteTable(tableName);
      }

      if (fs.exists(p)) {
        fs.delete(p, true);
      }
View Full Code Here


    Admin admin = util.getHBaseAdmin();
    if (admin.tableExists(tableName)) {
      if (admin.isTableEnabled(tableName)) {
        admin.disableTable(tableName);
      }
      admin.deleteTable(tableName);
    }
    util.createTable(tableName, new byte[][] {dummy, test});
  }

  /**
 
View Full Code Here

    assertFalse(MetaTableAccessor.tableExists(connection, name));
    UTIL.createTable(name, HConstants.CATALOG_FAMILY);
    assertTrue(MetaTableAccessor.tableExists(connection, name));
    Admin admin = UTIL.getHBaseAdmin();
    admin.disableTable(name);
    admin.deleteTable(name);
    assertFalse(MetaTableAccessor.tableExists(connection, name));
    assertTrue(MetaTableAccessor.tableExists(connection,
      TableName.META_TABLE_NAME));
  }
View Full Code Here

    admin.disableTable(TABLE_NAME);
    try {
      // Verify the column descriptor
      verifyHColumnDescriptor(1, TABLE_NAME, FAMILY);
    } finally {
      admin.deleteTable(TABLE_NAME);
    }
  }

  @Test
  public void testCreateTableWithDefaultFromConf() throws Exception {
View Full Code Here

    admin.disableTable(TABLE_NAME);
    try {
      // Verify the column descriptor
      verifyHColumnDescriptor(3, TABLE_NAME, FAMILY);
    } finally {
      admin.deleteTable(TABLE_NAME);
    }
  }

  @Test
  public void testCreateTableWithSetVersion() throws Exception {
View Full Code Here

    try {
      // Verify the column descriptor
      verifyHColumnDescriptor(5, TABLE_NAME, FAMILY);

    } finally {
      admin.deleteTable(TABLE_NAME);
    }
  }

  private void verifyHColumnDescriptor(int expected, final TableName tableName,
      final byte[]... families) throws IOException {
View Full Code Here

        if (table != null) {
          table.close();
        }
        // delete the table
        admin.disableTable(tableName);
        admin.deleteTable(tableName);
      }
    }
  }

  @Test
View Full Code Here

    Admin admin = util.getHBaseAdmin();
    if (admin.tableExists(TABLE_NAME)) {
      LOG.info(String.format("Deleting existing table %s.", TABLE_NAME));
      if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME);
      admin.deleteTable(TABLE_NAME);
      LOG.info(String.format("Existing table %s deleted.", TABLE_NAME));
    }
    LOG.info("Cluster ready");
  }
View Full Code Here

  public void tearDown() throws IOException {
    LOG.info("Cleaning up after test.");
    Admin admin = util.getHBaseAdmin();
    if (admin.tableExists(TABLE_NAME)) {
      if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME);
      admin.deleteTable(TABLE_NAME);
    }
    LOG.info("Restoring cluster.");
    util.restoreCluster();
    LOG.info("Cluster restored.");
  }
View Full Code Here

  @Before
  public void before() throws Exception  {
    Admin admin = TEST_UTIL.getHBaseAdmin();
    if (admin.tableExists(TABLE)) {
      if (admin.isTableEnabled(TABLE)) admin.disableTable(TABLE);
      admin.deleteTable(TABLE);
    }
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(new HColumnDescriptor(COLUMN_1).setMaxVersions(3));
    htd.addFamily(new HColumnDescriptor(COLUMN_2).setMaxVersions(3));
    htd.addFamily(new HColumnDescriptor(COLUMN_3).setMaxVersions(3));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.