Rails CHANGELOG "2019-10-14".."2019-10-20"
この期間の CHANGELOG.md へのコミットは3件。
ActiveRecordに関して1件, ActiveSupportに関して2件。
ActiveRecord
MySQLで primary_key を取得する処理を高速化した
コミット: Fixed the performance regression for `primary_keys` introduced MySQL 8.0 · rails/rails@77f4ae0
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#primary_keys の修正。
issueはこれ Fixed performance regression introduced MySQL 8.0 by alpaca-tc · Pull Request #37465 · rails/rails
MySQL8.0でメタデータのストレージが metadata files から data dictionary に変わり、その結果 information_schema.key_column_usage の速度が下がった。
primary_keys メソッドでは information_schema.key_column_usage を使っているので影響を受けていた。
この修正では、代わりに information_schema.statistics を使うことで高速化している。
ActiveSupport
ActiveSupport::EncryptedFile の content_path に symbolic link を使えるようにした
コミット: Keep symbolic link after editing credentials.yml.enc · rails/rails@6db6432
symbolic link を作ったあとに credentials.yml.enc を編集すると、 symbolic link が消えて通常のファイルで上書きされてしまうのを修正している。
@content_path = Pathname.new(content_path)
↓
@content_path = Pathname.new(content_path).yield_self { |path| path.symlink? ? path.realpath : path }
ActiveSupport.parse_json_times が true の場合に、 ActiveSupport::Messages::Metadata.verify がエラーにならないよう修正した
コミット: Fix Messages::Metadata#fresh? to handle parse_json_times = true · rails/rails@6e0aa18
verifyメソッドで使っている fresh? メソッドで、 Time.iso8601(@expires_at) となっていた。
ActiveSupport.parse_json_times が true の場合は @expires_at が String ではないのでエラーになる。
def fresh? - @expires_at.nil? || Time.now.utc < Time.iso8601(@expires_at) + @expires_at.nil? || Time.now.utc < @expires_at end
ん、これ ActiveSupport.parse_json_times が false の場合はどうなるの。よくわかってないけど。Stringが渡ってくるんじゃないの?
と思っていたら別コミットで修正されてた。
Follow-up 6e0aa1887d: So we do need the wrapper, doh · rails/rails@37e87fd