Database Administrators Asked on December 4, 2021
I am facing a issue with 3 node galera cluster where the read doesn’t return any records even when the write has been commited. Below are the steps which can happen from multiple servers.
1>Server A writes a record at 12:00:00 AM
2>Server B reads the same record after 10 seconds at 12:00:10 AM but doesn’t get any record.
The bin log on all 3 server confirms the commit at 12:00:00 AM.
What could be the issue here ?
Rick James and danblack both give the right answer.
The easy way:
SET SESSION wsrep_sync_wait = 1;
SELECT ...
SET SESSION wsrep_sync_wait = 0;
This is the method from the official: Achieving Read-After-Write Semantics With Galera.
But, **It is highly recommend that not to read after write. **In this situation, you should check your business logic if it is really have to do this way.
Answered by Ivory Ebony on December 4, 2021
This handles the "critical read" problem you describe:
SET SESSION wsrep_sync_wait = 1;
SELECT ...
SET SESSION wsrep_sync_wait = 0;
More discussion.
Answered by Rick James on December 4, 2021
If you are reading from a node other than then node where the transaction was commit, there is a finite response time on the other nodes from the time it is certified, to the time it is applied on the other node.
In theory you should be able to wait to ensure its committed.
Answered by danblack on December 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP