> Hibernate & my app
> org.h2.jdbc.JdbcSQLException: Concurrent update in table
> X_ACK_MESSAGE: another transaction has updated or deleted the same row
> [90131-74]
> So the message suggests that another transaction has updated or
> deleted the same row I am trying to update here. But, unfortunatley, I
> am unable to trace ( via <myh2>.trace.db file ) any such transaction,
> although I have the tracelog on level 3 therefore I see all SQLs
> printed out.
What database URL and setting do you use?
> Do you have any suggestion as how to find the other transaction that
> it is interfering with this one above ?
There is no easy solution I am afraid. You need to check what other
SQL statements were executed that changed (but not committed)
X_ACK_MESSAGE right before the one that fails.
Regards,
Thomas
Maybe the problem is solved in a newer version of H2 - could you try
1.0.77 (2008-08-16)? Two problems related with MVCC have been solved
(CREATE TABLE AS SELECT did not work correctly in the multi-version
concurrency mode., Multi version concurrency (MVCC): when a row was
updated or deleted, but this change was rolled back, the row was not
visible by other sessions if no index was used to access it.) see also
http://www.h2database.com/html/changelog.html
If this doesn't help, could you send me or post the .trace.db file?
Regards,
Thomas
You are right, if two threads concurrently update the same table when
using multi-version concurrency, things could break. However by
default this can not happend because only one thread can concurrently
update: MULTI_THREADED is disabled by default.
I wrote a test case that enables MULTI_THREADED and MVCC, and I can
reproduce the problem. In the next release I will make sure the
features can not be used at the same time:
"Multi-Version Concurrency (MVCC) may no longer be used when using
the multi-threaded kernel feature (MULTI_THREADED). An exception is
thrown when trying to connect with both settings. Additional
synchronization is required before those features can be used
together."
Regards,
Thomas
> jdbc:h2:/tmp/prod/
> h2cache;TRACE_LEVEL_FILE=3;CACHE_SIZE=1048576;LOCK_MODE=3;MVCC=TRUE;MULTI_THREADED=0
This means MULTI_THREADED is disabled in your case.
> But I am opening and using several Sessions, concurrently, from
> different threads .
This shouldn't be a problem.
> I believe, for MVCC=TRUE, you are synchronizing in sessions, not
> database
No, in this case access is synchronized on 'database'. See also
Command.java, methods executeQueryLocal and executeUpdate. You can
also find the places where isMultiVersion and getMultiThreaded is
used.
Regards,
Thomas