[Zodb-checkins] SVN: ZODB/branches/hannosch-pickle-protocol2/ Added pickle protocol to the zeo connection format - this looks ugly :)

Hanno Schlichting hannosch at hannosch.eu
Sat May 1 10:52:59 EDT 2010


Log message for revision 111826:
  Added pickle protocol to the zeo connection format - this looks ugly :)
  

Changed:
  _U  ZODB/branches/hannosch-pickle-protocol2/etc/
  U   ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf
  D   ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf
  U   ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf.in
  A   ZODB/branches/hannosch-pickle-protocol2/etc/zeo2.conf.in
  U   ZODB/branches/hannosch-pickle-protocol2/speedtest.cfg
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/StorageServer.py
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/component.xml
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/runzeo.py
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/connection.py
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/marshal.py

-=-

Property changes on: ZODB/branches/hannosch-pickle-protocol2/etc
___________________________________________________________________
Added: svn:ignore
   + zeo*.conf


Modified: ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf	2010-05-01 14:52:58 UTC (rev 111826)
@@ -1,7 +1,8 @@
 # This configuration compares the performance of databases based on ZEO.
 
-# You need to start the ZEO server before running the tests:
+# You need to start the ZEO servers before running the tests:
 # bin/runzeo -C etc/zeo.conf
+# bin/runzeo -C etc/zeo2.conf
 
 # Run the tests via:
 # bin/zodbshootout etc/sample.conf -c 1
@@ -33,7 +34,7 @@
 
 <zodb zeo_p2>
     <zeoclient>
-        server $host:8100
+        server $host:8101
         pickle-protocol 2
     </zeoclient>
 </zodb>
@@ -49,7 +50,7 @@
 
 <zodb zeo_pcache_p2>
     <zeoclient>
-        server $host:8100
+        server $host:8101
         client 2
         var var
         cache-size 200000000

Deleted: ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf	2010-05-01 14:52:58 UTC (rev 111826)
@@ -1,12 +0,0 @@
-<zeo>
-  address 8100
-  read-only false
-  invalidation-queue-size 100
-  pid-filename /opt/Dropbox/Development/zope/zodb-pickle2/var/zeo.pid
-  # monitor-address PORT
-  # transaction-timeout SECONDS
-</zeo>
-
-<filestorage 1>
-  path /opt/Dropbox/Development/zope/zodb-pickle2/var/Data_zeo.fs
-</filestorage>

Modified: ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf.in
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf.in	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf.in	2010-05-01 14:52:58 UTC (rev 111826)
@@ -3,8 +3,6 @@
   read-only false
   invalidation-queue-size 100
   pid-filename ${buildout:directory}/var/zeo.pid
-  # monitor-address PORT
-  # transaction-timeout SECONDS
 </zeo>
 
 <filestorage 1>

Copied: ZODB/branches/hannosch-pickle-protocol2/etc/zeo2.conf.in (from rev 111822, ZODB/branches/hannosch-pickle-protocol2/etc/zeo.conf.in)
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/etc/zeo2.conf.in	                        (rev 0)
+++ ZODB/branches/hannosch-pickle-protocol2/etc/zeo2.conf.in	2010-05-01 14:52:58 UTC (rev 111826)
@@ -0,0 +1,12 @@
+<zeo>
+  address ${port}
+  read-only false
+  invalidation-queue-size 100
+  pid-filename ${buildout:directory}/var/zeo.pid
+  pickle-protocol 2
+</zeo>
+
+<filestorage 1>
+  path ${buildout:directory}/var/Data_zeo2.fs
+  pickle-protocol 2
+</filestorage>

Modified: ZODB/branches/hannosch-pickle-protocol2/speedtest.cfg
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/speedtest.cfg	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/speedtest.cfg	2010-05-01 14:52:58 UTC (rev 111826)
@@ -6,6 +6,7 @@
     test
     scripts
     zeoconf
