なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2016/04/25)

2016/04/25分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md

actionpack/CHANGELOG.md


:nodoc: internal StatementPool class.

activerecord/lib/active_record/connection_adapters/statement_pool.rbのdocの修正です。

Rails内部用のクラスであるActiveRecord::ConnectionAdapters::StatementPool:nodoc:を設定しています。


Share lock: more accurate livelock fix for aa598f4

activesupport/lib/active_support/concurrency/share_lock.rbの修正です。

Share lock: avoid livelock due to exclusive thread sleeping before wa… · rails/rails@aa598f4で、#yield_sharesに渡すブロックの中で、排他スレッドの処理終了を待つ前に#broadcastを使用してスレッドを再開するよう修正したのですが、ブロックではなく、#yield_sharesメソッド自体で#broadcastを呼び出すよう修正しています。

@@ -69,7 +69,6 @@ def stop_exclusive(compatible: [])

             if eligible_waiters?(compatible)
               yield_shares(compatible: compatible, block_share: true) do
-                @cv.broadcast
                 @cv.wait_while { @exclusive_thread || eligible_waiters?(compatible) }
               end
             end
@@ -145,9 +144,9 @@ def yield_shares(purpose: nil, compatible: [], block_share: false)
             end
             compatible |= [false] unless block_share
             @waiting[Thread.current] = [purpose, compatible]
-
-            @cv.broadcast
           end
+
+          @cv.broadcast

より正確にロックの管理を出来るようにする為、のようなのですが、よくわからない…。


Include the Savepoints module in all adapters.

Active Recordの修正です。

各connection adaptersそれぞれでincludeしていたtransaction savepoint用のmodule(Savepoints)を、abstract adapterで読み込むよう修正しています。


removes useless use of string interpolation

railties/lib/rails/all.rbの修正です。

Stringを""で囲んで式展開している箇所から、不要な式展開を削除しています。

  begin
-    require "#{railtie}"
+    require railtie
   rescue LoadError

rewords code comment [ci skip]

activesupport/lib/active_support/core_ext/object/blank.rbのdocの修正です。

String#blank?メソッドのコード内の、処理内容についての説明のコメントを修正しています。


Follow up of #23461

Active Recordの修正です。

statement limitのデフォルトの値(1000)が各コード内に数字のまま使用されていたのを、定数を使用するよう修正、及びstatement limitを保持する変数名がmaxになっていたのを、statement_limitに修正しています。


remove_index do not fetch indexes if name is specified

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbの修正です。

remove_indexメソッドの引数にoptions[:name]が指定された場合は、全てのテーブルのフェッチ処理は行わないよう修正しています。 nameが指定された場合は、そのnameをそのまま使用すればよい為。


Add Expression Indexes and Operator Classes support for PostgreSQL

Active Recordの修正です。

PostgreSQLのExpression Indexes及びOperator Classesをmigrationファイルで使用出来るよう対応しています。

CHANGELOGより。

create_table :users do |t|
  t.string :name
  t.index 'lower(name) varchar_pattern_ops'
end

Operator Class(演算子クラス)というもの自体を初めて知りました。

参考:


Merge pull request #23103 from rails/refactor-handling-of-action-default

Action Packの修正です。

routesに:actionが指定されていなかった場合に、route生成処理中にpath parametersの値を書き換えていたのを、path parametersの値を変更しないようリファクタリングを行なっています。


remove unnessary option setting from test runner

railties/lib/rails/test_unit/minitest_plugin.rbの修正です。

rake testタスクに、rakeコマンドのオプションを指定した場合に、エラー(OptionParser::ParseError)になっていたのを、エラーにならないよう修正しています。


register rake options to OptionParser

railties/lib/rails/tasks/routes.rakeの修正です。

rake routesタスクに、rakeコマンドのオプションを指定した場合に、エラー(OptionParser::ParseError)になっていたのを、エラーにならないよう修正しています。


Remove Array#sum method before override it

activesupport/lib/active_support/core_ext/enumerable.rbの修正です。

独自のArray#sumメソッドを定義する前に、remove_methodメソッドで既に定義済みのsumメソッドを削除するよう修正しています。

削除しないと、Rubyのwarning(warning: method redefined; discarding old sum)が出てしまう為。