3. Extending Autopilot

3. Extending Autopilot

Autopilot can be started automatically by adding the keyword “auto” followed by the name of a script to run, this script must end in the extension .tcl.

./hammerdb.tcl auto
Usage: hammerdb.tcl [ auto [ script_to_autoload.tcl  ] ]

For example

./hammerdb.tcl auto newtpccscript.tcl

On doing so HammerDB will now load the script newtpccscript.tcl at startup and immediately enter the autopilot sequence defined in config.xml. Upon completion HammerDB will exit. As detailed in the post linked above this functionality enables the potential to run workloads such as the following with multiple sequences of autopilot interspersed with a database refresh.

#!/bin/bash

set -e
SEQ1="4 6 8 10"
SEQ2="12 14 16 18"
SEQ3="20 22 24 26"
CONFIGFILE='/usr/local/hammerDB/config.xml'
RUNS=6

for x in $(eval echo "{1..$RUNS}")
do
        # Running a number of passes for this autopilot sequence
        echo "running run $x of $RUNS"

        for s in "$SEQ1" "$SEQ2" "$SEQ3"
        do
                echo "Running tests for series: $s"
                sed -i "s/<autopilot_sequence>.*<\/autopilot_sequence>/<autopilot_sequence>${s}<\/autopilot_sequence>/" $CONFIGFILE

                (cd /usr/local/hammerDB/ && ./hammerdb.tcl auto TPCC.postgres.tcl)

                echo "Reloading data"
                ssh postgres@postgres  '/var/lib/pgsql/reloadData.sh'
        done
done