-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 storage - Take 2 #1485
MySQL storage - Take 2 #1485
Conversation
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.
Thanks for your contribution, and thanks for picking up where this was left off. (Also thanks to @pborzenkov)
I know that maintaining a storage backend takes a lot of time, I can offer my help (becoming a maintainer if needed/acceptable).
I think that might be a good idea -- @JoelSpeed, what do you think?
} | ||
|
||
func testDB(t *testing.T, o opener, withTransactions bool) { | ||
// t.Fatal has a bad habbit of not actually printing the error |
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.
IIRC the problem is the timeout. If a test times out, the t.Fatal(...)
output will be lost. If it doesn't timeout, you'll see it just fine.
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.
Should I just change it back? TBH I haven't had issues with Fatal
.
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.
It's fine, we can revisit that some other time 👍
@@ -61,14 +63,14 @@ func (c *conn) migrate() (int, error) { | |||
} | |||
|
|||
type migration struct { | |||
stmt string | |||
stmts []string |
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.
Why do we need this? I haven't dug into this code in a while, but I'd think we could wrap stuff in BEGIN; ... COMMIT;
, maybe? What's wrong with the ;
concatenation? 🤔I guess it's difficult to spot what's wrong; transactions-wise, I think it should not matter, should it?
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.
The issue here is that MySQL driver by default doesn't support multiple statements in one execution, in my original implementation I have used https://github.com/go-sql-driver/mysql#multistatements and this change is not needed. If you think that using that is better I can use that version.
@@ -77,8 +79,8 @@ var migrations = []migration{ | |||
public boolean not null, | |||
name text not null, | |||
logo_url text not null | |||
); | |||
|
|||
);`, |
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.
[nit] If we do this as multiple calls to tx.Exec
, we don't need the ending ;
, I think.
@@ -38,8 +38,10 @@ func (c *conn) migrate() (int, error) { | |||
|
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.
Correct me if I'm wrong, but if this change has nothing to do with the mysql backend, I'd rather split it off... 😃
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.
This is because of the multistatement stuff :)
matrix: | ||
include: | ||
- go: '1.12.x' | ||
|
||
env: | ||
global: DEX_POSTGRES_DATABASE=postgres DEX_POSTGRES_USER=postgres DEX_POSTGRES_HOST="localhost" DEX_ETCD_ENDPOINTS=http://localhost:2379 DEX_LDAP_TESTS=1 DEBIAN_FRONTEND=noninteractive DEX_KEYSTONE_URL=http://localhost:5000 DEX_KEYSTONE_ADMIN_URL=http://localhost:35357 DEX_KEYSTONE_ADMIN_USER=demo DEX_KEYSTONE_ADMIN_PASS=DEMO_PASS | ||
global: |
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.
👍 It's about time this happens.
The Postgres backend uses strict SSL verification by default, should this backend have the same semantics? |
I think that would be fair. 🤔 |
I made MySQL |
@bonifaido would you mind squashing these? maybe one commit per author? |
It will be shared by both Postgres and MySQL configs. Signed-off-by: Pavel Borzenkov <[email protected]>
Rebase done! 👍 |
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.
Thank you, @pborzenkov and @bonifaido! 🎉 👏
MySQL storage - Take 2
Question: Is there anything that specifically requires MySQL 5.7, or would 5.6 work? I'd like to run it against an Amazon Aurora Serverless database, and they claim they are compatible with MySQL 5.6. |
Hi @forsberg, the only issue that comes into my mind is the https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation
So we need to add some kind of logic to detect MySQL 5.6 and use But, I just checked and AWS Aurora supports 5.7 today: https://aws.amazon.com/about-aws/whats-new/2018/02/amazon-aurora-is-compatible-with-mysql-5-7/ It would be nice to run some tests on Aurora first since they say that SERIALIZABLE isolation level is not supported, but I have no idea if it is or not, and that is a hard requirement by Dex currently, please see: #1370 (comment) |
Okay, I just created an AWS Aurora instance for a quick check with MySQL 5.7 (Aurora version of the db was 2.04.6) and the transaction_isolation variable is still unavailable, probably this version is not MySQL 5.7.20. |
AWS Aurora does indeed support what they call 5.7, but AWS Aurora Serverless (where you don't have to run instances yourself) only support 5.6. This is pretty hard to find in the documentation, but is documented in the FAQ. |
This PR tries to continue where #924 dropped off, namely on the work of @pborzenkov, I have changed the following stuff:
Tested with MySQL 5.7 and 8.0.
I know that maintaining a storage backend takes a lot of time, I can offer my help (becoming a maintainer if needed/acceptable).