-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Background process rotate_notifs
fails due to unique constraint violation
#14641
Comments
rotate_notifs
fails due to unique constraint violation
Can you please connect to the db and show us the output of
and
please? |
At first glance this looks like a duplicate of (part of) #14120 (introduced by #13753). #14120 was supposedly fixed by #14138 in v1.69.0rc2, but I think this is referring to a different aspect of the issue. The new index on The only reason I can imagine it didn't is if you have background updates left over; please could you |
event_push_summary schema:
background_updates:
If the issue is the unique index on user_id, room_id is it safe to drop this index? |
Did you by any chance do a big jump from Synapse < 1.62.0 to >= 1.70.0? If so, what could have happened is that we registered multiple background jobs to create indexes ( We should probably add a background update to delete the first background job and attempt to re-delete the index (if it exists). DELETE FROM background_updates WHERE update_name = 'event_push_summary_unique_index';
DROP INDEX IF EXISTS event_push_summary_unique_index; We should check the other tables too, this could be an issue there too. |
It appears that we did. The upgrade moved from 1.59.1 to 1.70.1 from what I can tell. |
I've just seen this and I also did a big upgrade jump (in the same ballpark as @highsineburgh) a couple weeks back. Additionally, just like @highsineburgh, I'm using sqlite. sqlite> .schema event_push_summary
CREATE TABLE event_push_summary ( user_id TEXT NOT NULL, room_id TEXT NOT NULL, notif_count BIGINT NOT NULL, stream_ordering BIGINT NOT NULL , unread_count BIGINT, last_receipt_stream_ordering BIGINT, thread_id TEXT);
CREATE UNIQUE INDEX event_push_summary_unique_index ON event_push_summary (user_id, room_id) ;
CREATE UNIQUE INDEX event_push_summary_unique_index2 ON event_push_summary (user_id, room_id, thread_id) ;
CREATE INDEX event_push_summary_thread_id_null ON event_push_summary (thread_id) WHERE thread_id IS NULL; sqlite> SELECT * FROM background_updates ORDER BY ordering;
sqlite> Synapse 1.71.0 |
@highsineburgh @asymmetric I took a look at this again and I think you're safe to run my SQL from above to drop the index. If you'd prefer to wait then #14669 should fix it for you (and any other affected people / stop it from occurring again in the future). |
Thanks, dropping the index has prevented the error message from appearing and everything seems to be functioning properly. |
Should be fixed by #14669. |
Description
We've recently started seeing an exception being thrown every 30s from the background process 'rotate_notifs'. There does not appear to be any impact on users.
This appears to be the result of a violation of a unique constraint on the
event_push_summary
table. Full stack trace of the error is provided below.Steps to reproduce
Homeserver
self-hosted
Synapse Version
{"server_version":"1.70.1","python_version":"3.9.13"}
Installation Method
Other (please mention below)
Database
SQLite
Workers
Single process
Platform
Running on NixOS using the Nix package on AWS instance.
Configuration
Some users have enabled threads.
Relevant log output
Anything else that would be useful to know?
From the debug logs - the sql values looking at
user_id
,room_id
andthread_id
are unique, butuser_id
androom_id
are not.The text was updated successfully, but these errors were encountered: