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

Support update pump or drainer status #243

Conversation

aliiohs
Copy link
Contributor

@aliiohs aliiohs commented Mar 14, 2019

What problem does this PR solve?

support_update_Pump_or_Drainer_status
proposal:pingcap/tidb#9201

What is changed and how it works?

it will change parser.y/parser.go/ast.misc.go /misc.go.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to be included in the release note

@aliiohs aliiohs changed the title Support update pump or drainer status 2019 3 14 Support update pump or drainer status Mar 14, 2019
@WangXiangUSTC
Copy link
Contributor

LGTM

@WangXiangUSTC
Copy link
Contributor

@kennytm PTAL

ast/misc_test.go Outdated Show resolved Hide resolved
ast/misc.go Outdated

// Restore implements Node interface.
func (n *ChangeStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord(fmt.Sprintf("CHANGE %s TO", strings.ToUpper(n.NodeType)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.WriteKeyWord(fmt.Sprintf("CHANGE %s TO", strings.ToUpper(n.NodeType)))
ctx.WriteKeyWord("CHANGE ")
ctx.WriteKeyWord(n.NodeType)
ctx.WriteKeyWord(" TO ")

ast/misc.go Outdated Show resolved Hide resolved
ast/misc.go Outdated
type ChangeStmt struct {
stmtNode

NodeType string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use an enum for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i already changed, but i need you confirm it.

ast/misc.go Outdated Show resolved Hide resolved
ast/misc.go Outdated Show resolved Hide resolved
ast/misc.go Outdated Show resolved Hide resolved
ast/misc.go Outdated

// Restore implements Node interface.
func (n *ChangeStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("CHANGE")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.WriteKeyWord("CHANGE")
ctx.WriteKeyWord("CHANGE ")

ast/misc.go Outdated
// Restore implements Node interface.
func (n *ChangeStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("CHANGE")
ctx.WriteKeyWord(strings.ToUpper(n.NodeType))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.WriteKeyWord(strings.ToUpper(n.NodeType))
ctx.WriteKeyWord(n.NodeType)

ast/misc.go Outdated
func (n *ChangeStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("CHANGE")
ctx.WriteKeyWord(strings.ToUpper(n.NodeType))
ctx.WriteKeyWord("TO")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.WriteKeyWord("TO")
ctx.WriteKeyWord(" TO NODE_STATE ")

And delete the next line

ast/misc.go Outdated
ctx.WriteKeyWord("NODE_STATE")
ctx.WritePlain("=")
ctx.WriteString(n.State)
ctx.WriteKeyWord("FOR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.WriteKeyWord("FOR")
ctx.WriteKeyWord(" FOR NODE_ID ")

And delete the next line

ast/misc_test.go Show resolved Hide resolved
kennytm
kennytm previously approved these changes Mar 18, 2019
Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WangXiangUSTC WangXiangUSTC merged commit 7d694bd into pingcap:master Mar 18, 2019
WangXiangUSTC pushed a commit to WangXiangUSTC/parser that referenced this pull request Mar 25, 2019
WangXiangUSTC added a commit that referenced this pull request Mar 26, 2019
* parser: add support for show pump/drainer status  (#217)

* Support update pump or drainer status (#243)
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants