diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-27 13:41:48 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-27 13:41:48 +0100 |
commit | a6c102009e219d93b512f682e5f799037536e3ee (patch) | |
tree | f5d4542b8723e913ff52d782395bfb196a8bd851 | |
parent | Apply minor suggestions from review (diff) | |
download | synapse-a6c102009e219d93b512f682e5f799037536e3ee.tar.xz |
Lock tables in upsert fall-backs.
Should not be too much of a performance concern as this code won't be hit on Postgres, which large deployments should be using. Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r-- | synapse/storage/stats.py | 2 |
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 ) |