durusmail: durus-users: durus test code. meet some errors
durus test code. meet some errors
2009-02-20
2009-03-08
2009-03-08
2009-03-09
2009-03-09
2009-03-09
2009-03-09
2009-03-11
2009-03-11
2009-03-30
durus test code. meet some errors
Binger David
2009-03-09
Your tests have a very fast transaction rate, and that exposed
a bug in the FileStorage get_packer() method.  Transactions that
were processed by the StorageServer during the final packing phase
triggered the problem.  The method below is our proposed replacement
for this method.  Please verify that it works with your tests.

Thanks very much for your report.

- David

     def get_packer(self):
         if (self.pending_records or
             self.pack_extra is not None or
             self.shelf.get_file().is_temporary() or
             self.shelf.get_file().is_readonly()):
             return (x for x in []) # Don't pack.
         self.pack_extra = set()
         file_path = self.shelf.get_file().get_name()
         file = File(file_path + '.pack')
         file.truncate() # obtains lock and clears.
         assert file.tell() == 0
         def packer():
             yield "started %s" % datetime.now()
             items = self.gen_oid_record(start_oid=int8_to_str(0))
             for step in Shelf.generate_shelf(file, items):
                 yield step
             file.flush()
             file.fsync()
             shelf = Shelf(file)
             yield "base written %s" % datetime.now()
             for j, oid in enumerate(self.shelf):
                 yield j
                 if shelf.get_position(oid) is None:
                     self.invalid.add(oid)
             yield "invalidations identified %s" % datetime.now()
             shelf.store(
                 (name, self.shelf.get_value(name)) for name in
self.pack_extra)
             file.flush()
             file.fsync()
             if not self.shelf.get_file().is_temporary():
                 self.shelf.get_file().rename(file_path + '.prepack')
                 self.shelf.get_file().close()
             shelf.get_file().rename(file_path)
             self.shelf = shelf
             self.pack_extra = None
             yield "finished %s" % datetime.now()
         return packer()
reply