Merge branch 'jbrowning-fix_mariadb_rename_index'

Closes #15936

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Merge pull request #16954 from geoffharcourt/inject-over-sum

Use #inject over #sum to build PG create DB statement
Merge pull request #16936 from untidy-hair/plugin_test_db_migrate_path

Specify dummy app's db migrate path in plugin's test_helper.rb

Conflicts:
	railties/CHANGELOG.md

Conflicts:
	railties/CHANGELOG.md
inject Rack::Lock if config.eager_load is false

If code is not eager loaded constants are loaded on demand. Constant
autoloading is not thread-safe, so if eager loading is not enabled
multi-threading should not be allowed.

This showed up in certain Capybara scenarios: Most Capybara drivers
other than Rack::Test need a web server. In particular, drivers for
JavaScript support. Capybara launches WEBrick in its own thread for
those but that per se is fine, because the spec thread and the server
thread are coordinated.

Problem comes if the page being served in the spec makes Ajax calls.
Those may hit WEBrick in parallel, and since WEBrick is multi-threaded
and allow_concurrency? returns true in the test environment before
this patch, threads are spawned to serve those parallel requests. On
the other hand, since eager_load is false by default in the test
environment, constants are not preloaded.

So the suite is autoloading constants in a multi-threaded set. That's
a receipt for paracetamol. The symptom is random obscure errors whose
messages point somehow to constant autoloading.

As a consequence of this fix for allow_concurrency? WEBrick in
Capybara scenarios no longer runs in multi-threaded mode.

Fixes #15089.

Conflicts:
	railties/CHANGELOG.md
Revert "inject Rack::Lock if config.eager_load is false"

After some discussion in Campfire we have decided to revert this one.
There are legit use cases where concurrent but coordinated requests
are made.

We have seen a test suite that uses Rack::Reproxy to redispatch
requests down, and also some actions that call un-mocked services
that call the original app and need to complete the cycle to
complete the original request.

While this is a more sane default for 4.2, its backport is more
dubious because it would break those test suites.

As a workaround, people having issues related to this before 4.2 can
throw

    config.allow_concurrency = false

in config/environments/test.rb.

This reverts commit 65f75c0ceadac0080a576c1a4551b7c55f4bdff6.
Merge pull request #16974 from silp-com/mail_was_called

ActionMailer: mark mail as called after instead of before processing it

Conflicts:
	actionmailer/CHANGELOG.md