Commit Graph

92513 Commits

Author SHA1 Message Date
Xavier Noria cffb642a0c Revise punctuation in CHANGELOG entry 2024-08-17 09:21:46 +02:00
Xavier Noria 7d282b449e Move removal target of SQLite's retries config to 8.1
This warning was just introduced, we need one release in
between for people to see it.
2024-08-17 09:03:54 +02:00
Aaron Patterson b26a9fd255
Merge pull request #52631 from zenspider/zenspider/minitest-cleanup
Bump minitest to 5.25.1 and clean up hacks.
2024-08-16 14:57:16 -07:00
Jean Boussier 36b030d3e3
Merge pull request #52632 from byroot/3.2-connection-lease-registry
Refactor query cache and connection lease registry for performance
2024-08-16 21:13:00 +02:00
Jean Boussier 99808b1ce7 Workaround a GC crash in ObjectSpace::WeakKeyMap
Being investigated at https://github.com/byroot/rails/pull/3

It seems that it's caused by using Thread or Fiber as keys.
2024-08-16 20:53:56 +02:00
Gannon McGibbon ea585d6386
Merge pull request #52629 from Shopify/opt_scanner
Optimize ActionDispatch::Journey::Scanner
2024-08-16 13:34:25 -05:00
Ryan Davis 2650a05547 Bump minitest to 5.25.1 and clean up hacks for minitest 5.25.0 2024-08-16 11:28:19 -07:00
Jean Boussier e356c63501 Refactor query cache and connection lease registry for performance
Fix: https://github.com/rails/rails/issues/52617
Followup: https://github.com/rails/rails/pull/52622

Previous fixes solved the memory issues, but our fallback implementation
of WeakKeyMap actually have terrible performance, and I can't find a way
to do it in a performent way.

So instead we replace it by a specialized weak map that only accept
Thread or Fiber as keys, and simple purge dead threads on insertion.

