Skip to content

Commit bc1db42

Browse files
committed
Add additional logging when decoding fails with an uncaught exception.
This can help diagnose bugs faster.
1 parent 67fc3b7 commit bc1db42

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/RegionClient.java

+21-15
Original file line numberDiff line numberDiff line change
@@ -1291,24 +1291,30 @@ protected Object decode(final ChannelHandlerContext ctx,
12911291
}
12921292

12931293
final Object decoded;
1294-
if (server_version >= SERVER_VERSION_095_OR_ABOVE) {
1295-
if (header.hasException()) {
1296-
decoded = decodeException(rpc, header.getException());
1297-
} else {
1298-
final int cell_size;
1299-
{
1300-
final RPCPB.CellBlockMeta cellblock = header.getCellBlockMeta();
1301-
if (cellblock == null) {
1302-
cell_size = 0;
1303-
} else {
1304-
cell_size = cellblock.getLength();
1305-
HBaseRpc.checkArrayLength(buf, cell_size);
1294+
try {
1295+
if (server_version >= SERVER_VERSION_095_OR_ABOVE) {
1296+
if (header.hasException()) {
1297+
decoded = decodeException(rpc, header.getException());
1298+
} else {
1299+
final int cell_size;
1300+
{
1301+
final RPCPB.CellBlockMeta cellblock = header.getCellBlockMeta();
1302+
if (cellblock == null) {
1303+
cell_size = 0;
1304+
} else {
1305+
cell_size = cellblock.getLength();
1306+
HBaseRpc.checkArrayLength(buf, cell_size);
1307+
}
13061308
}
1309+
decoded = rpc.deserialize(buf, cell_size);
13071310
}
1308-
decoded = rpc.deserialize(buf, cell_size);
1311+
} else { // HBase 0.94 and before.
1312+
decoded = deserialize(buf, rpc);
13091313
}
1310-
} else { // HBase 0.94 and before.
1311-
decoded = deserialize(buf, rpc);
1314+
} catch (RuntimeException e) {
1315+
LOG.error("Uncaught error during de-serialization of " + rpc
1316+
+ ", rpcid=" + rpcid);
1317+
throw e;
13121318
}
13131319

13141320
if (LOG.isDebugEnabled()) {

0 commit comments

Comments
 (0)