-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
synapse_port_db produces unusable database due to numerous duplicate key constraint errors #13110
Comments
What happens if you run these queries against the sqlite version of your DB? SELECT COUNT(*) FROM events WHERE event_id = '$xd40t16UrIqo4_AvnHvYrXbSZAg_RtBUrVyC9IkirD8';
SELECT COUNT(*) FROM event_json WHERE event_id = '$xd40t16UrIqo4_AvnHvYrXbSZAg_RtBUrVyC9IkirD8'; |
Both queries return |
What happens if you try: SELECT outlier FROM events WHERE event_id = '$xd40t16UrIqo4_AvnHvYrXbSZAg_RtBUrVyC9IkirD8'; against both the SQLite and PostgreSQL versions of the database? From It'd be interesting to see if the results from the query above were inconsistent somehow. |
Hey, sorry for the delay. Unfortunately I cleared out the Postgres database to save space and trying to migrate again no longer succeeds, giving me a new set of errors:
|
Those new set of errors sound like #13191. The fix for that should be released in Synapse 1.63, due for release on Tuesday. There's also a release candidate 1.63.0rc1 available if you're keen to @hutchisr: could you do the following:
|
I upgraded my instance from v1.60.0 to v1.63.1 and the script completed without issue however my postgres logs filled up with messages like
I then tried reverting to a backup and rerunning the script just once (took the server down and ported homeserver.db directly) and am no longer seeing these messages. |
Sounds like #13191 fixed this issue then. Please shout if that isn't the case! |
Description
Porting a synapse homeserver from sqlite to postgresql results in an unusable server where any action (sending a message, leaving a room, etc) fails due to duplicate key errors in
event_json
,event_auth
tables.Steps to reproduce
matrix-synapse.service
cp homeserver.db homeserver-snapshot.db
createdb --encoding=UTF8 --locale=C --template=template0 --owner=matrix-synapse matrix
synapse_port_db --sqlite-database /var/lib/matrix-synapse/homeserver-snapshot.db --postgres-config homeserver-postgresql.yaml
matrix-synapse.service
Homeserver
homunyan.com
Synapse Version
1.61.0
Installation Method
Debian packages from packages.matrix.org
Platform
Ubuntu 22.04 Virtual Machine
Relevant log output
Anything else that would be useful to know?
Deleting the entries with the offending keys doesn't help since there are a seemingly unending number of keys that shouldn't exist.
The text was updated successfully, but these errors were encountered: