Using MVCC, should writers cause readers to block? I have a test that
does a select-for-update and then an update on one connection and then
tries a normal select on a second. Is that expected behavior for H2's
MVCC?
For reference the test is
http://fisheye.jboss.org/browse/Hibernate/core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java?r=17944#l54
So basically on the first connection we:
1) start a transaction
2) issue a select for update for a specific row
3) do an update to that specific row
(the transaction is still active)
Then on a second connection we:
1) start a transaction
2) perform a normal select of the same row
The normal select on second connection leads to:
16:02:52,608 WARN JDBCExceptionReporter:100 - SQL Error: 50200,
SQLState: HYT00
16:02:52,610 ERROR JDBCExceptionReporter:101 - Timeout trying to lock
table "EJB3_ITEM" [50200-134]
...
Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table
"EJB3_ITEM" [50200-134]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
316)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.table.RegularTable.doLock(RegularTable.java:464)
at org.h2.table.RegularTable.lock(RegularTable.java:402)
at org.h2.table.TableFilter.lock(TableFilter.java:117)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:542)
at org.h2.command.dml.Query.query(Query.java:233)
at org.h2.command.CommandContainer.query(CommandContainer.java:80)
at org.h2.command.Command.executeQuery(Command.java:132)
at
org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:
96)
...
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to
h2-da...@googlegroups.com.
To unsubscribe from this group, send email to
h2-database...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.