[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py
added pseudo code for online recovery
Thomas Lotze
tl at gocept.com
Thu Jan 31 11:29:18 EST 2008
Log message for revision 83338:
added pseudo code for online recovery
Changed:
A gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py
-=-
Added: gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py (rev 0)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py 2008-01-31 16:29:18 UTC (rev 83338)
@@ -0,0 +1,59 @@
+# vim:fileencoding=utf-8
+# Copyright (c) 2007 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id$
+"""ZEORaid online recovery implementation."""
+
+
+class Recovery(object):
+ """ZEORaid online recovery implementation.
+ """
+
+ _current = 0
+ raid_transaction_count = 0
+ target_transaction_count = 0
+
+ def __init__(self, raid_storage, target_name):
+ self.raid_storage = raid_storage
+ self.target_name = target_name
+ self.target = raid_storage.storages[target_name]
+ self.target_transaction_count = ...
+ # initialize counting up self.raid_transaction_count
+
+ def get_raid_transaction_info(self, n):
+ """Retrieves the n-th transaction info from the RAID, counting from
+ the beginning of the storage's history.
+ """
+
+ def get_target_transaction_info(self, n):
+ """Retrieves the n-th transaction info from the target storage,
+ counting from the beginning of the storage's history.
+ """
+
+ def __call__(self):
+ """Performs recovery."""
+ # Verify old transactions that may already be stored in the target
+ # storage.
+ for self._current in xrange(self.target_transaction_count):
+ if (self.get_raid_transaction_info(self._current) !=
+ self.get_target_transaction_info(self._current)):
+ raise XXX
+
+ # Recover all transaction from that point on until self._current
+ # equals self.raid_transaction_count.
+ # self._current now points to the first transaction to be copied.
+ # We need to do a "while True" loop in order to be able to check on
+ # our progress and finalize recovery atomically.
+ while True:
+ lock
+ try:
+ if self._current == self.raid_transaction_count:
+ no longer degraded
+ break
+ finally:
+ unlock
+
+ # Recover transaction self._current.
+ foo
+
+ self._current += 1
Property changes on: gocept.zeoraid/trunk/src/gocept/zeoraid/recovery.py
___________________________________________________________________
Name: svn:keywords
+ Id Rev Date
Name: svn:eol-style
+ native
More information about the Checkins
mailing list