Does the use of wsrep_sync_wait reduces the probability of conflicts?
For example, if we have two concurrent inserts on the same table from different nodes, if wsrep_sync_wait is set to 4 or 6, does this avoid the insert conflict, in particular, a conflict that results from a gap lock on a primary key?
Not necessarily but can.
wsrep_sync_wait is designed to reflect the latest data. So imagine it like a hook that is added when you execute it. But the point is not directly controlled by end-user.
Said that, it is not recommended option to control conflict. It is surely recommended option to fetch refreshed data.
Thank you for your reply. So, is there an effective way of avoid conflicts resulting from a gap lock, besides issuing write statements to only one master?
You can split your workload. Each node can dealt with different table there-by reducing conflict.
If this is not feasible then I don’t foresee any other way out. It is like even on single server if all user threads are trying to access same table then they need to wait.