Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
Signed-off-by: yeya24 <[email protected]>

update tables params

Signed-off-by: yeya24 <[email protected]>
  • Loading branch information
yeya24 committed Mar 7, 2020
1 parent 3e88550 commit 3fc9ea9
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {

var start2 time.Time
if *all || *csv {
if err = fetchTpcc(dataDirs, lightningIPs, *skipDownloading); err != nil {
if err = fetchTpcc(dataDirs, lightningIPs, *goTPCBinary, *skipDownloading); err != nil {
os.Exit(1)
}
start2 = time.Now()
Expand Down Expand Up @@ -152,32 +152,26 @@ func getLightningIPsAndDataDirs() (lightningIPs, dataDirs []string, err error) {
}

/**
> rm -rf /tmp/benchmarksql
> git clone https://github.com/pingcap/benchmarksql.git /tmp/benchmarksql
> yum install -y java ant
> cd /tmp/benchmarksql
> ant
> sed -i 's/localhost:4000/tidb_ip:tidb_port' /tmp/benchmarksql/run/props.mysql
> sed -i "s/warehouses=[0-9]\+/warehouses=10000/" /tmp/benchmarksql/run/props.mysql
> echo fileLocation=%s >> /tmp/benchmarksql/run/props.mysql
> echo tableName=%s >> /tmp/benchmarksql/run/props.mysql
> rm -f /tmp/go-tpc
> wget -O /tmp/go-tpc binary_url; chmod +x /tmp/go-tpc
*/
func fetchTpcc(lightningDirs []string, lightningIPs []string, skipDownloading bool) (err error) {
func fetchTpcc(lightningDirs []string, lightningIPs []string, binaryURL string, skipDownloading bool) (err error) {
errCh := make(chan error, 3)
wg := &sync.WaitGroup{}
for i, lightningIP := range lightningIPs {
ip := lightningIP
wg.Add(1)
go func() {
defer wg.Done()
if _, _, err = runCmd("ssh", ip, `rm -f /tmp/go-tpc`); err != nil {
errCh <- err
return
}
if !skipDownloading {
if _, _, err = runCmd("ssh", ip, `rm -f /tmp/go-tpc`); err != nil {
errCh <- err
return
}

// TODO(yeya24): This is just a tmp release to download the binary.
// Change it when the binary can be directly download in the main repo.
if _, _, err = runCmd("ssh", ip, fmt.Sprintf("wget -O /tmp/go-tpc %s; chmod +x /tmp/go-tpc", *goTPCBinary)); err != nil {
if _, _, err = runCmd("ssh", ip, fmt.Sprintf("wget -O /tmp/go-tpc %s; chmod +x /tmp/go-tpc", binaryURL)); err != nil {
errCh <- err
return
}
Expand All @@ -203,12 +197,8 @@ func fetchTpcc(lightningDirs []string, lightningIPs []string, skipDownloading bo
}

/**
> mysql -h tidbIP -u root -P tidbPort -e "drop database if exists tpcc"
> mysql -h tidbIP -u root -P tidbPort -e "create database tpcc"`
> cd /tmp/benchmarksql/run
> ./runSQL.sh props.mysql sql.mysql/tableCreates.sql
> ./runSQL.sh props.mysql sql.mysql/indexCreates.sql
> cd -
> mysql -h tidbIP -u root -P tidbPort -e "drop database if exists dbName"
> /tmp/go-tpc tpcc schema -U root -H tidbIP -P tidbPort -D dbName
*/
func genSchema(tidbIP, tidbPort, lightningIP, dbName string) (err error) {
if _, _, err = runCmd("bash", "-c", fmt.Sprintf(`mysql -h %s -u root -P %s -e "drop database if exists %s"`, tidbIP, tidbPort, dbName)); err != nil {
Expand All @@ -225,7 +215,7 @@ func genSchema(tidbIP, tidbPort, lightningIP, dbName string) (err error) {

/**
> cd /tmp/benchmarksql/run
> ./runLoader.sh props.mysql props.mysql
> /tmp/go-tpc tpcc prepare -D dbName -T threadsNum --warehouses warehouseNum --csv.output outputDir --csv.tables [tables]
*/
func genCSV(lightningIPs []string, lightningDirs []string, warehouse, threads int64, dbName string) (err error) {
var specifiedTables []string
Expand All @@ -234,7 +224,7 @@ func genCSV(lightningIPs []string, lightningDirs []string, warehouse, threads in
// empty means generating all tables
specifiedTables = []string{""}
case 2:
specifiedTables = []string{"--csv.tables stock", "--csv.tables orders"}
specifiedTables = []string{"--csv.tables customer", "--csv.tables stock,orders"}
case 3:
specifiedTables = []string{"--csv.tables customer", "--csv.tables stock", "--csv.tables orders"}
// TODO(yeya24): What about len > 3?
Expand Down

0 comments on commit 3fc9ea9

Please sign in to comment.