Skip to content

Commit

Permalink
*: remove useless defer and setReadTimeout (#10441)
Browse files Browse the repository at this point in the history
  • Loading branch information
lysu authored and jackysp committed May 14, 2019
1 parent ba7134d commit 3177328
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ var (
queryDurationHistogramDelete = metrics.QueryDurationHistogram.WithLabelValues("Delete")
queryDurationHistogramUpdate = metrics.QueryDurationHistogram.WithLabelValues("Update")
queryDurationHistogramSelect = metrics.QueryDurationHistogram.WithLabelValues("Select")
queryDurationHistogramExecute = metrics.QueryDurationHistogram.WithLabelValues("Execute")
queryDurationHistogramSet = metrics.QueryDurationHistogram.WithLabelValues("Set")
queryDurationHistogramGeneral = metrics.QueryDurationHistogram.WithLabelValues(metrics.LblGeneral)
)

Expand Down Expand Up @@ -828,6 +830,10 @@ func (cc *clientConn) addMetrics(cmd byte, startTime time.Time, err error) {
queryDurationHistogramUpdate.Observe(time.Since(startTime).Seconds())
case "Select":
queryDurationHistogramSelect.Observe(time.Since(startTime).Seconds())
case "Execute":
queryDurationHistogramExecute.Observe(time.Since(startTime).Seconds())
case "Set":
queryDurationHistogramSet.Observe(time.Since(startTime).Seconds())
case metrics.LblGeneral:
queryDurationHistogramGeneral.Observe(time.Since(startTime).Seconds())
default:
Expand All @@ -840,7 +846,6 @@ func (cc *clientConn) addMetrics(cmd byte, startTime time.Time, err error) {
// The most frequently used command is ComQuery.
func (cc *clientConn) dispatch(ctx context.Context, data []byte) error {
span := opentracing.StartSpan("server.dispatch")
ctx = opentracing.ContextWithSpan(ctx, span)

ctx1, cancelFunc := context.WithCancel(ctx)
cc.mu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const (
DefMaxChunkSize = 1024
DefDMLBatchSize = 20000
DefMaxPreparedStmtCount = -1
DefWaitTimeout = 28800
DefWaitTimeout = 0
DefTiDBMemQuotaHashJoin = 32 << 30 // 32GB.
DefTiDBMemQuotaMergeJoin = 32 << 30 // 32GB.
DefTiDBMemQuotaSort = 32 << 30 // 32GB.
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string,
case TmpTableSize:
return checkUInt64SystemVar(name, value, 1024, math.MaxUint64, vars)
case WaitTimeout:
return checkUInt64SystemVar(name, value, 1, 31536000, vars)
return checkUInt64SystemVar(name, value, 0, 31536000, vars)
case MaxPreparedStmtCount:
return checkInt64SystemVar(name, value, -1, 1048576, vars)
case TimeZone:
Expand Down
1 change: 0 additions & 1 deletion store/tikv/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ func sendBatchRequest(
}
ctx1, cancel := context.WithTimeout(ctx, timeout)
defer cancel()

select {
case connArray.batchCommandsCh <- entry:
case <-ctx1.Done():
Expand Down

0 comments on commit 3177328

Please sign in to comment.