|
18 | 18 | package org.apache.hadoop.hbase.quotas; |
19 | 19 |
|
20 | 20 | import java.io.IOException; |
| 21 | +import java.net.SocketTimeoutException; |
21 | 22 | import java.util.ArrayList; |
22 | 23 | import java.util.List; |
23 | 24 | import java.util.UUID; |
24 | 25 | import java.util.concurrent.TimeUnit; |
25 | 26 | import org.apache.hadoop.hbase.HBaseClassTestRule; |
26 | | -import org.apache.hadoop.hbase.HBaseTestingUtil; |
| 27 | +import org.apache.hadoop.hbase.HBaseTestingUtility; |
27 | 28 | import org.apache.hadoop.hbase.HConstants; |
28 | 29 | import org.apache.hadoop.hbase.TableName; |
29 | 30 | import org.apache.hadoop.hbase.client.Admin; |
@@ -51,7 +52,7 @@ public class TestAtomicReadQuota { |
51 | 52 | public static final HBaseClassTestRule CLASS_RULE = |
52 | 53 | HBaseClassTestRule.forClass(TestAtomicReadQuota.class); |
53 | 54 | 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(); |
55 | 56 | private static final TableName TABLE_NAME = TableName.valueOf(UUID.randomUUID().toString()); |
56 | 57 | private static final byte[] FAMILY = Bytes.toBytes("cf"); |
57 | 58 | private static final byte[] QUALIFIER = Bytes.toBytes("q"); |
@@ -181,7 +182,7 @@ public void testAtomicBatchCountedAgainstReadCapacity() throws Exception { |
181 | 182 | incs.add(inc); |
182 | 183 |
|
183 | 184 | testThrottle(table -> { |
184 | | - Object[] results = new Object[] {}; |
| 185 | + Object[] results = new Object[incs.size()]; |
185 | 186 | table.batch(incs, results); |
186 | 187 | return results; |
187 | 188 | }); |
@@ -210,7 +211,10 @@ private void testThrottle(ThrowingFunction<Table, ?> request) throws Exception { |
210 | 211 | request.run(table); |
211 | 212 | return false; |
212 | 213 | } 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; |
214 | 218 | if (!success) { |
215 | 219 | LOG.error("Unexpected exception", e); |
216 | 220 | } |
|
0 commit comments