Skip to content

Commit fa83436

Browse files
author
Ray Mattingly
committed
backport
1 parent d97d9b9 commit fa83436

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestAtomicReadQuota.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
package org.apache.hadoop.hbase.quotas;
1919

2020
import java.io.IOException;
21+
import java.net.SocketTimeoutException;
2122
import java.util.ArrayList;
2223
import java.util.List;
2324
import java.util.UUID;
2425
import java.util.concurrent.TimeUnit;
2526
import org.apache.hadoop.hbase.HBaseClassTestRule;
26-
import org.apache.hadoop.hbase.HBaseTestingUtil;
27+
import org.apache.hadoop.hbase.HBaseTestingUtility;
2728
import org.apache.hadoop.hbase.HConstants;
2829
import org.apache.hadoop.hbase.TableName;
2930
import org.apache.hadoop.hbase.client.Admin;
@@ -51,7 +52,7 @@ public class TestAtomicReadQuota {
5152
public static final HBaseClassTestRule CLASS_RULE =
5253
HBaseClassTestRule.forClass(TestAtomicReadQuota.class);
5354
private static final Logger LOG = LoggerFactory.getLogger(TestAtomicReadQuota.class);
54-
private static final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
55+
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
5556
private static final TableName TABLE_NAME = TableName.valueOf(UUID.randomUUID().toString());
5657
private static final byte[] FAMILY = Bytes.toBytes("cf");
5758
private static final byte[] QUALIFIER = Bytes.toBytes("q");
@@ -181,7 +182,7 @@ public void testAtomicBatchCountedAgainstReadCapacity() throws Exception {
181182
incs.add(inc);
182183

183184
testThrottle(table -> {
184-
Object[] results = new Object[] {};
185+
Object[] results = new Object[incs.size()];
185186
table.batch(incs, results);
186187
return results;
187188
});
@@ -210,7 +211,10 @@ private void testThrottle(ThrowingFunction<Table, ?> request) throws Exception {
210211
request.run(table);
211212
return false;
212213
} catch (Exception e) {
213-
boolean success = e.getCause() instanceof RpcThrottlingException;
214+
// a SocketTimeoutException is possible because multis do not yet appropriately handle
215+
// RpcThrottlingExceptions
216+
boolean success =
217+
e.getCause() instanceof RpcThrottlingException || e instanceof SocketTimeoutException;
214218
if (!success) {
215219
LOG.error("Unexpected exception", e);
216220
}

0 commit comments

Comments
 (0)