Skip to content

[vtadmin] Removing explicit Dial-ing for vtsql proxy#10237

Merged
ajm188 merged 8 commits intovitessio:mainfrom
planetscale:andrew/vtadmin/vtsql-nodial
May 9, 2022
Merged

[vtadmin] Removing explicit Dial-ing for vtsql proxy#10237
ajm188 merged 8 commits intovitessio:mainfrom
planetscale:andrew/vtadmin/vtsql-nodial

Conversation

@ajm188
Copy link
Copy Markdown
Contributor

@ajm188 ajm188 commented May 9, 2022

Description

This builds on #10233, but for vtsql this time (it's based on the same branch, so it should be merged after that PR).

It's the same changes, applied in the same order (config options, context plumbing through the call stack, etc etc) but applied to the DB interface and VTGateProxy type instead. In addition:

  • make vtgateconn's private drivers map thread safe. this was tripping the race detector during tests (see 69cf2f2975585025aea1cc7ab58d35aa1d5b4dfa)

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Andrew Mason added 8 commits May 9, 2022 14:04
Signed-off-by: Andrew Mason <andrew@planetscale.com>
…ial`

Signed-off-by: Andrew Mason <andrew@planetscale.com>
This was only testing that Dial-ing during GetTablets could fail, but
we're removing that call, so this test doesn't actually check
anything anymore.

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
@ajm188 ajm188 force-pushed the andrew/vtadmin/vtsql-nodial branch from 41ab024 to abdbbea Compare May 9, 2022 18:04
@ajm188 ajm188 marked this pull request as ready for review May 9, 2022 18:04
Copy link
Copy Markdown
Contributor

@doeg doeg left a comment

Choose a reason for hiding this comment

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

🌟 🌟

func DialProtocol(ctx context.Context, protocol string, address string) (*VTGateConn, error) {
dialersM.Lock()
dialer, ok := dialers[protocol]
dialersM.Unlock()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason for not using defer beyond "it's like, one line"? (Purely curious/not a leading question lol.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because we don't need to hold the mutex to invoke the dialer, just to get it out of the map

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 9, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has the correct release notes label. release notes none should only be used for PRs that are so trivial that they need not be included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

@ajm188 ajm188 merged commit 2cfed24 into vitessio:main May 9, 2022
@ajm188 ajm188 deleted the andrew/vtadmin/vtsql-nodial branch May 9, 2022 19:44
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.

2 participants