-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support lease renewal for distributed locks #3272
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
Comments
Hi @stefanvassilev ! I'm not sure that I fully understood how you workaround it and what the change you would like to do, but it looks more like you are looking for something like this: #3095. Please, share more info how we should fix it from your perspective. Thanks |
hi @artembilan, thanks for the quick response. The problem that I'm describing is the following: Imagine you have two instances which use 'lockRegistry', instance A and instance B. Instance 'A' acquires lock with name My proposal would be to include a method to renew to the lock from instance A so that instance B won't be able to acquire it, as it won't be expired. The issue you linked would probably solve to a degree my problem, however, from API standpoint one should be probably be able to decide for how long the lock should is maintained. I hope this clarifies what I'm trying to describe. |
Hm. Probably it sounds like an addition to the mentioned |
seems reasonable to me :-) |
So, since we agree about this feature, I make it official. Probably not all distributed locks could have that feature. I don't see a way in Curator Framework and looks like Hazelcast went a raft algorithm way, so there is no lease in their new |
Reopen since we need to revise all other |
Thanks @artembilan |
Hm. I didn't think it through yet, but if you have something in mind, feel free to raise a Pull Request and we will look together what and how should be fixed over there to support that Good catch though! |
Expected Behavior
One should be able to renew lock obtained from lockRegistry, as if one wants to hold onto a lock for longer than TTL.
Current Behavior
Calling
jdbcLockRegistry.tryLock()
from current thread would update the lock, which seems to renew it, however it would increase the hold's count as well, causingjdbcLock.unlock()'
not to release the lock as it would only decrease delegate's hold's by one see:spring-integration/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java
Line 236 in 62d472f
One can workaround this by using the 'DefaultLockRepository' to require a lock re-acquire a lock, which would update
CREATED_DATE
of the lock without increasing delegate's hold count.Context
It would be great if this is supported from
jdbcRegistry
rather than going over the workaround I mentioned above.The text was updated successfully, but these errors were encountered: