Skip to content

Commit

Permalink
undo version
Browse files Browse the repository at this point in the history
  • Loading branch information
zhexuany committed Jun 24, 2017
1 parent 03f37ba commit df028d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/http_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/pingcap/pd/pd-client"
"github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/store/tikv"
"github.com/pingcap/tidb/version"
"github.com/pingcap/tidb/util/printer"
"github.com/prometheus/client_golang/prometheus"
)

Expand Down Expand Up @@ -96,7 +96,7 @@ func (s *Server) handleStatus(w http.ResponseWriter, req *http.Request) {
st := status{
Connections: s.ConnectionCount(),
Version: mysql.ServerVersion,
GitHash: version.Get().GitCommit,
GitHash: printer.TiDBGitHash,
}
js, err := json.Marshal(st)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
. "github.com/pingcap/check"
"github.com/pingcap/tidb/executor"
tmysql "github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/version"
"github.com/pingcap/tidb/util/printer"
)

func TestT(t *testing.T) {
Expand Down Expand Up @@ -517,7 +517,7 @@ func runTestStatusAPI(c *C) {
err = decoder.Decode(&data)
c.Assert(err, IsNil)
c.Assert(data.Version, Equals, tmysql.ServerVersion)
c.Assert(data.GitHash, Equals, version.Get().GitCommit)
c.Assert(data.GitHash, Equals, printer.TiDBGitHash)
}

func runTestMultiStatements(c *C) {
Expand Down
13 changes: 10 additions & 3 deletions util/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@ import (
"fmt"

"github.com/ngaut/log"
"github.com/pingcap/tidb/version"
)

// Version information.
var (
TiDBBuildTS = "None"
TiDBGitHash = "None"
)

// PrintTiDBInfo prints the TiDB version information.
func PrintTiDBInfo() {
log.Infof("Welcome to TiDB.")
log.Infof("Version:")
log.Infof("%#v\n", version.Get())
log.Infof("Git Commit Hash: %s", TiDBGitHash)
log.Infof("UTC Build Time: %s", TiDBBuildTS)
}

// PrintRawTiDBInfo prints the TiDB version information without log info.
func PrintRawTiDBInfo() {
fmt.Printf("%#v\n", version.Get())
fmt.Println("Git Commit Hash:", TiDBGitHash)
fmt.Println("UTC Build Time: ", TiDBBuildTS)
}

// checkValidity checks whether cols and every data have the same length.
Expand Down

0 comments on commit df028d2

Please sign in to comment.