The best solution for 4-server multi-master? Don't do it.
Seriously, if one master crashes and is unrecoverable, it will be a nightmare to fix.
Also, multi-master does not provide much, in any, benefit. You cannot get more write throughput -- every write has to be performed on every server. MySQL (non-Cluster) is effectively limited in writes to the capacity of a single server.
Better way to deploy 4 machines:
M1 <-> M2
| |
v v
S1 S2
Dual-master, but write to only one of the Masters. This gives you
* A hot backup master for prompt recovery.
* No hassles with duplicate keys (that could happen if you write to all masters).
* Slaves for readonly scaling. (More slaves can be added as you grow.)
Note, however, if M1 dies, you lose S1, too. This is because there is no easy way to figure out how to point S1's replication to M2. To recover, take S2 out of service and clone it to create a new M1 and S1.