+    zeoconf2
     zeoserver
 
 [scripts]
@@ -17,6 +18,12 @@
 output = ${buildout:directory}/etc/zeo.conf
 port = 8100
 
+[zeoconf2]
+recipe = collective.recipe.template
+input = ${buildout:directory}/etc/zeo2.conf.in
+output = ${buildout:directory}/etc/zeo2.conf
+port = 8101
+
 [zeoserver]
 recipe = zc.recipe.egg
 eggs = ZODB3

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/StorageServer.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/StorageServer.py	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/StorageServer.py	2010-05-01 14:52:58 UTC (rev 111826)
@@ -814,7 +814,8 @@
                  monitor_address=None,
                  auth_protocol=None,
                  auth_database=None,
-                 auth_realm=None):
+                 auth_realm=None,
+                 pickle_protocol=1):
         """StorageServer constructor.
 
         This is typically invoked from the start.py script.
@@ -878,6 +879,9 @@
             subdirectory. This module may also define a DatabaseClass
             variable that should indicate what database should be used
             by the authenticator.
+
+        pickle_protocol -- The pickle protocol used by the server connections.
+            Defaults to 1.
         """
 
         self.addr = addr
@@ -899,6 +903,7 @@
         self.auth_protocol = auth_protocol
         self.auth_database = auth_database
         self.auth_realm = auth_realm
+        self._pickle_protocol = pickle_protocol
         self.database = None
         if auth_protocol:
             self._setup_auth(auth_protocol)

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/component.xml
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/component.xml	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/component.xml	2010-05-01 14:52:58 UTC (rev 111826)
@@ -122,6 +122,12 @@
        </description>
     </key>
 
+    <key name="pickle-protocol" required="no" datatype="integer" default="1">
+      <description>
+        The pickle protocol used by the server. Defaults to 1.
+      </description>
+    </key>
+
   </sectiontype>
 
 </component>

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/runzeo.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/runzeo.py	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/runzeo.py	2010-05-01 14:52:58 UTC (rev 111826)
@@ -344,6 +344,7 @@
         auth_protocol = options.auth_protocol,
         auth_database = options.auth_database,
         auth_realm = options.auth_realm,
+        pickle_protocol = getattr(options, 'pickle_protocol', 1),
         )
 
 

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/connection.py	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/connection.py	2010-05-01 14:52:58 UTC (rev 111826)
@@ -573,7 +573,8 @@
         self.mgr = mgr
         map = {}
         Connection.__init__(self, sock, addr, obj, 'S', map=map)
-        self.marshal = ServerMarshaller()
+        self._pickle_protocol = getattr(mgr, '_pickle_protocol', 1)
+        self.marshal = ServerMarshaller(pickle_protocol=self._pickle_protocol)
         self.trigger = ZEO.zrpc.trigger.trigger(map)
         self.call_from_thread = self.trigger.pull_trigger
 

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/marshal.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/marshal.py	2010-05-01 13:52:57 UTC (rev 111825)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/zrpc/marshal.py	2010-05-01 14:52:58 UTC (rev 111826)
@@ -21,6 +21,10 @@
 class Marshaller:
     """Marshal requests and replies to second across network"""
 
+    def __init__(self, pickle_protocol=1):
+        print pickle_protocol
+        self._pickle_protocol = pickle_protocol
+
     def encode(self, msgid, flags, name, args):
         """Returns an encoded message"""
         # (We used to have a global pickler, but that's not thread-safe. :-( )
@@ -31,7 +35,7 @@
         # being represented by \xij escapes in proto 0).
         # Undocumented:  cPickle.Pickler accepts a lone protocol argument;
         # pickle.py does not.
-        pickler = cPickle.Pickler(1)
+        pickler = cPickle.Pickler(self._pickle_protocol)
         pickler.fast = 1
 
         # Undocumented:  pickler.dump(), for a cPickle.Pickler, takes



More information about the Zodb-checkins mailing list