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

Add context to MysqlDaemon schema functions #6243

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

teejae
Copy link
Contributor

@teejae teejae commented May 29, 2020

Needed to correctly cancel long-running queries where rpc's may disconnect.

Signed-off-by: Toliver Jue toliver@planetscale.com

@teejae teejae requested a review from sougou as a code owner May 29, 2020 19:14
@teejae teejae marked this pull request as draft May 29, 2020 19:15
@teejae teejae force-pushed the tj-get-schema-ctx branch 4 times, most recently from fcfae7c to ec4d39d Compare May 29, 2020 19:24
@teejae teejae marked this pull request as ready for review May 29, 2020 19:25
@deepthi deepthi requested a review from enisoc May 29, 2020 19:27
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work! I'll let others take a look before we merge.

Copy link
Collaborator

@systay systay left a comment

Choose a reason for hiding this comment

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

❤️

func (mysqld *Mysqld) GetColumns(dbName, table string) ([]*querypb.Field, []string, error) {
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
func (mysqld *Mysqld) GetColumns(ctx context.Context, dbName, table string) ([]*querypb.Field, []string, error) {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
Copy link
Member

Choose a reason for hiding this comment

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

Note that this only applies the Context to fetching the connection. If you want the actual query to respect Context, you can replace conn.ExecuteFetch() everywhere with mysqld.executeFetchContext().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm...who should be doing that exactly?

Copy link
Member

Choose a reason for hiding this comment

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

Any method of Mysqld that wants to respect Context should use mysqld.executeFetchContext() as a wrapper around conn.ExecuteFetch() instead of calling it directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@teejae teejae requested a review from enisoc May 29, 2020 19:51
@teejae teejae marked this pull request as draft May 29, 2020 20:26
@teejae
Copy link
Contributor Author

teejae commented May 29, 2020

FYI, converted PR to draft, to address @enisoc's comments.

Signed-off-by: Toliver Jue <toliver@planetscale.com>
@teejae teejae force-pushed the tj-get-schema-ctx branch from ec4d39d to 7e69105 Compare May 31, 2020 01:13
@teejae
Copy link
Contributor Author

teejae commented May 31, 2020

@enisoc PTAL

@teejae teejae marked this pull request as ready for review May 31, 2020 01:14
@systay systay merged commit 48a40c8 into vitessio:master Jun 1, 2020
@enisoc enisoc deleted the tj-get-schema-ctx branch June 1, 2020 19:51
@deepthi deepthi added this to the v7.0 milestone Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants