More intelligently handle CacheCorruption errors in the writable cache.
authorZac Medico <zmedico@gentoo.org>
Wed, 20 Dec 2006 22:09:59 +0000 (22:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 20 Dec 2006 22:09:59 +0000 (22:09 -0000)
svn path=/main/trunk/; revision=5338

pym/cache/metadata_overlay.py

index 9320b0938b0648d6b6e220cb3367dcbf1565ec9e..c4d18c173327de1a06dc63a152c0cd747e51a4e2 100644 (file)
@@ -6,6 +6,7 @@ import time
 if not hasattr(__builtins__, "set"):
        from sets import Set as set
 from cache import template
+from cache.cache_errors import CacheCorruption
 from cache.flat_hash import database as db_rw
 from cache.metadata import database as db_ro
 
@@ -26,6 +27,9 @@ class database(template.database):
                        value = self.db_rw[cpv]
                except KeyError:
                        return self.db_ro[cpv] # raises a KeyError when necessary
+               except CacheCorruption:
+                       del self.db_rw[cpv]
+                       return self.db_ro[cpv] # raises a KeyError when necessary
                if self._is_whiteout(value):
                        if self._is_whiteout_valid(cpv, value):
                                raise KeyError(cpv)