[Zodb-checkins] SVN: ZODB/branches/benji-stop-instead-of-verify/src/Z first cut, existing tests pass, no new tests so it may not even work
Benji York
benji at zope.com
Fri Sep 5 14:34:04 EDT 2008
Log message for revision 90889:
first cut, existing tests pass, no new tests so it may not even work
Changed:
U ZODB/branches/benji-stop-instead-of-verify/src/ZEO/ClientStorage.py
U ZODB/branches/benji-stop-instead-of-verify/src/ZEO/component.xml
U ZODB/branches/benji-stop-instead-of-verify/src/ZODB/component.xml
U ZODB/branches/benji-stop-instead-of-verify/src/ZODB/config.py
-=-
Modified: ZODB/branches/benji-stop-instead-of-verify/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/benji-stop-instead-of-verify/src/ZEO/ClientStorage.py 2008-09-05 18:30:41 UTC (rev 90888)
+++ ZODB/branches/benji-stop-instead-of-verify/src/ZEO/ClientStorage.py 2008-09-05 18:34:04 UTC (rev 90889)
@@ -123,7 +123,8 @@
wait=None, wait_timeout=None,
read_only=0, read_only_fallback=0,
username='', password='', realm=None,
- blob_dir=None, shared_blob_dir=False):
+ blob_dir=None, shared_blob_dir=False,
+ stop_instead_of_verify=False):
"""ClientStorage constructor.
This is typically invoked from a custom_zodb.py file.
@@ -200,9 +201,12 @@
is retrieved via the loadBlob API.
shared_blob_dir -- Flag whether the blob_dir is a server-shared
- filesystem that should be used instead of transferring blob data over
- zrpc.
+ filesystem that should be used instead of transferring blob data
+ over zrpc.
+ stop_instead_of_verify -- if True, a SystemExit should be raised
+ instead of initiating a cache verification.
+
Note that the authentication protocol is defined by the server
and is detected by the ClientStorage upon connecting (see
testConnection() and doAuth() for details).
@@ -264,6 +268,7 @@
self._username = username
self._password = password
self._realm = realm
+ self._stop_instead_of_verify = stop_instead_of_verify
self._iterators = weakref.WeakValueDictionary()
self._iterator_ids = set()
@@ -1225,6 +1230,16 @@
elif ltid and ltid != utils.z64:
self._cache.setLastTid(ltid)
+ # we're about to verify the cache; that may not be desired
+ if self._stop_instead_of_verify:
+ log2("Would have verified the cache, but the "
+ "\"stop-instead-of-verify\" configuration option is enabled, "
+ "therefore stopping. Either disable the configuration "
+ "option, remove the out of date cache file, or replace the "
+ "cache file with one that doesn't have to be verified and "
+ "then restart.")
+ raise SystemExit("stopping instead of verifying cache")
+
log2("Verifying cache")
for oid, tid in self._cache.contents():
server.verify(oid, tid)
Modified: ZODB/branches/benji-stop-instead-of-verify/src/ZEO/component.xml
===================================================================
--- ZODB/branches/benji-stop-instead-of-verify/src/ZEO/component.xml 2008-09-05 18:30:41 UTC (rev 90888)
+++ ZODB/branches/benji-stop-instead-of-verify/src/ZEO/component.xml 2008-09-05 18:34:04 UTC (rev 90889)
@@ -102,6 +102,13 @@
<metadefault>$INSTANCE/var/ZEO.pid (or $clienthome/ZEO.pid)</metadefault>
</key>
+ <key name="stop-instead-of-verify" datatype="boolean"
+ required="no" default="false">
+ <description>
+ Exit the application instead of initiating a cache verification.
+ </description>
+ </key>
+
</sectiontype>
</component>
Modified: ZODB/branches/benji-stop-instead-of-verify/src/ZODB/component.xml
===================================================================
--- ZODB/branches/benji-stop-instead-of-verify/src/ZODB/component.xml 2008-09-05 18:30:41 UTC (rev 90888)
+++ ZODB/branches/benji-stop-instead-of-verify/src/ZODB/component.xml 2008-09-05 18:34:04 UTC (rev 90889)
@@ -163,6 +163,12 @@
that are accepted by this server.
</description>
</key>
+ <key name="stop-instead-of-verify" datatype="boolean" default="off">
+ <description>
+ A flag indicating whether the application should exit instead of
+ doing a -- potentially expensive -- full cache verification.
+ </description>
+ </key>
</sectiontype>
<sectiontype name="demostorage" datatype=".DemoStorage"
@@ -229,8 +235,4 @@
<section type="ZODB.storage" name="*" attribute="base"/>
</sectiontype>
-
-
-
-
</component>
Modified: ZODB/branches/benji-stop-instead-of-verify/src/ZODB/config.py
===================================================================
--- ZODB/branches/benji-stop-instead-of-verify/src/ZODB/config.py 2008-09-05 18:30:41 UTC (rev 90888)
+++ ZODB/branches/benji-stop-instead-of-verify/src/ZODB/config.py 2008-09-05 18:34:04 UTC (rev 90889)
@@ -163,6 +163,7 @@
wait=self.config.wait,
read_only=self.config.read_only,
read_only_fallback=self.config.read_only_fallback,
+ stop_instead_of_verify=self.config.stop_instead_of_verify,
username=self.config.username,
password=self.config.password,
realm=self.config.realm)
More information about the Zodb-checkins
mailing list