storageserver: the last segment is not always going to be the same size as the rest, so don't assert such a thing

This commit is contained in:
Brian Warner 2007-04-17 13:41:45 -07:00
parent 2e15c9aed2
commit dbbbc96cbf

View File

@ -38,7 +38,10 @@ class BucketWriter(Referenceable):
def remote_put_block(self, segmentnum, data): def remote_put_block(self, segmentnum, data):
precondition(not self.closed) precondition(not self.closed)
assert len(data) == self.blocksize # all blocks but the last will be of size self.blocksize, however the
# last one may be short, and we don't know the total number of
# segments so we can't tell which is which.
assert len(data) <= self.blocksize
f = open(os.path.join(self.incominghome, 'data'), 'wb') f = open(os.path.join(self.incominghome, 'data'), 'wb')
f.seek(self.blocksize*segmentnum) f.seek(self.blocksize*segmentnum)
f.write(data) f.write(data)