(final ChannelBuffer buf, final int cell_size)
| 255 | } |
| 256 | |
| 257 | @Override |
| 258 | Object deserialize(final ChannelBuffer buf, final int cell_size) { |
| 259 | |
| 260 | final ClientPB.MultiResponse multiResp = readProtobuf(buf, |
| 261 | ClientPB.MultiResponse.PARSER); |
| 262 | final int nregions = multiResp.getRegionActionResultCount(); |
| 263 | final int nrpcs = batch.size(); |
| 264 | int n = 0; // Index in `batch'. |
| 265 | int r = 0; // Index in `regionActionResult' in the PB. |
| 266 | ArrayList<KeyValue> kvs = null; |
| 267 | int kv_index = 0; |
| 268 | |
| 269 | final ActionResp[] resps = new ActionResp[batch.size()]; |
| 270 | |
| 271 | for (int i = 0; i < nregions; i++) { |
| 272 | final ClientPB.RegionActionResult results = multiResp.getRegionActionResult(i); |
| 273 | final int nresults = results.getResultOrExceptionCount(); |
| 274 | for (int j = 0; j < nresults; j++) { |
| 275 | Object resp; |
| 276 | |
| 277 | final ClientPB.ResultOrException roe = results.getResultOrException(j); |
| 278 | final int index = roe.getIndex(); //index in the original batchGet |
| 279 | ActionEntry actionEntry = batch.get(index); |
| 280 | if (roe.hasException()) { |
| 281 | final HBasePB.NameBytesPair pair = roe.getException(); |
| 282 | // This RPC failed, get what the exception was. |
| 283 | resp = RegionClient.decodeExceptionPair(batch.get(index).rpc, pair); |
| 284 | } else { |
| 285 | // In HBase 1.x, batchGet does not send result as protobuf due to performance concern |
| 286 | // It is kind of hacky that it still send data back as Cell after the protobuf section |
| 287 | // We will use the associatedCellCount() to find out the number of kvs for each Get, so |
| 288 | // that we can breakdown all kvs into correct GetRequest |
| 289 | int kvCount = roe.getResult().getAssociatedCellCount(); |
| 290 | resp = convertResult(roe.getResult(), buf, kvCount); |
| 291 | } |
| 292 | resps[n++] = new ActionResp(resp, actionEntry.order); |
| 293 | } |
| 294 | } |
| 295 | return resps; |
| 296 | } |
| 297 | |
| 298 | static ArrayList<KeyValue> convertResult(final ClientPB.Result res, |
| 299 | final ChannelBuffer buf, |
nothing calls this directly
no test coverage detected