Open daedric7 opened 1 year ago
Corresponding API docs are https://matrix-org.github.io/synapse/latest/admin_api/statistics.html#get-largest-rooms-by-size-in-database
Looks like there is a couple edge cases we should take into account in the stats code.
For example, just running the SQL query locally, I see that tables can return empty or just be completely omitted even after a ANALYZE;
SELECT
tablename, most_common_vals::TEXT::TEXT[], most_common_freqs::TEXT::NUMERIC[]
FROM pg_stats
WHERE
tablename IN ('event_json', 'events', 'event_search', 'event_edges', 'event_push_actions', 'stream_ordering_to_exterm')
and attname = 'room_id';
tablename | most_common_vals | most_common_freqs
---------------------------+-------------------------------------------------------------------------------------------+------------------------
event_json | {!KQuSGAhSwdtQiqBxGw:my.synapse.linux.server,!UVksaBnsYTjHqLmOqz:my.synapse.linux.server} | {0.75,0.25}
event_search | {!KQuSGAhSwdtQiqBxGw:my.synapse.linux.server,!UVksaBnsYTjHqLmOqz:my.synapse.linux.server} | {0.9,0.1}
stream_ordering_to_exterm | {!KQuSGAhSwdtQiqBxGw:my.synapse.linux.server,!UVksaBnsYTjHqLmOqz:my.synapse.linux.server} | {0.8636364,0.13636364}
events | {!KQuSGAhSwdtQiqBxGw:my.synapse.linux.server,!UVksaBnsYTjHqLmOqz:my.synapse.linux.server} | {0.75,0.25}
event_edges | |
(5 rows)
Description
When attempting to use the API endpoint
/_synapse/admin/v1/statistics/database/rooms
viacurl
, a HTTP 500 is received while Synapse throws Python errors in the log.Steps to reproduce
curl -XGET --header "Authorization: Bearer TOKENTOKEN" http://synapse-server/_synapse/admin/v1/statistics/database/rooms
Homeserver
aguiarvieira.pt
Synapse Version
1.86.0
Installation Method
Docker (
matrixdotorg/synapse
)Database
PostgreSQL
Workers
Multiple workers
Platform
Oracle Arm Free with Docker
Configuration
Presence: yes Retention: no Synapse modules: shared_secret_authenticator.SharedSecretAuthProvider
Relevant log output
Anything else that would be useful to know?
No response