Commit 564f8f8d authored by Jeremy Hylton's avatar Jeremy Hylton

Merge changes from Zope-2_7-branch to the trunk.

parent 78326867
...@@ -207,13 +207,6 @@ then this command will install the new ZEO and ZODB: ...@@ -207,13 +207,6 @@ then this command will install the new ZEO and ZODB:
The install command should create a /home/zope/lib/python/ZEO directoy. The install command should create a /home/zope/lib/python/ZEO directoy.
Simple configuration
--------------------
mkzeoinst.py
Or, do it step-by-step.
Configuring server Configuring server
------------------ ------------------
...@@ -407,13 +400,9 @@ Running the ZEO server as a daemon ...@@ -407,13 +400,9 @@ Running the ZEO server as a daemon
In an operational setting, you will want to run the ZEO server a In an operational setting, you will want to run the ZEO server a
daemon process that is restarted when it dies. The zdaemon package daemon process that is restarted when it dies. The zdaemon package
provides two tools for running daemons: zdrun.py and zdctl.py. provides two tools for running daemons: zdrun.py and zdctl.py. The
The document "Using zdctl and zdrun to manage server processes" document "Using zdctl and zdrun to manage server processes"
explains how to use these scripts to manage daemons. (Doc/zdctl.txt) explains how to use these scripts to manage daemons.
XXX example of how to use zdrun
XXX mkzeoinst.py docs should probably go here
Rotating log files Rotating log files
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
...@@ -437,10 +426,6 @@ manages a ZEO servers password database. ...@@ -437,10 +426,6 @@ manages a ZEO servers password database.
Diagnosing problems Diagnosing problems
------------------- -------------------
How to use the debug logs.
Common gotchas.
If an exception occurs on the server, the server will log a traceback If an exception occurs on the server, the server will log a traceback
and send an exception to the client. The traceback on the client will and send an exception to the client. The traceback on the client will
show a ZEO protocol library as the source of the error. If you need show a ZEO protocol library as the source of the error. If you need
......
Client Cache Tracing ZEO Client Cache Tracing
==================== ========================
An important question for ZEO users is: how large should the ZEO An important question for ZEO users is: how large should the ZEO
client cache be? ZEO 2 (as of ZEO 2.0b2) has a new feature that lets client cache be? ZEO 2 (as of ZEO 2.0b2) has a new feature that lets
......
...@@ -85,7 +85,7 @@ setup(name = "ExtensionClass", ...@@ -85,7 +85,7 @@ setup(name = "ExtensionClass",
url = "http://www.zope.com", url = "http://www.zope.com",
ext_modules = [ExtensionClass, Acquisition, ComputedAttribute, ext_modules = [ExtensionClass, Acquisition, ComputedAttribute,
MethodObject, Missing, MultiMapping, MethodObject, Missing, MultiMapping,
ThreadLock, Record], ThreadLock, Record],
headers = ["src/ExtensionClass.h"], headers = ["src/ExtensionClass.h"],
......
...@@ -21,7 +21,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -21,7 +21,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.61 2003/09/15 16:29:20 jeremy Exp $\n" "$Id: ExtensionClass.c,v 1.62 2003/10/02 18:17:27 jeremy Exp $\n"
; ;
#include "ExtensionClass.h" #include "ExtensionClass.h"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""Berkeley storage with full undo and versioning support. """Berkeley storage with full undo and versioning support.
$Revision: 1.73 $ $Revision: 1.74 $
""" """
import time import time
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"""Berkeley storage without undo or versioning. """Berkeley storage without undo or versioning.
""" """
__version__ = '$Revision: 1.31 $'[-2:][0] __version__ = '$Revision: 1.32 $'[-2:][0]
from ZODB import POSException from ZODB import POSException
from ZODB.utils import p64, U64 from ZODB.utils import p64, U64
...@@ -125,7 +125,8 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage): ...@@ -125,7 +125,8 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
if version is None: if version is None:
self._info.put('version', BDBMINIMAL_SCHEMA_VERSION, txn=txn) self._info.put('version', BDBMINIMAL_SCHEMA_VERSION, txn=txn)
elif version <> BDBMINIMAL_SCHEMA_VERSION: elif version <> BDBMINIMAL_SCHEMA_VERSION:
raise POSException.StorageSystemError, 'incompatible storage version' raise POSException.StorageSystemError(
'incompatible storage version')
def _make_autopacker(self, event): def _make_autopacker(self, event):
return _Autopack(self, event, self._config.frequency) return _Autopack(self, event, self._config.frequency)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
""" """
import os import os
import sys
import time import time
import errno import errno
import shutil import shutil
...@@ -448,7 +449,9 @@ class BerkeleyBase(BaseStorage): ...@@ -448,7 +449,9 @@ class BerkeleyBase(BaseStorage):
# i.e. abort the transaction -- but swallow the exception. # i.e. abort the transaction -- but swallow the exception.
txn.abort() txn.abort()
except: except:
#import traceback ; traceback.print_exc() ## import traceback ; traceback.print_exc()
zLOG.LOG(self.__class__.__name__, zLOG.DEBUG,
"unexpected error in _withtxn", error=sys.exc_info())
txn.abort() txn.abort()
raise raise
else: else:
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
# Base class for unit tests at the ZODB layer # Base class for unit tests at the ZODB layer
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
# Test creation of a brand new database, and insertion of root objects. # Test creation of a brand new database, and insertion of root objects.
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
import BDBStorage import BDBStorage
from BDBStorage.tests.ZODBTestBase import ZODBTestBase from BDBStorage.tests.ZODBTestBase import ZODBTestBase
from Persistence import PersistentMapping from Persistence import PersistentMapping
class InsertMixin: class InsertMixin:
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
# Test some simple ZODB level stuff common to both the BDBMinimalStorage and # Test some simple ZODB level stuff common to both the BDBMinimalStorage and
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
# Framework for running Unit tests # Framework for running Unit tests
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
"""Time transaction commits and normalize vs. pickle size and #objects. """Time transaction commits and normalize vs. pickle size and #objects.
...@@ -240,10 +240,10 @@ def doit(srcdb, dstdb, options): ...@@ -240,10 +240,10 @@ def doit(srcdb, dstdb, options):
for r in txn: for r in txn:
oid = r.oid oid = r.oid
objects += 1 objects += 1
thissize = len(r.data) thissize = len(r.data)
size += thissize size += thissize
if thissize > largest_pickle: if thissize > largest_pickle:
largest_pickle = thissize largest_pickle = thissize
if verbose: if verbose:
if not r.version: if not r.version:
vstr = 'norev' vstr = 'norev'
...@@ -266,10 +266,10 @@ def doit(srcdb, dstdb, options): ...@@ -266,10 +266,10 @@ def doit(srcdb, dstdb, options):
traceback.print_exc(file=logfp) traceback.print_exc(file=logfp)
# record the results # record the results
if objects > largest_txn_in_objects: if objects > largest_txn_in_objects:
largest_txn_in_objects = objects largest_txn_in_objects = objects
if size > largest_txn_in_size: if size > largest_txn_in_size:
largest_txn_in_size = size largest_txn_in_size = size
print >> outfp, utils.U64(tid), objects, size, t4-t0, \ print >> outfp, utils.U64(tid), objects, size, t4-t0, \
t1-t0, t2-t1, t3-t2, t4-t3 t1-t0, t2-t1, t3-t2, t4-t3
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
"""Time transaction commits and normalize vs. pickle size and #objects. """Time transaction commits and normalize vs. pickle size and #objects.
...@@ -206,7 +206,7 @@ def doit(srcdb, dstdb, options): ...@@ -206,7 +206,7 @@ def doit(srcdb, dstdb, options):
from bsddb3 import db from bsddb3 import db
env = db.DBEnv() env = db.DBEnv()
env.open('BDB', env.open('BDB',
db.DB_CREATE # create underlying files as necessary db.DB_CREATE # create underlying files as necessary
| db.DB_RECOVER # run normal recovery before opening | db.DB_RECOVER # run normal recovery before opening
| db.DB_INIT_MPOOL # initialize shared memory buffer pool | db.DB_INIT_MPOOL # initialize shared memory buffer pool
...@@ -252,34 +252,34 @@ def doit(srcdb, dstdb, options): ...@@ -252,34 +252,34 @@ def doit(srcdb, dstdb, options):
t1 = time.time() t1 = time.time()
try: try:
dbtxn = env.txn_begin() dbtxn = env.txn_begin()
for r in txn: for r in txn:
oid = r.oid oid = r.oid
objects += 1 objects += 1
thissize = len(r.data) thissize = len(r.data)
size += thissize size += thissize
if thissize > largest_pickle: if thissize > largest_pickle:
largest_pickle = thissize largest_pickle = thissize
if verbose: if verbose:
if not r.version: if not r.version:
vstr = 'norev' vstr = 'norev'
else: else:
vstr = r.version vstr = r.version
print utils.U64(oid), vstr, len(r.data) print utils.U64(oid), vstr, len(r.data)
key = oid + tid key = oid + tid
d.put(key, r.data, txn=dbtxn) d.put(key, r.data, txn=dbtxn)
t2 = time.time() t2 = time.time()
t3 = time.time() t3 = time.time()
dbtxn.commit() dbtxn.commit()
t4 = time.time() t4 = time.time()
except KeyError, e: except KeyError, e:
traceback.print_exc(file=logfp) traceback.print_exc(file=logfp)
# record the results # record the results
if objects > largest_txn_in_objects: if objects > largest_txn_in_objects:
largest_txn_in_objects = objects largest_txn_in_objects = objects
if size > largest_txn_in_size: if size > largest_txn_in_size:
largest_txn_in_size = size largest_txn_in_size = size
print >> outfp, utils.U64(tid), objects, size, t4-t0, \ print >> outfp, utils.U64(tid), objects, size, t4-t0, \
t1-t0, t2-t1, t3-t2, t4-t3 t1-t0, t2-t1, t3-t2, t4-t3
......
...@@ -21,4 +21,3 @@ class BaseLogger: ...@@ -21,4 +21,3 @@ class BaseLogger:
for handler in self.logger.handlers: for handler in self.logger.handlers:
if hasattr(handler, 'reopen') and callable(handler.reopen): if hasattr(handler, 'reopen') and callable(handler.reopen):
handler.reopen() handler.reopen()
...@@ -75,8 +75,3 @@ class StartupHandler(Handler): ...@@ -75,8 +75,3 @@ class StartupHandler(Handler):
for record in self.buffer: for record in self.buffer:
target.handle(record) target.handle(record)
self.buffer = [] self.buffer = []
...@@ -17,6 +17,7 @@ import sys ...@@ -17,6 +17,7 @@ import sys
import tempfile import tempfile
import unittest import unittest
import zLOG import zLOG
import logging
severity_string = { severity_string = {
-300: 'TRACE', -300: 'TRACE',
...@@ -50,13 +51,24 @@ class StupidLogTest(unittest.TestCase): ...@@ -50,13 +51,24 @@ class StupidLogTest(unittest.TestCase):
self.wipeEnvironment() self.wipeEnvironment()
self.path = tempfile.mktemp() self.path = tempfile.mktemp()
self._severity = 0 self._severity = 0
# Windows cannot remove a file that's open. The logging code
# keeps the log file open, and I can't find an advertised API
# to tell the logger to close a log file. So here we cheat:
# tearDown() will close and remove all the handlers that pop
# into existence after setUp() runs. This breaks into internals,
# but I couldn't find a sane way to do it.
self.handlers = logging._handlers.keys() # capture current handlers
def tearDown(self): def tearDown(self):
try: # Close and remove all the handlers that came into existence
os.remove(self.path) # since setUp ran.
except os.error: for h in logging._handlers.keys():
pass if h not in self.handlers:
h.close()
del logging._handlers[h]
os.remove(self.path)
self.wipeEnvironment() self.wipeEnvironment()
zLOG.initialize()
def setLog(self, severity=0): def setLog(self, severity=0):
os.environ['%s_LOG_FILE' % self.prefix] = self.path os.environ['%s_LOG_FILE' % self.prefix] = self.path
...@@ -111,14 +123,20 @@ class StupidLogTest(unittest.TestCase): ...@@ -111,14 +123,20 @@ class StupidLogTest(unittest.TestCase):
self.setLog() self.setLog()
zLOG.LOG("basic", zLOG.INFO, "summary") zLOG.LOG("basic", zLOG.INFO, "summary")
f = self.getLogFile() f = self.getLogFile()
self.verifyEntry(f, subsys="basic", summary="summary") try:
self.verifyEntry(f, subsys="basic", summary="summary")
finally:
f.close()
def checkDetail(self): def checkDetail(self):
self.setLog() self.setLog()
zLOG.LOG("basic", zLOG.INFO, "xxx", "this is a detail") zLOG.LOG("basic", zLOG.INFO, "xxx", "this is a detail")
f = self.getLogFile() f = self.getLogFile()
self.verifyEntry(f, subsys="basic", detail="detail") try:
self.verifyEntry(f, subsys="basic", detail="detail")
finally:
f.close()
def checkError(self): def checkError(self):
self.setLog() self.setLog()
...@@ -131,9 +149,13 @@ class StupidLogTest(unittest.TestCase): ...@@ -131,9 +149,13 @@ class StupidLogTest(unittest.TestCase):
zLOG.LOG("basic", zLOG.ERROR, "raised exception", error=err) zLOG.LOG("basic", zLOG.ERROR, "raised exception", error=err)
f = self.getLogFile() f = self.getLogFile()
self.verifyEntry(f, subsys="basic", summary="summary") try:
self.verifyEntry(f, subsys="basic", severity=zLOG.ERROR, self.verifyEntry(f, subsys="basic", summary="summary")
error=err) self.verifyEntry(f, subsys="basic", severity=zLOG.ERROR,
error=err)
finally:
f.close()
class EventLogTest(StupidLogTest): class EventLogTest(StupidLogTest):
""" Test alternate envvars EVENT_LOG_FILE and EVENT_LOG_SEVERITY """ """ Test alternate envvars EVENT_LOG_FILE and EVENT_LOG_SEVERITY """
......
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