本文整理了Java中org.apache.hadoop.hbase.HBaseTestingUtility.countRows()
方法的一些代码示例,展示了HBaseTestingUtility.countRows()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseTestingUtility.countRows()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.HBaseTestingUtility
类名称:HBaseTestingUtility
方法名:countRows
[英]Return the number of rows in the given table.
[中]返回给定表中的行数。
代码示例来源:origin: apache/hbase
protected int countRows(final Table table, final byte[]... families) throws IOException {
return UTIL.countRows(table, families);
}
}
代码示例来源:origin: apache/hbase
protected int countRows(final Table table, final byte[]... families) throws Exception {
return UTIL.countRows(table, families);
}
}
代码示例来源:origin: apache/hbase
/**
* Counts the number of rows to verify data loss or non-dataloss.
*/
int countRows() throws IOException {
return TEST_UTIL.countRows(tbl);
}
代码示例来源:origin: apache/hbase
protected int countRows(final Table table, final byte[]... families) throws IOException {
return UTIL.countRows(table, families);
}
}
代码示例来源:origin: apache/hbase
protected int countRows(Table table, byte[]... families) throws IOException {
return TEST_UTIL.countRows(table, families);
}
代码示例来源:origin: apache/hbase
protected int countRows(Table table) throws IOException {
return TEST_UTIL.countRows(table);
}
代码示例来源:origin: apache/hbase
/**
* Return the number of rows in the given table.
* @param table to count rows
* @return count of rows
*/
public static int countRows(final Table table) throws IOException {
return countRows(table, new Scan());
}
代码示例来源:origin: apache/hbase
/**
* Counts the number of rows to verify data loss or non-dataloss.
*/
int countRows(byte[] start, byte[] end) throws IOException {
return TEST_UTIL.countRows(tbl, new Scan(start, end));
}
代码示例来源:origin: apache/hbase
public int countRows(final Region region) throws IOException {
return countRows(region, new Scan());
}
代码示例来源:origin: apache/hbase
/**
* Gets the number of rows in the given table.
* @param table to get the scanner
* @return the number of rows
*/
public static int countMobRows(final Table table) throws IOException {
Scan scan = new Scan();
// Do not retrieve the mob data when scanning
scan.setAttribute(MobConstants.MOB_SCAN_RAW, Bytes.toBytes(Boolean.TRUE));
return HBaseTestingUtility.countRows(table, scan);
}
}
代码示例来源:origin: apache/hbase
public int countRows(final Table table, final byte[]... families) throws IOException {
Scan scan = new Scan();
for (byte[] family: families) {
scan.addFamily(family);
}
return countRows(table, scan);
}
代码示例来源:origin: apache/hbase
private void wait(Table target, int expectedCount, String msg) throws IOException,
InterruptedException {
for (int i = 0; i < NB_RETRIES; i++) {
int rowCount_ht2TargetAtPeer1 = utility2.countRows(target);
if (i == NB_RETRIES - 1) {
assertEquals(msg, expectedCount, rowCount_ht2TargetAtPeer1);
}
if (expectedCount == rowCount_ht2TargetAtPeer1) {
break;
}
Thread.sleep(SLEEP_TIME);
}
}
}
代码示例来源:origin: apache/hbase
private void assertRowCount(final Table t, final int expected)
throws IOException {
assertEquals(expected, TEST_UTIL.countRows(t, new Scan()));
}
代码示例来源:origin: apache/hbase
private void wait(int slaveNumber, Table target, int expectedCount)
throws IOException, InterruptedException {
int count = 0;
for (int i = 0; i < NB_RETRIES; i++) {
if (i == NB_RETRIES - 1) {
fail("Waited too much time for bulkloaded data replication. Current count=" + count
+ ", expected count=" + expectedCount);
}
count = utilities[slaveNumber].countRows(target);
if (count != expectedCount) {
LOG.info("Waiting more time for bulkloaded data replication.");
Thread.sleep(SLEEP_TIME);
} else {
break;
}
}
}
代码示例来源:origin: apache/hbase
public int countRows(final Region region, final Scan scan) throws IOException {
InternalScanner scanner = region.getScanner(scan);
try {
return countRows(scanner);
} finally {
scanner.close();
}
}
代码示例来源:origin: apache/hbase
/**
* Return the number of rows in the given table.
*/
public int countRows(final TableName tableName) throws IOException {
Table table = getConnection().getTable(tableName);
try {
return countRows(table);
} finally {
table.close();
}
}
代码示例来源:origin: apache/hbase
public static void verifyRowCount(final HBaseTestingUtility util, final TableName tableName,
long expectedRows) throws IOException {
Table table = util.getConnection().getTable(tableName);
try {
assertEquals(expectedRows, util.countRows(table));
} finally {
table.close();
}
}
代码示例来源:origin: apache/hbase
/**
* Tests the case where a Scan can throw an IOException in the middle of the seek / reseek leaving
* the server side RegionScanner to be in dirty state. The client has to ensure that the
* ClientScanner does not get an exception and also sees all the data.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void testClientScannerIsResetWhenScanThrowsIOException()
throws IOException, InterruptedException {
reset();
THROW_ONCE.set(true); // throw exceptions only once
TableName tableName = TableName.valueOf(name.getMethodName());
try (Table t = TEST_UTIL.createTable(tableName, FAMILY)) {
int rowCount = TEST_UTIL.loadTable(t, FAMILY, false);
TEST_UTIL.getAdmin().flush(tableName);
inject();
int actualRowCount = TEST_UTIL.countRows(t, new Scan().addColumn(FAMILY, FAMILY));
assertEquals(rowCount, actualRowCount);
}
assertTrue(REQ_COUNT.get() > 0);
}
代码示例来源:origin: apache/hbase
@Test
public void testOpenRegionReplica() throws Exception {
openRegion(HTU, getRS(), hriSecondary);
try {
//load some data to primary
HTU.loadNumericRows(table, f, 0, 1000);
// assert that we can read back from primary
Assert.assertEquals(1000, HTU.countRows(table));
} finally {
HTU.deleteNumericRows(table, f, 0, 1000);
closeRegion(HTU, getRS(), hriSecondary);
}
}
代码示例来源:origin: apache/hbase
@Test
public void testRegionReplicaGets() throws Exception {
try {
//load some data to primary
HTU.loadNumericRows(table, f, 0, 1000);
// assert that we can read back from primary
Assert.assertEquals(1000, HTU.countRows(table));
// flush so that region replica can read
HRegion region = getRS().getRegionByEncodedName(hriPrimary.getEncodedName());
region.flush(true);
openRegion(HTU, getRS(), hriSecondary);
// first try directly against region
region = getRS().getRegion(hriSecondary.getEncodedName());
assertGet(region, 42, true);
assertGetRpc(hriSecondary, 42, true);
} finally {
HTU.deleteNumericRows(table, HConstants.CATALOG_FAMILY, 0, 1000);
closeRegion(HTU, getRS(), hriSecondary);
}
}
内容来源于网络,如有侵权,请联系作者删除!