#!/bin/bash
#
# Restore the backup created by 'redobench-setup.sh', and time how
# long it takes to replay all the WAL.

set -e

rm -rf pgdata

cp -a pgdata-backup pgdata

echo "" > pgdata/recovery.signal
cat <<EOF >> pgdata/postgresql.conf
restore_command = 'cp /home/heikki/pgsql.fsmfork/pgdata-archive/%f "%p"'
recovery_target_name = 'the-end'
recovery_target_action = 'shutdown'
EOF

time postgres -D pgdata
#perf record --call-graph=lbr postgres -D pgdata
