mr=$1
setup=$2
char_index=$3
compress=$4
dop=$5

xa=""
if [[ $char_index == "yes" ]]; then
  xa="--with_char_column_in_index"
fi

for x in $( seq 1 $dop ); do

tn="purchases_index${x}"

if [[ $setup == "yes" ]]; then
  if [[ $compress == "yes" ]]; then
    echo setup with compression
    python iibench.py --table_name=${tn} --db_socket="" --db_password="pw" --db_host="127.0.0.1" --insert_only --max_rows=$mr --with_char_column $xa --engine_opt="key_block_size=8" --setup >& o.ib.$x &
    pids[$x]=$!
  else
    echo setup without compression
    python iibench.py --table_name=${tn} --db_socket="" --db_password="pw" --db_host="127.0.0.1" --insert_only --max_rows=$mr --with_char_column $xa --setup >& o.ib.$x &
    pids[$x]=$!
  fi
else
  python iibench.py --table_name=${tn} --db_socket="" --db_password="pw" --db_host="127.0.0.1" --insert_only --max_rows=$mr >& o.ib.$x &
  pids[$x]=$!
fi
done

for x in $( seq 1 $dop ); do
echo "Wait for $x with pid ${pids[$x]}"
wait ${pids[$x]}
done

