[Checkins] SVN: gocept.zeoraid/trunk/ - #484437: Recipe handles address in zeo.conf incorrectly. When giving the ZEO
Christian Theune
ct at gocept.com
Wed Dec 2 02:39:57 EST 2009
Log message for revision 106157:
- #484437: Recipe handles address in zeo.conf incorrectly. When giving the ZEO
address on the server only as a port that port would be ignored resulting in
127.0.0.1:8100 to be assumed for the management scripts.
- #486217: Incomplete recoveries did not get cleared. Now the status output
correctly displays 'degraded' after failed recoveries and the detailed
status informs that the storage was degraded due to a failed recovery.
Exception details are logged accordingly.
Changed:
U gocept.zeoraid/trunk/CHANGES.txt
U gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.py
U gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.txt
U gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
U gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
-=-
Modified: gocept.zeoraid/trunk/CHANGES.txt
===================================================================
--- gocept.zeoraid/trunk/CHANGES.txt 2009-12-02 05:51:07 UTC (rev 106156)
+++ gocept.zeoraid/trunk/CHANGES.txt 2009-12-02 07:39:57 UTC (rev 106157)
@@ -5,6 +5,15 @@
1.0b8 (unreleased)
------------------
+- #484437: Recipe handles address in zeo.conf incorrectly. When giving the ZEO
+ address on the server only as a port that port would be ignored resulting in
+ 127.0.0.1:8100 to be assumed for the management scripts.
+
+- #486217: Incomplete recoveries did not get cleared. Now the status output
+ correctly displays 'degraded' after failed recoveries and the detailed
+ status informs that the storage was degraded due to a failed recovery.
+ Exception details are logged accordingly.
+
- #484921: Further enhance logging output by also displaying the name of the
RAID storage involved.
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.py 2009-12-02 05:51:07 UTC (rev 106156)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.py 2009-12-02 07:39:57 UTC (rev 106157)
@@ -66,7 +66,7 @@
if len(address) == 2:
host, port = address
elif len(address) == 1:
- host, port = '127.0.0.1', 8100
+ host, port = '127.0.0.1', int(address[0])
else:
raise zc.buildout.UserError(
'Invalid ZEO address %r was specified.' %
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.txt
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.txt 2009-12-02 05:51:07 UTC (rev 106156)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/scripts/recipe.txt 2009-12-02 07:39:57 UTC (rev 106157)
@@ -13,7 +13,7 @@
>>> write('buildout.cfg',
... '''
... [buildout]
- ... parts = zodb zeoraid
+ ... parts = zodb zeoraid zeoraid2
...
... [zodb]
... recipe = zc.recipe.egg:script
@@ -23,7 +23,7 @@
... recipe = gocept.zeoraid:server
... zeo.conf =
... <zeo>
- ... address 8100
+ ... address 5555
... monitor-address 8101
... transaction-timeout 300
... </zeo>
@@ -33,6 +33,21 @@
... address 8101
... </zeoclient>
... </raidstorage>
+ ...
+ ... [zeoraid2]
+ ... recipe = gocept.zeoraid:server
+ ... zeo.conf =
+ ... <zeo>
+ ... address 111.111.111.111:4444
+ ... monitor-address 8101
+ ... transaction-timeout 300
+ ... </zeo>
+ ... %import gocept.zeoraid
+ ... <raidstorage 1>
+ ... <zeoclient 1>
+ ... address 8101
+ ... </zeoclient>
+ ... </raidstorage>
... ''')
Here we specified a minimal ZEORAID configuration. When we run the buildout:
@@ -52,6 +67,9 @@
Installing zeoraid.
Generated script '/sample-buildout/bin/zeoraid'.
Generated script '/sample-buildout/bin/zeoraid-1-manage'.
+ Installing zeoraid2.
+ Generated script '/sample-buildout/bin/zeoraid2'.
+ Generated script '/sample-buildout/bin/zeoraid2-1-manage'.
We get 2 things. We get a directory in parts containing ZEO and
zdaemon configuration files:
@@ -66,7 +84,7 @@
%import gocept.zeoraid
<BLANKLINE>
<zeo>
- address 8100
+ address 5555
monitor-address 8101
transaction-timeout 300
</zeo>
@@ -102,6 +120,8 @@
- zeopasswd
- zeoraid
- zeoraid-1-manage
+ - zeoraid2
+ - zeoraid2-1-manage
We have an additional RAID control script:
@@ -131,9 +151,36 @@
import gocept.zeoraid.scripts.controller
<BLANKLINE>
if __name__ == '__main__':
- gocept.zeoraid.scripts.controller.main(port=8100, host="127.0.0.1", storage="1")
+ gocept.zeoraid.scripts.controller.main(port=5555, host="127.0.0.1", storage="1")
+ >>> cat('bin', 'zeoraid2-1-manage')
+ #!/.../python
+ <BLANKLINE>
+ import sys
+ sys.path[0:0] = [
+ '.../src',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ '/sample-pyN.N.egg',
+ ]
+ <BLANKLINE>
+ import gocept.zeoraid.scripts.controller
+ <BLANKLINE>
+ if __name__ == '__main__':
+ gocept.zeoraid.scripts.controller.main(port=4444, host="111.111.111.111", storage="1")
+
This is a console script with customized defaults. We can use this to control
the RAID storage aspects of the ZEO server.
@@ -185,6 +232,7 @@
... ''' % globals())
>>> print system(buildout),
+ Uninstalling zeoraid2.
Uninstalling zeoraid.
Updating zodb.
Installing zeoraid.
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2009-12-02 05:51:07 UTC (rev 106156)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2009-12-02 07:39:57 UTC (rev 106157)
@@ -851,6 +851,9 @@
ref = results.values()[0]
for test in results.values()[1:]:
if test != ref:
+ logger.debug(
+ 'Got inconsistent results for method %s: %r' %
+ (method_name, results))
consistent = False
break
if not consistent:
@@ -887,9 +890,17 @@
recovery = gocept.zeoraid.recovery.Recovery(
self, target, self._finalize_recovery,
recover_blobs=(self.blob_fshelper and not self.shared_blob_dir))
- for msg in recovery():
- self.recovery_status = msg
- logger.debug(str(msg))
+ try:
+ for msg in recovery():
+ self.recovery_status = msg
+ logger.debug(str(msg))
+ except Exception:
+ logger.exception('Error recovering storage %s' % name)
+ self.storage_recovering = None
+ self.storages_degraded.append(name)
+ self.degrade_reasons[name] = (
+ 'an error occured recovering the storage')
+ raise
def _finalize_recovery(self, storage):
self._write_lock.acquire()
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py 2009-12-02 05:51:07 UTC (rev 106156)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py 2009-12-02 07:39:57 UTC (rev 106157)
@@ -1183,6 +1183,32 @@
self._dostore()
self.assertEquals('optimal', self._storage.raid_status())
+ def test_recover_failing(self):
+ self._dostore()
+ self._dostore()
+ self._dostore()
+ self._disable_storage(0)
+ self.assertEquals('degraded', self._storage.raid_status())
+ # Store something regularly
+ self._dostore()
+ self._dostore()
+ # Store something in the wrong storage which will cause recovery to
+ # fail
+ other = self._storage.openers['1'].open()
+ raid = self._storage
+ self._storage = other
+ self._dostore()
+ self._dostore()
+ self._storage.close()
+ self._storage = raid
+
+ self.assertRaises(
+ ValueError,
+ self._storage._recover_impl, self._storage.storages_degraded[0])
+ self.assertEquals(
+ {'1': 'failed: an error occured recovering the storage',
+ '0': 'optimal'}, self._storage.raid_details())
+
def test_timeoutBackend(self):
self._storage.timeout = 2
More information about the checkins
mailing list