The discussion revolves around the issue of the bundle exec rake db:migrate command taking a long time due to a calendar migration. Sikamikanico initially reported the issue, and Falco suggested checking which migration is causing the trouble.
After investigation, it was discovered that the calendar_events table had an enormous number of rows (69,724,384), causing the migration to slow down. Pfaffman found that a DELETE query was eating 100% CPU, and Falco requested the full SQL query.
The query was identified as a calendar plugin issue, which was duplicating events when a timezone changed. Pfaffman suggested removing the plugin, and after doing so, the database migrated, and the site was back online.
The root cause of the issue is believed to be a bug in the plugin that duplicated events. Renato asked if the duplicated entries were from the past or recent, and Pfaffman found that there were still a large number of recent entries.
The calendar plugin was removed as a temporary solution, and Pfaffman suggested that if the plugin is to be reinstated, all calendar events should be deleted, and the plugin should be restarted. The calendar_events table was found to be 11 GB in size, which is significantly larger than other tables in the database.
Sikamikanico confirmed that the site is now back online, and Pfaffman offered to help with cleaning up the issue further.
Now it is doing something, but it’s doing it extremely slowly. I’ve been running the forum via a self installed digital ocean droplet for 3 years now, but this is new and is causing a lot of downtime. Is there a way to smooth this out? Is it to do with images on the forum or something?
As someone who freely admits I’m an amateur doing his best - any recommendations for what I should do next?
The db:migrate failed - message was:
client_loop: send disconnect: Connection reset
On logging back in, you’re quite right:
New release ‘20.04.6 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.
Considering my forum is currently down, am I safe to do the upgrade, and then worry about fixing the forum? or should I try and get that back online first?
There’s a decent chance that you could spin up a new VM, stop the container (sounds like it’s not runnnig anyway) then rsync everything to the new server and try again there. That can likely get you back up and running without losing any data.
It all sounds so simple, but man am I feeling out of my depth here. It’s currently running on a digital ocean droplet. So spinning up a new VM - that’s a loaded sentence? On the same droplet? On a new one?
htop shows that the discourse [local] delete is what’s eating 100% cpu. The droplet has 8GB of RAM, and right now <1GB is in use (not counting buffers).
The OS is out of date, but this seems very strange to me. There’s plenty of RAM and disk, and that postgres delete task has been running for >12 minutes. There are less than 600K posts and <4K users, so the database isn’t huge. Oh. Wait. the postgres_data directory is 28GB.
Enter the container, switch to the postgres user, enter psql and run
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;