diff --git a/session/session.go b/session/session.go index 51502e0c6e6c5..adae5323ddb48 100644 --- a/session/session.go +++ b/session/session.go @@ -1072,13 +1072,14 @@ func CreateSession(store kv.Storage) (Session, error) { func loadSystemTZ(se *session) (string, error) { sql := `select variable_value from mysql.tidb where variable_name = "system_tz"` rss, errLoad := se.Execute(context.Background(), sql) + defer rss.Close() if errLoad != nil { return "", errLoad } chk := rss[0].NewChunk() + defer chk.Close() rss[0].Next(context.Background(), chk) return chk.GetRow(0).GetString(0), nil - } // BootstrapSession runs the first time when the TiDB server start. diff --git a/util/timeutil/time.go b/util/timeutil/time.go index 3b06e153a8412..7dce6f818fd2a 100644 --- a/util/timeutil/time.go +++ b/util/timeutil/time.go @@ -1,4 +1,4 @@ -// Copyright 2017 PingCAP, Inc. +// Copyright 2018 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ func init() { // locCa is a simple cache policy to improve the performance of 'time.LoadLocation'. var locCa *locCache -// LocalStr is current TiDB's system timezone name. +// systemTZ is current TiDB's system timezone name. var systemTZ string var zoneSources = []string{ "/usr/share/zoneinfo/", @@ -145,8 +145,6 @@ func LoadLocation(name string) (*time.Location, error) { // Zone returns the current timezone name and timezone offset in seconds. // In compatible with MySQL, we change `Local` to `System`. -// TODO: Golang team plan to return system timezone name intead of -// returning `Local` when `loc` is `time.Local`. We need keep an eye on this. func Zone(loc *time.Location) (string, int64) { _, offset := time.Now().In(loc).Zone() var name string diff --git a/util/timeutil/time_test.go b/util/timeutil/time_test.go index 23d52a9da3b36..17cbdf80f1c0c 100644 --- a/util/timeutil/time_test.go +++ b/util/timeutil/time_test.go @@ -1,4 +1,4 @@ -// Copyright 2018 The ql Authors. All rights reserved. +// Copyright 2018 PingCAP, Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSES/QL-LICENSE file.