spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

GH-3444: Add Custom TTL support for RedisLock, and JdbcLock

Open EddieChoCho opened this issue 1 year ago • 2 comments

Fixes: #3444

  • Add CustomTtlLock, and CustomTtlLockRegistry interfaces
  • Modify RedisLockRegistry to implement the interfaces.
  • Modify ddl of INT_LOCK table, LockRepository, DefaultLockRepository, and JdbcLockRegistry to implement the interfaces.
  • Fix potential concurrency issue of unlock method of JdbcLock.
  • Maintain existing test cases and add new test cases.

EddieChoCho avatar Mar 30 '24 14:03 EddieChoCho

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.

EddieChoCho avatar Apr 01 '24 19:04 EddieChoCho

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!

artembilan avatar Jun 10 '24 19:06 artembilan

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.

Pavankn18 avatar Oct 27 '24 03:10 Pavankn18

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.

artembilan avatar Oct 27 '24 14:10 artembilan