summary refs log tree commit diff
path: root/synapse/storage/stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/stats.py')
-rw-r--r--synapse/storage/stats.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py
index c950ab9953..0f3aa6a801 100644
--- a/synapse/storage/stats.py
+++ b/synapse/storage/stats.py
@@ -180,6 +180,7 @@ class StatsStore(StateDeltasStore):
 
             txn.execute(sql, qargs)
         else:
+            self.database_engine.lock_table(txn, table)
             retcols = chain(absolutes.keys(), additive_relatives.keys())
             current_row = self._simple_select_one_txn(
                 txn, table, keyvalues, retcols, allow_none=True
@@ -260,6 +261,7 @@ class StatsStore(StateDeltasStore):
             qargs = chain(additive_relatives.values(), keyvalues.values())
             txn.execute(sql, qargs)
         else:
+            self.database_engine.lock_table(txn, into_table)
             src_row = self._simple_select_one_txn(
                 txn, src_table, keyvalues, copy_columns
             )