Deadlock error when using HAProxy with Maria Galera Cluster

ldvhai
ldvhai used Ask the Experts™
on
Hi Experts,

I use HaProxy as load-balancing for Galera Cluster (2-3 node). And I get a error "Deadlock found when trying to get lock; try restarting transaction" when insert/update through HaProxy to Galera Nodes.

How I fix this errors.

Thanks so much!!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
It is not possible that galera cluster finds deadlocks on its own. Please post clashing SQL update statements/transactions, as they will clash on any setup.

Author

Commented:
Sorry for late, It's OK with galera cluster . But if I use HAProxy, I get Deadlock error like this post:

Avoiding Deadlocks in Galera - Set up HAProxy for single-node writes and multi-node reads

So, if I config HA like above, what's my app config need to connect to DB ?
Top Expert 2015
Commented:
You need to wrap 4 dependent updates in a transaction even for single concurrently accessed database.
galera+haproxy just adds some time jitter and aggravates problem originally in your SQL code that you refuse to share.

Author

Commented:
EE,

Sorry for my late, in my country are the Tết holidays, so I'm busy with some works and can't reply soon.

I test galera cluster with mysql-proxy in command-line, it's seem OK. I think Galera Cluster fixed transaction itself.

Thanks for your help!!
Top Expert 2015

Commented:
You need to fix SQL, otherwise it will keep returning.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial