We reliably have a problem with 1.1.107 and do not have the problem
with 1.1.106.
Our database URL is "jdbc:h2:foo;MVCC=TRUE"
Caused by: org.h2.jdbc.JdbcSQLException: General error:
java.lang.ArrayIndexOutOfBoundsException: 0 [50000-107]
at org.h2.message.Message.getSQLException(Message.java:103)
at org.h2.message.Message.convert(Message.java:274)
at org.h2.table.TableData.addRow(TableData.java:135)
at org.h2.command.dml.Insert.update(Insert.java:96)
at org.h2.command.CommandContainer.update(CommandContainer.java:71)
at org.h2.command.Command.executeUpdate(Command.java:207)
at
org
.h2
.jdbc
.JdbcPreparedStatement
.executeUpdateInternal(JdbcPreparedStatement.java:137)
at
org
.h2
.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:
126)
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.h2.util.IntArray.add(IntArray.java:43)
at org.h2.index.BtreeNode.add(BtreeNode.java:102)
at org.h2.index.BtreeIndex.add(BtreeIndex.java:223)
at org.h2.index.MultiVersionIndex.add(MultiVersionIndex.java:49)
at org.h2.table.TableData.addRow(TableData.java:117)
... 58 more
I don't have a test program to reproduce it, but there seems to be a
problem with the MVCC index code. I don't think the IntArray is the
cause of my problem, but there's a bug here, too:
The IntArray(int[] data) constructor can be called with zero-length
data, which makes size=0. The checkCapacity() method is supposed to
resize the IntArray if necessary, but it doesn't in this case: data
is still zero-length after the call
private void checkCapacity() {
if (size >= data.length) { // 0 >= 0
int[] d = new int[data.length * 2]; // still zero
System.arraycopy(data, 0, d, 0, data.length);
data = d;
}
}
Easy fix - change the IntArray(int[] data) constructor to check for
zero-length data and create a default-10-sized array like the other
constructor.
However, I don't think this is the real problem - I bet the IntArray
constructor shouldn't have been called with a zero-length data array
in the first place. Once I change the IntArray(int[] data)
constructor to creating an int[10] if data.length is zero, my app gets
a little further but then hits a different problem:
Caused by: org.h2.jdbc.JdbcSQLException: General error:
java.lang.ArrayIndexOutOfBoundsException: i=0 size=0 [50000-107]
at org.h2.message.Message.getSQLException(Message.java:103)
at org.h2.message.Message.convert(Message.java:274)
at org.h2.command.Command.executeUpdate(Command.java:230)
at
org
.h2
.jdbc
.JdbcPreparedStatement
.executeUpdateInternal(JdbcPreparedStatement.java:137)
at
org
.h2
.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:
126)
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: i=0 size=0
at org.h2.util.IntArray.get(IntArray.java:58)
at org.h2.index.BtreeNode.findFirst(BtreeNode.java:235)
at org.h2.index.BtreeIndex.find(BtreeIndex.java:283)
at org.h2.index.BtreeIndex.find(BtreeIndex.java:269)
at org.h2.index.MultiVersionIndex.find(MultiVersionIndex.java:67)
at
org
.h2.constraint.ConstraintReferential.found(ConstraintReferential.java:
354)
at
org
.h2
.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:
395)
at
org
.h2
.constraint
.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:413)
at
org
.h2
.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:
293)
at org.h2.table.Table.fireConstraints(Table.java:761)
at org.h2.table.Table.fireAfterRow(Table.java:776)
at org.h2.command.dml.Delete.update(Delete.java:75)
at org.h2.command.CommandContainer.update(CommandContainer.java:71)
at org.h2.command.Command.executeUpdate(Command.java:207)
... 65 more
Hopefully this is enough to help you find the bug. In the mean time,
we're stuck at 1.1.106 and won't be able to upgrade.
Thanks,
Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---