changed end_marker to not be inclusive

This commit is contained in:
John Dickinson 2010-11-29 10:58:23 -06:00
parent f3f62520a0
commit 78a150751d
3 changed files with 8 additions and 8 deletions

View File

@ -979,7 +979,7 @@ class ContainerBroker(DatabaseBroker):
FROM object WHERE'''
query_args = []
if end_marker:
query += ' name <= ? AND'
query += ' name < ? AND'
query_args.append(end_marker)
if marker and marker >= prefix:
query += ' name > ? AND'

View File

@ -137,11 +137,11 @@ class LogProcessor(object):
year = '%04d' % parsed_date.tm_year
month = '%02d' % parsed_date.tm_mon
day = '%02d' % parsed_date.tm_mday
hour = '%02d' % parsed_date.tm_hour
# Since the end_marker filters by <=, we need to add something
# to then end_key to make sure we get all the data under the
# last hour. Adding '/\x7f' should be all inclusive.
end_key = '/'.join([year, month, day, hour]) + '/\x7f'
# Since the end_marker filters by <, we need to add something
# to make sure we get all the data under the last hour. Adding
# one to the hour should be all-inclusive.
hour = '%02d' % (parsed_date.tm_hour + 1)
end_key = '/'.join([year, month, day, hour])
container_listing = self.internal_proxy.get_container_list(
swift_account,
container_name,

View File

@ -984,9 +984,9 @@ class TestContainerBroker(unittest.TestCase):
self.assertEquals(listing[-1][0], '0/0099')
listing = broker.list_objects_iter(100, '', '0/0050', None, '')
self.assertEquals(len(listing), 51)
self.assertEquals(len(listing), 50)
self.assertEquals(listing[0][0], '0/0000')
self.assertEquals(listing[-1][0], '0/0050')
self.assertEquals(listing[-1][0], '0/0049')
listing = broker.list_objects_iter(100, '0/0099', None, None, '')
self.assertEquals(len(listing), 100)