From: Brian Warner Date: Mon, 9 Mar 2009 03:42:20 +0000 (-0700) Subject: storage.expirer: handle upgrades better X-Git-Tag: allmydata-tahoe-1.4.0~71 X-Git-Url: https://git.rkrishnan.org/pf/content/simplejson/statistics?a=commitdiff_plain;h=df3f7f93e0b28a2bb28ac6bde45b30689ece801e;p=tahoe-lafs%2Ftahoe-lafs.git storage.expirer: handle upgrades better --- diff --git a/src/allmydata/storage/expirer.py b/src/allmydata/storage/expirer.py index 79254241..32913cb9 100644 --- a/src/allmydata/storage/expirer.py +++ b/src/allmydata/storage/expirer.py @@ -61,6 +61,10 @@ class LeaseCheckingCrawler(ShareCrawler): # get started: unit tests do this so_far = self.create_empty_cycle_dict() self.state.setdefault("cycle-to-date", so_far) + # in case we upgrade the code while a cycle is in progress, update + # the keys individually + for k in self.state["cycle-to-date"]: + self.state["cycle-to-date"].setdefault(k, so_far[k]) # initialize history if not os.path.exists(self.historyfile):