From dbbbc96cbf9f88799e64b8370a4277952a23ef03 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 17 Apr 2007 13:41:45 -0700 Subject: [PATCH] storageserver: the last segment is not always going to be the same size as the rest, so don't assert such a thing --- src/allmydata/storageserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.45.2