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

mysql: pass TLS config directly to MySQL's config #3348

Merged
merged 2 commits into from
Dec 28, 2023

Conversation

giautm
Copy link
Contributor

@giautm giautm commented Nov 25, 2023

No description provided.

Copy link

codecov bot commented Nov 25, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (53ccd8d) 77.45% compared to head (30f5dc5) 77.53%.

Files Patch % Lines
mysql/awsmysql/awsmysql.go 0.00% 4 Missing ⚠️
mysql/gcpmysql/gcpmysql.go 0.00% 3 Missing ⚠️
mysql/azuremysql/azuremysql.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3348      +/-   ##
==========================================
+ Coverage   77.45%   77.53%   +0.08%     
==========================================
  Files         104      104              
  Lines       13935    13916      -19     
==========================================
- Hits        10793    10790       -3     
+ Misses       2381     2365      -16     
  Partials      761      761              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@giautm giautm marked this pull request as ready for review November 25, 2023 04:20
Comment on lines -101 to -103
dialerCounter.mu.Lock()
dialerNum := dialerCounter.n
dialerCounter.mu.Unlock()
Copy link
Contributor Author

@giautm giautm Nov 25, 2023

Choose a reason for hiding this comment

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

No increment, it always zero

the `dialerNum` variable doesn't increment in the last implement, it always is zero.
@giautm
Copy link
Contributor Author

giautm commented Nov 28, 2023

Hello @vangent, can you please review? thanks!

PS: Oh, sorry. I just remember you're in Thanksgiving holiday

@@ -97,12 +98,8 @@ func (uo *URLOpener) OpenMySQLURL(ctx context.Context, u *url.URL) (*sql.DB, err
if uo.CertSource == nil {
return nil, fmt.Errorf("gcpmysql: URLOpener CertSource is nil")
}
// TODO(light): Avoid global registry once https://github.com/go-sql-driver/mysql/issues/771 is fixed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why this TODO can be addressed while the issue referenced is still open?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this part, it really doesnt have another solution, and the package itself will not support to change this to a custom dialer function. So, I think the current implement is correct and no need to change in future. The package sql-cloud-proxy also used this way without comment

Copy link
Contributor

Choose a reason for hiding this comment

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

It would help if you would explain what problem you are trying to solve. Does the current code not work? Or are you trying to simplify it?

Our testing for this part of the codebase is not good, and I am hesitant to make changes that I don't fully understand without any rationale, especially when there's a TODO in the code that hasn't been addressed.

Copy link
Contributor Author

@giautm giautm Dec 5, 2023

Choose a reason for hiding this comment

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

Hey, hello again.

I was checked the source code of awsmysql and azuremysql and notice about TLSConfig's todo. I checked mysql driver on the upstream repository and it was supported to replace with TLS field

https://github.com/go-sql-driver/mysql/blob/master/dsn.go#L125-L142

for the gcpmysql, the todo comment wasn't correct, because this package use Dial function to make the connection, which no replacement in the feature.

This is another example that use the same approach for Dial:
https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/blob/main/mysql/mysql/mysql.go#L40-L49

And the package gcpmysql also have a bug for generate driver name, it used same name for all connection.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would help if you would explain what problem you are trying to solve. Does the current code not work? Or are you trying to simplify it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplify, and fix one bug.

@giautm
Copy link
Contributor Author

giautm commented Dec 27, 2023

Hello, please let me know if you need anything to review/merge this PR.

@vangent vangent merged commit 92114ef into google:master Dec 28, 2023
6 checks passed
@giautm giautm deleted the g/mysql branch January 30, 2024 17:15
ybourgery pushed a commit to Simprints/go-cloud that referenced this pull request Jun 17, 2024
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.

2 participants