Hi,

This is a typical deadlock. The problem is that one connection is
locking the table t1 first, and then trying to lock the table t2. At
the same time, another connection is locking table t2 first, and then
trying to lock table t2. The solution is to lock the tables in he same
order (for example: first lock t1, and then lock t2).

> I've never seen such a problem before in
> other database systems?!

Most likely because the other database system you have used didn't use
table level locks. In that case, deadlocks occur less often (but it's
still possible to get deadlocks if you want to access the same rows).

> checked for possible deadlocks
> which is a complex thing.

It this test case it's relatively easy, but in more complex cases it's
not that easy. Generally it's a good idea to avoid "lock upgrade"
(lock a resource for reading and then writing within the same
transaction). Also, resources should be always locked in the same
order. See also http://en.wikipedia.org/wiki/Deadlock#Prevention

Regards,
Thomas

-- 
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.

Reply via email to