summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-09-27 12:31:37 +0100
committerGitHub <noreply@github.com>2018-09-27 12:31:37 +0100
commit51d33d51784d4adf265482b4b8f873e9bb82d130 (patch)
treeaa8b04ba81d99d1c16175100f57669d012139d71 /synapse/storage
parentMerge pull request #3966 from matrix-org/rav/rx_txn_logging_2 (diff)
parenttowncrier (diff)
downloadsynapse-51d33d51784d4adf265482b4b8f873e9bb82d130.tar.xz
Merge pull request #3961 from matrix-org/neilj/lock_mau_upserts
fix #3854 MAU transaction errors
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/monthly_active_users.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py
index 59580949f1..0fe8c8e24c 100644
--- a/synapse/storage/monthly_active_users.py
+++ b/synapse/storage/monthly_active_users.py
@@ -172,6 +172,10 @@ class MonthlyActiveUsersStore(SQLBaseStore):
             Deferred[bool]: True if a new entry was created, False if an
                 existing one was updated.
         """
+        # Am consciously deciding to lock the table on the basis that is ought
+        # never be a big table and alternative approaches (batching multiple
+        # upserts into a single txn) introduced a lot of extra complexity.
+        # See https://github.com/matrix-org/synapse/issues/3854 for more
         is_insert = yield self._simple_upsert(
             desc="upsert_monthly_active_user",
             table="monthly_active_users",
@@ -181,7 +185,6 @@ class MonthlyActiveUsersStore(SQLBaseStore):
             values={
                 "timestamp": int(self._clock.time_msec()),
             },
-            lock=False,
         )
         if is_insert:
             self.user_last_seen_monthly_active.invalidate((user_id,))