Today I just stumble upon a very strange bug and I am not sure if that's
Django bug or not.

Here's the context:
I have a model Job which has a status field.

For debugging, I run python manage.py shell and do

jobs = Job.objects.filter(status__in=['A'])

*I am using MySQL 5.0 InnoDb*

Re-running this command will NOT get updated result even if a new job with
status 'A' is inserted to the DB (I explicitly turned off buffer_pool cache
and no query cache)
I then open another terminal and do python manage.py shell and run this
command and I got the newly updated result set.

So in summary:
- calling Job.objects.filter(status__in=['A']) does NOT get the latest
result from the DB, running the SQL statement directly in mysql client does
result the correct result.
- do the same query on another shell (i.e. a new python manage.py shell)
correct gets the updated result, but repeated execute gets back stale data
- checking the connection.queries[-1] shows a new SQL was sent to the DB.
- I even turned on MySQL proxy to intercept the incoming query and verify
that a new query was sent.
- ALTER TABLE jobsdone_job ENGINE=MyISAM does the magic and everything works
correctly i.e. repeated execution yields the latest data from the DB.

So is there some InnoDB specific thing in Django that does some "smart"
caching?

-Aaron

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to