Skip to content

Commit

Permalink
store/tikv: do gc parallel (#5850)
Browse files Browse the repository at this point in the history
* do gc parallel
  • Loading branch information
wentaoxu authored Feb 9, 2018
1 parent 151f6d0 commit b43c41c
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 89 deletions.
21 changes: 0 additions & 21 deletions cmd/benchdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/pingcap/tidb/store/tikv"
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/util/logutil"
"golang.org/x/net/context"
)

var (
Expand Down Expand Up @@ -76,8 +75,6 @@ func main() {
ut.updateRangeRows(spec)
case "select":
ut.selectRows(spec)
case "gc":
ut.manualGC(nil)
case "query":
ut.query(spec)
default:
Expand Down Expand Up @@ -272,24 +269,6 @@ func (ut *benchDB) selectRows(spec string) {
})
}

// manualGC manually triggers GC and sends to done channel after finished.
func (ut *benchDB) manualGC(done chan bool) {
cLog("GC started")
start := time.Now()
ver, err := ut.store.CurrentVersion()
if err != nil {
log.Fatal(err)
}
err = tikv.RunGCJob(context.Background(), ut.store, ver.Ver, "benchDB")
if err != nil {
log.Fatal(err)
}
cLog("GC finished, duration ", time.Since(start))
if done != nil {
done <- true
}
}

func (ut *benchDB) query(spec string) {
strs := strings.Split(spec, ":")
sql := strs[0]
Expand Down
Loading

0 comments on commit b43c41c

Please sign in to comment.