Delayed columndropper issues

We’ve ran into a few fights with the delayed column dropping mechanism lately. These are rare issues but they cause a lot of pain, relatively speaking.

The question is : is there any way to manually force the columndropper to run?

Details of the issues in case anyone is interested:

  • run migrations, then within an hour export the database and try to import it elsewhere. The import will fail because the required triggers in the discourse_functions schema will not exist on the new host.
  • import or attach a new database into a multisite. The migrations will run but the columns will not drop, causing PG::UndefinedColumn errors and causing Discourse to step in and clear the activerecord cache. This keeps on happening for one hour until the delayed drops are executed.

Being able to force the delayed drops to run would solve work around all those issues.

2 Likes

You could trick the system into believing that the first migration ran more than one hour ago.

https://github.com/discourse/discourse/blob/dd810b8b05aa5baa3e1cfe3e6e35c42dab7716bd/spec/components/migration/column_dropper_spec.rb#L19-L22

BTW: This is going to change soon: https://github.com/discourse/discourse/pull/6406

7 Likes

Maybe @tgxworld or @sam could comment, as they have time.

1 Like

Our plan is to introduce a new system that is not subject to these issues in the next few weeks, we will announce it on meta when ready

8 Likes
3 Likes