lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Rollback of a large transaction could fail #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run the attached class as java application.

When I run it with "h2 1.0.74", I got the following exception.

org.h2.jdbc.JdbcSQLException: 一般エラー: java.lang.RuntimeException:
Unexpected code path

General error: java.lang.RuntimeException: Unexpected code path [50000-75]

    at org.h2.message.Message.getSQLException(Message.java:103)

    at org.h2.message.Message.convert(Message.java:257)

    at org.h2.command.Command.executeUpdate(Command.java:210)

    at org.h2.jdbc.JdbcConnection.rollbackInternal(JdbcConnection.java:1295)

    at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:426)

    at RollbackTest.process(RollbackTest.java:71)

    at RollbackTest.main(RollbackTest.java:29)

Caused by: java.lang.RuntimeException: Unexpected code path

    at org.h2.message.Message.getInternalError(Message.java:179)

    at org.h2.message.Message.getInternalError(Message.java:280)

    at org.h2.index.MultiVersionCursor.getPos(MultiVersionCursor.java:88)

    at org.h2.log.UndoLogRecord.undo(UndoLogRecord.java:93)

    at org.h2.engine.Session.rollbackTo(Session.java:400)

    at org.h2.engine.Session.rollback(Session.java:378)

    at org.h2.command.dml.TransactionCommand.update(TransactionCommand.java:122)

    at org.h2.command.CommandContainer.update(CommandContainer.java:69)

    at org.h2.command.Command.executeUpdate(Command.java:205)

    ... 4 more

With "h2 1.1.116". I got the following exception.

org.h2.jdbc.JdbcSQLException: テーブル TEST 
に並行して更新が行われました:
別のトランザクションが、同じ行に更新か削除を行いまし��
�

Concurrent update in table TEST: another transaction has updated or deleted
the same row; SQL statement:

ROLLBACK [90131-116]

    at org.h2.message.Message.getSQLException(Message.java:105)

    at org.h2.message.Message.getSQLException(Message.java:116)

    at org.h2.message.Message.getSQLException(Message.java:75)

    at org.h2.table.TableData.removeRow(TableData.java:306)

    at org.h2.log.UndoLogRecord.undo(UndoLogRecord.java:103)

    at org.h2.engine.Session.rollbackTo(Session.java:523)

    at org.h2.engine.Session.rollback(Session.java:500)

    at org.h2.command.dml.TransactionCommand.update(TransactionCommand.java:121)

    at org.h2.command.CommandContainer.update(CommandContainer.java:72)

    at org.h2.command.Command.executeUpdate(Command.java:208)

    at org.h2.jdbc.JdbcConnection.rollbackInternal(JdbcConnection.java:1366)

    at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:422)

    at RollbackTest.process(RollbackTest.java:71)

    at RollbackTest.main(RollbackTest.java:29)

What version of the product are you using? On what operating system, file
system, and virtual machine?

WindowsXP SP3
Sun Java 1.6.0_04

In your view, is this a defect or a feature request?

It is a defect.

Original issue reported on code.google.com by mstky...@gmail.com on 23 Jul 2009 at 6:47

Attachments:

GoogleCodeExporter commented 9 years ago
I tried it without MVCC (H2 v1.1.116). I got the following exception.

org.h2.jdbc.JdbcSQLException: インデックス PUBLIC.PRIMARY_KEY_2 
から削除を試みました
が、行が見つかりません
Row not found when trying to delete from index PUBLIC.PRIMARY_KEY_2; SQL 
statement:
ROLLBACK [90112-116]
    at org.h2.message.Message.getSQLException(Message.java:105)
    at org.h2.message.Message.getSQLException(Message.java:116)
    at org.h2.message.Message.getSQLException(Message.java:75)
    at org.h2.index.BtreeLeaf.remove(BtreeLeaf.java:125)
    at org.h2.index.BtreeNode.remove(BtreeNode.java:140)
    at org.h2.index.BtreeNode.remove(BtreeNode.java:140)
    at org.h2.index.BtreeNode.remove(BtreeNode.java:140)
    at org.h2.index.BtreeIndex.remove(BtreeIndex.java:261)
    at org.h2.table.TableData.removeRow(TableData.java:321)
    at org.h2.log.UndoLogRecord.undo(UndoLogRecord.java:103)
    at org.h2.engine.Session.rollbackTo(Session.java:523)
    at org.h2.engine.Session.rollback(Session.java:500)
    at org.h2.command.dml.TransactionCommand.update(TransactionCommand.java:121)
    at org.h2.command.CommandContainer.update(CommandContainer.java:72)
    at org.h2.command.Command.executeUpdate(Command.java:208)
    at org.h2.jdbc.JdbcConnection.rollbackInternal(JdbcConnection.java:1366)
    at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:422)
    at RollbackTest.process(RollbackTest.java:71)
    at RollbackTest.main(RollbackTest.java:29)

