Skip to content

Commit

Permalink
Save to etcd on failover
Browse files Browse the repository at this point in the history
  • Loading branch information
lnguyen committed Jan 21, 2014
1 parent 03e41af commit 8d38180
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pgha/bin/run
Expand Up @@ -46,7 +46,7 @@ setMyRole

case ${my_role} in
(master)
saveIPs # TODO: Replace this with etcd.
saveToEtcd
if isResponsive ${master_ip}
then saveToEtcd
fi
Expand All @@ -55,19 +55,19 @@ case ${my_role} in
if ! isResponsive ${master_ip}
then promoteToMaster
fi
saveIPs # TODO: Replace this with etcd.
saveToEtcd
;;
(replica)
if isResponsive ${master_ip}
then
saveIPs
saveToEtcd
elif [[ -n ${sync_ip} ]] && isResponsive ${sync_ip}
then
master_ip=${sync_ip}
if replicateFromMaster
then
loadIPs
saveIPs # TODO: Replace this with etcd.
saveToEtcd
fi
else # master and sync replica are offline...
if (( ${#replica_ips} == 1 ))
Expand All @@ -82,7 +82,7 @@ case ${my_role} in
if replicateFromMaster
then
loadIPs
saveIPs # TODO: Replace this with etcd.
saveToEtcd
fi
fi
fi
Expand All @@ -94,15 +94,15 @@ case ${my_role} in
if replicateFromMaster
then
loadIPs
saveIPs # TODO: Replace this with etcd.
saveToEtcd
fi
elif [[ -n "${sync_ip}" ]] && isResponsive ${sync_ip}
then
master_ip=${sync_ip}
if replicateFromMaster
then
loadIPs
saveIPs # TODO: Replace this with etcd.
saveToEtcd
fi
fi
;;
Expand Down

0 comments on commit 8d38180

Please sign in to comment.