]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
encode.py: don't record BAD log event unless there is actually a problem
authorBrian Warner <warner@allmydata.com>
Mon, 28 Jan 2008 18:59:10 +0000 (11:59 -0700)
committerBrian Warner <warner@allmydata.com>
Mon, 28 Jan 2008 18:59:10 +0000 (11:59 -0700)
src/allmydata/encode.py

index 0815df937bba290dc2c49fdc76c3d4b8d729dd1f..a2878a41e80d38f3747903c44649f07adad2c6d9 100644 (file)
@@ -352,8 +352,9 @@ class Encoder(object):
                     encrypted_pieces.append('\x00' * pad_size)
             else:
                 # non-tail segments should be the full segment size
-                log.msg("non-tail segment should be full segment size: %d!=%d"
-                        % (length, input_chunk_size), level=log.BAD)
+                if length != input_chunk_size:
+                    log.msg("non-tail segment should be full segment size: %d!=%d"
+                            % (length, input_chunk_size), level=log.BAD)
                 precondition(length == input_chunk_size,
                              "length=%d != input_chunk_size=%d" %
                              (length, input_chunk_size))
@@ -597,7 +598,7 @@ class Encoder(object):
                 self.num_shares, self.file_size)
 
     def err(self, f):
-        self.log("UNUSUAL: %s: upload failed: %s" % (self, f))
+        self.log("upload failed", failure=f, level=log.UNUSUAL)
         # we need to abort any remaining shareholders, so they'll delete the
         # partial share, allowing someone else to upload it again.
         self.log("aborting shareholders")