# Understanding split brain in a Galera cluster

Split brain is a condition when a cluster gets partitioned and each part is operating independently. This is an unwanted situation that one would always want to avoid. So, how is it handled in a MariaDB Galera cluster? In order to understand this, let’s first start by looking into the logs of a node from a split-brain(ed) cluster.

In the event of a network partition, some nodes of the cluster may no longer be reachable from the other nodes. They try to reconnect to these suspecting nodes and later move them to partitioned list by marking them as inactive when no response is received. A voting for quorum is then taken on each node to see if they belong to the majority partition (Primary Component) using the following formula :

$\frac{\sum&space;\left&space;(&space;p_{i}&space;\times&space;w_{i}&space;\right&space;)&space;-&space;\sum&space;\left&space;(&space;l_{j}&space;\times&space;w_{j}&space;\right&space;)}{2}&space;<&space;\sum&space;\left&space;(&space;m_{k}&space;\times&space;w_{k}&space;\right&space;)$

where,

In a Galera cluster, nodes outside the primary component are not allowed to process queries. It is mainly done preserve data consistency.