I have a multi-nodes Galera setup which is master-master. An API call to a web server A could write data to either database 1, 2, 3 or 4 (we are not using HaProxy). Another API call right after that could hit web server A again. However, the second API call couldn't find the record created in the previous request.
- Request 1: Hits either WS A or B. It could connect to either DB 1,2,3, or 4. Writes a record into a table with PDO transaction
- Request 2: Hits either WS A or B. It could connect to either DB 1,2,3, or 4. Tried to get the record created in Request 1 but it's not available.
It's worth noticing that:
- Both requests were made asynchronously.
- The record eventually showed up in all nodes (manually checked, so, not sure if it wasn't there when the second request was made)
What am I dealing with here, guys?
SET GLOBAL wsrep_sync_wait=1;You should also specify it in your my.cnf file so that the change persists even after a restart. In my.cnf add the following line:wsrep_sync_wait=1– Chad Cahill Aug 01 '17 at 21:43