From fec4957e99fbdedd5b57713734e00114668f2286 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Tue, 9 Nov 2021 16:35:08 +0800 Subject: [PATCH] bench rerun --- bench/http.go | 2 +- bench/run-dtm.sh | 1 + bench/run-mysql.sh | 4 +++- bench/setup.sh | 3 ++- dtmsvr/trans.go | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bench/http.go b/bench/http.go index 8fba47a..6f1f1be 100644 --- a/bench/http.go +++ b/bench/http.go @@ -87,7 +87,7 @@ func StartSvr() { } func qsAdjustBalance(uid int, amount int, c *gin.Context) (interface{}, error) { - if strings.Contains(mode, "empty") { + if strings.Contains(mode, "empty") || sqls == 0 { return dtmcli.MapSuccess, nil } tb := dtmimp.TransBaseFromQuery(c.Request.URL.Query()) diff --git a/bench/run-dtm.sh b/bench/run-dtm.sh index 695cc0d..5bc8e39 100755 --- a/bench/run-dtm.sh +++ b/bench/run-dtm.sh @@ -4,6 +4,7 @@ set -x export TIME=10 export CONCURRENT=20 +curl "http://127.0.0.1:8083/api/busi_bench/reloadData?m=dtm_tx&sqls=0" && ab -t $TIME -c $CONCURRENT "http://127.0.0.1:8083/api/busi_bench/bench" curl "http://127.0.0.1:8083/api/busi_bench/reloadData?m=dtm_tx&sqls=5" && ab -t $TIME -c $CONCURRENT "http://127.0.0.1:8083/api/busi_bench/bench" curl "http://127.0.0.1:8083/api/busi_bench/reloadData?m=dtm_barrier&sqls=5" && ab -t $TIME -c $CONCURRENT "http://127.0.0.1:8083/api/busi_bench/bench" curl "http://127.0.0.1:8083/api/busi_bench/reloadData?m=raw_tx&sqls=5" && ab -t $TIME -c $CONCURRENT "http://127.0.0.1:8083/api/busi_bench/bench" diff --git a/bench/run-mysql.sh b/bench/run-mysql.sh index f943ae5..8db27b4 100755 --- a/bench/run-mysql.sh +++ b/bench/run-mysql.sh @@ -1,6 +1,8 @@ # !/bin/bash cd /usr/share/sysbench/ +echo 'create database sbtest;' > mysql -h 127.0.0.1 -uroot + sysbench oltp_write_only.lua --time=60 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password= --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=10 --events=999999999 --report-interval=10 prepare -sysbench oltp_write_only.lua --time=60 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password= --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=10 --events=999999999 --report-interval=10 run \ No newline at end of file +sysbench oltp_write_only.lua --time=60 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password= --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=10 --events=999999999 --report-interval=10 run diff --git a/bench/setup.sh b/bench/setup.sh index 47e2310..fe47bd0 100755 --- a/bench/setup.sh +++ b/bench/setup.sh @@ -1,6 +1,7 @@ # !/bin/bash # install all commands needed +apt update apt install -y git sysbench apache2-utils mysql-client-core-8.0 # install docker and docker-compose @@ -11,4 +12,4 @@ chmod +x /usr/local/bin/docker-compose # install go wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz -rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz +rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz && cp -f /usr/local/bin/go /usr/local/go/bin/go diff --git a/dtmsvr/trans.go b/dtmsvr/trans.go index 8dab820..70ca608 100644 --- a/dtmsvr/trans.go +++ b/dtmsvr/trans.go @@ -274,7 +274,7 @@ func (t *TransGlobal) execBranch(db *common.DB, branch *TransBranch) error { t.touch(db, cronReset) } else if err == dtmimp.ErrOngoing { t.touch(db, cronKeep) - } else { + } else if err != nil { t.touch(db, cronBackoff) } return err