# HG changeset patch # User Pierre-Yves David # Date 1535322951 -7200 # Node ID 8a6a2c37c0fa1f788b8cf2048de2799d44456c8e # Parent b3517f834f83831d7897e7ca205c7dbdb46d7aac sqlcache: also ignore integrity error integrity error can happens when multiple client tries to warm similar cache. Given we leave multiple hole in the cache that can be warmed by anyone, this is harder to avoid that we would like. We simply catch the error in this case. Someone will warm the missing entry later. diff -r b3517f834f83 -r 8a6a2c37c0fa hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 00:28:19 2018 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 00:35:51 2018 +0200 @@ -570,7 +570,14 @@ def _save(self, repo): try: return self._trysave(repo) - except sqlite3.OperationalError as exc: + except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc: + # Catch error that may arise under stress + # + # operational error catch read-only and locked database + # IntegrityError catch Unique constraint error that may arise + if '_con' in vars(self): + del self._con + self._new.clear() repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) def _trysave(self, repo): diff -r b3517f834f83 -r 8a6a2c37c0fa hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Mon Aug 27 00:28:19 2018 +0200 +++ b/hgext3rd/evolve/stablerangecache.py Mon Aug 27 00:35:51 2018 +0200 @@ -225,7 +225,14 @@ def _save(self, repo): try: return self._trysave(repo) - except sqlite3.OperationalError as exc: + except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc: + # Catch error that may arise under stress + # + # operational error catch read-only and locked database + # IntegrityError catch Unique constraint error that may arise + if '_con' in vars(self): + del self._con + self._unsavedsubranges.clear() repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) def _trysave(self, repo):