From: Brian Warner Date: Tue, 17 Apr 2007 20:41:45 +0000 (-0700) Subject: storageserver: the last segment is not always going to be the same size as the rest... X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~82 X-Git-Url: https://git.rkrishnan.org/%5B/README.win32?a=commitdiff_plain;h=dbbbc96cbf9f88799e64b8370a4277952a23ef03;p=tahoe-lafs%2Ftahoe-lafs.git storageserver: the last segment is not always going to be the same size as the rest, so don't assert such a thing --- diff --git a/src/allmydata/storageserver.py b/src/allmydata/storageserver.py index 136c5dc5..1cdea75a 100644 --- a/src/allmydata/storageserver.py +++ b/src/allmydata/storageserver.py @@ -38,7 +38,10 @@ class BucketWriter(Referenceable): def remote_put_block(self, segmentnum, data): 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.seek(self.blocksize*segmentnum) f.write(data)