summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-07-18 13:25:35 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-07-18 13:25:35 +0100
commit94463bf5fb76e1baa9409f8faf53055a68083209 (patch)
treeb4227986badb9e75cdcd2002de6dc0f84468d499
parentChangelog for #5691 (diff)
downloadsynapse-94463bf5fb76e1baa9409f8faf53055a68083209.tar.xz
Disuse `room_stats.state_events` (relates to #5690)
since it is tricky to maintain and has no known use case (for now).

Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r--synapse/handlers/stats.py8
-rw-r--r--synapse/storage/stats.py8
2 files changed, 6 insertions, 10 deletions
diff --git a/synapse/handlers/stats.py b/synapse/handlers/stats.py
index d3b1db4951..f595de1537 100644
--- a/synapse/handlers/stats.py
+++ b/synapse/handlers/stats.py
@@ -148,10 +148,6 @@ class StatsHandler(StateDeltasHandler):
             # quantise time to the nearest bucket
             now = (now // 1000 // self.stats_bucket_size) * self.stats_bucket_size
 
-            yield self.store.update_stats_delta(
-                now, "room", room_id, "state_events", +1
-            )
-
             if prev_event_id is None:
                 # this state event doesn't overwrite another,
                 # so it is a new effective/current state event
@@ -277,7 +273,9 @@ class StatsHandler(StateDeltasHandler):
                         "invited_members": 0,
                         "left_members": 0,
                         "banned_members": 0,
-                        "state_events": 1,
+                        # this column is disused but not yet removed from the
+                        # schema, so fill with -1.
+                        "state_events": -1,
                     },
                 )
 
diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py
index 1cec84ee2e..440bac41de 100644
--- a/synapse/storage/stats.py
+++ b/synapse/storage/stats.py
@@ -258,10 +258,6 @@ class StatsStore(StateDeltasStore):
 
                 membership_counts = self._get_user_counts_in_room_txn(txn, room_id)
 
-                total_state_events = self._get_total_state_event_counts_txn(
-                    txn, room_id
-                )
-
                 self._update_stats_txn(
                     txn,
                     "room",
@@ -274,7 +270,9 @@ class StatsStore(StateDeltasStore):
                         "invited_members": membership_counts.get(Membership.INVITE, 0),
                         "left_members": membership_counts.get(Membership.LEAVE, 0),
                         "banned_members": membership_counts.get(Membership.BAN, 0),
-                        "state_events": total_state_events,
+                        # this column is disused but not (yet) removed from the
+                        # schema, so we fill it with -1.
+                        "state_events": -1,
                     },
                 )
                 self._simple_insert_txn(