Repository navigation
cherry-pick: add locks functions - #25094
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
已经修改:
|
|
@mergify refresh |
✅ Pull request refreshed |
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [x] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24486 ## What this PR does / why we need it: 增加user level locks函数: is_used_lock, release_all_locks. • IS_USED_LOCK: - 新增 lockservice 点查接口 GetLockHolder(tableID, row, options) - 复用现有 GetTxnLock 远程 RPC,并在 response 中增加 Holder / Found,让 holder 查询能路由到真正持有 lock table 的 CN,支持跨 CN。 - user lock 的 row key 保持为 <account>\0<lock_name>;synthetic txn id 中编码 <owner>\0<connection_id>\0<lock_name>。 - IS_USED_LOCK 从 holder 的 synthetic txn id 中解析 connection_id;如果锁不存在或 holder txn id 不是 user lock 格式,则返回 NULL。 RELEASE_ALL_LOCKS: - 只维护本 session 的本地状态:counts 记录可重入计数,byOwner 记录当前 session 持有的 lock name。 - 只释放当前 session 自己持有的 user locks,通过当前 session 的 owner 和 connection id 生成 synthetic txn id 执行 unlock。 - 返回释放的本地可重入 lock 次数。 - 不再维护本地全局 holders map,避免错误报告或释放其他 session / 其他 CN 持有的锁。
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [x] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24486 ## What this PR does / why we need it: 增加user level locks函数: is_used_lock, release_all_locks. • IS_USED_LOCK: - 新增 lockservice 点查接口 GetLockHolder(tableID, row, options) - 复用现有 GetTxnLock 远程 RPC,并在 response 中增加 Holder / Found,让 holder 查询能路由到真正持有 lock table 的 CN,支持跨 CN。 - user lock 的 row key 保持为 <account>\0<lock_name>;synthetic txn id 中编码 <owner>\0<connection_id>\0<lock_name>。 - IS_USED_LOCK 从 holder 的 synthetic txn id 中解析 connection_id;如果锁不存在或 holder txn id 不是 user lock 格式,则返回 NULL。 RELEASE_ALL_LOCKS: - 只维护本 session 的本地状态:counts 记录可重入计数,byOwner 记录当前 session 持有的 lock name。 - 只释放当前 session 自己持有的 user locks,通过当前 session 的 owner 和 connection id 生成 synthetic txn id 执行 unlock。 - 返回释放的本地可重入 lock 次数。 - 不再维护本地全局 holders map,避免错误报告或释放其他 session / 其他 CN 持有的锁。
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [x] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24486 ## What this PR does / why we need it: 增加user level locks函数: is_used_lock, release_all_locks. • IS_USED_LOCK: - 新增 lockservice 点查接口 GetLockHolder(tableID, row, options) - 复用现有 GetTxnLock 远程 RPC,并在 response 中增加 Holder / Found,让 holder 查询能路由到真正持有 lock table 的 CN,支持跨 CN。 - user lock 的 row key 保持为 <account>\0<lock_name>;synthetic txn id 中编码 <owner>\0<connection_id>\0<lock_name>。 - IS_USED_LOCK 从 holder 的 synthetic txn id 中解析 connection_id;如果锁不存在或 holder txn id 不是 user lock 格式,则返回 NULL。 RELEASE_ALL_LOCKS: - 只维护本 session 的本地状态:counts 记录可重入计数,byOwner 记录当前 session 持有的 lock name。 - 只释放当前 session 自己持有的 user locks,通过当前 session 的 owner 和 connection id 生成 synthetic txn id 执行 unlock。 - 返回释放的本地可重入 lock 次数。 - 不再维护本地全局 holders map,避免错误报告或释放其他 session / 其他 CN 持有的锁。
What type of PR is this?
Which issue(s) this PR fixes:
issue #24486
What this PR does / why we need it:
增加user level locks函数: is_used_lock, release_all_locks.
• IS_USED_LOCK:
RELEASE_ALL_LOCKS: