#30928 closed Cleanup/optimization (fixed)
Update documentation about MariaDB and MySQL support for nowait and skip_locked arguments.
Reported by: | Par Andersson | Owned by: | Kolawole Nafiu Erinoso |
---|---|---|---|
Component: | Documentation | Version: | 2.2 |
Severity: | Normal | Keywords: | mysql mariadb |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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
Change History (9)
comment:1 by , 5 years ago
Keywords: | mariadb added |
---|---|
Summary: | documentation of select_for_update is incorrect regarding MySQL → Update documentation about MariaDB and MySQL support for nowait and skip_locked arguments. |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
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.
comment:4 by , 5 years ago
Here's the PR https://github.com/django/django/pull/12015 ready for review.
comment:6 by , 5 years ago
Here's the new PR https://github.com/django/django/pull/12018 ready for review.
Thanks, good catch. We should also update row-locking-with-queryset-select-for-update and it will be good to mention MariaDB in the
select_for_update()
documentation. Please remember that both don't support theof
argument.