1. 20 Sep, 2002 3 commits
    • Guido van Rossum's avatar
    • Guido van Rossum's avatar
      I set out making wait=1 work for fallback connections, i.e. the · 24afe7ac
      Guido van Rossum authored
      ClientStorage constructor called with both wait=1 and
      read_only_fallback=1 should return, indicating its readiness, when a
      read-only connection was made.  This is done by calling
      connect(sync=1).  Previously this waited for the ConnectThread to
      finish, but that thread doesn't finish until it's made a read-write
      connection, so a different mechanism is needed.
      
      I ended up doing a major overhaul of the interfaces between
      ClientStorage, ConnectionManager, ConnectThread/ConnectWrapper, and
      even ManagedConnection.  Changes:
      
      ClientStorage.py:
      
        ClientStorage:
      
        - testConnection() now returns just the preferred flag; stubs are
          cheap and I like to have the notifyConnected() signature be the
          same for clients and servers.
      
        - notifyConnected() now takes a connection (to match the signature
          of this method in StorageServer), and creates a new stub.  It also
          takes care of the reconnect business if the client was already
          connected, rather than the ClientManager.  It stores the
          connection as self._connection so it can close the previous one.
          This is also reset by notifyDisconnected().
      
      zrpc/client.py:
      
        ConnectionManager:
      
        - Changed self.thread_lock into a condition variable.  It now also
          protects self.connection.  The condition is notified when
          self.connection is set to a non-None value in connect_done();
          connect(sync=1) waits for it.  The self.connected variable is no
          more; we test "self.connection is not None" instead.
      
        - Tried to made close() reentrant.  (There's a trick: you can't set
          self.connection to None, conn.close() ends up calling close_conn()
          which does this.)
      
        - Renamed notify_closed() to close_conn(), for symmetry with the
          StorageServer API.
      
        - Added an is_connected() method so ConnectThread.try_connect()
          doesn't have to dig inside the manager's guts to find out if the
          manager is connected (important for the disposition of fallback
          wrappers).
      
        ConnectThread and ConnectWrapper:
      
        - Follow above changes in the ClientStorage and ConnectionManager
          APIs: don't close the manager's connection when reconnecting, but
          leave that up to notifyConnected(); ConnectWrapper no longer
          manages the stub.
      
        - ConnectWrapper sets self.sock to None once it's created a
          ManagedConnection -- from there on the connection is is charge of
          closing the socket.
      
      zrpc/connection.py:
      
        ManagedServerConnection:
      
        - Changed the order in which close() calls things; super_close()
          should be last.
      
        ManagedConnection:
      
        - Ditto, and call the manager's close_conn() instead of
          notify_closed().
      
      tests/testZEO.py:
      
        - In checkReconnectSwitch(), we can now open the client storage with
          wait=1 and read_only_fallback=1.
      24afe7ac
    • Guido van Rossum's avatar
      Address Chris McDonough's request: make the ClientStorage() · f8411024
      Guido van Rossum authored
      constructor signature backwards compatible with ZEO 1.  This means
      adding wait_for_server_on_startup and debug options.
      wait_for_server_on_startup is an alias for wait, which makes the
      argument decoding for these two a little tricky.  debug is ignored.
      
      Also change the default of wait to True, like it was in ZEO 1.  This
      is less likely to screw naive customers.
      f8411024
  2. 19 Sep, 2002 8 commits
  3. 18 Sep, 2002 2 commits
    • Guido van Rossum's avatar
      Cache policy improvement: · d1c6a2c8
      Guido van Rossum authored
      When load() finds a hit in the non-current file, copy it to the
      current file (except when this would cause a cache flip).
      
      It is hoped that this improves the cache performance.
      
      (Now merged into the trunk!  Jeremy & Jim want this in the ZEO and ZODB3 beta2 releases.)
      d1c6a2c8
    • Guido van Rossum's avatar
      Fix a mysterious Windows hang: checkReconnectSwitch() would fail. · 5cf04dac
      Guido van Rossum authored
      The fix is to change testConnection() to only retry the register()
      call with the read-only flag set when we're not alrady connected.
      But I don't understand why this fix is needed; I'll keep debugging.
      5cf04dac
  4. 17 Sep, 2002 26 commits
  5. 16 Sep, 2002 1 commit
    • Jeremy Hylton's avatar
      Rewrite new_persistent_id() to make it clear what's going on. · e94f7e66
      Jeremy Hylton authored
      Reformat all the code to use Python style.
      
      We got an undiagnosed bug report for coptimization, which lead to an
      attempt at code review.
      
      Break up a the large new_persistent_id() function into several helpers
      -- get_class(), get_class_tuple(), and set_oid().  Each function now
      does a little less.  Don't reuse variable names for random purposes.
      e94f7e66