Ndb Cluster has row level locking. Transactions take row locks
before updating or deleting existing rows. Two transactions attempting
to update the same row will be serialised by the system. The second
transaction will see the effects of the first. The final effect will be
as if the transactions were run in some serial order.
I am not sure how / if Hibernate uses table locks directly, or just
expects that the DBMS 'somehow' avoids races between different users.
If it uses Table locks directly, and is using them for some purpose
other than serialising updates to the database, then this may not work
with Cluster. If it just expects that the DBMS present a consistent
view of the database, and serialises competing transactions, then this
can work fine with Cluster.
Perhaps if you can explain how/why Hibernate uses Table locks, then
we can determine whether or not it will work unmodified with Cluster.
The 'Single User Mode' which Wagner Bianchi mentions is probably not
what you want to use, except on very rare occasions (e.g. DBA
maintenance windows etc.).
Diego Martínez wrote:
> Thanks for your response. My question are what happens when several threads
> update the same tables. For example, if I have a web service application
> where multiple threads are updating the product table and no exist table
> locking, the result would be completely unexpected. Each thread would update
> the same table, but in a different node?. What would be the end result?.
> Best regards, Diego Martínez
> El 7 de febrero de 2011 12:52, Wagner Bianchi
>> Hi Martinez,
>> I understand the unique and efficient way to lock tables on MySQL Cluster
>> SQL NODES is using "SINGLE-USER MODE". LOCK TABLES [WRITE | READ] will work
>> as expected, but, using only one SQL NODE. You'll LOCK TABLE t1 TO WRITE on
>> SQL NODE 1, but your application will can access the same table through the
>> SQL NODE 2 and write to that table.
>> Let us know more about your project and perhaps we can help you.
>> Best regards.
>> Wagner Bianchi
>> 2011/2/7 Diego Martínez <tabarem@stripped>
>>> Members of the list have experience using MySQL Cluster through Hibernate?
>>> am worried, because I understand that MySQL Cluster does not support
>>> tables for example.
>>> Do you know design patterns to use this new engine?
>>> Best regards, Diego Martínez
Frazer Clement, Senior Software Engineer,
MySQL Cluster / Oracle - www.mysql.com
Office: Edinburgh, UK
Are you MySQL certified? www.mysql.com/certification