2012-11-06 13:39:32 |
david |
description |
bin/swift in python-swiftclient.
If you specific the segment size to be X, files smaller than X should NOT be put into the _segment container and be created in the main container as manifest files. Currently the do due to the following :
if options.segment_size and \
getsize(path) < options.segment_size:
two problems to my eyes - the comparison is wrong (should be greater than) and we're comparing with a string. The fix would be:
if options.segment_size and \
getsize(path) > int(options.segment_size):
>>> bigfile = '/path/to/file/bigger/than/1gig'
>>> smallfile = '/etc/hosts'
>>> segment_size = '1073741824'
>>> segment_size and os.path.getsize(bigfile) < segment_size
True
>>> segment_size and os.path.getsize(smallfile) < segment_size
True
>>> segment_size and os.path.getsize(bigfile) > segment_size
False
>>> segment_size and os.path.getsize(smallfile) > segment_size
False
>>> segment_size and os.path.getsize(smallfile) > int(segment_size)
False
>>> segment_size and os.path.getsize(bigfile) > int(segment_size)
True |
bin/swift in python-swiftclient.
If you specify the segment size to be X, files smaller than X should NOT be put into the _segment container and should not be created in the main container as manifest files. Currently they do due to the following :
if options.segment_size and \
getsize(path) < options.segment_size:
Two problems to my eyes - the comparison is wrong (should be greater than) and we're comparing with a string. The fix would be:
if options.segment_size and \
getsize(path) > int(options.segment_size):
>>> bigfile = '/path/to/file/bigger/than/1gig'
>>> smallfile = '/etc/hosts'
>>> segment_size = '1073741824'
>>> segment_size and os.path.getsize(bigfile) < segment_size
True
>>> segment_size and os.path.getsize(smallfile) < segment_size
True
>>> segment_size and os.path.getsize(bigfile) > segment_size
False
>>> segment_size and os.path.getsize(smallfile) > segment_size
False
>>> segment_size and os.path.getsize(bigfile) > int(segment_size)
True
>>> segment_size and os.path.getsize(smallfile) > int(segment_size)
False |
|