-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
fcfae7c
to
ec4d39d
Compare
There was a problem hiding this 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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
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()
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
FYI, converted PR to draft, to address @enisoc's comments. |
Signed-off-by: Toliver Jue <toliver@planetscale.com>
@enisoc PTAL |
Needed to correctly cancel long-running queries where rpc's may disconnect.
Signed-off-by: Toliver Jue toliver@planetscale.com