Skip to content

Commit bd1693e

Browse files
committed
address comment
1 parent 44996c2 commit bd1693e

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

session/session.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1072,13 +1072,14 @@ func CreateSession(store kv.Storage) (Session, error) {
10721072
func loadSystemTZ(se *session) (string, error) {
10731073
sql := `select variable_value from mysql.tidb where variable_name = "system_tz"`
10741074
rss, errLoad := se.Execute(context.Background(), sql)
1075+
defer rss.Close()
10751076
if errLoad != nil {
10761077
return "", errLoad
10771078
}
10781079
chk := rss[0].NewChunk()
1080+
defer chk.Close()
10791081
rss[0].Next(context.Background(), chk)
10801082
return chk.GetRow(0).GetString(0), nil
1081-
10821083
}
10831084

10841085
// BootstrapSession runs the first time when the TiDB server start.

util/timeutil/time.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 PingCAP, Inc.
1+
// Copyright 2018 PingCAP, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ func init() {
3939
// locCa is a simple cache policy to improve the performance of 'time.LoadLocation'.
4040
var locCa *locCache
4141

42-
// LocalStr is current TiDB's system timezone name.
42+
// systemTZ is current TiDB's system timezone name.
4343
var systemTZ string
4444
var zoneSources = []string{
4545
"/usr/share/zoneinfo/",
@@ -145,8 +145,6 @@ func LoadLocation(name string) (*time.Location, error) {
145145

146146
// Zone returns the current timezone name and timezone offset in seconds.
147147
// In compatible with MySQL, we change `Local` to `System`.
148-
// TODO: Golang team plan to return system timezone name intead of
149-
// returning `Local` when `loc` is `time.Local`. We need keep an eye on this.
150148
func Zone(loc *time.Location) (string, int64) {
151149
_, offset := time.Now().In(loc).Zone()
152150
var name string

util/timeutil/time_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The ql Authors. All rights reserved.
1+
// Copyright 2018 PingCAP, Inc. All rights reserved.
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSES/QL-LICENSE file.
44

0 commit comments

Comments
 (0)