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

Upgrading from 1.3.2 to 2.0.1 causing errors #130

Open
KieranP opened this issue May 15, 2023 · 3 comments
Open

Upgrading from 1.3.2 to 2.0.1 causing errors #130

KieranP opened this issue May 15, 2023 · 3 comments

Comments

@KieranP
Copy link

KieranP commented May 15, 2023

We just upgraded from 1.3.2 to 2.0.1. Local machine and specs worked fine, but once deployed, we started getting errors.

undefined method `-' for "K":String
/app/shared/bundle/ruby/2.7.0/gems/redlock-2.0.1/lib/redlock/client.rb:302

and

NoMethodError: undefined method `last' for #<Hash:0x00005555e3ec7280>
/app/shared/bundle/ruby/2.7.0/gems/redlock-2.0.1/lib/redlock/client.rb:289

From what I can see, the structure of the data stored in redis has changed between versions, so that locks created prior to upgrading are not longer compatible with the new version.

This breakage is not documented, and there does not seem to be a migration option.

@leandromoreira
Copy link
Owner

Sorry @KieranP did you find a way to fix it? If you did, would you mind to send a PR explanning the problem and the solution?

@KieranP
Copy link
Author

KieranP commented Jun 16, 2023

@leandromoreira I'm afraid not. We ended up rolling back to version 1.3.2 right away to prevent further breakages. I suspect any change would need to either clear all locks (not ideal), or be able to run a rake task to convert all the 1.3.2 locks into a 2.0+ compatible format. But it's not something we're going to worry about for now since 1.3.2 continues to work for us.

@obahareth
Copy link

obahareth commented Jul 26, 2023

We are also facing the same issue but without having any keys from previous versions. These keys have been created on 2.0.1

undefined method `-' for "K":String

This is leading me to suspect this is an issue in Redlock 2.0.1 and unrelated to upgrading.

Somehow this line might be returning a "K" ?

 min_ttl = ttls.sort.last(@quorum).first

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

No branches or pull requests

3 participants