Skip to content

Commit

Permalink
Refs #16490 - Add a commit to ensure that a fresh read is provided; t…
Browse files Browse the repository at this point in the history
…his is only a problem for databases in REPEATABLE READ mode, which is MySQL InnoDB's default. Thanks to Jim Dalton for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16781 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Sep 10, 2011
1 parent fee2d18 commit eb29758
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/modeltests/select_for_update/tests.py
Expand Up @@ -205,6 +205,11 @@ def test_block(self):
# Check the thread has finished. Assuming it has, we should # Check the thread has finished. Assuming it has, we should
# find that it has updated the person's name. # find that it has updated the person's name.
self.failIf(thread.isAlive()) self.failIf(thread.isAlive())

# We must commit the transaction to ensure that MySQL gets a fresh read,
# since by default it runs in REPEATABLE READ mode
transaction.commit()

p = Person.objects.get(pk=self.person.pk) p = Person.objects.get(pk=self.person.pk)
self.assertEqual('Fred', p.name) self.assertEqual('Fred', p.name)


Expand Down

0 comments on commit eb29758

Please sign in to comment.