HBASE-18633 Add more info to understand the source/scenario of large batch requests exceeding threshold
This commit is contained in:
parent
d63a287bfd
commit
4e7f677170
|
@ -1131,16 +1131,17 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
|
|
||||||
// Exposed for testing
|
// Exposed for testing
|
||||||
static interface LogDelegate {
|
static interface LogDelegate {
|
||||||
void logBatchWarning(int sum, int rowSizeWarnThreshold);
|
void logBatchWarning(String firstRegionName, int sum, int rowSizeWarnThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LogDelegate DEFAULT_LOG_DELEGATE = new LogDelegate() {
|
private static LogDelegate DEFAULT_LOG_DELEGATE = new LogDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void logBatchWarning(int sum, int rowSizeWarnThreshold) {
|
public void logBatchWarning(String firstRegionName, int sum, int rowSizeWarnThreshold) {
|
||||||
if (LOG.isWarnEnabled()) {
|
if (LOG.isWarnEnabled()) {
|
||||||
LOG.warn("Large batch operation detected (greater than " + rowSizeWarnThreshold
|
LOG.warn("Large batch operation detected (greater than " + rowSizeWarnThreshold
|
||||||
+ ") (HBASE-18023)." + " Requested Number of Rows: " + sum + " Client: "
|
+ ") (HBASE-18023)." + " Requested Number of Rows: " + sum + " Client: "
|
||||||
+ RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress());
|
+ RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress()
|
||||||
|
+ " first region in multi=" + firstRegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2513,11 +2514,15 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
|
|
||||||
private void checkBatchSizeAndLogLargeSize(MultiRequest request) {
|
private void checkBatchSizeAndLogLargeSize(MultiRequest request) {
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
String firstRegionName = null;
|
||||||
for (RegionAction regionAction : request.getRegionActionList()) {
|
for (RegionAction regionAction : request.getRegionActionList()) {
|
||||||
|
if (sum == 0) {
|
||||||
|
firstRegionName = Bytes.toStringBinary(regionAction.getRegion().getValue().toByteArray());
|
||||||
|
}
|
||||||
sum += regionAction.getActionCount();
|
sum += regionAction.getActionCount();
|
||||||
}
|
}
|
||||||
if (sum > rowSizeWarnThreshold) {
|
if (sum > rowSizeWarnThreshold) {
|
||||||
ld.logBatchWarning(sum, rowSizeWarnThreshold);
|
ld.logBatchWarning(firstRegionName, sum, rowSizeWarnThreshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,25 +117,25 @@ public class TestMultiLogThreshold {
|
||||||
@Test
|
@Test
|
||||||
public void testMultiLogThresholdRegionActions() throws ServiceException, IOException {
|
public void testMultiLogThresholdRegionActions() throws ServiceException, IOException {
|
||||||
sendMultiRequest(THRESHOLD + 1, ActionType.REGION_ACTIONS);
|
sendMultiRequest(THRESHOLD + 1, ActionType.REGION_ACTIONS);
|
||||||
verify(LD, Mockito.times(1)).logBatchWarning(Mockito.anyInt(), Mockito.anyInt());
|
verify(LD, Mockito.times(1)).logBatchWarning(Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiNoLogThresholdRegionActions() throws ServiceException, IOException {
|
public void testMultiNoLogThresholdRegionActions() throws ServiceException, IOException {
|
||||||
sendMultiRequest(THRESHOLD, ActionType.REGION_ACTIONS);
|
sendMultiRequest(THRESHOLD, ActionType.REGION_ACTIONS);
|
||||||
verify(LD, Mockito.never()).logBatchWarning(Mockito.anyInt(), Mockito.anyInt());
|
verify(LD, Mockito.never()).logBatchWarning(Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiLogThresholdActions() throws ServiceException, IOException {
|
public void testMultiLogThresholdActions() throws ServiceException, IOException {
|
||||||
sendMultiRequest(THRESHOLD + 1, ActionType.ACTIONS);
|
sendMultiRequest(THRESHOLD + 1, ActionType.ACTIONS);
|
||||||
verify(LD, Mockito.times(1)).logBatchWarning(Mockito.anyInt(), Mockito.anyInt());
|
verify(LD, Mockito.times(1)).logBatchWarning(Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiNoLogThresholdAction() throws ServiceException, IOException {
|
public void testMultiNoLogThresholdAction() throws ServiceException, IOException {
|
||||||
sendMultiRequest(THRESHOLD, ActionType.ACTIONS);
|
sendMultiRequest(THRESHOLD, ActionType.ACTIONS);
|
||||||
verify(LD, Mockito.never()).logBatchWarning(Mockito.anyInt(), Mockito.anyInt());
|
verify(LD, Mockito.never()).logBatchWarning(Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue