OpenTenBase / OpenTenBase/TXSQL

Perf : try lock优化purge binlog与rotate binlog时锁LOCK_index的冲突

Open
#83 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
337
Forks
234
PR merge metrics
No merged PRs in 30d

Description

用try lock优化purge binlog与rotate binlog时锁LOCK_index的冲突
1.如果puger加上锁, rotate 进行try lock失败,就不加锁了,让binlog增长
2.如果rotate加上锁了, purge进行try lock失败,就多尝试几次等锁

作用:

  1. 减少purge流程对gtid分配影响,当index中文件数量很多的时候,purge会长时间持有gtid的排他锁,导致正常提交的事务不能分配gtid。purge卡点:从index文件中获取所有文件名称,用于后续更新lost gtids。实际上对于我们的场景,不需要获取所有的binlog文件名称,只需要获取第一个binlog文件即可,提供参数控制获取binlog文件数量,设置成1,降低purge对正常事务的影响。
  2. 减少rotate影响rotate会先锁住LOCK_log,采用try lock的方式,拿不到LOCK_log的锁就放弃rotate

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the purge and rotate binlog paths and their LOCK_index and LOCK_log handling, then inspect existing lock-related tests if present. Done means the requested try-lock, retry, and reduced-contention behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.