python-swiftclient/swiftclient
John Dickinson 0cc4d8af18 respect bulk delete page size and fix logic error
Previously, using SwiftService to delete "many" objects would use
bulk delete if available, but it would not respect the bulk delete
page size. If the number of objects to delete exceeded the bulk delete
page size, SwiftService would ignore the error and nothing would be
deleted.

This patch changes _should_bulk_delete() to be _bulk_delete_page_size();
instead of returning a simple True/False, it returns the page size for
the bulk deleter, or 1 if objects should be deleted one at a time.
Delete SDK calls are then spread across multiple bulk DELETEs if the
requested number of objects to delete exceeds the returned page size.

Fixed the logic in _should_bulk_delete() so that if the object list
is exactly 2x the thread count, it will not bulk delete. This is the
natural conclusion following the logic that existed previously: if
the delete request can be satisfied by every worker thread doing one
or two tasks, don't bulk delete. But if it requires a worker thread
to do three or more tasks, do a bulk delete instead. Previously, the
logic would mean that if every worker thread did exactly two tasks, it
would bulk delete. This patch changes a "<" to a "<=".

Closes-Bug: 1679851
Change-Id: I3c18f89bac1170dc62187114ef06dbe721afcc2e
2017-04-20 09:41:53 -07:00
..
__init__.py Use "# noqa" instead of "#flake8: noqa" 2016-02-09 23:09:24 +08:00
authv1.py Add v1password keystoneauth plugin 2016-10-24 01:52:37 +02:00
client.py Fix logging of the gzipped body 2017-03-08 00:50:55 +04:00
command_helpers.py Add additional headers for HEAD/GET/DELETE requests. 2016-11-07 13:18:29 +08:00
exceptions.py Include response headers in ClientExceptions 2016-03-03 17:16:33 +00:00
multithreading.py Add new doc structure and contents for swiftclient 2016-04-29 19:21:36 +01:00
service.py respect bulk delete page size and fix logic error 2017-04-20 09:41:53 -07:00
shell.py [trivial] Be consistent in using example.com 2017-03-13 16:26:28 +01:00
utils.py Fix some reST field lists in docstrings 2017-03-29 09:28:46 +08:00
version.py Fix some typos 2015-12-30 11:01:33 -08:00