1. 05 Feb, 2005 1 commit
    • Tim Peters's avatar
      Merge rev 29052 from 3.3 branch. · 3ebdc9a2
      Tim Peters authored
      Port from ZODB 3.2.
      
      Fixed several thread and asyncore races in ZEO's connection dance.
      
      ZEO/tests/ConnectionTests.py
          The pollUp() and pollDown() methods were pure busy loops whenever
          the asyncore socket map was empty, and at least on some flavors of
          Linux that starved the other thread(s) trying to do real work.
          This grossly increased the time needed to run tests using these, and
          sometimes caused bogus "timed out" test failures.
      
      ZEO/zrpc/client.py
      ZEO/zrpc/connection.py
          Renamed class ManagedConnection to ManagedClientConnection, for clarity.
      
          Moved the comment block about protocol negotiation from the guts of
          ManagedClientConnection to before the Connection base class -- the
          Connection constructor can't be understood without this context.  Added
          more words about the delicate protocol negotiation dance.
      
          Connection class:  made this an abstract base clase.  Derived classes
          _must_ implement the handshake() method.  There was really nothing in
          common between server and client wrt what handshake() needs to do, and
          it was confusing for one of them to use the base class handshake() while
          the other replaced handshake() completely.
      
          Connection.__init__:  It isn't safe to register with asyncore's socket
          map before special-casing for the first (protocol handshake) message is
          set up.  Repaired that.  Also removed the pointless "optionalness" of
          the optional arguments.
      
          ManagedClientConnection.__init__:  Added machinery to set up correct
          (thread-safe) message queueing.  There was an unrepairable hole before,
          in the transition between "I'm queueing msgs waiting for the server
          handshake" and "I'm done queueing messages":  it was impossible to know
          whether any calls to the client's "queue a message" method were in
          progress (in other threads), so impossible to make the transition safely
          in all cases.  The client had to grow its own message_output() method,
          with a mutex protecting the transition from thread races.
      
          Changed zrpc-conn log messages to include "(S)" for server-side or
          "(C)" for client-side.  This is especially helpful for figuring out
          logs produced while running the test suite (the server and client
          log messages end up in the same file then).
      3ebdc9a2
  2. 04 Feb, 2005 2 commits
  3. 03 Feb, 2005 3 commits
  4. 24 Jan, 2005 2 commits
  5. 12 Jan, 2005 2 commits
  6. 11 Jan, 2005 2 commits
  7. 07 Jan, 2005 1 commit
    • Tim Peters's avatar
      Merge rev 28769 from 3.3 branch. · 75fe517f
      Tim Peters authored
      Forward-port from ZODB 3.2.
      
      Collector 1503:  excessive logging.
      
      ClientStorage._wait_sync():  Don't log more than one "waiting for cache
      verification to finish" message per 5 minutes.
      75fe517f
  8. 23 Dec, 2004 1 commit
    • Tim Peters's avatar
      Merge rev 28701 from 3.3 branch. · 743ef117
      Tim Peters authored
      Critical bugfix for invalidations during ZEO cache verification.
      
      ClientCache.invalidate():
      
      - This was written not to expect tid=None, which is what happens
        during cache verification, although it didn't catch the tid=None
        case and went on doing really strange things then.  Rewrote so
        that tid=None means "forget everything I think I know about
        the oid".  It was kind-of performing an invalidation wrt the
        in-memory data structures in this case, but leaving the
        invalidated data for oid looking as if it were still current on
        disk.  That was accidental, depending on what various other
        parts of the code thought "None" meant (primarily, an end_tid
        of None is generally taken here to mean "the data is current").
        
      - Also changed the "and we already have version data for oid" case
        to a "forget everything I think I know about the oid" case.  The
        comments seemed to say that's what it thought it was doing, but
        the code actually left non-current revisions sitting around.  I
        really don't want to spend time trying to figure out what versions
        are supposed to do in all cases here, and nuking everything in
        this case is an obviously *safe* thing to do.
      
      - Added more asserts, because the pre- and post-conditions here are
        delicate and non-obvious (indeed, that a new assert failed is how
        I stumbled into the invalidation problem to begin with).
      
      FileCache.remove():  Changed to remove the key from self.key2entry.
      While self.filemap keeps an in-memory map of the entire disk file,
      there's no need to keep info in key2entry for keys that no longer
      exist in the disk file.  I'm not sure a visible bug followed from
      this (but not sure one didn't either!), but it at best wasted
      memory, and violated a documented invariant.
      
      ConnectionTests.py:  New test checkVerificationInvalidationPersists().
      Before the patch, this provokes a persistent ZEO cache into
      delivering stale object state.  Of course the test passes after
      this patch.
      
      stats.py:  Added a trace code meaning "invalidation hit, and the
      object state was discarded".  This is what happens now for
      invalidations produced by verification.  Because of MVCC, that's
      really not needed *except* for the invalidations produced by
      startup verification (invalidations normally just set a new
      ending tid on the validity range for what was current data; but
      validity-range info isn't available from verification invalidations).
      
      743ef117
  9. 22 Dec, 2004 1 commit
    • Tim Peters's avatar
      Merge rev 28685 from 3.3 branch. · 2855b2d9
      Tim Peters authored
      Collector 1536:  ClientStorage.__init__ ignores cache_size.
      
      Also split test checkRollover into two tests,
      checkDisconnectedCacheWorks (persistent ZEO cache large enough
      to satisfy all requests) and checkDisconnectedCacheFails (cache
      too small to satisfy all requests while disconnected).
      2855b2d9
  10. 21 Dec, 2004 5 commits
    • Tim Peters's avatar
      Merge rev 28680 from 3.3 branch. · dc518849
      Tim Peters authored
      More cleanup, and a new problem.  Notable:
      
      Object.serialize_header():  Stopped stuffing the version string into this
      notion of "a header".  Couldn't see any reason for it, and it was
      surprising.
      
      ClientCache.invalidate():  Added some asserts to clarify intended
      preconditions.  Alas, my guess that it was intended that the passed-in
      tid always be greater than the current tid turned out to trigger
      errors.  This gets complicated, and hasn't been resolved yet.  The
      problem is that the passed-in tid can be (in fact, always is) None
      during cache verification.  The code here *really* doesn't seem to
      be expecting that, and the on-disk cache file is clearly left in a
      wrong state (if we repopulated the cache from the disk file, the
      object would not look invalidated any more, it would look current).
      Dumped in a giant stack trace so I don't forget this; sent email to
      Jeremy asking if he recalls what the real intent was.
      dc518849
    • Tim Peters's avatar
      Merge rev 28673 from 3.3 branch. · 60e508aa
      Tim Peters authored
      More cleanup.  Notable:
      
      - Object.fromFile():  renamed `header_only` arg to `skip_data`.
        Skipping the data is what it does, while there are at least 3
        distinct notions of what "a header" means in this module.
        Object has two notions of "header" all by itself (& I'm still
        not sure why Object.serialize_header() considers the version
        string to be part of "the header").
      
      - FileCache.__init__():  log a warning if reuse=True but the
        given file path doesn't exist.  The code ignores `reuse` then
        (before, and now).  Not sure that's the best thing to do.
      60e508aa
    • Tim Peters's avatar
      Merged rev 28671 from 3.3 branch. · 6f12261d
      Tim Peters authored
      More cleanup.  Notable:
      
      - Moved the logger object to module scope.  There's virtually
        no logging of any kind done here, and I suspect that's partly
        because the logging object was clumsy to get at.
      
      - Figured out what the code actually does when the cache size
        asked for doesn't match the actual size of a pre-existing
        cache file.  It apparently wanted to ignore the requested
        size then.  It probably shouldn't, but leaving that for later.
        Still, it left its own idea of the file size out of synch
        with the actual file size, and that was a bug.  For now,
        logged a warning when this happens, and changed the code to
        respect the actual file size.
      6f12261d
    • Tim Peters's avatar
      Merged rev 28664 from 3.3 branch. · 10324308
      Tim Peters authored
      More cleanup.  Notable:
      
      ClientCache:  Removed the .tid attribute.  It was never updated; the
      contained FileCache instance actually keeps track of the last tid.
      This had the happy side effect of fixing bugs in testSerialization:
      it was accessing .tid directly, and so was _always_ comparing None to
      None.  Changing the test to use .getLastTid() instead means it's now
      testing what it always intended to test.
      
      FileCache:  Removed some unused private attributes for tracking
      internal statistics.
      10324308
    • Tim Peters's avatar
      Merge rev 28660 from 3.3 branch. · d3a1bc6a
      Tim Peters authored
      More code and comment cleanups.  Notable changes:
      
      FileCache:  removed the currentsize attribute.  It was initialized
      to 0 but never updated.  Some tests referenced it, but since it was
      always 0 those tests weren't getting any good from it.  Don't
      recall (or never knew) what its intended purpose may have been.
      
      FileCache.remove():  Repaired major bug.  This mistakenly stored
      the "this disk block is free now" status byte into the start of
      the serialized Object record's end_tid field (incorrect seek
      offset).  The in-memory structures were correct then, but got out
      of synch with the disk file; the latter then still claimed to have
      info for a "live" object revision, but that revision was actually
      dead, and the info on disk had a corrupt end_tid value.
      d3a1bc6a
  11. 20 Dec, 2004 1 commit
  12. 10 Dec, 2004 2 commits
  13. 09 Dec, 2004 4 commits
  14. 16 Nov, 2004 1 commit
    • Tim Peters's avatar
      Merge rev 28466 from 3.3 branch. · cefbb8a8
      Tim Peters authored
      Forward port from ZODB 3.2.
      
      Collector 1581:  fspack can blow up when .fs is corrupted
      
      Repaired three places where fspack referenced an undefined global while
      *trying* to raise CorruptedError.  Added new checkCorruptionInPack()
      test to verify the correct exception gets raised.
      
      cefbb8a8
  15. 11 Nov, 2004 6 commits
  16. 05 Nov, 2004 3 commits
  17. 04 Nov, 2004 1 commit
    • Tim Peters's avatar
      Brrr. · 1e730a8c
      Tim Peters authored
      Weak sets have have pragmatic gotchas, explained in the comments
      before the new WeakSet.as_weakref_list() method.  In essence, we
      just took all the weak sets of connection objects and changed
      everything so that a list of live objects is never materialized
      anymore.  Also added new map()-like methods so that clients don't
      usually need to be aware of the weakrefs under the covers.
      1e730a8c
  18. 02 Nov, 2004 2 commits