HBASE-21592 quota.addGetResult(r) throw NPE
Signed-off-by: huzheng <openinx@gmail.com>
This commit is contained in:
parent
1971d02e72
commit
f78284685f
|
@ -2571,7 +2571,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
builder.setResult(pbr);
|
builder.setResult(pbr);
|
||||||
}
|
}
|
||||||
if (r != null) {
|
//r.cells is null when an table.exists(get) call
|
||||||
|
if (r != null && r.rawCells() != null) {
|
||||||
quota.addGetResult(r);
|
quota.addGetResult(r);
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
|
@ -553,6 +553,23 @@ public class TestQuotaThrottle {
|
||||||
triggerTableCacheRefresh(true, TABLE_NAMES[0]);
|
triggerTableCacheRefresh(true, TABLE_NAMES[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTableExistsGetThrottle() throws Exception {
|
||||||
|
final Admin admin = TEST_UTIL.getAdmin();
|
||||||
|
|
||||||
|
// Add throttle quota
|
||||||
|
admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0],
|
||||||
|
ThrottleType.REQUEST_NUMBER, 100, TimeUnit.MINUTES));
|
||||||
|
triggerTableCacheRefresh(false, TABLE_NAMES[0]);
|
||||||
|
|
||||||
|
Table table = TEST_UTIL.getConnection().getTable(TABLE_NAMES[0]);
|
||||||
|
// An exists call when having throttle quota
|
||||||
|
table.exists(new Get(Bytes.toBytes("abc")));
|
||||||
|
|
||||||
|
admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
|
||||||
|
triggerTableCacheRefresh(true, TABLE_NAMES[0]);
|
||||||
|
}
|
||||||
|
|
||||||
private int doPuts(int maxOps, final Table... tables) throws Exception {
|
private int doPuts(int maxOps, final Table... tables) throws Exception {
|
||||||
return doPuts(maxOps, -1, tables);
|
return doPuts(maxOps, -1, tables);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue