changeset 4014:6fcda453b317

sqlcache: also catch malformed database error This is apparently another way for sqlite to fail at concurrency.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 27 Aug 2018 12:40:47 +0200
parents 434398b37e16
children 9ec77b6f2626
files hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/stablerangecache.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py	Mon Aug 27 12:40:41 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Mon Aug 27 12:40:47 2018 +0200
@@ -442,7 +442,7 @@
                 if obshash is not None:
                     value = obshash[0]
                 self._data[rangeid] = value
-            except sqlite3.OperationalError:
+            except (sqlite3.DatabaseError, sqlite3.OperationalError):
                 # something is wrong with the sqlite db
                 # Since this is a cache, we ignore it.
                 if '_con' in vars(self):
@@ -494,7 +494,7 @@
                             con.executemany(_delete, ranges)
                             for r in ranges:
                                 self._data.pop(r, None)
-                    except sqlite3.OperationalError as exc:
+                    except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc:
                         repo.ui.log('evoext-cache', 'error while updating obshashrange cache: %s' % exc)
                         del self._updating
                         return
@@ -589,7 +589,7 @@
             return
         try:
             return self._trysave(repo)
-        except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
+        except (sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
             # Catch error that may arise under stress
             #
             # operational error catch read-only and locked database
--- a/hgext3rd/evolve/stablerangecache.py	Mon Aug 27 12:40:41 2018 +0200
+++ b/hgext3rd/evolve/stablerangecache.py	Mon Aug 27 12:40:47 2018 +0200
@@ -183,7 +183,7 @@
                     value = self._con.execute(_querysubranges, rangeid).fetchall()
                 # in memory caching of the value
                 cache[rangeid] = value
-            except sqlite3.OperationalError:
+            except (sqlite3.DatabaseError, sqlite3.OperationalError):
                 # something is wrong with the sqlite db
                 # Since this is a cache, we ignore it.
                 if '_con' in vars(self):
@@ -235,7 +235,7 @@
             return
         try:
             return self._trysave(repo)
-        except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
+        except (sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
             # Catch error that may arise under stress
             #
             # operational error catch read-only and locked database