title: Automatic failover with PostgreSQL 9.1
body: <p>PostgreSql 9.1 has master-slave synchronous replication. Suppose the master is machine A and the slave is machine B.</p>
  
  <p>If the master fails, how does PostgreSQL know when to make the slave the master? What if the slave incorrectly thought the master was down because of a temporary network glitch on the master where the client program could still contact the master though.</p>
  
  <p>And moreover, how would my client program know the slave in the new master and more importantly is ready to accept writes. Does the slave send a message to the client?</p>