[
https://issues.apache.org/jira/browse/HBASE-9885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13815645#comment-13815645
]
Ted Yu commented on HBASE-9885:
-------------------------------
{code}
List<CellProtos.Cell> values = proto.getCellList();
- if (cells == null) cells = new ArrayList<Cell>(values.size());
- for (CellProtos.Cell c: values) {
- cells.add(toCell(c));
+ if (cells == null) {
+ if (values.isEmpty()) {
+ return EMPTY_RESULT;
+ } else {
+ cells = new ArrayList<Cell>(values.size());
+ for (CellProtos.Cell c : values) {
+ toCell(c));
+ }
+ }
{code}
Looks like the scope of cells == null condition is too wide: the for loop
should be outside 'if (cells == null)' check.
> Avoid some Result creation in protobuf conversions
> --------------------------------------------------
>
> Key: HBASE-9885
> URL: https://issues.apache.org/jira/browse/HBASE-9885
> Project: HBase
> Issue Type: Bug
> Components: Client, Protobufs, regionserver
> Affects Versions: 0.98.0, 0.96.0
> Reporter: Nicolas Liochon
> Assignee: Nicolas Liochon
> Fix For: 0.98.0, 0.96.1
>
> Attachments: 9885.v1.patch, 9885.v2, 9885.v2.patch, 9885.v3.patch,
> 9885.v3.patch
>
>
> We creates a lot of Result that we could avoid, as they contain nothing else
> than a boolean value. We create sometimes a protobuf builder as well on this
> path, this can be avoided.
--
This message was sent by Atlassian JIRA
(v6.1#6144)