1. 21 May, 2001 2 commits
    • Jeremy Hylton's avatar
      Fix deadlock problem reported by John D. Heintz. · 30e6b67a
      Jeremy Hylton authored
      If one thread was committing a transaction and another thread was
      opening a new DB connection, deadlock could occur.  The cause of the
      deadlock is that tpc_finish() acquires the storage and db locks in a
      different order than DB.open().  As a result, if each starts at the
      same time and gets one of the two locks it needs, the system will be
      deadlocked.
      
      The solution is to enforce a consistent locking order.  If a thread is
      going to hold the DB lock and the storage lock, it MUST acquire the DB
      lock first.  This patch implements that locking order for the
      invalidation in tpc_finish().
      
      The DB object gets methods called begin_invalidation() and
      finish_invalidation() that acquire and release the DB lock
      respectively.  Before the Connection calls tpc_finish() on the
      storage, it calls begin_invalidation().  This guarantees that the DB
      acquired before the storage lock.
      
      When the invalidation phase is over, the Connection calls
      end_invalidation() to release the DB lock.  This is an optimization.
      It could wait until tpc_finish() returns, but we know that the DB will
      not be used again for the rest of the tpc_finish() and tpc_finish()
      could take a long time.
      
      Specific changes:
      
      DB.py
      begin_invalidation(): Added.
      finish_invalidation(): Added.
      invalidate(): Remove locking.
      invalidateMany(): Add comment about how it should be used.
      
      Connection.py
      tpc_finish(): Don't pass second argument to storage's tpc_finish()
          when committing a transaction with no data.  Add call to
          begin_invalidation() before calling storage's tpc_finish().
      _invalidate_sub(): Remove empty, unnecessary method.
      _invalidating_invalidating(): Add call to finish_invalidation() after
          last call to DB's invalidate().
      30e6b67a
    • Evan Simpson's avatar
      Fixed assorted typos (Collector #218) · 4fc9694d
      Evan Simpson authored
      4fc9694d
  2. 20 May, 2001 2 commits
  3. 18 May, 2001 1 commit
  4. 17 May, 2001 1 commit
  5. 16 May, 2001 1 commit
  6. 14 May, 2001 1 commit
    • Jeremy Hylton's avatar
      Fix get_info() so that it copes if the storage doesn't define a · 65391a99
      Jeremy Hylton authored
      "supportsTransactionalUndo()" method.
      
      XXX untested
      
      XXX This mechanism for feature evolutional doesn't seem right, because
      it because a morass of backwards compatibility issues.  I'd rather see
      the test by one of presence/absence of an attribute or a base class.
      65391a99
  7. 10 May, 2001 3 commits
  8. 09 May, 2001 12 commits
  9. 08 May, 2001 10 commits
  10. 02 May, 2001 7 commits
    • Jeremy Hylton's avatar
      Fix order of return values from _undoDataInfo(). · 95cb9170
      Jeremy Hylton authored
      The cdata and cver had been swapped, causing all undos to fail,
      because the version was compared to a pickle.
      95cb9170
    • Jeremy Hylton's avatar
      Three new tests: · 32bad8be
      Jeremy Hylton authored
      checkBuggyResolve2() -- _p_resolveConflict takes too few args
      checkUndoConflictResolution() -- make sure conflict resolution is
           invoked properly during transactional undo
      checkUndoUnresolvable() -- make sure transactional undo can cope with
           failed conflict resolution
      32bad8be
    • Jeremy Hylton's avatar
      07cd63ab
    • Jeremy Hylton's avatar
      Fix tests to work correctly with conflict resolution. · 58cfe930
      Jeremy Hylton authored
      Add new tests for conflict resolution.
      
      The old blanket try-except for conflict resolution was hiding some
      bugs caused by the pickles used in the test suite.  The conflict
      resolution code imposes some restrictions on the format of pickles.
      Basically, the conflict resolution requires that the storage API only
      accept a pickles that constructed according to the ZODB rules.
      
      XXX This new restriction sounds unfortunate, but it would require a
      substantial change to conflict resolution to remove it.
      
      The key changes to the test suite are to store only persistent objects
      and to format the pickles using the standard ZODB format.  All tests
      now use ZODB.tests.MinPO.MinPO instances for data.  The pickling is
      down with zodb_pickle() and zodb_unpickle() defined in
      StorageTestBase.
      
      Add conflict resolution tests to testFileStorage.  (They pass.)
      58cfe930
    • Jeremy Hylton's avatar
      Fix conflict resolution bug in transactionalUndo. · 95f9483c
      Jeremy Hylton authored
      The value of _loadBack() -- a pickle and a serialno -- was being
      passed to tryToResolveConflict() where only a pickle was expected.
      
      XXX _loadBack() can raise KeyError, but this wasn't handled by the
      code.  Turn into UndoError() for now.
      95f9483c
    • Jeremy Hylton's avatar
      Replace blanket try-except for all exceptions with try-except for · 23387167
      Jeremy Hylton authored
      exactly one exception, ConflictError
      
      Remove klass._p_resolveConflict line, because it's only apparent
      purpose was to raise an AttributeError that was caught by the blanket
      try-except.  Instead, let the later code, which actually uses
      _p_resolveConflict() catch the AttributeError and return 0.
      23387167
    • Jeremy Hylton's avatar