This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/db/post_migrate
Claire 526332c545
Fix account deletion sometimes failing because of optimistic locks (#16317)
* Fix account deletion sometimes failing because of optimistic locks

In some rare occasions[1], deleting accounts would fail with a
`StaleObjectError` exception.

Indeed, account deletion manually sets the `AccountStat` values without
handling cases where the optimistic locking on `AccountStat` would fail.

To my knowledge, with the rewrite of account counters in #15913, the
`DeleteAccountService` is now the only place that changes the counters in
a way that is not atomic.

Since in this specific case, we do not care about the previous values of the
account counters, it appears we don't need locking at all for this table
anymore.

[1]: https://discourse.joinmastodon.org/t/account-cant-be-deleted/3602

* Bump MAX_SUPPORTED_VERSION in maintenance script
2021-06-02 17:41:25 +02:00
..
.gitkeep
20180813113448_copy_status_stats_cleanup.rb
20181116184611_copy_account_stats_cleanup.rb
20190511152737_remove_suspended_silenced_account_fields.rb
20190519130537_remove_boosts_widening_audience.rb
20190706233204_drop_stream_entries.rb
20190715031050_drop_subscriptions.rb
20190901040524_remove_score_from_tags.rb
20190927124642_remove_invalid_web_push_subscription.rb
20200917193528_migrate_notifications_type.rb
20200917222734_remove_index_notifications_on_account_activity.rb
20201017234926_fill_account_suspension_origin.rb
20210308133107_remove_subscription_expires_at_from_accounts.rb
20210502233513_drop_account_tag_stats.rb
20210507001928_remove_hub_url_from_accounts.rb
20210526193025_remove_lock_version_from_account_stats.rb