[Checkins] SVN: zc.zodbdgc/branches/dev/src/zc/zodbdgc/ Whine if there are xrefs when xrefs aren't allowed.
Jim Fulton
jim at zope.com
Wed May 27 16:57:46 EDT 2009
Log message for revision 100489:
Whine if there are xrefs when xrefs aren't allowed.
Changed:
U zc.zodbdgc/branches/dev/src/zc/zodbdgc/README.test
U zc.zodbdgc/branches/dev/src/zc/zodbdgc/__init__.py
-=-
Modified: zc.zodbdgc/branches/dev/src/zc/zodbdgc/README.test
===================================================================
--- zc.zodbdgc/branches/dev/src/zc/zodbdgc/README.test 2009-05-27 20:50:11 UTC (rev 100488)
+++ zc.zodbdgc/branches/dev/src/zc/zodbdgc/README.test 2009-05-27 20:57:46 UTC (rev 100489)
@@ -60,8 +60,11 @@
>>> conn1.root.x = C()
>>> conn2.root.x = C()
>>> conn3.root.x = C()
+ >>> transaction.commit()
>>> conn1.root.i = C()
+ >>> transaction.commit()
>>> conn1.root.j = C()
+ >>> transaction.commit()
>>> conn1.root.lots = [C({'x': C()}) for i in range(1100)]
>>> transaction.commit()
>>> conn2.root.y = C()
@@ -364,7 +367,7 @@
>>> zc.zodbdgc.check_command(['config2'])
!!! db1 2206 db1 0
POSKeyError: 'No blob file'
- !!! db2 2 db1 2
+ !!! db2 2 db1 1
POSKeyError: 0x02
Note that we see the missing link from db1 to db2. There is not
@@ -386,9 +389,41 @@
>>> zc.zodbdgc.check_command(['config2'])
!!! db1 2206 db1 0
POSKeyError: 'No blob file'
- !!! db2 2 db1 2
+ !!! db2 2 db1 1
KeyError: 'db2'
+If a database is configured to not allow cross references, we complain
+about cross references that we see:
+
+ >>> open('config2', 'w').write("""
+ ... <zodb db1>
+ ... allow-implicit-cross-references false
+ ... <filestorage>
+ ... path 1.fs-2
+ ... blob-dir 1.blobs-2
+ ... </filestorage>
+ ... </zodb>
+ ... <zodb db2>
+ ... allow-implicit-cross-references false
+ ... <filestorage>
+ ... path 2.fs-2
+ ... </filestorage>
+ ... </zodb>
+ ... <zodb db3>
+ ... allow-implicit-cross-references false
+ ... <filestorage>
+ ... path 3.fs-2
+ ... </filestorage>
+ ... </zodb>
+ ... """)
+
+ >>> zc.zodbdgc.check_command(['config2'])
+ !!! db1 2206 db1 0
+ POSKeyError: 'No blob file'
+ bad xref db2 2 db1 1
+ !!! db2 2 db1 1
+ POSKeyError: 0x02
+
.. cleanup
>>> logging.getLogger().setLevel(old_level)
Modified: zc.zodbdgc/branches/dev/src/zc/zodbdgc/__init__.py
===================================================================
--- zc.zodbdgc/branches/dev/src/zc/zodbdgc/__init__.py 2009-05-27 20:50:11 UTC (rev 100488)
+++ zc.zodbdgc/branches/dev/src/zc/zodbdgc/__init__.py 2009-05-27 20:57:46 UTC (rev 100489)
@@ -303,6 +303,8 @@
referers.pop((name, oid), None)
for ref in getrefs(p, name):
+ if (ref[0] != name) and not databases[name].xrefs:
+ print 'bad xref', ref[0], u64(ref[1]), name, u64(oid)
if seen.has(*ref):
continue
if ref in roots:
More information about the Checkins
mailing list