Log actual number of entries deleted

This commit is contained in:
Erik Johnston 2019-05-29 11:58:32 +01:00
parent 6ebc08c09d
commit 1d818fde14
2 changed files with 13 additions and 5 deletions

View File

@ -1261,7 +1261,8 @@ class SQLBaseStore(object):
" AND ".join("%s = ?" % (k,) for k in keyvalues), " 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): def _simple_delete_many(self, table, column, iterable, keyvalues, desc):
return self.runInteraction( return self.runInteraction(
@ -1280,9 +1281,12 @@ class SQLBaseStore(object):
column : column name to test for inclusion against `iterable` column : column name to test for inclusion against `iterable`
iterable : list iterable : list
keyvalues : dict of column names and values to select the rows with keyvalues : dict of column names and values to select the rows with
Returns:
int: Number rows deleted
""" """
if not iterable: if not iterable:
return return 0
sql = "DELETE FROM %s" % table sql = "DELETE FROM %s" % table
@ -1297,7 +1301,9 @@ class SQLBaseStore(object):
if clauses: if clauses:
sql = "%s WHERE %s" % (sql, " AND ".join(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( def _get_cache_dict(
self, db_conn, table, entity_column, stream_column, max_value, limit=100000 self, db_conn, table, entity_column, stream_column, max_value, limit=100000

View File

@ -2476,7 +2476,7 @@ class EventsStore(
logger.info("Deleting up to %d forward extremities", len(to_delete)) logger.info("Deleting up to %d forward extremities", len(to_delete))
self._simple_delete_many_txn( deleted = self._simple_delete_many_txn(
txn=txn, txn=txn,
table="event_forward_extremities", table="event_forward_extremities",
column="event_id", column="event_id",
@ -2484,7 +2484,9 @@ class EventsStore(
keyvalues={}, keyvalues={},
) )
if to_delete: logger.info("Deleted %d forward extremities", deleted)
if deleted:
# We now need to invalidate the caches of these rooms # We now need to invalidate the caches of these rooms
rows = self._simple_select_many_txn( rows = self._simple_select_many_txn(
txn, txn,