[sr-dev] continuous rls related db_mysql errors

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 26 16:42:51 CEST 2013


On 9/26/13 4:02 PM, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> I pushed a commit trying to fix it -- can you test it? I don't have an
>> environment for it, as these functions are used only in some cases from
>> presence modules. I coded it looking at mysql docs.
> i build new debian package and don't anymore get the errors.
ok.

>
>> Provided that, it seems transactions and locking tables are not working
>> together in mysql:
>> -http://dev.mysql.com/doc/refman/5.6/en/lock-tables-and-transactions.html
>>
>> BEGIN is an alias to START TRANSACTION according to:
>>
>> -http://dev.mysql.com/doc/refman/5.6/en/commit.html
>>
>> Apparently, set autocommit=0 should be used instead of START
>> TRANSACTION, but then is not clear if we have to set autocommit back to
>> one after COMMIT or ROLLBACK.
> my understanding is that there is no need to set autocommit=0 if START
> TRANSACTION is used to start transaction, because START TRANSACTION
> implicitly does that and autocommit=0 stays in effect until COMMIT or
> ROLLBACK is executed.
The problem is ending the transaction with locak tables.

Quoting from mysql site - 
http://dev.mysql.com/doc/refman/5.6/en/lock-tables-and-transactions.html:

"LOCK TABLES is not transaction-safe and implicitly commits any active 
transaction before attempting to lock the tables. "
That seems to say, if you start transaction then do lock tables, the 
transaction is committed.

In the code I saw that transaction start function can lock tables based 
on a parameter, but after start transaction -- which on the light of 
above statements mean closing the just opened transaction. Then I assume 
several queries are done from the module, which are supposed to be part 
of a transaction, but it might not exist anymore if I understand 
correctly the documentation.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Nov 25-28; Miami, Nov 18-20, 2013
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-dev mailing list