Loading...

h2-database@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Index corruption bug Thomas Mueller Tue Apr 03 13:00:36 2012

Hi,

Thanks a lot for the great test case! I can reproduce the problem, it
will be fixed in the next release.

Regards,
Thomas


On Sat, Mar 31, 2012 at 12:30 AM, Andrew <[EMAIL PROTECTED]> wrote:
> We have recently encountered an issue where updateRow() fails due to an
> apparently corrupt H2 index.  This particular index is on a varchar column
> that can contain relatively large (1000-2000 characters is not uncommon)
> values.  We have reproduced this on both 1.3.163 and 1.3.165.  The issue
> appears to depend entirely upon the nature of the data stored in the indexed
> table -- in one deployment with 3000+ rows we have not experienced any
> corruption, while in another deployment with approximately 1300 rows a
> corrupted index occurred.
>
> Depending upon the data inserted into the table, and the order in which rows
> are updated, we have seen two different exceptions:
>
> 1.
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Row not found when
> trying to delete from index "PUBLIC.IDX: ( /* key:226 */ 226,
> '{""operation"":""ADD"",""keys"":[""21216384"", ... ""21299408""]}',
> FALSE)"; SQL statement:
> UPDATE "PUBLIC"."T" SET "ID"=? ,"S"=? ,"B"=?  WHERE "ID"=? [90112-163]
>     at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>     at org.h2.message.DbException.get(DbException.java:169)
>     at org.h2.message.DbException.get(DbException.java:146)
>     at org.h2.index.PageBtreeLeaf.remove(PageBtreeLeaf.java:224)
>     at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:324)
>     ...
>     at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:324)
>     at org.h2.index.PageBtreeIndex.remove(PageBtreeIndex.java:241)
>     at org.h2.table.RegularTable.removeRow(RegularTable.java:361)
>     at org.h2.table.Table.updateRows(Table.java:430)
>     at org.h2.command.dml.Update.update(Update.java:128)
>     at org.h2.command.CommandContainer.update(CommandContainer.java:73)
>     at org.h2.command.Command.executeUpdate(Command.java:226)
>     at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
>     at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
>     at org.h2.result.UpdatableRow.updateRow(UpdatableRow.java:285)
>     at org.h2.jdbc.JdbcResultSet.updateRow(JdbcResultSet.java:2763)
>     at Reproducer.main(Reproducer.java:55)
>
> 2.
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: General error:
> "java.lang.ArrayIndexOutOfBoundsException: 2"; SQL statement:
> UPDATE "PUBLIC"."T" SET "ID"=? ,"S"=? ,"B"=?  WHERE "ID"=? [50000-163]
>     at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>     at org.h2.message.DbException.get(DbException.java:158)
>     at org.h2.message.DbException.convert(DbException.java:281)
>     at org.h2.table.RegularTable.removeRow(RegularTable.java:379)
>     at org.h2.table.Table.updateRows(Table.java:430)
>     at org.h2.command.dml.Update.update(Update.java:128)
>     at org.h2.command.CommandContainer.update(CommandContainer.java:73)
>     at org.h2.command.Command.executeUpdate(Command.java:226)
>     at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
>     at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
>     at org.h2.result.UpdatableRow.updateRow(UpdatableRow.java:285)
>     at org.h2.jdbc.JdbcResultSet.updateRow(JdbcResultSet.java:2763)
>     at Reproducer.main(Reproducer.java:54)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
>     at org.h2.index.PageBtree.getRow(PageBtree.java:172)
>     at org.h2.index.PageBtreeLeaf.remove(PageBtreeLeaf.java:222)
>     at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:324)
>     ...
>     at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:324)
>     at org.h2.index.PageBtreeIndex.remove(PageBtreeIndex.java:241)
>     at org.h2.table.RegularTable.removeRow(RegularTable.java:361)
>     ... 9 more
>
> I've attached a zip file containing the Java code for a standalone, minimal
> reproducer application along with two data files, one for each type of
> exception seen.  I suspect some sort of unfortunate hash collision could be
> happening.  Please let me know if any additional information is needed to
> track this issue down.
>
> thanks,
> Andrew Olson
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/GIpAUvXRdPkJ.
> To post to this group, send email to [EMAIL PROTECTED]
> To unsubscribe from this group, send email to
> [EMAIL PROTECTED]
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.