shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Refactor the lock implementation in GlobalClockTransactionHook

Open FlyingZC opened this issue 9 months ago • 1 comments

Feature Request

Refactor the lock implementation in GlobalClockTransactionHook.

  1. Avoid using registry-based locks (e.g., ZooKeeper) because acquiring a lock might timeout in beforeCommit, but the afterCommit could still attempt to release it. Eliminate unnecessary unlock operations.

Corresponding FIXME:

FIXME: If timeout occurs when a lock is required but TSO is not assigned, the commit will still proceed. The solution is to replace the registry center's lock with a Redis-based lock implementation.
  1. Move the locking logic to the TSO component (e.g., implement locking/unlocking via Redis's native lock in RedisTSOProvider). Corresponding TODO:
// TODO: Use Redis lock instead of registry center's lock.

FlyingZC avatar Mar 20 '25 04:03 FlyingZC

Hi, please assign this issue to me. Thank you!

Dltmd202 avatar Jun 14 '25 14:06 Dltmd202

Hi @FlyingZC, I’ve created a refactor PR here: https://github.com/apache/shardingsphere/pull/35842 When you have a moment, could you please take a look?

Dltmd202 avatar Jun 20 '25 15:06 Dltmd202