Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aliiohs committed Mar 21, 2019
1 parent 5d83bb8 commit ae18f5c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ func (b *executorBuilder) buildCancelDDLJobs(v *plannercore.CancelDDLJobs) Execu

func (b *executorBuilder) buildChange(v *plannercore.Change) Executor {
return &ChangeExec{
Statement: v.Statement,
NodeType: v.NodeType,
State: v.State,
NodeID: v.NodeID,
}
}

Expand Down
12 changes: 6 additions & 6 deletions executor/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"strings"

"github.com/pingcap/errors"
"github.com/pingcap/parser/ast"
"github.com/pingcap/tidb-tools/tidb-binlog/node"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/util/chunk"
Expand All @@ -28,13 +27,14 @@ import (
type ChangeExec struct {
baseExecutor

Statement *ast.ChangeStmt
NodeType string
State string
NodeID string
}

// Next implements the Executor Next interface.
func (e *ChangeExec) Next(ctx context.Context, req *chunk.RecordBatch) error {
stmt := e.Statement
kind := strings.ToLower(stmt.NodeType)
kind := strings.ToLower(e.NodeType)
urls := config.GetGlobalConfig().Path
registry, err := createRegistry(urls)
if err != nil {
Expand All @@ -44,8 +44,8 @@ func (e *ChangeExec) Next(ctx context.Context, req *chunk.RecordBatch) error {
if err != nil {
return err
}
state := stmt.State
nodeID := stmt.NodeID
state := e.State
nodeID := e.NodeID
for _, n := range nodes {
if n.NodeID != nodeID {
continue
Expand Down
4 changes: 3 additions & 1 deletion planner/core/common_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ type CancelDDLJobs struct {
type Change struct {
baseSchemaProducer

Statement *ast.ChangeStmt
NodeType string
State string
NodeID string
}

// Prepare represents prepare plan.
Expand Down
6 changes: 5 additions & 1 deletion planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ func (b *PlanBuilder) Build(node ast.Node) (Plan, error) {
}

func (b *PlanBuilder) buildChange(v *ast.ChangeStmt) (Plan, error) {
exe := &Change{Statement: v}
exe := &Change{
NodeType: v.NodeType,
State: v.State,
NodeID: v.NodeID,
}
return exe, nil
}

Expand Down

0 comments on commit ae18f5c

Please sign in to comment.