github / github/gh-ost

Column drops with Rails

Open
#579 11 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

What is the suggested way of handling column drops with gh-ost, when running a Rails application? We've run into problems with this, because of the [Rails schema cache](http://kirshatrov.com/2016/12/13/schema-cache/). After the cut-over, Rails gets confused because it still has the old table schema in its cache and as a result starts throwing exceptions.

Since GitHub is also using Rails, I thought this would be a good place to ask. 😛

Two simple ways of dealing with the problem are (1) restart the Rails server after the cut-over or (2) explicitly invalidate the schema cache after the cut-over. Neither of these is desirable, because they couple the gh-ost migration to the Rails application, and de-coupling these is one of the reasons we started using gh-ost.

Another suggestion we have is to remove eager loading on the relevant queries, before the cut-over. Personally I'm not too familiar with eager loading, but it would fit with our process, which requires making the application code capable of working with or without the column that is being dropped, _before_ the cut-over happens.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.