[英]MySQL Master <-> Slave, PDO , Zend Framework and Transactions
We have some wired problems with the following structure: 以下结构存在一些有线问题:
Example: 例:
Query 1 查询1
$adapter->beginTransaction():
$where = $adapter->quoteInto('ID = ?', $id);
$adapter->update()...
$adapter->commit();
Query 2 查询2
$adapter->beginTransaction():
$where = $adapter->quoteInto('ID = ?', $id);
$adapter->update()...
$adapter->commit();
When started on an non cluster mysql server everything works fine. 在非群集mysql服务器上启动时,一切正常。 When started on an replicated enviorment we get the following exception: 在复制环境上启动时,我们会收到以下异常:
There is no active transaction 没有活跃交易
Now i have added: 现在我添加了:
$adapter->closeConnection();
after the first query, voila it works on the cluster. 在第一个查询之后,瞧,它可以在集群上工作。 Removed it : and it is still working... 删除它:它仍在工作...
Cant explain this, maybe an unclosed transaction? 不能解释一下,也许是未完成的交易? or normal behavoir? 还是正常的行为?
Do you have a plugin that ensures that the connections are closed on every http request? 您是否有一个插件可以确保每个http请求均关闭连接? I used to have weird behaviors with zend and dbs because the connections were remaining open. 我以前对zend和dbs都有奇怪的行为,因为连接一直保持打开状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.