Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFixed #27683 -- Made MySQL default to the read committed isolation level. #7978
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
timgraham
Jan 28, 2017
Member
MySQL expert advice on the test failure appreciated! Perhaps it should be skipped or modified based on the transaction level.
|
MySQL expert advice on the test failure appreciated! Perhaps it should be skipped or modified based on the transaction level. |
adamchainz
reviewed
Jan 28, 2017
You know you can @ me :) There's no good way I know of auto-subscribing to django pr's featuring 'mysql'
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adamchainz
Jan 28, 2017
Member
The test fails now because the semantics for the locks used for the insert/update statements have slightly changed and now MySQL can report the duplication on the unique index earlier. This isn't a classic way of creating a deadlock, it's probably better to change the example. There's a good example in this blog post I found from the inimitable Baron Schwartz: https://www.xaprb.com/blog/2006/08/08/how-to-deliberately-cause-a-deadlock-in-mysql/ (The second one; the first relies on serializable). Afraid I don't have time to try it right now.
|
The test fails now because the semantics for the locks used for the insert/update statements have slightly changed and now MySQL can report the duplication on the unique index earlier. This isn't a classic way of creating a deadlock, it's probably better to change the example. There's a good example in this blog post I found from the inimitable Baron Schwartz: https://www.xaprb.com/blog/2006/08/08/how-to-deliberately-cause-a-deadlock-in-mysql/ (The second one; the first relies on |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
DIdn't we want to also add a compatibility check? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adamchainz
Jan 29, 2017
Member
I don't know if the check would be useful now we're just changing the default in one version. Potentially we could add one to warn users that are on 'repeatable read', but they'd be setting it manually then and it might be safer to assume they know what they're doing?
|
I don't know if the check would be useful now we're just changing the default in one version. Potentially we could add one to warn users that are on 'repeatable read', but they'd be setting it manually then and it might be safer to assume they know what they're doing? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
timgraham
Jan 30, 2017
Member
I tried to fix the test as suggested but the deadlock now happens in "other_thread" rather than the main thread. I'm taking a break on it for now.
|
I tried to fix the test as suggested but the deadlock now happens in "other_thread" rather than the main thread. I'm taking a break on it for now. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shaib
Jan 31, 2017
Member
@timgraham I don't see a reason for any deadlock there at all now. I think the fix should be to add .select_for_update() in the list(Reporter.objects.filter(id=...)) lines.
|
@timgraham I don't see a reason for any deadlock there at all now. I think the fix should be to add |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shaib
Jan 31, 2017
Member
@adamchainz The compatibility check was supposed to warn people that the default isolation level has changed; so it is supposed to trigger not based on the actual isolation level, but based on the absence of an isolation-level setting in DATABASES[...]['OPTIONS'].
|
@adamchainz The compatibility check was supposed to warn people that the default isolation level has changed; so it is supposed to trigger not based on the actual isolation level, but based on the absence of an isolation-level setting in |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adamchainz
Jan 31, 2017
Member
@shaib Yes I know, but that was when we were thinking of a "deprecation path" rather than just switching the default. If we add the check it will be noise to most people. It would require a change to all existing MySQL projects and since startproject defaults to sqlite3 it would need a change on all new projects too
|
@shaib Yes I know, but that was when we were thinking of a "deprecation path" rather than just switching the default. If we add the check it will be noise to most people. It would require a change to all existing MySQL projects and since |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
timgraham
Jan 31, 2017
Member
I tried your suggestion about the test Shai, but the result is the same.
|
I tried your suggestion about the test Shai, but the result is the same. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shaib
Jan 31, 2017
Member
@adamchainz startproject could silence the check by default; I feel uneasy about subtly changing the transaction semantics under people's feet without telling them (and the release notes don't count).
|
@adamchainz |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shaib
Jan 31, 2017
Member
@timgraham indeed adding .select_for_update() calls is necessary but not sufficient, see timgraham#10
|
@timgraham indeed adding |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adamchainz
Jan 31, 2017
Member
startprojectcould silence the check by default
That makes the default configuration a bit mysterious imo
indeed adding
.select_for_update()calls is necessary but not sufficient, see timgraham#10
Nice one
That makes the default configuration a bit mysterious imo
Nice one |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adamchainz
Jan 31, 2017
Member
feel uneasy about subtly changing the transaction semantics under people's feet without telling them (and the release notes don't count).
I do too still but at the same time, most users have never thought about this and will be confused by the message. It's a hard balance, maybe we should move back to the idea of a "deprecation" ?
I do too still but at the same time, most users have never thought about this and will be confused by the message. It's a hard balance, maybe we should move back to the idea of a "deprecation" ? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
timgraham
Jan 31, 2017
Member
My take (not as a MySQL user) given Aymeric comments, "I think there’s been little feedback because this issue is very, very far from the concerns of most Django users — aside from some very performance-sensitive websites that already worked around Django’s bugs and will add the configuration line needed to keep whatever the isolation level they chose." is that anyone running Django apps that could be affected by the change is probably careful enough to read the release notes and test their application appropriately. It doesn't seem worthwhile to nag everyone about it with a deprecation or check. Feel free to continue the discussion on the mailing list though.
|
My take (not as a MySQL user) given Aymeric comments, "I think there’s been little feedback because this issue is very, very far from the concerns of most Django users — aside from some very performance-sensitive websites that already worked around Django’s bugs and will add the configuration line needed to keep whatever the isolation level they chose." is that anyone running Django apps that could be affected by the change is probably careful enough to read the release notes and test their application appropriately. It doesn't seem worthwhile to nag everyone about it with a deprecation or check. Feel free to continue the discussion on the mailing list though. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shaib
Jan 31, 2017
Member
@adamchainz said:
maybe we should move back to the idea of a "deprecation" ?
So, instead of a check you can silence, a silent-by-default warning? I don't think that's much better. "People who check for deprecations" are not our target audience, IMO.
@timgraham said:
anyone running Django apps that could be affected by the change is probably careful enough to read the release notes and test their application appropriately. It doesn't seem worthwhile to nag everyone about it with a deprecation or check.
I've read over that discussion again now, and reached the same conclusion. Let's just change it.
@timgraham said:
Feel free to continue the discussion on the mailing list though.
Judging by the previous discussion, I think everybody who cares is already here
|
@adamchainz said:
So, instead of a check you can silence, a silent-by-default warning? I don't think that's much better. "People who check for deprecations" are not our target audience, IMO. @timgraham said:
I've read over that discussion again now, and reached the same conclusion. Let's just change it. @timgraham said:
Judging by the previous discussion, I think everybody who cares is already here |
timgraham
merged commit 924af63
into
django:master
Feb 1, 2017
17 checks passed
timgraham
deleted the
timgraham:27683
branch
Feb 1, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
It is done! |
timgraham commentedJan 28, 2017
https://code.djangoproject.com/ticket/27683