This gives us reasonable performance on Ruby 3.1 and 3.2.
2024-08-16 20:27:27 +02:00
Nick Pezza afecc8fd6c
Permit frozen models to be validated (#47969)
* Permit frozen models to be validated

* Remove initialize method since it's not needed

 Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
2024-08-16 08:24:39 -07:00
Rafael Mendonça França c0effe0479
Merge pull request #52623 from frenkel/documentation-fix
Add Rails 7.2 release date to guides index
2024-08-16 12:08:24 -03:00
Jean Boussier f26faa8fc3
Merge pull request #52625 from Uaitt/remove-rubocop-offense-in-assets.rb
Remove Rubocop offense in `config/initializers/assets.rb` [ci skip]
2024-08-16 15:12:29 +02:00
Lorenzo Zabot e47a96378c Remove Rubocop offense in config/initializers/assets.rb 2024-08-16 14:54:07 +02:00
Jean Boussier 156b9ac638
Merge pull request #51958 from fractaledmind/activerecord-busy-handler-timeout
SQLite non-GVL-blocking, fair retry interval busy handler
2024-08-16 14:04:48 +02:00
Stephen Margheim 2976d3767e Use the new SQLite3::Database#busy_handler_timeout= method for a non-GVL-blocking, fair retry interval busy handler implementation
Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2024-08-16 13:56:24 +02:00
Jean Boussier 8bf495a622
Merge pull request #52577 from n-studio/handle-sqlite-busy-as-deadlock
Handle SQLite3::BusyException to raise ActiveRecord::StatementTimeout
2024-08-16 13:49:14 +02:00
Jean Boussier 24ded0354e Hold query caches in a WeakKeyMap
Followup: https://github.com/rails/rails/pull/52622

Avoid leaking query caches when a ConnectionPool is gargabe collected.
2024-08-16 13:46:32 +02:00
Frank Groeneveld f17524e48c
Add Rails 7.2 release date
[skip ci]
2024-08-16 13:33:21 +02:00
Matthew Nguyen 41c547cb47 Translate SQLite3::BusyException into ActiveRecord::StatementTimeout 2024-08-16 13:22:44 +02:00
Jean Boussier b64eaddd73 Don't hold on connection pools from the query cache
Followup: https://github.com/rails/rails/pull/52622

This reference causes connections to linger around longer on Rails CI.
Instead we can simply share an atomic integer to bump the version.
x
2024-08-16 13:21:12 +02:00
Jean Boussier ffc580af94
Merge pull request #52622 from byroot/query-cache-isolated-context
Store query caches in IsolatedExecutionState to avoid memory bloat
2024-08-16 12:50:55 +02:00
Jean Boussier 49c9cf82bc Store query caches in IsolatedExecutionState to avoid memory bloat
Fix: https://github.com/rails/rails/issues/52617
Closes: https://github.com/rails/rails/pull/52618

It isn't per say a leak because the connection reaper eventually prune these,
and also it's not expected that new Threads are constantly making entries into that cache.
But it's true that with Fiber it's probably a bit more common, and the default reaper frequency
isn't adapted to clear this fast enough.

So instead of waiting for the reaper to trigger, which may take a long time, we keep the
caches in IsolatedExcutionState so that when the owning thread or fiber is garbage collected
its cache is too.

However since we need to be able to clear all threads caches, we keep a cache version
on the pool, and bump it to invalidate all caches of a pool at once.
2024-08-16 12:35:27 +02:00
Jean Boussier cc2c43b860
Merge pull request #52378 from fatkodima/fix-batches-error_on_ignore
Fix swallowing ignore order warning when batching using `BatchEnumerator`
2024-08-16 10:24:38 +02:00
Ryuta Kamizono 29f675999c Remove unused require 2024-08-16 12:20:30 +09:00
Jean Boussier ff64ad1d64 Fix a typo in Application#name doc 2024-08-16 00:42:16 +02:00
Gannon McGibbon 90b293ce82 Optimize journey scanner
Allocates less arrays and uses less regexes.
2024-08-15 16:27:09 -05:00
Jean Boussier d102960369
Merge pull request #52619 from fatkodima/eager-load-nil-associations
Allow to eager load nested nil associations
2024-08-15 22:40:36 +02:00
fatkodima 7bee100c33 Allow to eager load nested nil associations 2024-08-15 23:17:11 +03:00
Gannon McGibbon 9f9deaf6c1
Merge pull request #52605 from Shopify/scope_with_keywords
Use keywords with scopes and resources
2024-08-15 14:17:45 -05:00
Gannon McGibbon 36f5a2003f
Merge pull request #52610 from Shopify/no_more_racc
Remove racc
2024-08-15 13:04:26 -05:00
Jean Boussier 3dbff874b5
Merge pull request #52616 from byroot/fix-console-app-name
rails console: Handle non standard application names
2024-08-15 16:49:15 +02:00
Jean Boussier 1099b815b5 rails console: Handle non standard application names
Fix: https://github.com/rails/rails/issues/52615
Ref: https://github.com/rails/rails/pull/50796

The code assumed the application follow the standard `Name::Application`
naming, but it's possible to rename it however you like.
2024-08-15 16:48:49 +02:00
Jean Boussier 41921f9ec2
Merge pull request #52613 from byroot/fix-ar-base-lazy-schema-message
Fix ActiveRecord::Base.inspect to correctly indicate how to load schema
2024-08-15 10:27:58 +02:00
Jean Boussier 278ebf5651 Fix ActiveRecord::Base.inspect to correctly indicate how to load schema
Fix: https://github.com/rails/rails/issues/52601

Now that Active Record connections are fully lazy, just calling
`.lease_connection` isn't actually enough to estalish a connection.

We might as well suggest to use a method with the actual intent.
2024-08-15 10:15:05 +02:00
Jean Boussier 7c8704afc3
Merge pull request #52612 from SamvitaKarkal/fix_bin_setup_output_test
Fixed failure in bin setup test
2024-08-15 09:06:51 +02:00
Gannon McGibbon 7d42bf68e2 Manually implement journey parser
Removes racc dependency, and writes our own parser for routing instead.
2024-08-15 00:53:23 -05:00
Gannon McGibbon f4b581b675 Use keywords in routing scopes and resources
Converts hashes to keywords in ActionDispatch::Resources::Resource and
in ActionDispatch::Scope to match syntax of other mapping methods and
allocate less.
2024-08-15 00:39:07 -05:00
samvitakarkal 73f458819d Fixed failure in bin setup test 2024-08-15 08:17:36 +05:30
Yasuo Honda c44d7ae6b1
Merge pull request #52313 from afn/include-schema-name-in-enable-extension
Update PostgreSQLAdapter#extensions to include schema name
2024-08-15 09:29:36 +09:00
Rafael Mendonça França 05e9bd2fd8
Merge pull request #52609 from rails/rm-minitest
Support minitest 5.25+
2024-08-14 19:59:32 -03:00
Rafael Mendonça França 002519a5fa
Support minitest 5.25+
Minitest 5.25+ has a new API for `with_info_handler` that accepts an
additional argument.

The code now support all versions of minitest 5.

See 8cd3b1c749
2024-08-14 22:39:50 +00:00
Rafael Mendonça França 7cb7cb844b
Merge pull request #52608 from kirs/extract-load-schema
Split AR::Migration.load_schema_if_pending! into two methods
2024-08-14 19:18:43 -03:00
Kir Shatrov 12059434f0 Split AR::Migration.load_schema_if_pending! into two methods 2024-08-14 13:50:55 -07:00
Rafael Mendonça França 5ec96d9cf5
Merge pull request #49853 from skipkayhil/hm-avoid-env-name
Avoid calling Headers#env_name when static header
2024-08-14 15:26:39 -03:00
Rafael Mendonça França fc1332625a
Merge pull request #52567 from biow0lf/fix-date_field_tag-examples
Fix date_field_tag examples. [ci skip]
2024-08-14 15:08:29 -03:00
Rafael Mendonça França ebad4e6bd1
Check invalid enum options for the new syntax
The options using `_` prefix in the old syntax are invalid in the new syntax.

We should raise an error when using them.

Fixes #52586.
2024-08-14 17:49:18 +00:00
Rafael Mendonça França 455cf48c7e
Merge pull request #52169 from ioquatix/routes-websocket
Add route helper for websockets.
2024-08-14 14:32:47 -03:00
Tony Novak 2ea8e89fd1 Update PostgreSQLAdapter#extensions to include schema name
This allows the schema dumper's generated `enable_extension` statements
to include the schema name, if different from `current_schema`.

[Fix #52312]
2024-08-14 12:26:50 -04:00
Vasiliy Ermolovich eaa74eedba
EncryptedAttributeType#type should return cast_type's type. (#52247) 2024-08-13 14:04:24 -07:00
John Hawthorn 7186cebd04
Merge pull request #52449 from jhawthorn/avoid_generated_method_name
Avoid eagerly generating Module methods on ActiveRecord::Relation delegation
2024-08-13 14:00:28 -07:00
Ryuta Kamizono ac1d7681d0
Merge pull request #52591 from fatkodima/fix-create_table-with-auto_increment
Fix `create_table` with `:auto_increment` option for MySQL adapter
2024-08-13 23:42:06 +09:00