Original comment by mstky...@gmail.com on 26 Jul 2009 at 6:06

GoogleCodeExporter commented 9 years ago

Original comment by thomas.t...@gmail.com on 30 Jul 2009 at 2:43

GoogleCodeExporter commented 9 years ago
This seems to be a bug. I will try to fix it.

Original comment by thomas.t...@gmail.com on 30 Jul 2009 at 2:44

GoogleCodeExporter commented 9 years ago
I found the problem, it will be fixed in the next release.
I have committed the correction and test case in the trunk.

Original comment by thomas.t...@gmail.com on 2 Aug 2009 at 4:22

GoogleCodeExporter commented 9 years ago
Issue 103 has been merged into this issue.

Original comment by thomas.t...@gmail.com on 2 Aug 2009 at 4:27

GoogleCodeExporter commented 9 years ago
Thank you for the correction.
But I think that issue 103 is not fixed yet.
I add the comment to issue 103.

Original comment by mstky...@gmail.com on 3 Aug 2009 at 4:25

GoogleCodeExporter commented 9 years ago
Fixed in version 1.1.116. Please add a comment if the problem persists,
I will then re-open the bug.

Original comment by thomas.t...@gmail.com on 10 Aug 2009 at 3:37

GoogleCodeExporter commented 9 years ago
I modify the value of INSERT_DATA_COUNT to 10000 in RollbackTest.java.
And I run it without MVCC in H2 v1.1.117, I got the following exception.

org.h2.jdbc.JdbcSQLException: インデックス PUBLIC.PRIMARY_KEY_2 
から削除を試みました
が、行が見つかりません
Row not found when trying to delete from index PUBLIC.PRIMARY_KEY_2; SQL 
statement:
ROLLBACK [90112-117]
    at org.h2.message.Message.getSQLException(Message.java:105)
    at org.h2.message.Message.getSQLException(Message.java:116)
    at org.h2.message.Message.getSQLException(Message.java:75)
    at org.h2.index.BtreeLeaf.remove(BtreeLeaf.java:125)
    at org.h2.index.BtreeNode.remove(BtreeNode.java:140)
    at org.h2.index.BtreeNode.remove(BtreeNode.java:140)
    at org.h2.index.BtreeIndex.remove(BtreeIndex.java:261)
    at org.h2.table.TableData.removeRow(TableData.java:322)
    at org.h2.log.UndoLogRecord.undo(UndoLogRecord.java:105)
    at org.h2.engine.Session.rollbackTo(Session.java:529)
    at org.h2.engine.Session.rollback(Session.java:506)
    at org.h2.command.dml.TransactionCommand.update(TransactionCommand.java:121)
    at org.h2.command.CommandContainer.update(CommandContainer.java:72)
    at org.h2.command.Command.executeUpdate(Command.java:208)
    at org.h2.jdbc.JdbcConnection.rollbackInternal(JdbcConnection.java:1366)
    at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:422)
    at RollbackTest.process(RollbackTest.java:71)
    at RollbackTest.main(RollbackTest.java:29)

When I run it with MVCC, it is successful.

I try to set MAX_MEMORY_UNDO to 1000.
And I run test without MVCC, I don't get the exception.

Original comment by mstky...@gmail.com on 10 Aug 2009 at 7:00

GoogleCodeExporter commented 9 years ago
Thanks! I will re-test it.

Original comment by thomas.t...@gmail.com on 10 Aug 2009 at 7:40

GoogleCodeExporter commented 9 years ago
I found the problem, it will be fixed in the next release.

Original comment by thomas.t...@gmail.com on 15 Aug 2009 at 7:07

GoogleCodeExporter commented 9 years ago
This should be fixed in version 1.1.118 (2009-09-04).

Original comment by thomas.t...@gmail.com on 4 Sep 2009 at 9:03