Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

checksum: use gc ttl api for checksum gc safepoint in v4.0 cluster #396

Merged
merged 13 commits into from
Oct 23, 2020
8 changes: 1 addition & 7 deletions lightning/backend/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,7 @@ func checkTiDBVersion(tls *common.TLS, requiredVersion semver.Version) error {
}

func checkPDVersion(tls *common.TLS, pdAddr string, requiredVersion semver.Version) error {
var rawVersion string
err := tls.WithHost(pdAddr).GetJSON("/pd/api/v1/config/cluster-version", &rawVersion)
if err != nil {
return err
}

version, err := semver.NewVersion(rawVersion)
version, err := common.FetchPDVersion(tls, pdAddr)
if err != nil {
return errors.Trace(err)
}
Expand Down
1 change: 1 addition & 0 deletions lightning/checkpoints/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type TidbDBInfo struct {

type TidbTableInfo struct {
ID int64
DB string
Name string
Core *model.TableInfo
}
13 changes: 13 additions & 0 deletions lightning/common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ package common
import (
"fmt"

"github.com/coreos/go-semver/semver"
"github.com/pingcap/errors"
"go.uber.org/zap"

"github.com/pingcap/tidb-lightning/lightning/log"
Expand Down Expand Up @@ -58,3 +60,14 @@ func PrintInfo(app string, callback func()) {
callback()
}
}

// FetchPDVersion get pd version
func FetchPDVersion(tls *TLS, pdAddr string) (*semver.Version, error) {
var rawVersion string
err := tls.WithHost(pdAddr).GetJSON("/pd/api/v1/config/cluster-version", &rawVersion)
if err != nil {
return nil, errors.Trace(err)
}

return semver.NewVersion(rawVersion)
}
Loading