[Commits] c74fdfb: Option to use per-index-cfs, misc fixes
revision-id: c74fdfb005d696209f0def67c15a562d3dbfe803 () parent(s): 8db4a6a5e2b2a3a53b2a4e01f87753a1d7e03c3d author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-12-14 12:59:31 +0300 message: Option to use per-index-cfs, misc fixes - Added an option to use 4 tables and per-index CFs. - Compile script fixes to use the current branch --- make-4-cfs.sql | 48 ++++++++++++++++++++++++++++++++++ run-all.sh | 2 +- run-test.sh | 73 ++++++++++++++++++++++++++++++++++++++-------------- setup-fbmysql-nov.sh | 9 +++++++ 4 files changed, 112 insertions(+), 20 deletions(-) diff --git a/make-4-cfs.sql b/make-4-cfs.sql new file mode 100644 index 0000000..6e22311 --- /dev/null +++ b/make-4-cfs.sql @@ -0,0 +1,48 @@ +use sbtest; +alter table sbtest1 rename sbtest1_orig; +alter table sbtest2 rename sbtest2_orig; +alter table sbtest3 rename sbtest3_orig; +alter table sbtest4 rename sbtest4_orig; + +CREATE TABLE sbtest1 ( + id int(11) NOT NULL AUTO_INCREMENT, + k int(11) NOT NULL DEFAULT '0', + c char(120) NOT NULL DEFAULT '', + pad char(60) NOT NULL DEFAULT '', + PRIMARY KEY (id) COMMENT 'cf1_pk', + KEY k_1 (k) COMMENT 'cf1_sk' +) ENGINE=ROCKSDB CHARSET=latin1; + +CREATE TABLE sbtest2 ( + id int(11) NOT NULL AUTO_INCREMENT, + k int(11) NOT NULL DEFAULT '0', + c char(120) NOT NULL DEFAULT '', + pad char(60) NOT NULL DEFAULT '', + PRIMARY KEY (id) COMMENT 'cf2_pk', + KEY k_1 (k) COMMENT 'cf2_sk' +) ENGINE=ROCKSDB CHARSET=latin1; + +CREATE TABLE sbtest3 ( + id int(11) NOT NULL AUTO_INCREMENT, + k int(11) NOT NULL DEFAULT '0', + c char(120) NOT NULL DEFAULT '', + pad char(60) NOT NULL DEFAULT '', + PRIMARY KEY (id) COMMENT 'cf3_pk', + KEY k_1 (k) COMMENT 'cf3_sk' +) ENGINE=ROCKSDB CHARSET=latin1; + +CREATE TABLE sbtest4 ( + id int(11) NOT NULL AUTO_INCREMENT, + k int(11) NOT NULL DEFAULT '0', + c char(120) NOT NULL DEFAULT '', + pad char(60) NOT NULL DEFAULT '', + PRIMARY KEY (id) COMMENT 'cf4_pk', + KEY k_1 (k) COMMENT 'cf4_sk' +) ENGINE=ROCKSDB CHARSET=latin1; + +set rocksdb_commit_in_the_middle=1; +insert into sbtest1 select * from sbtest1_orig; +insert into sbtest2 select * from sbtest2_orig; +insert into sbtest3 select * from sbtest3_orig; +insert into sbtest4 select * from sbtest4_orig; +set rocksdb_commit_in_the_middle=0; diff --git a/run-all.sh b/run-all.sh index 777b9e2..eb897b5 100755 --- a/run-all.sh +++ b/run-all.sh @@ -1,6 +1,6 @@ #!/bin/bash -./setup.sh +#./setup.sh echo "rocksdb_use_range_locking=1" >> my-fbmysql-range-locking.cnf diff --git a/run-test.sh b/run-test.sh index 78a0644..21411a0 100755 --- a/run-test.sh +++ b/run-test.sh @@ -3,12 +3,20 @@ ### ### Parse options ### -USAGE_STR="Usage: $0 [-p] server_name test_run_name" +USAGE_STR="Usage: $0 [-p] [-m] [-c] server_name test_run_name \ + -p - Use perf for profiling + -m - Put datadir on /dev/shm + -c - Assume sysbench uses 4 tables and move them to different CFs. +" -while getopts ":p" opt; do +while getopts ":pmc" opt; do case ${opt} in p ) USE_PERF=1 ;; + m ) USE_RAMDISK=1 + ;; + c ) USE_4_CFS=1 + ;; \? ) echo $USAGE_STR exit 1 ;; @@ -46,6 +54,10 @@ echo "Starting test "$RUN_NAME" with $SERVER_DIR" if [[ $USE_PERF ]] ; then echo " Collecting perf profile" fi + +if [[ $USE_RAMDISK ]] ; then + echo " Using /dev/shm for data dir" +fi #exit 0 ############################################################################# @@ -55,34 +67,49 @@ sleep 5 DATA_DIR=data-fbmysql-$SERVERNAME rm -rf $DATA_DIR -# cp -r ${DATA_DIR}.clean /dev/shm/$DATA_DIR +if [[ $USE_RAMDISK ]] ; then + rm -rf /dev/shm/$DATA_DIR + cp -r ${DATA_DIR}.clean /dev/shm/$DATA_DIR + ln -s /dev/shm/$DATA_DIR $DATA_DIR +else + cp -r ${DATA_DIR}.clean $DATA_DIR +fi + +#exit 0; ./$SERVER_DIR/sql/mysqld --defaults-file=./my-fbmysql-${SERVERNAME}.cnf & -attempts=0 -while true ; do - ./$SERVER_DIR/client/mysql --defaults-file=./my-fbmysql-${SERVERNAME}.cnf -uroot -e "create database sbtest" +server_attempts=0 - if [ $? -eq 0 ]; then +while true ; do + client_attempts=0 + while true ; do + ./$SERVER_DIR/client/mysql --defaults-file=./my-fbmysql-${SERVERNAME}.cnf -uroot -e "create database sbtest" + + if [ $? -eq 0 ]; then + break + fi + sleep 1 + + client_attempts=$((client_attempts + 1)) + if [ $client_attempts -ge 10 ]; then + break; + fi + done + + MYSQLD_PID=`ps -C mysqld --no-header | awk '{print $1}'` + if [[ "a${MYSQLD_PID}b" != "ab" ]] ; then break fi - sleep 1 - attempts=$((attempts + 1)) - if [ $attempts -ge 10 ]; then - echo "Failed!" + server_attempts=$((server_attempts + 1)) + if [ $server_attempts -ge 4 ]; then + echo "Failed to launch mysqld" exit 1 fi done -MYSQLD_PID=`ps -C mysqld --no-header | awk '{print $1}'` -if [[ "a${MYSQLD_PID}b" == "ab" ]] ; then - echo "Failed to locate mysqld process" - exit 1 -fi - - ############################################################################# ### Prepare the benchmark @@ -93,7 +120,7 @@ mkdir -p $RESULT_DIR SYSBENCH_ARGS=" --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root \ --mysql-storage-engine=rocksdb \ --time=60 \ - /usr/share/sysbench/oltp_write_only.lua --table-size=1000000" + /usr/share/sysbench/oltp_write_only.lua --table-size=250000 --tables=4" SYSBENCH_TEST="oltp_write_only.lua" cat > $RESULT_DIR/info.txt <<END @@ -104,8 +131,15 @@ SYSBENCH_ARGS=$SYSBENCH_ARGS END +sleep 3 sysbench $SYSBENCH_ARGS prepare | tee $RESULT_DIR/sysbench-prepare.txt +if [[ $USE_4_CFS ]] ; then + echo "Splitting 4 tables into different CFs" + ./$SERVER_DIR/client/mysql --defaults-file=./my-fbmysql-${SERVERNAME}.cnf \ + -uroot < make-4-cfs.sql +fi +sleep 3 ./$SERVER_DIR/client/mysql --defaults-file=./my-fbmysql-${SERVERNAME}.cnf \ -uroot -e "show variables like 'rocksdb%'" > $RESULT_DIR/variables-rocksdb.txt @@ -118,6 +152,7 @@ sysbench $SYSBENCH_ARGS prepare | tee $RESULT_DIR/sysbench-prepare.txt ./$SERVER_DIR/client/mysql --defaults-file=./my-fbmysql-${SERVERNAME}.cnf \ -uroot -e "create table test.rocksdb_vars as select * from information_schema.GLOBAL_STATUS where variable_name like 'ROCKSDB%'" +sleep 3 ############################################################################# ### Start the profiler if [[ $USE_PERF ]] ; then diff --git a/setup-fbmysql-nov.sh b/setup-fbmysql-nov.sh new file mode 100755 index 0000000..b2fcf77 --- /dev/null +++ b/setup-fbmysql-nov.sh @@ -0,0 +1,9 @@ +#!/bin/bash + + +./setup-server/setup-fbmysql-clone.sh range-locking range-locking-fb-mysql-5.6.35-seekforupdate +./setup-server/setup-fbmysql-clone.sh orig range-locking-fb-mysql-5.6.35-seekforupdate-nov-base + +cp -r data-fbmysql-orig data-fbmysql-orig.clean +cp -r data-fbmysql-range-locking data-fbmysql-range-locking.clean +
participants (1)
-
Sergei Petrunia