From ce21c0b610468ed4749cf8580a507f61998c4f17 Mon Sep 17 00:00:00 2001 From: coffeegoddd Date: Tue, 13 Feb 2024 17:18:33 -0800 Subject: [PATCH] /go/performance/utils/sysbench_runner: wip, all seems to work, need to fix json unmarshalling --- .../sysbench_runner/dolt_server_config.go | 3 +- .../sysbench_runner/doltgres_server_config.go | 1 + .../sysbench_runner/mysql_server_config.go | 1 + .../sysbench_runner/postgres_server_config.go | 1 + .../utils/sysbench_runner/results.go | 3 +- .../utils/sysbench_runner/run_test.go | 38 +++++++++++++++++++ go/performance/utils/sysbench_runner/tpcc.go | 6 ++- .../utils/sysbench_runner/tpcc_tests.go | 10 ++++- 8 files changed, 59 insertions(+), 4 deletions(-) diff --git a/go/performance/utils/sysbench_runner/dolt_server_config.go b/go/performance/utils/sysbench_runner/dolt_server_config.go index b5358f4393..61840d0d31 100644 --- a/go/performance/utils/sysbench_runner/dolt_server_config.go +++ b/go/performance/utils/sysbench_runner/dolt_server_config.go @@ -2,8 +2,9 @@ package sysbench_runner import ( "fmt" - "github.com/google/uuid" "os" + + "github.com/google/uuid" ) type ServerProfile string diff --git a/go/performance/utils/sysbench_runner/doltgres_server_config.go b/go/performance/utils/sysbench_runner/doltgres_server_config.go index cd9ff3a3fb..e073f1be15 100644 --- a/go/performance/utils/sysbench_runner/doltgres_server_config.go +++ b/go/performance/utils/sysbench_runner/doltgres_server_config.go @@ -2,6 +2,7 @@ package sysbench_runner import ( "fmt" + "github.com/google/uuid" ) diff --git a/go/performance/utils/sysbench_runner/mysql_server_config.go b/go/performance/utils/sysbench_runner/mysql_server_config.go index 8fc9e4126a..a5bdf3f516 100644 --- a/go/performance/utils/sysbench_runner/mysql_server_config.go +++ b/go/performance/utils/sysbench_runner/mysql_server_config.go @@ -2,6 +2,7 @@ package sysbench_runner import ( "fmt" + "github.com/google/uuid" ) diff --git a/go/performance/utils/sysbench_runner/postgres_server_config.go b/go/performance/utils/sysbench_runner/postgres_server_config.go index e1e790f2e3..ffefa4cf7f 100644 --- a/go/performance/utils/sysbench_runner/postgres_server_config.go +++ b/go/performance/utils/sysbench_runner/postgres_server_config.go @@ -2,6 +2,7 @@ package sysbench_runner import ( "fmt" + "github.com/google/uuid" ) diff --git a/go/performance/utils/sysbench_runner/results.go b/go/performance/utils/sysbench_runner/results.go index 10ab10d6e5..a371706bda 100644 --- a/go/performance/utils/sysbench_runner/results.go +++ b/go/performance/utils/sysbench_runner/results.go @@ -16,10 +16,11 @@ package sysbench_runner import ( "errors" - "github.com/google/uuid" "path/filepath" "strconv" "strings" + + "github.com/google/uuid" ) var ( diff --git a/go/performance/utils/sysbench_runner/run_test.go b/go/performance/utils/sysbench_runner/run_test.go index f8e28e2aa3..ba038797da 100644 --- a/go/performance/utils/sysbench_runner/run_test.go +++ b/go/performance/utils/sysbench_runner/run_test.go @@ -213,3 +213,41 @@ func TestDoltProfiler(t *testing.T) { log.Fatal("failed to create dolt cpu profile") } } + +func TestDoltMysqlTpccRunner(t *testing.T) { + t.Skip() + dir := t.TempDir() + log.Println(dir) + err := os.Chdir(dir) + if err != nil { + log.Fatal(err) + } + + conf := &tpccConfigImpl{ + Servers: []ServerConfig{ + &doltServerConfigImpl{ + Id: "test-dolt-tpcc", + Version: "1.33.0", + ResultsFormat: CsvFormat, + ServerExec: "/Users/dustin/go/bin/dolt", + }, + &mysqlServerConfigImpl{ + Id: "test-mysql-tpcc", + Host: "127.0.0.1", + Port: 3606, + Version: "8.0.35", + ResultsFormat: CsvFormat, + ServerExec: "/opt/homebrew/bin/mysqld", + ServerUser: "root", + SkipLogBin: true, + ConnectionProtocol: "tcp", + }, + }, + ScriptDir: "/Users/dustin/src/sysbench-tpcc", + } + + err = RunTpcc(context.Background(), conf) + if err != nil { + log.Fatal(err) + } +} diff --git a/go/performance/utils/sysbench_runner/tpcc.go b/go/performance/utils/sysbench_runner/tpcc.go index 25753efd5c..a4cc1c6579 100644 --- a/go/performance/utils/sysbench_runner/tpcc.go +++ b/go/performance/utils/sysbench_runner/tpcc.go @@ -78,7 +78,11 @@ func (t *tpccTesterImpl) cleanup(ctx context.Context) error { args := t.test.GetCleanupArgs(t.serverConfig) cmd := ExecCommand(ctx, t.tpccCommand, args...) cmd = t.updateCmdEnv(cmd) - return cmd.Run() + err := cmd.Run() + if err != nil { + return err + } + return nil } func (t *tpccTesterImpl) Test(ctx context.Context) (*Result, error) { diff --git a/go/performance/utils/sysbench_runner/tpcc_tests.go b/go/performance/utils/sysbench_runner/tpcc_tests.go index f8d7fdda33..20af830152 100644 --- a/go/performance/utils/sysbench_runner/tpcc_tests.go +++ b/go/performance/utils/sysbench_runner/tpcc_tests.go @@ -2,6 +2,7 @@ package sysbench_runner import ( "fmt" + "github.com/google/uuid" ) @@ -110,6 +111,10 @@ func (t *tpccTestImpl) doltArgs(serverConfig ServerConfig) []string { args := make([]string, 0) args = append(args, defaultTpccParams...) args = append(args, fmt.Sprintf("%s=%s", tpccMysqlHostFlag, serverConfig.GetHost())) + port := serverConfig.GetPort() + if port > 0 { + args = append(args, fmt.Sprintf("%s=%d", tpccMysqlPortFlag, serverConfig.GetPort())) + } args = append(args, fmt.Sprintf("%s=%d", tpccMysqlPortFlag, serverConfig.GetPort())) args = append(args, fmt.Sprintf("%s=%s", tpccMysqlUserFlag, defaultMysqlUser)) args = append(args, fmt.Sprintf("%s=%d", tpccTimeFlag, t.Params.GetTime())) @@ -125,14 +130,17 @@ func (t *tpccTestImpl) mysqlArgs(serverConfig ServerConfig) []string { args := make([]string, 0) args = append(args, defaultTpccParams...) host := serverConfig.GetHost() + port := serverConfig.GetPort() args = append(args, fmt.Sprintf("%s=%s", tpccMysqlHostFlag, host)) if host == defaultHost { args = append(args, fmt.Sprintf("%s=%s", tpccMysqlUserFlag, tpccMysqlUsername)) args = append(args, fmt.Sprintf("%s=%s", tpccMysqlPasswordFlag, tpccPassLocal)) } else { - args = append(args, fmt.Sprintf("%s=%d", tpccMysqlPortFlag, serverConfig.GetPort())) args = append(args, fmt.Sprintf("%s=%s", tpccMysqlUserFlag, defaultMysqlUser)) } + if port > 0 { + args = append(args, fmt.Sprintf("%s=%d", tpccMysqlPortFlag, serverConfig.GetPort())) + } args = append(args, fmt.Sprintf("%s=%d", tpccTimeFlag, t.Params.GetTime())) args = append(args, fmt.Sprintf("%s=%d", tpccThreadsFlag, t.Params.GetNumThreads())) args = append(args, fmt.Sprintf("%s=%d", tpccReportIntervalFlag, t.Params.GetReportInterval()))