14

Add ability to ignore tables in the schema cache by eileencodes · Pull Request #...

 2 years ago
source link: https://github.com/rails/rails/pull/43075
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Member

eileencodes commented 7 days ago

edited

In cases where an application uses pt-osc or lhm they may have
temporary tables being used for migrations. Those tables shouldn't be
included by the schema cache because it makes the cache bigger and those
tables shouldn't ever be queried by the application. This feature allows
applications to configure a list of or regex of tables to ignore. The
behavior for ignored tables for each method in the schema cache
(columns, columns_hash, primary_keys, and indexes) matches the
behavior of a non-existent table.

To use in an application configure config.active_record.schema_cache_ignored_tables
to an array of tables or regex's. Those tables will not be included in
the schema cache dump.

cc/ @rafaelfranca @casperisfine @tenderlove - I think this will work for your schema cache. Note that in our app I found we actually weren't ensuring that primary_keys, columns, columns_hash and indexes were behaving the same as a non-existent table which meant that if these tables were ever queried then they'd populate the cache in-memory. Since these tables are not supposed to be queried this technically shouldn't change behavior when your app opts into this.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK