I think the lock is per database, not global.
Also, there is a difference between a transaction and a statement
running. You can have lots of statements per transaction. Transactions
get the table locks, and when a statement executes it gets the lock on
the Database. So the single threaded nature of H2 only becomes a problem
if you have a single long running statement. Then it will block
everything else from running. The solution is to make sure you don't run
a single long query if you don't want to block other threads from
executing (or use MULTI_THREADED=1).
Hope that helps. There are a few explanations in the forums and probably
in the documentation on the website.
On 22/01/2013 12:57 AM, Michael Rogers wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Ryan,
Does this mean there's some kind of global lock that ensures only one
thread can execute any H2 method at once? That would seem to make
table locking and row locking redundant, so I guess I've misunderstood
- - could you explain?
Thanks,
Michael
On 17/01/13 12:11, Ryan How wrote:
I'm not sure how it works in a cluster, but H2 can only handle a
single thread at a time, so will block in MVCC mode anyway if you
have a single long running operation. You could try with
MULTI_THREADED=1 to allow multithreading.
On 17/01/2013 6:58 PM, Matouš Voldřich wrote:
Thanks for answers. Well our problem is that H2 is used in highly
concurrent environment where multiple threads (spread accross a
cluster) are making queries to one H2 cluster (2 nodes). And
because of H2 locks entire table, the queries often wait and
block. If there is a long running operation (like backup of 5
milion records), it blocks H2 server for 30sec - 1 minute,
halting everything.
I know that chosing H2 for this use case was wrong and am trying
to convince to switch to some other server, but right now we are
investigating the options we have.
Matous
Dne pondělí, 14. ledna 2013 21:08:20 UTC+1 Thomas Mueller
napsal(a):
Hi,
The cluster mode is also an area that is not very well tested.
And using LOCK_MODE=0 is not recommended (even when not using a
cluster).
What problem do you want to solve? Why don't you just use the
default settings?
Regards, Thomas
On Sun, Jan 13, 2013 at 3:32 PM, Ryan How <[email protected]>
wrote:
I'm not sure sorry, someone else might be able to answer for you.
I could only suggest give it a go and see if it works. I don't
see why it wouldn't work, you are only changing transaction
isolation level.
Thanks, Ryan
On 13/01/2013 6:24 PM, Matouš Voldřich wrote:
Thanks for answer. We will give it a try and at write some
tests.
Could you answer my second question? Is it possible to set
LOCK_MODE=0 and still use cluster mode?
Thanks Matous
Dne sobota, 12. ledna 2013 15:34:27 UTC+1 Kartweel napsal(a):
MVCC has been around for a while, so it is pretty stable. But I
did find a bug the other day with "for update" and lobs, so it
still has bugs. It isn't as well tested as the rest of the
engine, and not as well supported :)
Ryan
On 11/01/2013 6:35 PM, Matouš Voldřich wrote:
Hi,
I would like to ask about H2 feature MVCC (multi version
concurrency). On some places this feature is marked as
experimental so I would like to ask about its status. Is it
ussable?
We would like to prevent locking of entire table. Are there
any other options? I found only to use LOCK_LEVEL=0 since we
do not need transactions at all (we use it as simple
INSERT-GET-UPDATE-DELETE store). But we also use cluster, so
I'm not sure if setting it will not disable the cluster
functionality as well.
Thanks. Matous -- You received this message because you are
subscribed to the Google Groups "H2 Database" group. To view
this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/IPVunNjiwuUJ
<https://groups.google.com/d/msg/h2-database/-/IPVunNjiwuUJ>.
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
<http://groups.google.com/group/h2-database?hl=en>.
-- You received this message because you are subscribed to the
Google Groups "H2 Database" group. To view this discussion on
the web visit
https://groups.google.com/d/msg/h2-database/-/vImI06FfFZMJ
<https://groups.google.com/d/msg/h2-database/-/vImI06FfFZMJ>.
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
<http://groups.google.com/group/h2-database?hl=en>.
-- 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
<http://groups.google.com/group/h2-database?hl=en>.
-- You received this message because you are subscribed to the
Google Groups "H2 Database" group. To view this discussion on the
web visit
https://groups.google.com/d/msg/h2-database/-/5TNsLRCIhHMJ. 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.
-- 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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQEcBAEBAgAGBQJQ/XOEAAoJEBEET9GfxSfMwr8H/jjSZ2SPym8yqzM/lBp9Wabx
nPsF8HPOkT4iOvMW7BJiAUqSHMlaOiTSrBOG+vEfjkkAHnFan5d6qN4AIO9tj6Ih
7anA3341JNeocplqpCVv0ZZdQCp37QP5rInUpS+46nxQMoRszaiFZpQzeQZ7pIIB
JiIunt0yZk1w1yRDCPAMrEfIadAQ4N/hTKIHzKRO8JwD+Om6aB6ZYjWpEKDPg381
IJWkFz9SgxHRIcKuinuNA58lo551ZfFjAuScY2o1EoRuv8XhvHoY14C9WkvrtxWx
Sy9lGduIjDY4oJVbqBK1Cm1NU0UlIm+Q4ulFVgF6nUrNoidsaXFcN3+w54X0X7Y=
=zqK2
-----END PGP SIGNATURE-----
--
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.