diff options
author | Darrell Bishop <darrell@swiftstack.com> | 2012-08-03 19:27:07 -0700 |
---|---|---|
committer | Darrell Bishop <darrell@swiftstack.com> | 2012-08-03 19:34:40 -0700 |
commit | c87458e229281a050ecca11a0b99fa55c07ad29c (patch) | |
tree | 9ff353bb868762f363f339772c3538b682eb61f2 | |
parent | 1f6096e063cc56896039f1b09fc5d49f6b2de9ae (diff) | |
download | python-swiftclient-c87458e229281a050ecca11a0b99fa55c07ad29c.tar.gz |
Fix container delete throughput and 409 retries.
Fix race condition in _delete_container() where all elements of
object_queue have been removed, but the last one (per thread) may not
have actually been deleted yet when the container deletion thread calls
conn.delete_container(container). Fixes bug 1032879.
Improves container deletion throughput by immediately deleting
containers with no objects instead of waiting for all pending object
deletes to complete. Fixes bug 1032878.
Change-Id: I404229a4c608995294e0ada77724ac8afe8d6f3c
-rwxr-xr-x | bin/swift | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -215,16 +215,20 @@ def st_delete(parser, args, print_queue, error_queue): def _delete_container(container, conn): try: marker = '' + had_objects = False while True: objects = [o['name'] for o in conn.get_container(container, marker=marker)[1]] if not objects: break + had_objects = True for obj in objects: object_queue.put((container, obj)) marker = objects[-1] - while not object_queue.empty(): - sleep(0.01) + if had_objects: + # By using join() instead of empty() we should avoid most + # occurrences of 409 below. + object_queue.join() attempts = 1 while True: try: |