Commit 47f89f61 authored by Chris McDonough's avatar Chris McDonough

Merge in changes from PacklessBerkeley3Storage product.

parent aa6a0112
...@@ -84,12 +84,20 @@ ...@@ -84,12 +84,20 @@
############################################################################## ##############################################################################
""" Base module for BerkeleyStorage implementations """ """ Base module for BerkeleyStorage implementations """
__version__ ='$Revision: 1.3 $'[11:-2] __version__ ='$Revision: 1.4 $'[11:-2]
from ZODB.BaseStorage import BaseStorage from ZODB.BaseStorage import BaseStorage
from ZODB import POSException
from bsddb3 import db from bsddb3 import db
import os, tempfile import os, tempfile
class BerkeleyDBError(POSException.POSError):
""" A BerkeleyDB exception occurred. This probably indicates that
there is a low memory condition, a tempfile space shortage, or
a space shortage in the directory which houses the BerkeleyDB log
files. Check available tempfile space, logfile space, and RAM and
restart the server process."""
class Base(BaseStorage): class Base(BaseStorage):
def __init__(self, name='', env=0, prefix="zodb_"): def __init__(self, name='', env=0, prefix="zodb_"):
...@@ -175,8 +183,11 @@ def envFromString(name): ...@@ -175,8 +183,11 @@ def envFromString(name):
except: except:
raise "Error creating BerkeleyDB environment dir: %s" % name raise "Error creating BerkeleyDB environment dir: %s" % name
e=db.DbEnv() e=db.DbEnv()
e.open(name, try:
db.DB_CREATE | db.DB_RECOVER e.open(name,
| db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_INIT_TXN db.DB_CREATE | db.DB_RECOVER
) | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_INIT_TXN
)
except db.error, msg:
raise BerkeleyDBError, "%s (%s)" % (BerkeleyDBError.__doc__, msg)
return e return e
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