Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mvcc): fix commit xid may be accidentally reused #26

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

hotwords123
Copy link
Contributor

问题: 在事务恢复阶段,MTR_BEGIN 日志对应的 trx id 会在 MvccTrxManager 类的 create_trx(int32_t trx_id) 方法中更新 current_trx_id 以避免重复使用,符合预期。但是 MTR_COMMIT 日志所使用的 commit xid 没有更新,可能会被重用而导致错误的结果。

解决方案: 增加 update_trx_id 方法用于确保 current_trx_id 不小于给定的参数。在 recover 阶段,MvccTrx 提交时应当调用该方法更新 current_trx_id

@ycycse ycycse requested a review from RkGrit June 2, 2024 13:08
@RkGrit
Copy link
Contributor

RkGrit commented Jun 12, 2024

这个问题确认存在,你的解决方案是对的~

@RkGrit RkGrit merged commit d4f8684 into THSS-DB:master Jun 12, 2024
@hotwords123 hotwords123 deleted the fix-xid-reuse branch June 17, 2024 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants