Skip to content

Commit

Permalink
executor: removed unused code (#46352)
Browse files Browse the repository at this point in the history
ref #46351
  • Loading branch information
Rustin170506 authored Aug 23, 2023
1 parent 6dd4a3a commit 2b766b4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion executor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ go_library(
"joiner.go",
"load_data.go",
"load_stats.go",
"lock_stats.go",
"mem_reader.go",
"memtable_reader.go",
"merge_join.go",
Expand Down Expand Up @@ -127,6 +126,7 @@ go_library(
"//executor/internal/querywatch",
"//executor/internal/util",
"//executor/internal/vecgroupchecker",
"//executor/lockstats",
"//executor/metrics",
"//executor/mppcoordmanager",
"//expression",
Expand Down
5 changes: 3 additions & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/pingcap/tidb/executor/internal/pdhelper"
"github.com/pingcap/tidb/executor/internal/querywatch"
"github.com/pingcap/tidb/executor/internal/vecgroupchecker"
"github.com/pingcap/tidb/executor/lockstats"
executor_metrics "github.com/pingcap/tidb/executor/metrics"
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/expression/aggregation"
Expand Down Expand Up @@ -1072,15 +1073,15 @@ func (b *executorBuilder) buildLoadStats(v *plannercore.LoadStats) exec.Executor
}

func (b *executorBuilder) buildLockStats(v *plannercore.LockStats) exec.Executor {
e := &LockStatsExec{
e := &lockstats.LockExec{
BaseExecutor: exec.NewBaseExecutor(b.ctx, nil, v.ID()),
Tables: v.Tables,
}
return e
}

func (b *executorBuilder) buildUnlockStats(v *plannercore.UnlockStats) exec.Executor {
e := &UnlockStatsExec{
e := &lockstats.UnlockExec{
BaseExecutor: exec.NewBaseExecutor(b.ctx, nil, v.ID()),
Tables: v.Tables,
}
Expand Down
15 changes: 15 additions & 0 deletions executor/lockstats/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "lockstats",
srcs = ["lock_stats.go"],
importpath = "github.com/pingcap/tidb/executor/lockstats",
visibility = ["//visibility:public"],
deps = [
"//domain",
"//executor/internal/exec",
"//parser/ast",
"//util/chunk",
"@com_github_pingcap_errors//:errors",
],
)
48 changes: 13 additions & 35 deletions executor/lock_stats.go → executor/lockstats/lock_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package executor
package lockstats

import (
"context"
Expand All @@ -24,28 +24,17 @@ import (
"github.com/pingcap/tidb/util/chunk"
)

var _ exec.Executor = &LockStatsExec{}
var _ exec.Executor = &UnlockStatsExec{}
var _ exec.Executor = &LockExec{}
var _ exec.Executor = &UnlockExec{}

// LockStatsExec represents a lock statistic executor.
type LockStatsExec struct {
// LockExec represents a lock statistic executor.
type LockExec struct {
exec.BaseExecutor
Tables []*ast.TableName
}

// lockStatsVarKeyType is a dummy type to avoid naming collision in context.
type lockStatsVarKeyType int

// String defines a Stringer function for debugging and pretty printing.
func (lockStatsVarKeyType) String() string {
return "lock_stats_var"
}

// LockStatsVarKey is a variable key for lock statistic.
const LockStatsVarKey lockStatsVarKeyType = 0

// Next implements the Executor Next interface.
func (e *LockStatsExec) Next(_ context.Context, _ *chunk.Chunk) error {
func (e *LockExec) Next(_ context.Context, _ *chunk.Chunk) error {
do := domain.GetDomain(e.Ctx())
is := do.InfoSchema()
h := do.StatsHandle()
Expand Down Expand Up @@ -83,34 +72,23 @@ func (e *LockStatsExec) Next(_ context.Context, _ *chunk.Chunk) error {
}

// Close implements the Executor Close interface.
func (*LockStatsExec) Close() error {
func (*LockExec) Close() error {
return nil
}

// Open implements the Executor Open interface.
func (*LockStatsExec) Open(context.Context) error {
func (*LockExec) Open(context.Context) error {
return nil
}

// UnlockStatsExec represents a unlock statistic executor.
type UnlockStatsExec struct {
// UnlockExec represents a unlock statistic executor.
type UnlockExec struct {
exec.BaseExecutor
Tables []*ast.TableName
}

// unlockStatsVarKeyType is a dummy type to avoid naming collision in context.
type unlockStatsVarKeyType int

// String defines a Stringer function for debugging and pretty printing.
func (unlockStatsVarKeyType) String() string {
return "unlock_stats_var"
}

// UnlockStatsVarKey is a variable key for unlock statistic.
const UnlockStatsVarKey unlockStatsVarKeyType = 0

// Next implements the Executor Next interface.
func (e *UnlockStatsExec) Next(context.Context, *chunk.Chunk) error {
func (e *UnlockExec) Next(context.Context, *chunk.Chunk) error {
do := domain.GetDomain(e.Ctx())
is := do.InfoSchema()
h := do.StatsHandle()
Expand Down Expand Up @@ -148,11 +126,11 @@ func (e *UnlockStatsExec) Next(context.Context, *chunk.Chunk) error {
}

// Close implements the Executor Close interface.
func (*UnlockStatsExec) Close() error {
func (*UnlockExec) Close() error {
return nil
}

// Open implements the Executor Open interface.
func (*UnlockStatsExec) Open(context.Context) error {
func (*UnlockExec) Open(context.Context) error {
return nil
}

0 comments on commit 2b766b4

Please sign in to comment.