You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Doğacan Güney (JIRA)" <ji...@apache.org> on 2008/09/20 20:21:44 UTC
[jira] Created: (HBASE-892) Cell iteration is broken
Cell iteration is broken
------------------------
Key: HBASE-892
URL: https://issues.apache.org/jira/browse/HBASE-892
Project: Hadoop HBase
Issue Type: Bug
Components: io
Affects Versions: 0.19.0
Reporter: Doğacan Güney
Priority: Minor
Attachments: cell.patch
Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HBASE-892) Cell iteration is broken
Posted by "Doğacan Güney (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633489#action_12633489 ]
Doğacan Güney commented on HBASE-892:
-------------------------------------
Hi Jim,
Thanks for the comments.
About applying patch: I develop on git, so you have to apply my patches with -p1. I guess I should migrate to svn to make things easier :)
This code throws on exception without this patch for me:
{code}
byte[][] vals = Bytes.toByteArrays(new String[] { "cell", "iteration", "testing"});
long now = System.currentTimeMillis();
long[] ts = {now, now + 10, now + 20};
Cell cell = new Cell(vals, ts);
Iterator<Cell> it = cell.iterator();
while (it.hasNext()) {
Cell c = it.next();
System.out.println(Bytes.toString(c.getValue()));
}
{code}
Assume currentValue == values.length - 1. We first call hasNext and since currentValue is less than values.length it returns true. Now, during next(), we increase currentValue by one thus making it values.length. So attempting to access values[values.length] causes an exception.
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Priority: Minor
> Attachments: cell.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HBASE-892) Cell iteration is broken
Posted by "Doğacan Güney (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doğacan Güney updated HBASE-892:
--------------------------------
Attachment: cell_svn.patch
svn-ified version of the same patch.
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Priority: Minor
> Attachments: cell.patch, cell_svn.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HBASE-892) Cell iteration is broken
Posted by "Doğacan Güney (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doğacan Güney updated HBASE-892:
--------------------------------
Attachment: cell.patch
Changes CellIterator to properly check for bounds.
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Priority: Minor
> Attachments: cell.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HBASE-892) Cell iteration is broken
Posted by "Jim Kellerman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633450#action_12633450 ]
Jim Kellerman commented on HBASE-892:
-------------------------------------
Several comments on this patch.
- patch does not apply.
- both the current code and the patch do essentially the same thing. Both work provide you follow the Iterator idiom.
{code}
Iterator<Cell> it = cell.iterator();
while (it.hasNext()) {
Cell c = it.next();
...
}
{code}
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Priority: Minor
> Attachments: cell.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HBASE-892) Cell iteration is broken
Posted by "Jim Kellerman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jim Kellerman resolved HBASE-892.
---------------------------------
Resolution: Fixed
Fix Version/s: 0.19.0
Committed to trunk. Thanks for the patch Doğacan.
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Priority: Minor
> Fix For: 0.19.0
>
> Attachments: cell.patch, cell_svn.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (HBASE-892) Cell iteration is broken
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stack reassigned HBASE-892:
---------------------------
Assignee: Doğacan Güney
> Cell iteration is broken
> ------------------------
>
> Key: HBASE-892
> URL: https://issues.apache.org/jira/browse/HBASE-892
> Project: Hadoop HBase
> Issue Type: Bug
> Components: io
> Affects Versions: 0.19.0
> Reporter: Doğacan Güney
> Assignee: Doğacan Güney
> Priority: Minor
> Fix For: 0.19.0
>
> Attachments: cell.patch, cell_svn.patch
>
>
> Cell implements Iterable<Cell> but its iteration is broken since it will always go one past the edge and throw an ArrayIndexOutOfBoundsException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.