1. 01 Apr, 2002 2 commits
    • Jeremy Hylton's avatar
      Cache cleanups. · 5cd55aa4
      Jeremy Hylton authored
      Remove use of staticforward.
      
      Avoid forward reference to Cctype by defining newccobject after type
      struct.
      5cd55aa4
    • Jeremy Hylton's avatar
      Some first cosmetic changes to the new cache implementation. · 09125899
      Jeremy Hylton authored
      Define the contents of ccobject_head_struct via CACHE_HEAD macro.
      Don't rely on two different files to define a struct with the same
      layout by convention.
      
      Remove many levels of parentheses from the HOME and NON_GHOST_COUNT
      macros.
      
      Replace KEEP_THIS_ONE_AROUND_FOR_A_WHILE() macro with a call to the
      accessed() function.  (Who comes up with these names :-).
      
      Remove include of string.h in cPersistence.c.
      
      Expand cPersistent_HEAD macro so that it has one line for each
      attribute!
      
      Use typedef to define PerCache as "struct ccobject_head_struct" and
      use this for the entry cache slot in cPersistent_HEAD instead of
      PyObject *.
      
      In cPickleCache.c, reflow a bunch of long lines, add some whitespace,
      and an XXX comment explaining that I don't understand a different
      comment.
      09125899
  2. 30 Mar, 2002 2 commits
    • Jeremy Hylton's avatar
      Two new tests. · 86cc6f96
      Jeremy Hylton authored
      These tests verify that transactional undo works with abortVersion and
      commitVersion, even in the face of a pack that invalidates the file
      position contained in the transaction record.
      86cc6f96
    • Jeremy Hylton's avatar
      Simplify transactional undo implementation. · 6b003959
      Jeremy Hylton authored
      Use the file position stored in the transaction_id whenever possible.
      It is possible when _check_txn_pos() returns true; i.e. when the file
      position does point to the transaction record header.
      
      Remove ostloc and here arguments to _txn_undo_write(), as they can be
      computed after the call.
      
      Omit redundant tests in _txn_undo_write().  All the paths that lead
      here verify that the file position is valid.
      
      Remove some attribute lookup optimizations.
      6b003959
  3. 29 Mar, 2002 9 commits
    • Jeremy Hylton's avatar
      Break up transactionalUndo() into possibly understandable chunks. · 0e8427c9
      Jeremy Hylton authored
      transactionalUndo() does argument checking and locking.  It calls
      _transactional_undo(), which finds the right transaction record.  It calls
      _txn_undo_write(), which writes the data records.
      
      Add a summary comment above undoLog() that explains how the
      transaction_id is created and used.
      0e8427c9
    • Jeremy Hylton's avatar
      Move undoLog() before transactionalUndo(). · 8f9d1fc4
      Jeremy Hylton authored
      It makes more sense in this order, because the comments in undoLog()
      help to explain what transactionalUndo() is doing.
      8f9d1fc4
    • Jeremy Hylton's avatar
      663174eb
    • Jeremy Hylton's avatar
      Simplify implementation of undoLog() and add comment about how it · 7b1532bf
      Jeremy Hylton authored
      appears to be broken.
      7b1532bf
    • Shane Hathaway's avatar
      The file position has to be encoded in the transaction ID for non-transactional · 065bfea5
      Shane Hathaway authored
      undo to continue to work, and the IDs have to be base64 encoded to work on
      HTML forms.  In future, non-transactional undo may be removed and the HTML
      forms might be updated to perform the encoding of transaction IDs.
      065bfea5
    • Barry Warsaw's avatar
      Here is a fix for a problem reported against the standby replicas. In · 606639c4
      Barry Warsaw authored
      that environment, it is possible that all the data in the replicas
      recoverable through the public api are identical, while the actual
      on-disc representation differs.  This bug can be boiled down to doing
      the following in "standard" ZODB:
      
          1. undoLog()
          2. pack()
          3. transactionalUndo()
      
      Previously, undoLog() encoded the file position in the 'id' key of the
      undo record, but of course the pack() breaks that file position.  We
      fix this by encoding the oid of an object touched in the transaction
      instead.  That way, transactionalUndo() can start at the current
      revision of the object, and scan back until it can find a transaction
      with a matching id to the one we're undoing.
      
      This approach breaks when the transaction we're undoing doesn't touch
      any objects, e.g. is an abortVersion() or commitVersion().  By edict,
      that's a non-requirement for now.  We could fix that by doing a more
      expensive binary search for the matching transaction.
      
      WIBNI we had an index from tids to file positions? :)
      606639c4
    • Barry Warsaw's avatar
      checkTransactionalUndoAfterPack(): Removed two tests that weren't · d9c08573
      Barry Warsaw authored
      really testing what we're interested in (they were testing the
      equality of the exact layout of the undoInfo() -- not interesting).
      d9c08573
    • Barry Warsaw's avatar
      checkTransactionalUndoAfterPack(): A better test which confirms the · 84a87a68
      Barry Warsaw authored
      suspicion that FileStorage (and an FS-backed ZEO) fails a
      transactional undo after a pack, but Berkeley storage passes.
      84a87a68
    • Jeremy Hylton's avatar
      Don't pass a revid to pack(). Pass the current time. · 6410bd0f
      Jeremy Hylton authored
      Two problems: A revid doesn't have the right type.  But even if we
      decoded the revid using TimeStamp(revid).timeTime(), it would be the
      wrong time.  We want to pack to the current time to delete older
      revisions.
      
      I believe the test case tried to keep one revision available so that
      it could be packed.  The new test doesn't do that, so it will fail
      even after we fix FileStorage.  I think the right answer is to call
      time.time() after the second commit *and* make sure that there is at
      least a one second delay between the two stores.
      6410bd0f
  4. 28 Mar, 2002 4 commits
    • Barry Warsaw's avatar
      checkTransactionalUndoAfterPack(): This is a test which should provoke · cc4b9ae5
      Barry Warsaw authored
      the underlying bug in transactionalUndo() on a standby storage.  If
      our hypothesis is correct, the bug is in FileStorage, and is caused by
      encoding the file position in the `id' field of the undoLog
      information.  Note that Full just encodes the tid, but this is a
      problem for FileStorage (we have a strategy for fixing this).
      
      NOTE: checking this in on the trunk is mildly antisocial because it
      introduces failures in the test suite.  I'm doing it this way because
      1) it really isn't worth a branch, even a short lived one; 2) Jeremy
      may have time to look at it before tomorrow; 3) I don't trust my
      machine not to lock up and make this mod unavailable. :(
      
      Either way, this /will/ get fixed by tomorrow.
      cc4b9ae5
    • Jeremy Hylton's avatar
      Replace more KeyErrors with POSKeyErrors · 48874b2e
      Jeremy Hylton authored
      48874b2e
    • Jeremy Hylton's avatar
      zeoup now writes an object in the root to test transaction commit. · e7e18db7
      Jeremy Hylton authored
      The --nowrite option will disable writing.  (It's not possible to
      enable writing and disable reading, so that's the only option.)
      e7e18db7
    • Jeremy Hylton's avatar
      Backport Jim's conflict error fix from the Zope-3x-branch. · 028a8c94
      Jeremy Hylton authored
      The problem was that the randomly generated test data was occasionally
      invalid.  Fix is to hardcode a specific set of test data instead of
      using random.
      028a8c94
  5. 27 Mar, 2002 1 commit
  6. 15 Mar, 2002 4 commits
  7. 12 Mar, 2002 2 commits
  8. 11 Mar, 2002 1 commit
  9. 08 Mar, 2002 3 commits
    • Jeremy Hylton's avatar
      (Possibly) correct use of Python memory APIs. · 469b47a0
      Jeremy Hylton authored
      Fix SF bug #516768 reported by Dave Wallace.
      
      Replace use of PyMem_DEL() with PyObject_Del() on object dealloc
      functions.  The use of PyMem_DEL() is incorrect for object
      deallocation, because it only ever calls the low-level free().  If a
      custom allocator like pymalloc is used, it needs to be called to free
      the memory.
      469b47a0
    • Jeremy Hylton's avatar
      (Possibly) correct use of Python memory APIs. · ff24f9df
      Jeremy Hylton authored
      Fix SF bug #516768 reported by Dave Wallace.
      
      Replace use of PyMem_DEL() with PyObject_Del() on object dealloc
      functions.  The use of PyMem_DEL() is incorrect for object
      deallocation, because it only ever calls the low-level free().  If a
      custom allocator like pymalloc is used, it needs to be called to free
      the memory.
      
      Also replace bare malloc() and realloc() with PyMem_Malloc() and
      PyMem_Realloc().  I think this isn't a strict bug fix, but a would be
      nice.  It guarantees that BTrees objects get their memory from the
      same allocator as the Python core.
      ff24f9df
    • Jeremy Hylton's avatar
      Add a sane __str__() to transaction objects. · 0afd8bdf
      Jeremy Hylton authored
         The previous, insane version was passing None or a thread id to "%.03f".
      
      Add some whitespace around get_transaction() implementations.
      0afd8bdf
  10. 28 Feb, 2002 2 commits
  11. 21 Feb, 2002 1 commit
  12. 20 Feb, 2002 1 commit
  13. 13 Feb, 2002 1 commit
  14. 12 Feb, 2002 3 commits
  15. 11 Feb, 2002 4 commits
    • Guido van Rossum's avatar
    • Guido van Rossum's avatar
      Upgrade to ZPL 2.0 (merge) · 09d96587
      Guido van Rossum authored
      09d96587
    • Guido van Rossum's avatar
      Adding AMK's guide (merge) · 1f7fd3ac
      Guido van Rossum authored
      1f7fd3ac
    • Jeremy Hylton's avatar
      Major reformatting of code along with a few sundry changes. · 5c0bad8d
      Jeremy Hylton authored
      Summary of changes:
      
      - Add function gc_all_items() to call gc_item() on everything in
        dict.  This factors out common code in all the gc methods.
      
      - Add check_size() function that factors out code to check cache size
        before starting a gc.
      
      - Simplify argument processing in cc_invalidate(), avoiding a second
        call to PyArg_ParseTuple() when argument is a sequence instead of a
        dictionary.
      
      - Chance code to reflect belief that NULL return from PyDict_GetItem()
        does not set exception, except in cases that don't apply for the
        pickle cache like comparing a string with high-order bit set to a
        Unicode object.
      
      - Use if (!expr) instead of UNLESS().
      
      - Remove all statements from conditionals.
      
      - Reformat to 4 spaces and Python-style brace placement.
      
      - Put whitespace around operators and after commas.
      5c0bad8d