GH-3444: Add Custom TTL support for RedisLock, and JdbcLock
Fixes: #3444
- Add
CustomTtlLock, andCustomTtlLockRegistryinterfaces - Modify
RedisLockRegistryto implement the interfaces. - Modify ddl of
INT_LOCKtable,LockRepository,DefaultLockRepository, andJdbcLockRegistryto implement the interfaces. - Fix potential concurrency issue of
unlockmethod ofJdbcLock. - Maintain existing test cases and add new test cases.
Can you elaborate, please, why do we need a result from
delete()?
If the result(row count) is 0, which means that the lock is not owned by current process.
For example:
ProcessA and processB are in the same region.
ProcessA acquired the distributed lock. //{REGION: r, LOCK_KEY: lock, CLIENT_ID: processA}
But the work takes too long and the ownership of the lock has been expired.
Before processA release the lock, processB acquired the same distributed lock. //{REGION: r, LOCK_KEY: lock, CLIENT_ID: processB}
When processA try to release the distributed lock. //DELETE FROM INT_LOCK WHERE REGION='r' AND LOCK_KEY='lock' AND CLIENT_ID='processA'
The result from delete() would be 0.
In this case, an IllegalStateException should be thrown to info the process that the integrity of data protected by this lock may have been compromised.
This is good stuff. Thank you very much for looking into that!
As I expected this is really huge breaking change in the API, so I'm afraid we cannot accept it right now according to our migration policies.
We have to wait until the next major version 7.0 next year.
Of course we might be able to start it in the end of this year, when Spring Framework 6.2 release train is out this November.
Please, keep in touch meanwhile.
Thank you for understanding!
Any new on this? Spring 7 will be out soon right? Will these changes be included 7.0?
Spring framework will become GA in Nov 2024 -https://spring.io/blog/2024/10/01/from-spring-framework-6-2-to-7-0.
Thank you both for keeping an eye on this! So, in November we are releasing 6.4. After that we are good to start 7.0. But that is going to be released only next November 2025. So, not soon enough, but we still don’t have a choice with such a breaking change.