discourse/lib/freedom_patches
David Taylor 836ab73d59
FIX: Patch ActiveRecord SchemaCache for safe concurrency support
A single SchemaCache instance is maintained by the connection pool, and made available via a schema_cache method on each connection. When the SchemaCache instance is fetched from the pool, its internal connection reference is updated to equal the requesting connection. However, since there is only one instance of SchemaCache, this internal connection reference is updated everywhere, and can ultimately result in multiple threads accessing the same database connection. In Discourse, this could result in Sidekiq jobs getting 'stuck' in database connections.

This patch modifies SchemaCache so that it caches the internal connection on a per-thread basis

Co-authored-by: Sam Saffron <sam.saffron@gmail.com>
Co-authored-by: Matt Palmer <mpalmer@hezmatt.org>
2020-02-19 16:26:02 +00:00
..
active_record_attribute_methods.rb DEV: Apply Rubocop redundant return style 2019-11-14 15:10:51 -05:00
active_record_base.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
ams_include_without_root.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
better_handlebars_errors.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
fast_pluck.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
inflector_backport.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
match.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
open_uri_redirections.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
performance_fixes.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
pluck_first.rb DEV: pluck_first 2019-10-21 12:08:20 +01:00
postgresql_adapter.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
rack_patches.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
rails4.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
raw_handlebars.rb DEV: Use .hbr for raw template file extension (#8883) 2020-02-11 13:38:12 -06:00
reaper.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
regexp.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
safe_buffer.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
safe_migrations.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
schema_cache_concurrency.rb FIX: Patch ActiveRecord SchemaCache for safe concurrency support 2020-02-19 16:26:02 +00:00
schema_migration_details.rb PERF: avoid shelling to get hostname aggressively 2020-02-18 15:13:19 +11:00
sprockets_patches.rb Correct some missing spots for frozen_string_literal 2019-05-13 09:31:32 +08:00
translate_accelerator.rb DEV: properly pass keyword args 2019-11-08 17:30:42 +11:00
zeitwerk.rb PERF: avoid regex for hot path 2019-10-08 13:43:54 +11:00