summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-29 11:58:32 +0100
committerErik Johnston <erik@matrix.org>2019-05-30 16:15:37 +0100
commit1d818fde14595299de9e13008c67239ca677014f (patch)
tree0a177261aed4be263d9a238a3d9afa4a202a679a /synapse/storage
parentAdd DB bg update to cleanup extremities. (diff)
downloadsynapse-1d818fde14595299de9e13008c67239ca677014f.tar.xz
Log actual number of entries deleted
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/_base.py12
-rw-r--r--synapse/storage/events.py6
2 files changed, 13 insertions, 5 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index fa6839ceca..3fe827cd43 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -1261,7 +1261,8 @@ class SQLBaseStore(object):
             " AND ".join("%s = ?" % (k,) for k in keyvalues),
         )
 
-        return txn.execute(sql, list(keyvalues.values()))
+        txn.execute(sql, list(keyvalues.values()))
+        return txn.rowcount
 
     def _simple_delete_many(self, table, column, iterable, keyvalues, desc):
         return self.runInteraction(
@@ -1280,9 +1281,12 @@ class SQLBaseStore(object):
             column : column name to test for inclusion against `iterable`
             iterable : list
             keyvalues : dict of column names and values to select the rows with
+
+        Returns:
+            int: Number rows deleted
         """
         if not iterable:
-            return
+            return 0
 
         sql = "DELETE FROM %s" % table
 
@@ -1297,7 +1301,9 @@ class SQLBaseStore(object):
 
         if clauses:
             sql = "%s WHERE %s" % (sql, " AND ".join(clauses))
-        return txn.execute(sql, values)
+        txn.execute(sql, values)
+
+        return txn.rowcount
 
     def _get_cache_dict(
         self, db_conn, table, entity_column, stream_column, max_value, limit=100000
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index a9be143bd5..a9664928ca 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -2476,7 +2476,7 @@ class EventsStore(
 
             logger.info("Deleting up to %d forward extremities", len(to_delete))
 
-            self._simple_delete_many_txn(
+            deleted = self._simple_delete_many_txn(
                 txn=txn,
                 table="event_forward_extremities",
                 column="event_id",
@@ -2484,7 +2484,9 @@ class EventsStore(
                 keyvalues={},
             )
 
-            if to_delete:
+            logger.info("Deleted %d forward extremities", deleted)
+
+            if deleted:
                 # We now need to invalidate the caches of these rooms
                 rows = self._simple_select_many_txn(
                     txn,