Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply SKIP LOCKED optimization v4.1.7 #3

Draft
wants to merge 72 commits into
base: master
Choose a base branch
from

Conversation

gz2ca
Copy link

@gz2ca gz2ca commented Oct 14, 2022

Need to upgrade to v4.1.7 for Rails 6.1 upgrade https://github.com/docsend/elaine/pull/9657

Only change on top of v4.1.7 is the skip lock optimization collectiveidea:delayed_job_active_record:v4.1.7...v4.1.7_skip-locked-patched

rvasquez-flip4new and others added 30 commits March 23, 2018 16:02
This prevents potential destruction of already existent data.
Instead of reading the entire job record for our detect loop, just pluck the ID, and only read the job record after we've successfully locked the job.
ActiveRecord <= 4.0 are not compatible with mysql 5.7. Choosing to drop these out of our test runs.
MySQL 5.7 no longer supports null default values for the primary key.
Override the Native default for primary keys in MySql.
https://stackoverflow.com/a/34555109
For most versions the constant actually lives under `AbstractMysqlAdapter`
Explicitly requiring ActiveRecord models in
`lib/delayed_job_active_record.rb` may result in losing custom
configurations that are set in config/initializers on Rails.

Let' use Railtie and ActiveSupport.on_load to set it up so that
Delayed::Backend::ActiveRecord::Job model will respect arbitrary
configs.
Delay initializing of backend until all initializers have run.
Removing calls to `find_by` and `pluck` for Rails 3.0 compatibility.
…ce-true-from-migration

Remove force flag from migration
…-strategy

Optimize default sql performance
albus522 and others added 23 commits December 7, 2020 22:06
…github-actions

Attempt to use GitHub actions
…fix/autoload

Revert "Fix Rails autoloading"
Since psych4.0, the load method has been safe_load, which causes the following error.

So I use YAML#load_dj to avoid them. ref: ref: collectiveidea/delayed_job@b4ddd3d

```
  1) ActiveRecord loads classes with non-default primary key
     Failure/Error:
       expect do
         YAML.load(Story.create.to_yaml)
       end.not_to raise_error

       expected no Exception, got #<Psych::DisallowedClass: Tried to load unspecified class: Story> with backtrace:
         # ./spec/delayed/serialization/active_record_spec.rb:8:in `block (3 levels) in <top (required)>'
         # ./spec/delayed/serialization/active_record_spec.rb:7:in `block (2 levels) in <top (required)>'
     # ./spec/delayed/serialization/active_record_spec.rb:7:in `block (2 levels) in <top (required)>'
```
If we use Ruby 3.0 without quotations in YAML, It is interpreted as "3". If you specify 3 on GitHub Actions, it means the latest stable version of the 3 series, so 3.1 will be used.
Rails 7.0.0 doesn't work with Ruby 3.1.

ref: rails/rails#43951
Active Record shouldn't introduce any breaking changes until version 8
@gz2ca gz2ca requested review from a team, kicktheken and tmandke October 14, 2022 18:33
@stevenharman
Copy link
Member

This is perhaps outside the scope of what we're trying to do here, but is there a reason not to upstream this optimization?

@kicktheken
Copy link

I got pinged for this old PR, is it still applicable?

@stevenharman
Copy link
Member

As far as I can tell, we're still pinned to this branch for our production deploys. That said, I've also got a PR open to up-stream this, and so it might make more sense to pin to that since it will (hopefully) be merged, or at least track the upstream directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants