2017-03-22 20:35:00 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-06-10 07:16:46 +00:00
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-04-28 21:21:32 +00:00
|
|
|
|
2020-08-26 12:06:48 +00:00
|
|
|
sanitize_results() {
|
|
|
|
process_core
|
|
|
|
[[ -d $RESULTS_DIR ]] && chmod 644 "$RESULTS_DIR/"*
|
|
|
|
}
|
|
|
|
|
2020-02-19 15:37:50 +00:00
|
|
|
dump_db_bench_on_err() {
|
|
|
|
# Fetch std dump of the last run_step that might have failed
|
|
|
|
[[ -e $db_bench ]] || return 0
|
|
|
|
|
|
|
|
# Dump entire *.txt to stderr to clearly see what might have failed
|
|
|
|
xtrace_disable
|
2020-05-07 11:27:06 +00:00
|
|
|
mapfile -t step_map < "$db_bench"
|
2020-02-19 15:37:50 +00:00
|
|
|
printf '%s\n' "${step_map[@]/#/* $step (FAILED)}" >&2
|
|
|
|
xtrace_restore
|
|
|
|
}
|
|
|
|
|
2017-09-15 16:53:34 +00:00
|
|
|
run_step() {
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo run_step called with no parameter
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-11-18 11:32:48 +00:00
|
|
|
cat <<- EOL >> "$1"_flags.txt
|
2020-05-07 11:27:06 +00:00
|
|
|
--spdk=$ROCKSDB_CONF
|
|
|
|
--spdk_bdev=Nvme0n1
|
|
|
|
--spdk_cache_size=$CACHE_SIZE
|
2019-11-18 11:32:48 +00:00
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
2020-02-19 15:37:50 +00:00
|
|
|
db_bench=$1_db_bench.txt
|
2017-09-15 16:53:34 +00:00
|
|
|
echo -n Start $1 test phase...
|
2020-02-21 08:16:09 +00:00
|
|
|
time taskset 0xFF $DB_BENCH --flagfile="$1"_flags.txt &> "$db_bench"
|
2020-04-24 14:22:49 +00:00
|
|
|
DB_BENCH_FILE=$(grep -o '/dev/shm/\(\w\|\.\|\d\|/\)*' "$db_bench")
|
2019-04-26 09:51:11 +00:00
|
|
|
gzip $DB_BENCH_FILE
|
|
|
|
mv $DB_BENCH_FILE.gz "$1"_trace.gz
|
|
|
|
chmod 644 "$1"_trace.gz
|
2017-09-15 16:53:34 +00:00
|
|
|
echo done.
|
|
|
|
}
|
|
|
|
|
2018-06-08 15:13:35 +00:00
|
|
|
run_bsdump() {
|
2020-06-15 08:34:56 +00:00
|
|
|
# 0x80 is the bit mask for BlobFS tracepoints
|
|
|
|
$SPDK_EXAMPLE_DIR/blobcli -j $ROCKSDB_CONF -b Nvme0n1 --tpoint-group-mask 0x80 &> bsdump.txt
|
2018-06-08 15:13:35 +00:00
|
|
|
}
|
|
|
|
|
2019-04-24 21:29:45 +00:00
|
|
|
# In the autotest job, we copy the rocksdb source to just outside the spdk directory.
|
|
|
|
DB_BENCH_DIR="$rootdir/../rocksdb"
|
2017-03-22 20:35:00 +00:00
|
|
|
DB_BENCH=$DB_BENCH_DIR/db_bench
|
2020-06-15 08:34:56 +00:00
|
|
|
ROCKSDB_CONF=$testdir/rocksdb.json
|
2017-03-22 20:35:00 +00:00
|
|
|
|
|
|
|
if [ ! -e $DB_BENCH_DIR ]; then
|
2020-05-19 07:38:11 +00:00
|
|
|
echo $DB_BENCH_DIR does not exist
|
|
|
|
false
|
2017-03-22 20:35:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
timing_enter db_bench_build
|
|
|
|
|
|
|
|
pushd $DB_BENCH_DIR
|
2019-04-26 09:04:25 +00:00
|
|
|
if [ -z "$SKIP_GIT_CLEAN" ]; then
|
|
|
|
git clean -x -f -d
|
|
|
|
fi
|
2020-03-02 11:59:40 +00:00
|
|
|
|
|
|
|
EXTRA_CXXFLAGS=""
|
|
|
|
GCC_VERSION=$(cc -dumpversion | cut -d. -f1)
|
2020-05-07 11:27:06 +00:00
|
|
|
if ((GCC_VERSION >= 9)); then
|
|
|
|
EXTRA_CXXFLAGS+="-Wno-deprecated-copy -Wno-pessimizing-move -Wno-error=stringop-truncation"
|
2020-03-02 11:59:40 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-05 10:04:01 +00:00
|
|
|
$MAKE db_bench $MAKEFLAGS $MAKECONFIG DEBUG_LEVEL=0 SPDK_DIR=../spdk EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS"
|
2017-03-22 20:35:00 +00:00
|
|
|
popd
|
|
|
|
|
|
|
|
timing_exit db_bench_build
|
|
|
|
|
2020-10-21 10:59:09 +00:00
|
|
|
$rootdir/scripts/gen_nvme.sh --json-with-subsystems > $ROCKSDB_CONF
|
2017-03-22 20:35:00 +00:00
|
|
|
|
2020-08-26 12:06:48 +00:00
|
|
|
trap 'dump_db_bench_on_err; run_bsdump || :; rm -f $ROCKSDB_CONF; sanitize_results; exit 1' SIGINT SIGTERM EXIT
|
2017-05-25 18:54:00 +00:00
|
|
|
|
2019-04-26 09:04:25 +00:00
|
|
|
if [ -z "$SKIP_MKFS" ]; then
|
2020-06-15 08:34:56 +00:00
|
|
|
# 0x80 is the bit mask for BlobFS tracepoints
|
|
|
|
run_test "blobfs_mkfs" $rootdir/test/blobfs/mkfs/mkfs $ROCKSDB_CONF Nvme0n1 --tpoint-group-mask 0x80
|
2019-04-26 09:04:25 +00:00
|
|
|
fi
|
2017-09-15 17:37:14 +00:00
|
|
|
|
2019-04-26 08:59:48 +00:00
|
|
|
mkdir -p $output_dir/rocksdb
|
2017-09-15 16:53:34 +00:00
|
|
|
RESULTS_DIR=$output_dir/rocksdb
|
2018-10-15 14:09:08 +00:00
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
2018-12-07 23:07:47 +00:00
|
|
|
CACHE_SIZE=4096
|
2017-12-15 00:51:55 +00:00
|
|
|
DURATION=60
|
|
|
|
NUM_KEYS=100000000
|
|
|
|
else
|
2018-12-07 23:07:47 +00:00
|
|
|
CACHE_SIZE=2048
|
2017-12-15 00:51:55 +00:00
|
|
|
DURATION=20
|
|
|
|
NUM_KEYS=20000000
|
|
|
|
fi
|
2020-08-26 10:59:19 +00:00
|
|
|
# Make sure that there's enough memory available for the mempool. Unfortunately,
|
|
|
|
# db_bench doesn't seem to allocate memory from all numa nodes since all of it
|
|
|
|
# comes exclusively from node0. With that in mind, try to allocate CACHE_SIZE
|
|
|
|
# + some_overhead (1G) of pages but only on node0 to make sure that we end up
|
|
|
|
# with the right amount not allowing setup.sh to split it by using the global
|
|
|
|
# nr_hugepages setting. Instead of bypassing it completely, we use it to also
|
|
|
|
# get the right size of hugepages.
|
|
|
|
HUGEMEM=$((CACHE_SIZE + 1024)) HUGENODE=0 \
|
|
|
|
"$rootdir/scripts/setup.sh"
|
2017-09-15 16:53:34 +00:00
|
|
|
|
|
|
|
cd $RESULTS_DIR
|
|
|
|
cp $testdir/common_flags.txt insert_flags.txt
|
2019-11-18 11:32:48 +00:00
|
|
|
cat << EOL >> insert_flags.txt
|
|
|
|
--benchmarks=fillseq
|
|
|
|
--threads=1
|
|
|
|
--disable_wal=1
|
|
|
|
--use_existing_db=0
|
|
|
|
--num=$NUM_KEYS
|
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
|
|
|
cp $testdir/common_flags.txt randread_flags.txt
|
2019-11-18 11:32:48 +00:00
|
|
|
cat << EOL >> randread_flags.txt
|
|
|
|
--benchmarks=readrandom
|
|
|
|
--threads=16
|
|
|
|
--duration=$DURATION
|
|
|
|
--disable_wal=1
|
|
|
|
--use_existing_db=1
|
|
|
|
--num=$NUM_KEYS
|
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
|
|
|
cp $testdir/common_flags.txt overwrite_flags.txt
|
2019-11-18 11:32:48 +00:00
|
|
|
cat << EOL >> overwrite_flags.txt
|
|
|
|
--benchmarks=overwrite
|
|
|
|
--threads=1
|
|
|
|
--duration=$DURATION
|
|
|
|
--disable_wal=1
|
|
|
|
--use_existing_db=1
|
|
|
|
--num=$NUM_KEYS
|
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
|
|
|
cp $testdir/common_flags.txt readwrite_flags.txt
|
2019-11-18 11:32:48 +00:00
|
|
|
cat << EOL >> readwrite_flags.txt
|
|
|
|
--benchmarks=readwhilewriting
|
|
|
|
--threads=4
|
|
|
|
--duration=$DURATION
|
|
|
|
--disable_wal=1
|
|
|
|
--use_existing_db=1
|
|
|
|
--num=$NUM_KEYS
|
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
|
|
|
cp $testdir/common_flags.txt writesync_flags.txt
|
2019-11-18 11:32:48 +00:00
|
|
|
cat << EOL >> writesync_flags.txt
|
|
|
|
--benchmarks=overwrite
|
|
|
|
--threads=1
|
|
|
|
--duration=$DURATION
|
|
|
|
--disable_wal=0
|
|
|
|
--use_existing_db=1
|
|
|
|
--sync=1
|
|
|
|
--num=$NUM_KEYS
|
|
|
|
EOL
|
2017-09-15 16:53:34 +00:00
|
|
|
|
2019-12-19 23:03:30 +00:00
|
|
|
run_test "rocksdb_insert" run_step insert
|
|
|
|
run_test "rocksdb_overwrite" run_step overwrite
|
|
|
|
run_test "rocksdb_readwrite" run_step readwrite
|
|
|
|
run_test "rocksdb_writesync" run_step writesync
|
|
|
|
run_test "rocksdb_randread" run_step randread
|
2017-03-22 20:35:00 +00:00
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
2018-06-08 15:13:35 +00:00
|
|
|
run_bsdump
|
2017-03-22 20:35:00 +00:00
|
|
|
rm -f $ROCKSDB_CONF
|
2020-08-26 12:06:48 +00:00
|
|
|
sanitize_results
|