From 754d350b309ae7a04fd09cff06cbf0b9ab060787 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Tue, 29 Mar 2022 02:03:48 +0800 Subject: [PATCH 1/5] fix helper/bench --- helper/bench/Makefile | 1 + helper/bench/prepare.sh | 4 ++-- helper/bench/svr/http.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helper/bench/Makefile b/helper/bench/Makefile index e819a4b..72c8094 100644 --- a/helper/bench/Makefile +++ b/helper/bench/Makefile @@ -1,6 +1,7 @@ # All targets. default: bench +# configure these paths according to you system bench: /usr/local/bin/go /etc/redis/redis.conf /usr/local/bin/docker-compose main.go rm -f ../conf.sample.yml go build -o bench diff --git a/helper/bench/prepare.sh b/helper/bench/prepare.sh index 2ec3ad1..bde6b63 100755 --- a/helper/bench/prepare.sh +++ b/helper/bench/prepare.sh @@ -6,5 +6,5 @@ git clone https://github.com/dtm-labs/dtm.git && cd dtm && git checkout alpha && echo 'all prepared. you shoud run following commands to test in different terminal' echo -echo 'cd dtm && go run bench/main.go redis|boltdb|db' -echo 'cd dtm && bench/run-redis|boltdb|mysql.sh' +echo 'cd dtf && go run helper/bench/main.go redis|boltdb|db' +echo 'cd dtf/helper && bench/run-redis|boltdb|mysql.sh' diff --git a/helper/bench/svr/http.go b/helper/bench/svr/http.go index 76844d6..ef5c057 100644 --- a/helper/bench/svr/http.go +++ b/helper/bench/svr/http.go @@ -96,7 +96,7 @@ func PrepareBenchDB() { func StartSvr() { app := dtmutil.GetGinApp() benchAddRoute(app) - logger.Debugf("bench listening at %d", benchPort) + logger.Infof("bench listening at %s", benchPort) go func() { _ = app.Run(fmt.Sprintf(":%s", benchPort)) }() From f7debdd4d19a78c76bcb27274454b5ec47aaca9d Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Tue, 29 Mar 2022 02:13:44 +0800 Subject: [PATCH 2/5] fix mysql error --- test/busi/startup.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/busi/startup.go b/test/busi/startup.go index 3181787..08de468 100644 --- a/test/busi/startup.go +++ b/test/busi/startup.go @@ -22,6 +22,8 @@ func PopulateDB(skipDrop bool) { dtmutil.RunSQLScript(BusiConf, file, skipDrop) file = fmt.Sprintf("%s/dtmcli.barrier.%s.sql", dtmutil.GetSQLDir(), BusiConf.Driver) dtmutil.RunSQLScript(BusiConf, file, skipDrop) + file = fmt.Sprintf("%s/dtmsvr.storage.%s.sql", dtmutil.GetSQLDir(), BusiConf.Driver) + dtmutil.RunSQLScript(BusiConf, file, skipDrop) _, err := RedisGet().FlushAll(context.Background()).Result() // redis barrier need clear dtmimp.E2P(err) SetRedisBothAccount(10000, 10000) From e871c8a581a6ac15ac7f2635eb7fd14217db0a70 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Tue, 29 Mar 2022 02:03:48 +0800 Subject: [PATCH 3/5] fix helper/bench --- helper/bench/Makefile | 1 + helper/bench/prepare.sh | 4 ++-- helper/bench/svr/http.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helper/bench/Makefile b/helper/bench/Makefile index e819a4b..72c8094 100644 --- a/helper/bench/Makefile +++ b/helper/bench/Makefile @@ -1,6 +1,7 @@ # All targets. default: bench +# configure these paths according to you system bench: /usr/local/bin/go /etc/redis/redis.conf /usr/local/bin/docker-compose main.go rm -f ../conf.sample.yml go build -o bench diff --git a/helper/bench/prepare.sh b/helper/bench/prepare.sh index 2ec3ad1..bde6b63 100755 --- a/helper/bench/prepare.sh +++ b/helper/bench/prepare.sh @@ -6,5 +6,5 @@ git clone https://github.com/dtm-labs/dtm.git && cd dtm && git checkout alpha && echo 'all prepared. you shoud run following commands to test in different terminal' echo -echo 'cd dtm && go run bench/main.go redis|boltdb|db' -echo 'cd dtm && bench/run-redis|boltdb|mysql.sh' +echo 'cd dtf && go run helper/bench/main.go redis|boltdb|db' +echo 'cd dtf/helper && bench/run-redis|boltdb|mysql.sh' diff --git a/helper/bench/svr/http.go b/helper/bench/svr/http.go index 76844d6..ef5c057 100644 --- a/helper/bench/svr/http.go +++ b/helper/bench/svr/http.go @@ -96,7 +96,7 @@ func PrepareBenchDB() { func StartSvr() { app := dtmutil.GetGinApp() benchAddRoute(app) - logger.Debugf("bench listening at %d", benchPort) + logger.Infof("bench listening at %s", benchPort) go func() { _ = app.Run(fmt.Sprintf(":%s", benchPort)) }() From 963904dcbe42d09e321df9ac37be3690d188d10d Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Tue, 29 Mar 2022 02:13:44 +0800 Subject: [PATCH 4/5] fix mysql error --- test/busi/startup.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/busi/startup.go b/test/busi/startup.go index 3181787..08de468 100644 --- a/test/busi/startup.go +++ b/test/busi/startup.go @@ -22,6 +22,8 @@ func PopulateDB(skipDrop bool) { dtmutil.RunSQLScript(BusiConf, file, skipDrop) file = fmt.Sprintf("%s/dtmcli.barrier.%s.sql", dtmutil.GetSQLDir(), BusiConf.Driver) dtmutil.RunSQLScript(BusiConf, file, skipDrop) + file = fmt.Sprintf("%s/dtmsvr.storage.%s.sql", dtmutil.GetSQLDir(), BusiConf.Driver) + dtmutil.RunSQLScript(BusiConf, file, skipDrop) _, err := RedisGet().FlushAll(context.Background()).Result() // redis barrier need clear dtmimp.E2P(err) SetRedisBothAccount(10000, 10000) From 3fe9888e0a669003f19c5d3bff3c6bb5118c05ff Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Tue, 29 Mar 2022 12:19:41 +0800 Subject: [PATCH 5/5] fix database not exist --- helper/bench/prepare.sh | 2 +- helper/bench/svr/http.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/helper/bench/prepare.sh b/helper/bench/prepare.sh index bde6b63..b78f0d5 100755 --- a/helper/bench/prepare.sh +++ b/helper/bench/prepare.sh @@ -7,4 +7,4 @@ git clone https://github.com/dtm-labs/dtm.git && cd dtm && git checkout alpha && echo 'all prepared. you shoud run following commands to test in different terminal' echo echo 'cd dtf && go run helper/bench/main.go redis|boltdb|db' -echo 'cd dtf/helper && bench/run-redis|boltdb|mysql.sh' +echo 'cd dtf && ./helper/bench/test-redis|boltdb|mysql.sh' diff --git a/helper/bench/svr/http.go b/helper/bench/svr/http.go index ef5c057..0c61c5a 100644 --- a/helper/bench/svr/http.go +++ b/helper/bench/svr/http.go @@ -73,7 +73,9 @@ var sqls = 1 // PrepareBenchDB prepares db data for bench func PrepareBenchDB() { db := pdbGet() - _, err := dtmimp.DBExec(db, "drop table if exists dtm_busi.user_account_log") + _, err := dtmimp.DBExec(db, "CREATE DATABASE if not exists dtm_busi") + logger.FatalIfError(err) + _, err = dtmimp.DBExec(db, "drop table if exists dtm_busi.user_account_log") logger.FatalIfError(err) _, err = dtmimp.DBExec(db, `create table if not exists dtm_busi.user_account_log ( id INT(11) AUTO_INCREMENT PRIMARY KEY,