Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: fix some varcheck lint warnings #23011

Merged
merged 10 commits into from
Mar 1, 2021
1 change: 1 addition & 0 deletions ddl/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/pingcap/tidb/util/dbterror"
)

// nolint:varcheck
var (
// errWorkerClosed means we have already closed the DDL worker.
errInvalidWorker = dbterror.ClassDDL.NewStd(mysql.ErrInvalidDDLWorker)
Expand Down
1 change: 1 addition & 0 deletions domain/infosync/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const (
// ErrPrometheusAddrIsNotSet is the error that Prometheus address is not set in PD and etcd
var ErrPrometheusAddrIsNotSet = dbterror.ClassDomain.NewStd(errno.ErrPrometheusAddrIsNotSet)

// nolint:varcheck
// errPlacementRulesDisabled is exported for internal usage, indicating PD rejected the request due to disabled placement feature.
tangenta marked this conversation as resolved.
Show resolved Hide resolved
var errPlacementRulesDisabled = errors.New("placement rules feature is disabled")

Expand Down
3 changes: 3 additions & 0 deletions executor/hash_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,21 @@ import (
)

const (
// nolint:varcheck
// estCountMaxFactor defines the factor of estCountMax with maxChunkSize.
// estCountMax is maxChunkSize * estCountMaxFactor, the maximum threshold of estCount.
// if estCount is larger than estCountMax, set estCount to estCountMax.
// Set this threshold to prevent buildSideEstCount being too large and causing a performance and memory regression.
estCountMaxFactor = 10 * 1024

// nolint:varcheck
// estCountMinFactor defines the factor of estCountMin with maxChunkSize.
// estCountMin is maxChunkSize * estCountMinFactor, the minimum threshold of estCount.
// If estCount is smaller than estCountMin, set estCount to 0.
// Set this threshold to prevent buildSideEstCount being too small and causing a performance regression.
estCountMinFactor = 8

// nolint:varcheck
// estCountDivisor defines the divisor of buildSideEstCount.
// Set this divisor to prevent buildSideEstCount being too large and causing a performance regression.
estCountDivisor = 8
tangenta marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
7 changes: 0 additions & 7 deletions executor/merge_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package executor

import (
"context"
"fmt"

"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/config"
Expand All @@ -24,7 +23,6 @@ import (
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/disk"
"github.com/pingcap/tidb/util/memory"
"github.com/pingcap/tidb/util/stringutil"
)

// MergeJoinExec implements the merge join algorithm.
Expand Down Expand Up @@ -53,11 +51,6 @@ type MergeJoinExec struct {
diskTracker *disk.Tracker
}

var (
innerTableLabel fmt.Stringer = stringutil.StringerStr("innerTable")
outerTableLabel fmt.Stringer = stringutil.StringerStr("outerTable")
)

type mergeJoinTable struct {
isInner bool
childIndex int
Expand Down
1 change: 1 addition & 0 deletions expression/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/pingcap/tidb/util/dbterror"
)

// nolint:varcheck
// Error instances.
var (
// All the exported errors are defined here:
Expand Down
1 change: 1 addition & 0 deletions planner/core/find_best_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (c *PlanCounterTp) IsForce() bool {
return *c != -1
}

// nolint:varcheck
// wholeTaskTypes records all possible kinds of task that a plan can return. For Agg, TopN and Limit, we will try to get
// these tasks one by one.
var wholeTaskTypes = [...]property.TaskType{property.CopSingleReadTaskType, property.CopDoubleReadTaskType, property.RootTaskType}
Expand Down
7 changes: 0 additions & 7 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,3 @@ func setSystemTimeZoneVariable() {
variable.SetSysVar("system_time_zone", tz)
})
}

// Server error codes.
const (
codeUnknownFieldType = 1
codeInvalidSequence = 3
codeInvalidType = 4
)
2 changes: 2 additions & 0 deletions sessionctx/binloginfo/binloginfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var pumpsClient *pumpcli.PumpsClient
var pumpsClientLock sync.RWMutex
var shardPat = regexp.MustCompile(`SHARD_ROW_ID_BITS\s*=\s*\d+\s*`)
var preSplitPat = regexp.MustCompile(`PRE_SPLIT_REGIONS\s*=\s*\d+\s*`)

// nolint:varcheck
var autoRandomPat = regexp.MustCompile(`AUTO_RANDOM\s*\(\s*\d+\s*\)\s*`)
tangenta marked this conversation as resolved.
Show resolved Hide resolved

// BinlogInfo contains binlog data and binlog client.
Expand Down
1 change: 1 addition & 0 deletions store/mockstore/unistore/cophandler/mpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
MPPErrEstablishConnMultiTimes
)

// nolint:varcheck
const (
taskInit int32 = iota
taskRunning
Expand Down
5 changes: 0 additions & 5 deletions util/chunk/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
package chunk

import (
"fmt"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/memory"
"github.com/pingcap/tidb/util/stringutil"
)

// List holds a slice of chunks, use to append rows with max chunk size properly handled.
Expand All @@ -42,8 +39,6 @@ type RowPtr struct {
RowIdx uint32
}

var chunkListLabel fmt.Stringer = stringutil.StringerStr("chunk.List")

// NewList creates a new List with field types, init chunk size and max chunk size.
func NewList(fieldTypes []*types.FieldType, initChunkSize, maxChunkSize int) *List {
l := &List{
Expand Down