Urgent: site down after rebuild

AI-generated summary

The user bartv reported their Discourse site went down after an upgrade and rebuild, encountering an error about a duplicate index on the topics table. After attempting to fix it by deleting the index, the issue persisted. sam pointed to a fix in a GitHub commit, noting it would be available once tests passed. j.jaffeux clarified how to track when the fix is ready, and bartv confirmed the rebuild succeeded after the fix was applied.

Hi,

I urgently need some help - I did an upgrade from /admin/upgrade today, but the process never finished. I then restarted Discourse and tried a ./launcher rebuild app from the command line, but I keep getting the following error:

	SET first_unread_at = u.created_at
	FROM users u
	WHERE u.id = us.user_id
	
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Index name 'index_topics_on_updated_at_public' on table 'topics' already exists

The problem remains after disabling all plugins. Our site is down right now, I’d appreciate some help to diagnose and fix this. Thanks!

Update: I found that I could restart Discourse with ./launcher start app, but I’m not entirely sure of the current state of my instance.

Update: After starting the app, I went into psql and deleted the index that was mentioned in the error. After a rebuild, the exact same error came up again.

This should fix it, but you will need to wait till tests passed

https://github.com/discourse/discourse/commit/8f4527c1f1861e5038bf6104fc86e6c8308c03c4

if you nuked the index though it should surely pass, but maybe you did not nuke it properly… I don’t know.

:+1:thanks Sam!

maybe you did not nuke it properly

That’s very possible, Postgres is still new to me :slight_smile:

wait till tests passed

How will I know when that is?

When the commit appears in this list:

https://github.com/discourse/discourse/commits/tests-passed

It’s in tests-passed

Thanks to @pmusaraj our faster build times are paying off :smiling_face_with_three_hearts:

My rebuild just passed the part where it creates the index. Thanks, gentlemen!