mysql readview错误?
这是一个关于 MySQL 8.0 源代码中 InnoDB 存储引擎内部代码的问题。
在 'ReadView::prepare' 方法(文件 read/read0read.c)中:
m_up_limit_id = !m_ids.empty() ? m_ids.front() : m_low_limit_id;
在 'changes_visible' 方法(文件 include/read0types.h)中:
if (id < m_up_limit_id || id == m_creator_trx_id) {
return (true);
}
...
if (id >= m_low_limit_id) {
return (false);
} else if (m_ids.empty()) {
return (true);
}
m_ids.empty()
的逻辑没有用,id
不能小于 m_up_limit_id
且大于或等于 m_low_limit_id
,因为m_ids.empty()
,然后m_up_limit_id == m_low_limit_id
,不知道我的理解是否准确,希望得到答案
This is a question about code internal to the InnoDB storage engine in MySQL 8.0 source.
In the 'ReadView::prepare' method (file read/read0read.c):
m_up_limit_id = !m_ids.empty() ? m_ids.front() : m_low_limit_id;
in the 'changes_visible' method (file include/read0types.h):
if (id < m_up_limit_id || id == m_creator_trx_id) {
return (true);
}
...
if (id >= m_low_limit_id) {
return (false);
} else if (m_ids.empty()) {
return (true);
}
The logic of m_ids.empty()
is useless, id
cannot be less than m_up_limit_id
and greater than or equal to m_low_limit_id
, because m_ids.empty()
, then m_up_limit_id == m_low_limit_id
, I don't know if my understanding is accurate, I hope to get an answer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为调用
empty()
很重要。一组活动交易可能是空的。换句话说,在没有主动交易的时候准备了ReadView。如果是这种情况,则
front()
函数无法返回有效的事务ID。front()中的代码
如果在空集中调用了调试声明。I think the call to
empty()
is important. The set of active transactions might be empty. In other words, the ReadView is prepared at a time when there are no active transactions.If that is the case, the
front()
function cannot return a valid transaction id. The code infront()
throws a debug assertion if it is called on an empty set.