Commit 57e58ca1 authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent e3890f54
...@@ -27,14 +27,17 @@ You must specify either -p and -h or -U. ...@@ -27,14 +27,17 @@ You must specify either -p and -h or -U.
import getopt import getopt
import socket import socket
import sys import sys
import time
import ZODB import ZODB
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from ZODB.tests.MinPO import MinPO
from ZEO.ClientStorage import ClientStorage from ZEO.ClientStorage import ClientStorage
ZEO_VERSION = 2 ZEO_VERSION = 2
def check_server(addr, storage, write): def check_server(addr, storage, write):
t0 = time.time()
if ZEO_VERSION == 2: if ZEO_VERSION == 2:
cs = ClientStorage(addr, storage=storage, wait=1, cs = ClientStorage(addr, storage=storage, wait=1,
read_only=(not write)) read_only=(not write))
...@@ -51,7 +54,8 @@ def check_server(addr, storage, write): ...@@ -51,7 +54,8 @@ def check_server(addr, storage, write):
cn = db.open() cn = db.open()
root = cn.root() root = cn.root()
try: try:
root['zeoup'] = root.get('zeoup', 0) + 1 obj = root['zeoup'] = root.get('zeoup', MinPO(0))
obj.value += 1
get_transaction().commit() get_transaction().commit()
except ConflictError: except ConflictError:
pass pass
...@@ -59,7 +63,9 @@ def check_server(addr, storage, write): ...@@ -59,7 +63,9 @@ def check_server(addr, storage, write):
db.close() db.close()
else: else:
data, serial = cs.load("\0\0\0\0\0\0\0\0", "") 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): def usage(exit=1):
print __doc__ print __doc__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment