From this post, we can do leader election with MySQL, but I don't know if we can do fencing in MySQL. That is: let MySQL determine if the client is primary master or not. Consider following case: server A, B, C formed a quorum, and A is primary master, at certain moment, A is not primary anymore, but A doesn't know, and issued an insert statement, we need to prevent that.
So I'm wondering if we can change SQL statements into something like:
IF i'm primary master
do xxx
ENDIF