[Django] #30928: documentation of select_for_update is incorrect regarding MySQL

14 views
Skip to first unread message

Django

unread,
Oct 29, 2019, 11:28:16 PM10/29/19
to django-...@googlegroups.com
#30928: documentation of select_for_update is incorrect regarding MySQL
-----------------------------------------+------------------------
Reporter: Par Andersson | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 2.2
Severity: Normal | Keywords: mysql
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
The documentation incorrectly claims that NOWAIT & SKIP LOCKED is not
supported by MySQL:

https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-for-
update

{{{
Currently, the postgresql, oracle, and mysql database backends support
select_for_update(). However, MySQL doesn’t support the nowait,
skip_locked, and of arguments.

Passing nowait=True, skip_locked=True, or of to select_for_update() using
database backends that do not support these options, such as MySQL, raises
a NotSupportedError. This prevents code from unexpectedly blocking.
}}}

However MySQL added support for nowait and skip locked since version 8, as
documented here:
https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html

--
Ticket URL: <https://code.djangoproject.com/ticket/30928>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 30, 2019, 7:15:06 AM10/30/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
--------------------------------------+------------------------------------

Reporter: Par Andersson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 2.2
Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* keywords: mysql => mysql mariadb
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Thanks, good catch. We should also update
[https://docs.djangoproject.com/en/2.2/ref/databases/#row-locking-with-
queryset-select-for-update row-locking-with-queryset-select-for-update]
and it will be good to mention MariaDB in the `select_for_update()`
[https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-for-
update documentation]. Please remember that both don't support the `of`
argument.

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:1>

Django

unread,
Nov 3, 2019, 4:30:35 AM11/3/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kolawole Nafiu Erinoso):

* owner: nobody => Kolawole Nafiu Erinoso
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:2>

Django

unread,
Nov 3, 2019, 7:12:30 PM11/3/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Kolawole Nafiu Erinoso):

The changes for the fix reside in this branch https://github.com/kola-
er/django/tree/ticket_30928_2_2.

Note that the changes do not include MariaDB because the documentation as
a whole specifically listed the supported database backends (PostgreSQL,
MySQL, Oracle and SQLite) without the mention of it even though it's a
variant of MySQL. In addition, there's an explicit omission of MariaDB
backend done within the codebase here
https://github.com/django/django/blob/stable/2.2.x/django/db/backends/mysql/features.py#L94
for the options.

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:3>

Django

unread,
Nov 3, 2019, 7:30:50 PM11/3/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Kolawole Nafiu Erinoso):

Here's the PR https://github.com/django/django/pull/12015 ready for
review.

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:4>

Django

unread,
Nov 4, 2019, 4:20:10 PM11/4/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by CarlosMirdeSouza):

The PR is closed, please update the PR to an open one.

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:5>

Django

unread,
Nov 4, 2019, 5:15:49 PM11/4/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Kolawole Nafiu Erinoso):

Here's the new PR https://github.com/django/django/pull/12018 ready for
review.

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:6>

Django

unread,
Nov 5, 2019, 8:53:31 AM11/5/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.2
Severity: Normal | Resolution: fixed

Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"a5b4a909f09955d164c3462ae32a45aa1fdd6f2d" a5b4a909]:
{{{
#!CommitTicketReference repository=""
revision="a5b4a909f09955d164c3462ae32a45aa1fdd6f2d"
[3.0.x] Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.

Thanks Par Andersson for reporting the issue.

Backport of d94d7b113c21d7a0fd802fadb1adbbec8155e880 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:7>

Django

unread,
Nov 5, 2019, 9:40:00 AM11/5/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.2

Severity: Normal | Resolution: fixed
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"d94d7b113c21d7a0fd802fadb1adbbec8155e880" d94d7b11]:
{{{
#!CommitTicketReference repository=""
revision="d94d7b113c21d7a0fd802fadb1adbbec8155e880"


Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.

Thanks Par Andersson for reporting the issue.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:8>

Django

unread,
Nov 5, 2019, 9:55:20 AM11/5/19
to django-...@googlegroups.com
#30928: Update documentation about MariaDB and MySQL support for nowait and
skip_locked arguments.
-------------------------------------+-------------------------------------
Reporter: Par Andersson | Owner: Kolawole
Type: | Nafiu Erinoso
Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.2

Severity: Normal | Resolution: fixed
Keywords: mysql mariadb | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"22466f91dccf440fa8b0aff3610ed51dbb25403b" 22466f91]:
{{{
#!CommitTicketReference repository=""
revision="22466f91dccf440fa8b0aff3610ed51dbb25403b"
[2.2.x] Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.

Thanks Par Andersson for reporting the issue.

Backport of d94d7b113c21d7a0fd802fadb1adbbec8155e880 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:9>

Reply all
Reply to author
Forward
0 new messages