org.apache.hadoop.hbase.HBaseTestingUtility.truncateTable()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.hadoop.hbase.HBaseTestingUtility.truncateTable()方法的一些代码示例,展示了HBaseTestingUtility.truncateTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseTestingUtility.truncateTable()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.HBaseTestingUtility
类名称:HBaseTestingUtility
方法名:truncateTable

HBaseTestingUtility.truncateTable介绍

[英]Truncate a table using the admin command. Effectively disables, deletes, and recreates the table. For previous behavior of issuing row deletes, see deleteTableData. Expressly does not preserve regions of existing table.
[中]使用admin命令截断表。有效地禁用、删除和重新创建表。有关以前发出行删除的行为,请参见deleteTableData。不保留现有表的区域。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Truncate a table using the admin command.
 * Effectively disables, deletes, and recreates the table.
 * For previous behavior of issuing row deletes, see
 * deleteTableData.
 * Expressly does not preserve regions of existing table.
 * @param tableName table which must exist.
 * @return HTable for the new table
 */
public Table truncateTable(final TableName tableName) throws IOException {
 return truncateTable(tableName, false);
}

代码示例来源:origin: apache/hbase

@After
public void tearDown() throws IOException {
 TEST_UTIL.truncateTable(TABLE_NAME);
}

代码示例来源:origin: apache/hbase

/**
 * all rowKeys are fit in the last region.
 * @throws IOException
 */
@Test
public void testSmallReversedScan01() throws IOException {
 String[][] keysCases = new String[][] {
  { "d0", "d1", "d2", "d3" }, // all rowKeys fit in the last region.
  { "a0", "a1", "a2", "a3" }, // all rowKeys fit in the first region.
  { "a0", "b1", "c2", "d3" }, // each region with a rowKey
 };
 for (int caseIndex = 0; caseIndex < keysCases.length; caseIndex++) {
  testSmallReversedScanInternal(keysCases[caseIndex]);
  TEST_UTIL.truncateTable(TABLE_NAME);
 }
}

代码示例来源:origin: apache/hbase

@Test
public void testTruncateTable() throws Exception {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
 TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
 // All regions should have favored nodes
 checkIfFavoredNodeInformationIsCorrect(tableName);
 List<HRegionInfo> regions = admin.getTableRegions(tableName);
 TEST_UTIL.truncateTable(tableName, true);
 checkNoFNForDeletedTable(regions);
 checkIfFavoredNodeInformationIsCorrect(tableName);
 regions = admin.getTableRegions(tableName);
 TEST_UTIL.truncateTable(tableName, false);
 checkNoFNForDeletedTable(regions);
 TEST_UTIL.deleteTable(tableName);
}

代码示例来源:origin: apache/hbase

@Test
public void testTruncatePerms() throws Exception {
 try {
  List<UserPermission> existingPerms = AccessControlClient.getUserPermissions(
    systemUserConnection, TEST_TABLE.getNameAsString());
  assertTrue(existingPerms != null);
  assertTrue(existingPerms.size() > 1);
  TEST_UTIL.getAdmin().disableTable(TEST_TABLE);
  TEST_UTIL.truncateTable(TEST_TABLE);
  TEST_UTIL.waitTableAvailable(TEST_TABLE);
  List<UserPermission> perms = AccessControlClient.getUserPermissions(
    systemUserConnection, TEST_TABLE.getNameAsString());
  assertTrue(perms != null);
  assertEquals(existingPerms.size(), perms.size());
 } catch (Throwable e) {
  throw new HBaseIOException(e);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

/**
 * Truncate a table using the admin command.
 * Effectively disables, deletes, and recreates the table.
 * For previous behavior of issuing row deletes, see
 * deleteTableData.
 * Expressly does not preserve regions of existing table.
 * @param tableName table which must exist.
 * @return HTable for the new table
 */
public Table truncateTable(final TableName tableName) throws IOException {
 return truncateTable(tableName, false);
}

代码示例来源:origin: kite-sdk/kite

public static void truncateTables(Collection<String> tableNames)
   throws IOException {
  for (String tableName : tableNames) {
   util.truncateTable(Bytes.toBytes(tableName));
  }
 }
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 tablePool.close();
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(compositeTableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(incrementTableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: org.apache.hbase/hbase-server

@After
public void tearDown() throws IOException {
 TEST_UTIL.truncateTable(TABLE_NAME);
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 repo.delete("default", tableName);
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 ((HBaseActionModifiable) ds).clearAllModifiers();
 repo.delete("default", tableName);
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@AfterClass
public static void afterClass() throws Exception {
 HBaseTestUtils.util.deleteTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: kite-sdk/kite

@After
public void after() throws Exception {
 tablePool.close();
 HBaseTestUtils.util.deleteTable(Bytes.toBytes(tableName));
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(managedTableName));
}

代码示例来源:origin: cdapio/cdap

@After
public void after() throws Exception {
 testingUtility.truncateTable(hTable.getTableName());
}

代码示例来源:origin: kite-sdk/kite

@Before
public void beforeTest() throws Exception {
 HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
 tablePool = new HTablePool(HBaseTestUtils.getConf(), 10);
}

代码示例来源:origin: org.apache.hbase/hbase-server

/**
 * all rowKeys are fit in the last region.
 * @throws IOException
 */
@Test
public void testSmallReversedScan01() throws IOException {
 String[][] keysCases = new String[][] {
  { "d0", "d1", "d2", "d3" }, // all rowKeys fit in the last region.
  { "a0", "a1", "a2", "a3" }, // all rowKeys fit in the first region.
  { "a0", "b1", "c2", "d3" }, // each region with a rowKey
 };
 for (int caseIndex = 0; caseIndex < keysCases.length; caseIndex++) {
  testSmallReversedScanInternal(keysCases[caseIndex]);
  TEST_UTIL.truncateTable(TABLE_NAME);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testTruncateTable() throws Exception {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
 TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
 // All regions should have favored nodes
 checkIfFavoredNodeInformationIsCorrect(tableName);
 List<HRegionInfo> regions = admin.getTableRegions(tableName);
 TEST_UTIL.truncateTable(tableName, true);
 checkNoFNForDeletedTable(regions);
 checkIfFavoredNodeInformationIsCorrect(tableName);
 regions = admin.getTableRegions(tableName);
 TEST_UTIL.truncateTable(tableName, false);
 checkNoFNForDeletedTable(regions);
 TEST_UTIL.deleteTable(tableName);
}

相关文章

HBaseTestingUtility类方法