Page MenuHomePhabricator

Actively delete echo_event rows when they become orphaned
Closed, ResolvedPublic

Description

Instead of periodically purging orphaned echo_event rows using removeOrphanedEvents.php, we should actively delete them when the last thing that refers to them is deleted. This means that when an echo_notification row is deleted (because the user exceeded the 2000 notification limit) and when an echo_email_batch row is deleted (because the email was sent), we should check whether the echo_event rows they refer to still have other things referring to them, and if not, delete them.

When deleting these echo_event rows, we also need to delete the corresponding echo_target_page rows, per T221261.

Details

Related Gerrit Patches:

Event Timeline

Catrope created this task.Apr 17 2019, 4:40 PM
Restricted Application added a project: Growth-Team. · View Herald TranscriptApr 17 2019, 4:40 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 505829 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/extensions/Echo@master] Proactively delete echo_event rows when they become orphaned

https://gerrit.wikimedia.org/r/505829

Catrope claimed this task.Apr 24 2019, 4:04 PM

Change 505829 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Proactively delete echo_event rows when they become orphaned

https://gerrit.wikimedia.org/r/505829

Etonkovidova closed this task as Resolved.May 3 2019, 9:22 PM
Etonkovidova added a subscriber: Etonkovidova.

Checked in betalabs

@deployment-deploy01:~$ mwscript extensions/Echo/maintenance/removeOrphanedEvents.php --wiki=enwiki --force
Removing orphaned echo_event rows...
MariaDB [enwiki]> SELECT COUNT(*) FROM echo_event LEFT JOIN echo_notification ON notification_event=event_id WHERE notification_timestamp IS NULL;
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.15 sec)

Change 532483 had a related patch set uploaded (by Paladox; owner: Catrope):
[mediawiki/extensions/Echo@REL1_33] Proactively delete echo_event rows when they become orphaned

https://gerrit.wikimedia.org/r/532483

Change 532483 merged by jenkins-bot:
[mediawiki/extensions/Echo@REL1_33] Proactively delete echo_event rows when they become orphaned

https://gerrit.wikimedia.org/r/532483