#!/bin/bash

mkdir -p "$BENCH_DIR/bench_output/Replication_master_performance"
mkdir -p "$BENCH_DIR/bench_output/Replication_slave_performance"
. `dirname "$0"`/DESCRIPTION_RUN > "$BENCH_DIR/bench_output/Replication_master_performance/DESCRIPTION_RUN"
. `dirname "$0"`/DESCRIPTION_RUN > "$BENCH_DIR/bench_output/Replication_slave_performance/DESCRIPTION_RUN"

if [ $DATABASE == "rethinkdb" ]; then
    . `dirname "$0"`/DESCRIPTION > "$BENCH_DIR/bench_output/Replication_master_performance/DESCRIPTION"
    . `dirname "$0"`/DESCRIPTION > "$BENCH_DIR/bench_output/Replication_slave_performance/DESCRIPTION"
fi

rm -rf /tmp/replication_setup_out

# Delete temporary key file.
ssh $MASTER_CLIENT -- rm -f "$MASTER_TMP_KEY_FILE"
ssh $SLAVE_CLIENT -- rm -f "$SLAVE_TMP_KEY_FILE"

# Delete temporary rethinkdb binaries
ssh $MASTER_SERVER rm -f /tmp/rethinkdb
ssh $SLAVE_SERVER rm -f /tmp/rethinkdb
