List:Cluster« Previous MessageNext Message »
From:Frazer Clement Date:February 8 2011 11:01am
Subject:Re: Hibernate - locking tables
View as plain text  
Hi Diego,
   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
> <wagnerbianchijr@stripped>escribió:
>> Hi Martinez,
>> I understand the unique and efficient way to lock tables on MySQL Cluster
>> 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>
>> Hi,
>>> Members of the list have experience using MySQL Cluster through Hibernate?
>>> I
>>> am worried, because I understand that MySQL Cluster does not support
>>> locking
>>> 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 -
Office: Edinburgh, UK

Are you MySQL certified?
Hibernate - locking tablesDiego Martínez7 Feb
  • Re: Hibernate - locking tablesWagner Bianchi7 Feb
    • Re: Hibernate - locking tablesDiego Martínez8 Feb
      • Re: Hibernate - locking tablesFrazer Clement8 Feb
        • Re: Hibernate - locking tablesDiego Martínez8 Feb
          • RE: Hibernate - locking tablesAndrew Armstrong8 Feb
            • Re: Hibernate - locking tablesDiego Martínez11 Feb