1. 21 Dec, 2001 1 commit
  2. 20 Dec, 2001 2 commits
  3. 05 Dec, 2001 1 commit
  4. 04 Dec, 2001 2 commits
  5. 30 Nov, 2001 2 commits
    • Jeremy Hylton's avatar
    • Jeremy Hylton's avatar
      Ensure that new code produces pickles acceptable to old code. · 8e9260c5
      Jeremy Hylton authored
      Add __getstate__() and __setstate__() methods.
      
      Thanks to Chris McDonough for helping me see the problem.
      
      There are extensive comments that discuss the backwards compatibility
      issues.  Basically, we must be careful that the pickles these methods
      operate on are just like the pickles generated by the old code, or
      developers couldn't switch back and forth between new and old code.
      That's a incompatibility we aren't willing to live with for now --
      perhaps not ever.
      
          # If the internal representation of PersistentMapping changes,
          # it causes compatibility problems for pickles generated by
          # different versions of the code.  Compatibility works in both
          # directions, because an application may want to share a database
          # between applications using different versions of the code.
      
          # Effectively, the original rep is part of the "API."  To provide
          # full compatibility, the getstate and setstate must read and
          # right objects using the old rep.
      
          # As a result, the PersistentMapping must save and restore the
          # actual internal dictionary using the name _container.
      8e9260c5
  6. 28 Nov, 2001 4 commits
  7. 27 Nov, 2001 2 commits
    • Jeremy Hylton's avatar
      Make consistent use of assignment to _p_changed instead of __changed__(). · 4ab87b52
      Jeremy Hylton authored
      The doc string for __changed__() says that it is deprecated, but
      presumably the calls here were old and just never got updated.
      4ab87b52
    • Jeremy Hylton's avatar
      Simplify and cleanup implementation of PersistentMapping. · abc8eb11
      Jeremy Hylton authored
      The implementation now defers all implementation decisions to UserDict
      and merely handles updates to _p_changed in the PersistentMapping
      implementation.  This change simplifies the implementation and ensures
      that it implements all the new methods of dictionaries like popitem()
      and setdefault().
      
      There is one (important?) behavioral change:  The old implementation
      of the keys() method did not return keys that were strings starting
      with underscore.  This behavior was undocumented and could lead to
      problems for implementations that expect keys() to working like a
      regular mapping.
      
          The feature was removed after verifying that the Zope test suite
          does not depend on this behavior.
      
      An internal implementation change is that the PersistentMapping does
      not keep a copy of the keys() of the dict.  It simplifies the
      implementation a lot to remove the cacheing and the benefit is
      unclear.  It only benefits applications that call keys() frequently
      without modifying the dict.  And it requires that two copies of the
      list exist for each call to keys() which may require a lot of space.
      abc8eb11
  8. 26 Nov, 2001 1 commit
  9. 16 Nov, 2001 1 commit
  10. 08 Nov, 2001 6 commits
    • Barry Warsaw's avatar
      initcoptimizations(): Some cleanup of the initializer. First be sure · 0fb1d30e
      Barry Warsaw authored
      to decref the revision string, added to the module dict with the keys
      "__version__".  This fixes a small leaks detected by Insure.
      
      Also, at the end of the function, we do a PyErr_Occurred() check and
      throw a fatal error if true.  This makes this module's init function
      more in line with other init functions in this package.
      0fb1d30e
    • Barry Warsaw's avatar
      initcPickleCache(): Some cleanup of the initializer. First be sure to · 1fc6caac
      Barry Warsaw authored
      decref the revision string, added to the module dict with the keys
      "__version__".  This fixes a small leaks detected by Insure.
      
      Also, at the end of the function, we do a PyErr_Occurred() check and
      throw a fatal error if true.  This makes this module's init function
      more in line with other init functions in this package.
      1fc6caac
    • Barry Warsaw's avatar
      initcPersistence(): Some cleanup of the initializer. First be sure to · 0efdedfe
      Barry Warsaw authored
      decref the revision string, added to the module dict with the keys
      "__version__".  Do the same with the PyCObject set to the dict's
      "CAPI" key.  This fixes small leaks detected by Insure.
      
      Also, clean up the way the global TimeStamp static is handled on
      creation failure.  We need to decref `s' whether or not TimeStamp was
      properly created or not.  Also, at the end of the function, we do a
      PyErr_Occurred() check and throw a fatal error if true.  This makes
      this module's init function more in line with other init functions in
      this package.
      0efdedfe
    • Barry Warsaw's avatar
      initTimeStamp(): Some cleanup of the initializer. First be sure to · 8640cc84
      Barry Warsaw authored
      decref the revision string, added to the module dict with the keys
      "__version__".  This fixes a small leaks detected by Insure.
      
      Also, instead of returning from the init should the
      PyString_FromString() of "TimeStamp.error fail, we simply take
      precautions by XDECREF'ing it.  Then at the end of the function, we do
      a PyErr_Occurred() check and throw a fatal error if true.  This makes
      this module's init function more in line with other init functions in
      this package.
      8640cc84
    • Jeremy Hylton's avatar
    • Barry Warsaw's avatar
      INITMODULE(): Be sure to decref the $Revision$ string added to the · 50754cda
      Barry Warsaw authored
      module dictionary under the "__version__" key.  Plugs a small memory
      leak caught by Insure.
      50754cda
  11. 07 Nov, 2001 2 commits
    • Jeremy Hylton's avatar
      Really stop the leak of file descriptors! · 4858c98e
      Jeremy Hylton authored
      The previous checkin stopped using the per-connection trigger, but
      didn't stop creating it.  (Dang.)
      
      Thanks to Shane for noticing.
      4858c98e
    • Jim Fulton's avatar
      Totally rewrote recovery script to use an entirely different approach · 2d0d8c08
      Jim Fulton authored
      based on:
      
        - transaction iteration/copy
      
        - scanning for transactions after bad data
      
      This should allow recovery of data when:
      
        - only data records are damaged and when
      
        - multiple parts of a file are damaged
      
      The interface has changed to not modify in place.
      
      Other features:
      
        - Progress indicator
      
        - Verbose output
      
        - optional packing
      
        - index creation
      2d0d8c08
  12. 06 Nov, 2001 3 commits
  13. 02 Nov, 2001 4 commits
  14. 31 Oct, 2001 1 commit
    • Jeremy Hylton's avatar
      Fix memory leak in BTrees. · c294cd02
      Jeremy Hylton authored
      The Mapping_update() method iterated over a sequence of 2-tuples, but
      held an extra reference to the sequence.  The sequence object was
      DECREFed on an error exit but not on the normal return.
      
      The fix reworks the control flow of the function to make the reference
      counting behavior a little clearer:
      
         - Test for call with no arguments and return immediately if so.
      
         - If the argument is a sequence, don't INCREF it.
      
         - If the argument passed isn't a sequence, call its items() method
           and store the result in the local variables seq and items.
      
         - On exit, do Py_XDECREF(items).  This will do a decref only if a
           the second case above applied.
      
      Two other minor nits:
      
         - Make consistent use of spaces around = in assignments (as opposed
           to a fix of both)
      
         - Remove assignment from conditional expression.
      c294cd02
  15. 29 Oct, 2001 3 commits
    • Jeremy Hylton's avatar
      Add a sleep(1) before each pack() call. · 13a4bef6
      Jeremy Hylton authored
      pack() uses a coarse-grain timer to decide which revisions to look at
      during a pack.  The tests depend on a pack() called after a commit to
      see that committed transaction, but the implementation can't guarantee
      that it will.
      
      In particular, pack() converts its time argument to a TimeStamp by
      truncating to the nearest second.  If a transaction T1 commits and pack
      is called (with the current time as its argument) during the same second,
      the pack() will not consider T1.  This was causing intermittent, but
      frequent test failures on Windows.
      
      The fix is to add a small delay in the pack test cases to guarantee that
      pack(time.time()) will always see the last committed transaction.
      13a4bef6
    • Jeremy Hylton's avatar
      Small change to pack to make it more robust. · b94b218f
      Jeremy Hylton authored
      If the packpos returned by the read_index() call is 4, return immediately.
      In this case, the very first transaction, which contains the root object,
      is after the pack time.  This is a degenerate case, but it seems clearest
      to do nothing.
      
      This change eliminates an unexpected traceback in pack() that occurred
      frequently, but not every time, when testing on Windows.  When
      read_index() returned 4, a seek() call in _redundant_pack() would fail
      with a bad argument.
      
      Add an assertion to _redundant_pack() because it should never be called
      with bogus arguments as a result of the other change.
      b94b218f
    • Jeremy Hylton's avatar
      Fix test to succeed on Windows. · 0b70a63b
      Jeremy Hylton authored
      Don't test for explicit end-of-line markers, since they vary across
      platforms.  Instead, strip() the line read and test for the actual content.
      0b70a63b
  16. 26 Oct, 2001 3 commits
    • Jeremy Hylton's avatar
      Tests for transactional undo support need to be more cautious: · ebdf1e36
      Jeremy Hylton authored
      If a storage doesn't support T.U. and is old enough, you need to first
      check if it has a supportsTransactionalUndo attribute.
      ebdf1e36
    • Jeremy Hylton's avatar
      Update tests so that ZEO tests pass on Zope 2.3. · 32425b5a
      Jeremy Hylton authored
      There are a few problems with Zope 2.3 that prevented the tests from
      succeeding.  Since the 1.0 release must support Zope 2.3, we'll need
      to hack the various tests to work around them.
      
          Assuming releases after 1.0 don't need to work with 2.3: After the
          1.0 final release, I'll tag both ZEO and ZODB trees and then undo
          all these silly changes.
      
      Problems:
      
          - no support for transactional undo or getSerial()
          - FileStorage commitVersion() and abortVersion() didn't check for
            bogus arguments
      32425b5a
    • Jeremy Hylton's avatar
      Some reformatting for readability. · 21067f66
      Jeremy Hylton authored
      21067f66
  17. 24 Oct, 2001 2 commits