#19918: select_for_update runs on db_for_read rather than db_for_write
----------------------------------------------+--------------------
Reporter: alexandruioan.cucu@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Discussion on the developer group:
https://groups.google.com/forum/?fromgroups=#!topic/django-
developers/38gWxf5qfxg
This bug is quite easy to reproduce if you use mysql with a master-slave
replication setup and start the slave db with a --read-only flag:
{{{
Traceback:
File "/home/kux/workspace/src/other/django/django/core/handlers/base.py"
in get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
File
"/home/kux/workspace/src/other/django/django/contrib/admin/options.py" in
wrapper
366. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/home/kux/workspace/src/other/django/django/utils/decorators.py" in
_wrapped_view
91. response = view_func(request, *args, **kwargs)
File
"/home/kux/workspace/src/other/django/django/views/decorators/cache.py" in
_wrapped_view_func
89. response = view_func(request, *args, **kwargs)
File "/home/kux/workspace/src/other/django/django/contrib/admin/sites.py"
in inner
196. return view(request, *args, **kwargs)
File "/home/kux/workspace/src/other/django/django/db/transaction.py" in
inner
209. return func(*args, **kwargs)
File "/home/kux/workspace/src/other/django-cms/cms/admin/pageadmin.py" in
wrap
154. Page.objects.select_for_update()
File "/home/kux/workspace/src/other/django/django/db/models/query.py" in
exists
562. return self.query.has_results(using=self.db)
File "/home/kux/workspace/src/other/django/django/db/models/sql/query.py"
in has_results
441. return bool(compiler.execute_sql(SINGLE))
File
"/home/kux/workspace/src/other/django/django/db/models/sql/compiler.py" in
execute_sql
818. cursor.execute(sql, params)
File "/home/kux/workspace/src/other/django/django/db/backends/util.py" in
execute
40. return self.cursor.execute(sql, params)
File
"/home/kux/workspace/src/other/django/django/db/backends/mysql/base.py" in
execute
114. return self.cursor.execute(query, args)
File "/home/kux/workspace/envs/hb23/local/lib/python2.7/site-
packages/MySQLdb/cursors.py" in execute
174. self.errorhandler(self, exc, value)
File "/home/kux/workspace/envs/hb23/local/lib/python2.7/site-
packages/MySQLdb/connections.py" in defaulterrorhandler
36. raise errorclass, errorvalue
Exception Type: DatabaseError at /admin/cms/page/add/
Exception Value: (1290, 'The MySQL server is running with the --read-only
option so it cannot execute this statement')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/19918>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.