[Zodb-checkins] CVS: ZODB3/Tools - zeoup.py:1.11

Jeremy Hylton jeremy@zope.com
Mon, 18 Nov 2002 16:40:22 -0500


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv11036

Modified Files:
	zeoup.py 
Log Message:
Two more improvements.

Put a MinPO in the root, so that we don't actually modify the root.
Print the elapsed time for zeoup to run.


=== ZODB3/Tools/zeoup.py 1.10 => 1.11 ===
--- ZODB3/Tools/zeoup.py:1.10	Mon Nov 18 16:31:16 2002
+++ ZODB3/Tools/zeoup.py	Mon Nov 18 16:40:22 2002
@@ -27,14 +27,17 @@
 import getopt
 import socket
 import sys
+import time
 
 import ZODB
 from ZODB.POSException import ConflictError
+from ZODB.tests.MinPO import MinPO
 from ZEO.ClientStorage import ClientStorage
 
 ZEO_VERSION = 2
 
 def check_server(addr, storage, write):
+    t0 = time.time()
     if ZEO_VERSION == 2:
         cs = ClientStorage(addr, storage=storage, wait=1,
                            read_only=(not write))
@@ -51,7 +54,8 @@
         cn = db.open()
         root = cn.root()
         try:
-            root['zeoup'] = root.get('zeoup', 0) + 1
+            obj = root['zeoup'] = root.get('zeoup', MinPO(0))
+            obj.value += 1
             get_transaction().commit()
         except ConflictError:
             pass
@@ -59,7 +63,9 @@
         db.close()
     else:
         data, serial = cs.load("\0\0\0\0\0\0\0\0", "")
-        
+        cs.close()
+    t1 = time.time()
+    print "Elapsed time: %.2f" % (t1 - t0)
 
 def usage(exit=1):
     print __doc__