Skip to content

Commit

Permalink
/go/performance/utils/sysbench_runner: wip, all seems to work, need t…
Browse files Browse the repository at this point in the history
…o fix json unmarshalling
  • Loading branch information
coffeegoddd committed Feb 14, 2024
1 parent aabdce4 commit ce21c0b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 4 deletions.
3 changes: 2 additions & 1 deletion go/performance/utils/sysbench_runner/dolt_server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package sysbench_runner

import (
"fmt"
"github.com/google/uuid"
"os"

"github.com/google/uuid"
)

type ServerProfile string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sysbench_runner

import (
"fmt"

"github.com/google/uuid"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sysbench_runner

import (
"fmt"

"github.com/google/uuid"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sysbench_runner

import (
"fmt"

"github.com/google/uuid"
)

Expand Down
3 changes: 2 additions & 1 deletion go/performance/utils/sysbench_runner/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ package sysbench_runner

import (
"errors"
"github.com/google/uuid"
"path/filepath"
"strconv"
"strings"

"github.com/google/uuid"
)

var (
Expand Down
38 changes: 38 additions & 0 deletions go/performance/utils/sysbench_runner/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 5 additions & 1 deletion go/performance/utils/sysbench_runner/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion go/performance/utils/sysbench_runner/tpcc_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sysbench_runner

import (
"fmt"

"github.com/google/uuid"
)

Expand Down Expand Up @@ -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()))
Expand All @@ -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()))
Expand Down

0 comments on commit ce21c0b

Please sign in to comment.