Fixed #9479 -- Corrected an edge case in bulk queryset deletion that could cause an infinite loop when using MySQL InnoDB.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10913 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2009-06-03 13:23:19 +00:00
parent be907bcdcb
commit 2416e5fefe
4 changed files with 78 additions and 2 deletions

View file

@ -355,10 +355,11 @@ class QuerySet(object):
# Delete objects in chunks to prevent the list of related objects from
# becoming too long.
seen_objs = None
while 1:
# Collect all the objects to be deleted in this chunk, and all the
# objects that are related to the objects that are to be deleted.
seen_objs = CollectedObjects()
seen_objs = CollectedObjects(seen_objs)
for object in del_query[:CHUNK_SIZE]:
object._collect_sub_objects(seen_objs)