gpt4 book ai didi

php - cake_session 1213 : Deadlock found when trying to get lock; try restarting transaction

转载 作者:行者123 更新时间:2023-11-30 23:13:42 25 4
gpt4 key购买 nike

我使用 Percona(3 个主-主同步节点,使用 galera 负载均衡器)迁移到 SQL 集群环境,并将所有数据库转换为 InnoDB。我们现在在 CakePHP 1.3 应用程序中不断得到它

2013-09-11 09:16:52 Sql_errors: Session error: (1213: Deadlock found when trying to get lock; try restarting transaction) - File:/cake/libs/cake_session.php - Line:759

2013-09-11 09:16:52 Sql_errors: Session error: (1213: Deadlock found when trying to get lock; try restarting transaction) - File:/cake/libs/cake_session.php - Line:759

2013-09-11 10:54:49 Sql_errors: Session error: (1213: Deadlock found when trying to get lock; try restarting transaction) - File:/cake/libs/cake_session.php - Line:759

2013-09-11 11:36:36 Sql_errors: Session error: (1213: Deadlock found when trying to get lock; try restarting transaction) -

因为它是 CakePHP 核心的一部分,所以我有点厌倦了进行任何修改。我想知道是否有人在使用 CakePHP 时遇到过这个问题,有什么建议可以避免它?

最佳答案

有关这里发生的事情的详尽解释,请参阅 Percona XtraDB Cluster: Multi-node writing and Unexpected deadlocks .

TL;DR 版本:

Dealing with this problem, quite simply, is the tradeoff to multi-node writing in a synchronous replication system with optimistic locking.

What can you do to work with/around this problem? Here are some ideas from simplest to most complex:

  • Only write to a single node in the cluster (at a time)

  • Update your application DB library to handle sudden deadlocks

  • Restructure your application/schema to avoid data hot-spots

关于php - cake_session 1213 : Deadlock found when trying to get lock; try restarting transaction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18819413/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com