On 22 April 2016 at 20:30, 'Francesco Lo Franco' via doctrine-user < [email protected]> wrote:
> ok, but I'm assuming that what I'm trying IS using a different > transaction. > > I'm locking the row with a query that comes from DOCTRINE (that should be > an SELECT FOR UPDATE) and, while this transaction is pending (I stopped the > php execution with an xdebug breakpoint just after the lock, before the > commit of the transaction), I'm trying to do another simple SELECT from the > mysql cli for the same row. > > But the latter simple query is succeeding, while I was expected a failure > for timeout. > I must say that it has been ages since I used an explicit lock like that, so please mind my words. This might depend on the transaction isolation level set for MySQL. MySQL allows reading uncommitted records by default ( http://dev.mysql.com/doc/refman/5.7/en/set-transaction.html ), so you can actually read records before they changed, regardless of what is happening to them. You might use a "READ COMMITTED" there. Another thing that I didn't really try is checking whether transactions are actually required for this scenario to work. Starting a transaction, doing some work and then committing should be the same as autocommit, but this again depends on the RDBMS. I would suggest replicating the desired behavior only via SQL first, and then checking whether there is a bug in Doctrine, in MySQL or in the assumptions (documentation issue). Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
