[Zope-dev] Read-only root database doesn't work ... bug or feature?

Paul Winkler pw_lists at slinkp.com
Wed May 19 19:15:27 EDT 2004


I'm trying to figure out how to mount my main storage read-only
with zope 2.7.0.  I'm starting to suspect that it's impossible.
I tried a few things below....

---------------------------------------------
ATTEMPT #1.

I find this in the zope.conf examples:

# Directive: read-only-database
#
# Description:
#     This causes the main Zope FileStorage-backed ZODB to be opened in
#     read-only mode.
#
# Default: off
#
# Example:
#
#     read-only-database on


... so I uncomment that line and restart.
Zope starts OK but the database is evidently still writeable, I can
still change anything.

Is this a bug in the zope.conf examples, or a bug in zope?


-------------------------------------------------
ATTEMPT #2.

Apparently there is another read-only flag within each database config
section. So, I try that. In my zope.conf:

<zodb_db main>
    # Main FileStorage database
    cache-size 20000
    mount-point /
    <filestorage>
      path $INSTANCE/var/Data.fs
      read-only on
    </filestorage>
</zodb_db>


When I start with this config, zope dies during product initialization
which apparently wants to commit:

------
2004-05-19T19:08:10 ERROR(200) Zope Couldn't install Formulator
Traceback (most recent call last):
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 785, in install_product
    get_transaction().commit()
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 232, in commit
    self._commit_begin(jars, subjars, subtransaction)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 340, in _commit_begin
    jar.tpc_begin(self)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Connection.py", line 692, in tpc_begin
    self._storage.tpc_begin(transaction)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/BaseStorage.py", line 142, in tpc_begin
    raise POSException.ReadOnlyError()
ReadOnlyError
Traceback (most recent call last):
  File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 49, in ?
    run()
  File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 19, in run
    start_zope(opts.configroot)
  File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 51, in start_zope
    starter.startZope()
  File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 230, in startZope
    Zope.startup()
  File "/home/pw/Zope-2.7.0/lib/python/Zope/__init__.py", line 46, in startup
    _startup()
  File "/home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py", line 93, in startup
    OFS.Application.initialize(application)
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 279, in initialize
    initializer.initialize()
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 306, in initialize
    self.install_products() 
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 553, in install_products
    return install_products(app)
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 584, in install_products
    folder_permissions, raise_exc=debug_mode)
  File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 785, in install_product
    get_transaction().commit()
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 232, in commit
    self._commit_begin(jars, subjars, subtransaction)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 340, in _commit_begin
    jar.tpc_begin(self)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/Connection.py", line 692, in tpc_begin
    self._storage.tpc_begin(transaction)
  File "/home/pw/Zope-2.7.0/lib/python/ZODB/BaseStorage.py", line 142, in tpc_begin
    raise POSException.ReadOnlyError()
ZODB.POSException.ReadOnlyError

-----------------------------------------

So, am I just plain S.O.L.?  Is this impossible?


(Note: a similar message was sent earlier to dirstorage-users, but
experimentation has shown me that the storage implementation
doesn't seem to matter... i get the same result with filestorage,
directorystorage, or clientstorage.)


-- 

Paul Winkler
http://www.slinkp.com



More information about the Zope-Dev mailing list