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.

Assessment

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

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.

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
Dominant language
C++
Stars
712
Forks
428
Avg merge
5h 43m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from OpenTenBase/TXSQL

All issues in OpenTenBase/TXSQL

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.