fix state queries against secondaries

This commit is contained in:
Christopher Winslett
2015-05-04 13:39:30 -07:00
parent 5facf8638e
commit 1879b9c76a
+2 -2
View File
@@ -7,10 +7,10 @@ do {
if [ "${response}" == " f" ]
then
echo "HTTP/1.1 200 OK"
echo "X-XLOG-POSITION: $(echo "SELECT pg_current_xlog_location();" | psql -t postgres 2> /dev/null | tr -d ' ' | head -n 1)"
echo "X-XLOG-POSITION: $(echo "SELECT pg_current_xlog_location();" | psql -t postgres --port $2 --host $1 2> /dev/null | tr -d ' ' | head -n 1)"
else
echo "HTTP/1.1 503 Service unavailable"
echo "X-XLOG-POSITION: $(echo "SELECT pg_last_xlog_replay_location();" | psql -t postgres 2> /dev/null | tr -d ' ' | head -n 1)"
echo "X-XLOG-POSITION: $(echo "SELECT pg_last_xlog_replay_location();" | psql -t postgres --port $2 --host $1 2> /dev/null | tr -d ' ' | head -n 1)"
fi
} | nc -l $3; done