List:General Discussion« Previous MessageNext Message »
From:Alec.Cawley Date:February 10 2006 4:52pm
Subject:Re: InnoDB and locking
View as plain text  
Patrick Duda <pduda@stripped> wrote on 10/02/2006 16:28:56:

> I guess I don't understand this locking stuff.  I have a InnoDB table 
> has one thing in it, a counter.  All I want to do is have multiple 
> instances of the code read this counter and increment it.  I want to 
> sure that each one is unique.
> Here is what I am doing in java:
> c.setAutoCommit(false);
> ...
> rs = statement.executeQuery("select request_id from requestid_innodb for 

> update");
> ...
> String updateQuery = "update requestid_innodb set request_id=";
>   updateQuery = updateQuery + nextRequestId;
> tempStatement = c.createStatement();
> tempStatement.executeUpdate(updateQuery);
> ...
> c.commit();
> c.setAutoCommit(true);
> If I have multiple instances of this code running I end up with 
> keys.  I thought this was suppose to lock the table so that would not 
> What am I not doing right?  What am I not understanding about locking?

I think this problem is explained in detail at


InnoDB and lockingPatrick Duda10 Feb
  • Re: InnoDB and lockingAlec.Cawley10 Feb
    • Re: InnoDB and lockingPatrick Duda10 Feb
  • Re: InnoDB and lockingMark Matthews10 Feb
    • Re: InnoDB and lockingPatrick Duda10 Feb
  • Re: InnoDB and lockingPeter Brawley11 Feb
Re: InnoDB and lockingHeikki Tuuri11 Feb