The discussion revolves around the error “integer out of range” in Discourse. The issue occurs when the id column in the notifications table reaches its maximum limit. markersocial initially reported the error, and Falco identified it as the “integer max problem.” sam provided a workaround by running the SQL command ALTER TABLE notifications ALTER COLUMN id SET DATA TYPE bigint, but noted that it may cause increased storage requirements.
However, bjlarouche reported that the workaround did not fully resolve the issue, and sam suggested that there may be other tables or columns that need to be updated. bjlarouche eventually identified four columns in four tables that needed to be migrated to bigint: notifications.id, user.seen_notification_id, user_badges.notification_id, and shelved_notifications.notification_id.
sam decided to migrate the columns in core Discourse to bigint, citing the potential for the issue to occur again on large forums. A pull request was created to implement the migration, which has since been merged JammyDodger.
Regarding the workaround, this should be relatively safe to do? Not worried about down time, just breaking something.
It’s using the standard app.yml single container. For shedding the web load, do you think using read-only mode and running ./launcher stop app, ./launcher start app prior to doing the workaround probably suffice?
I ran that (no confirmation/feedback received, like the previous one). Forum didn’t slow down, so not sure if it worked. Getting the same errors currently.
Maybe it would be best if I wait for the official migration.
Curious where you are on this issue now? Did the errors stop?
Originally we were thinking of making some official migration here, but the risk far outweighs the benefit. We find it exceedingly rare to come across DBs with more than 2,147,483,647 posts. 2.1 billion is a real big number.
The downside of increasing the sized everywhere are that storage requirements go up.
Where we are now is that we are considering adding a rake task that “makes space” if you are in an outlier case where you have tables in Discourse that containe 2 billion rows (or had 2 billion rows of churn)
I just upgraded to 2.8.0.beta6 and still getting the integer out of range errors.
I think that it’s just the notifications that has got to a massive number, which is a bit more realistic to reach the limit compared to number of posts. A lot of large topics with many replies, likes etc. from different users can result in quite a lot of notifications.
Yes this remains the only workaround here. I worry about changing it in core, but I guess this is just going to keep happening on gigantic forums if we don’t fix this.
Do you know if there are any usages in the post_actions service (or somewhere in the notification process) that might still be expecting integers after runing ALTER?
We’re seeing 5xx errors on like/unlike calls to /post_actions with the response
{"errors":["The requested URL or resource could not be found."],"error_type":"not_found"}
Plus, some the job failures around notfications (Jobs::BookmarkReminderNotifications, Jobs::GrantAnniversaryBadges, Jobs::PostAlert).
I added the backtrace for PostAlert in my prev message; looks like theres an issue being thrown for an integer limit by consolidate_or_create in notification.rb.
For our usage, increased storage isn’t too big of a concern if we can restore functionality