gpt4 book ai didi

mysql - 索引的历史记录不足

转载 作者:IT王子 更新时间:2023-10-28 23:52:23 27 4
gpt4 key购买 nike

在 MySQL 日志中,有一个错误 'InnoDB: insufficient history for index 0'

我不知道为什么会这样。我用谷歌搜索并找到了 this :

InnoDB: If a transaction was started with a consistent snapshot, then new indexes were added to the table while the transaction was in progress, a subsequent UPDATE statement could incorrectly encounter the error:

ER_TABLE_DEF_CHANGED: insufficient history for index
This issue could cause an assertion error in debug builds. (Bug #14036214)

在我的例子中,我启动了事务并将数据插入到表中,在此期间我没有在该表中插入或更新数据。为什么会出现这个错误?

最佳答案

您指出的错误仅用于调试编译版本:

存储/innobase/handler/ha_innodb.cc

        if (!m_prebuilt->index_usable) {
if (dict_index_is_corrupted(m_prebuilt->index)) {
// Code removed for clarity
}
} else {
push_warning_printf(
m_user_thd, Sql_condition::SL_WARNING,
HA_ERR_TABLE_DEF_CHANGED,
"InnoDB: insufficient history for index %u",
keynr);
}

/* The caller seems to ignore this. Thus, we must check
this again in row_search_for_mysql(). */
DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED);
}

该错误发生在创建索引时,表结构发生变化,表示索引不可用。请检查 mysqld.err 文件中提供的错误,因为可能有更多错误可以帮助确定它位于哪个阶段。

如果您的案例是使用调试符号编译的 MySQL,您可能会注意到您的评论中报告的错误。否则我会建议检查是否有任何其他事务发生在事务期间更改与索引相关的表结构(您是否在长时间事务期间删除了索引?目录在操作期间是否损坏?)。

关于mysql - 索引的历史记录不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35196489/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com