You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2021/10/18 13:47:57 UTC
[hbase] branch branch-2 updated: HBASE-26364 TestThriftServer is
failing 100% in our flaky test job (#3759)
This is an automated email from the ASF dual-hosted git repository.
wchevreuil pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new be9877e HBASE-26364 TestThriftServer is failing 100% in our flaky test job (#3759)
be9877e is described below
commit be9877efdc790164bf94248add81829460e212f0
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Mon Oct 18 13:59:42 2021 +0100
HBASE-26364 TestThriftServer is failing 100% in our flaky test job (#3759)
Signed-off-by: Xiaolin Ha <ha...@apache.org>
Signed-off-by: Duo Zhang <zh...@apache.org>
(cherry picked from commit 4454c2f90949950c1ed3b54c0e2e60b730a5178d)
---
.../hadoop/hbase/thrift/TestThriftServer.java | 57 ++++++++++++----------
1 file changed, 30 insertions(+), 27 deletions(-)
diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
index 64957f2..e636bbc 100644
--- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
+++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
@@ -775,44 +775,47 @@ public class TestThriftServer {
String col = "c";
// create a table which will throw exceptions for requests
final TableName tableName = TableName.valueOf(name.getMethodName());
- HTableDescriptor tableDesc = new HTableDescriptor(tableName);
- tableDesc.addCoprocessor(ErrorThrowingGetObserver.class.getName());
- tableDesc.addFamily(new HColumnDescriptor(family));
+ try {
+ HTableDescriptor tableDesc = new HTableDescriptor(tableName);
+ tableDesc.addCoprocessor(ErrorThrowingGetObserver.class.getName());
+ tableDesc.addFamily(new HColumnDescriptor(family));
- Table table = UTIL.createTable(tableDesc, null);
- long now = EnvironmentEdgeManager.currentTime();
- table.put(new Put(Bytes.toBytes(rowkey))
+ Table table = UTIL.createTable(tableDesc, null);
+ long now = EnvironmentEdgeManager.currentTime();
+ table.put(new Put(Bytes.toBytes(rowkey))
.addColumn(Bytes.toBytes(family), Bytes.toBytes(col), now, Bytes.toBytes("val1")));
- Configuration conf = UTIL.getConfiguration();
- ThriftMetrics metrics = getMetrics(conf);
- ThriftHBaseServiceHandler hbaseHandler =
- new ThriftHBaseServiceHandler(UTIL.getConfiguration(),
- UserProvider.instantiate(UTIL.getConfiguration()));
- Hbase.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, conf);
+ Configuration conf = UTIL.getConfiguration();
+ ThriftMetrics metrics = getMetrics(conf);
+ ThriftHBaseServiceHandler hbaseHandler =
+ new ThriftHBaseServiceHandler(UTIL.getConfiguration(), UserProvider.instantiate(UTIL.getConfiguration()));
+ Hbase.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, conf);
- ByteBuffer tTableName = asByteBuffer(tableName.getNameAsString());
+ ByteBuffer tTableName = asByteBuffer(tableName.getNameAsString());
- // check metrics increment with a successful get
- long preGetCounter = metricsHelper.checkCounterExists("getRow_num_ops", metrics.getSource()) ?
+ // check metrics increment with a successful get
+ long preGetCounter = metricsHelper.checkCounterExists("getRow_num_ops", metrics.getSource()) ?
metricsHelper.getCounter("getRow_num_ops", metrics.getSource()) :
0;
- List<TRowResult> tRowResult = handler.getRow(tTableName, asByteBuffer(rowkey), null);
- assertEquals(1, tRowResult.size());
- TRowResult tResult = tRowResult.get(0);
+ List<TRowResult> tRowResult = handler.getRow(tTableName, asByteBuffer(rowkey), null);
+ assertEquals(1, tRowResult.size());
+ TRowResult tResult = tRowResult.get(0);
- TCell expectedColumnValue = new TCell(asByteBuffer("val1"), now);
+ TCell expectedColumnValue = new TCell(asByteBuffer("val1"), now);
- assertArrayEquals(Bytes.toBytes(rowkey), tResult.getRow());
- Collection<TCell> returnedColumnValues = tResult.getColumns().values();
- assertEquals(1, returnedColumnValues.size());
- assertEquals(expectedColumnValue, returnedColumnValues.iterator().next());
+ assertArrayEquals(Bytes.toBytes(rowkey), tResult.getRow());
+ Collection<TCell> returnedColumnValues = tResult.getColumns().values();
+ assertEquals(1, returnedColumnValues.size());
+ assertEquals(expectedColumnValue, returnedColumnValues.iterator().next());
- metricsHelper.assertCounter("getRow_num_ops", preGetCounter + 1, metrics.getSource());
+ metricsHelper.assertCounter("getRow_num_ops", preGetCounter + 1, metrics.getSource());
- // check metrics increment when the get throws each exception type
- for (ErrorThrowingGetObserver.ErrorType type : ErrorThrowingGetObserver.ErrorType.values()) {
- testExceptionType(handler, metrics, tTableName, rowkey, type);
+ // check metrics increment when the get throws each exception type
+ for (ErrorThrowingGetObserver.ErrorType type : ErrorThrowingGetObserver.ErrorType.values()) {
+ testExceptionType(handler, metrics, tTableName, rowkey, type);
+ }
+ } finally {
+ UTIL.deleteTable(tableName);
}
}