[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/ Test coverage for non-blocking startup, fix handling of POSKeyErrors during

Christian Theune ct at gocept.com
Wed Nov 18 04:59:17 EST 2009


Log message for revision 105812:
  Test coverage for non-blocking startup, fix handling of POSKeyErrors during
  startup on empty databases. 
  
  Fix behaviour when including non-undoable storage in the configuration: simply
  degrade them regularly.
  

Changed:
  U   gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
  U   gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py

-=-
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py	2009-11-18 09:51:37 UTC (rev 105811)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py	2009-11-18 09:59:17 UTC (rev 105812)
@@ -663,12 +663,15 @@
             storage = self.openers[name].open()
             assert hasattr(storage, 'supportsUndo') and storage.supportsUndo()
             storage.load('\x00' * 8)
-            self.storages[name] = storage
+        except ZODB.POSException.POSKeyError, e:
+            pass
         except Exception, e:
             logger.critical('Could not open storage %s' % name, exc_info=True)
             # We were trying to open a storage. Even if we fail we can't be
             # more broke than before, so don't ever fail due to this.
             self._degrade_storage(name, fail=False)
+            return
+        self.storages[name] = storage
 
     def _close_storage(self, name):
         if name in self.storages_optimal:

Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py	2009-11-18 09:51:37 UTC (rev 105811)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py	2009-11-18 09:59:17 UTC (rev 105812)
@@ -67,8 +67,7 @@
             self._pids.append(pid)
             self._servers.append(adminaddr)
             self._storages.append(gocept.zeoraid.testing.ZEOOpener(
-                str(i), zport, storage='1',
-                min_disconnect_poll=0.5, wait=1, wait_timeout=60))
+                str(i), zport, storage='1', wait=False))
         self.open()
 
     def getConfig(self):
@@ -942,7 +941,7 @@
             def open(self):
                 return ZODB.MappingStorage.MappingStorage()
 
-        self.assertRaises(AssertionError,
+        self.assertRaises(RuntimeError,
                           gocept.zeoraid.storage.RAIDStorage,
                           'name', [Opener()])
 
@@ -1363,7 +1362,18 @@
         # optional in the doc string.
         pass
 
+    def check_startup_missing_zeo_does_not_block(self):
+        forker.shutdown_zeo_server(self._servers[0])
+        self._storage.close()
+        self.open()
+        self.assertEquals('degraded', self._storage.raid_status())
+        # We should still be able to write
+        oid = self._storage.new_oid()
+        self._dostore(oid=oid, data='0', already_pickled=True)
+        # Remove closed ZEO server to allow correct shutdown.
+        del self._servers[0]
 
+
 def raise_exception():
     raise Exception()
 



More information about the checkins mailing list