Home > Database > Mysql Tutorial > body text

mysql的“Incorrect key file for table '/tmp/#sql_1194_12.MYI';

WBOY
Release: 2016-06-07 17:18:09
Original
918 people have browsed it

而这个函数调用mysql_file_pwrite函数。这里就比较清楚了,实际操作就是写文件了。确定的是写文件失败了。而之所以写文件的位置是/tmp,通过

线上数据库出现以下错误:
 Incorrect key file for table '/tmp/#sql_1194_1.MYI'; try to repair it
 Got an error from unknown thread, XXXX/storage/myisam/mi_write.c:223

通过查看源码,在mi_write函数的223行报错。
mi_write.c:44
/* Write new record to database */
int mi_write (MI_INFO * info, uchar *record)

而这里是一段err处理逻辑,跳转到err的函数是mi_write.c:142行的write_record函数。而该函数的实现是_mi_write_static_record 函数。
mi_statrec.c:21
int _mi_write_static_record (MI_INFO * info, const uchar * record)

到这里实际还没有结束,还没有完全显示出具体操作的逻辑。继续调试代码,该函数调用了mi_nommap_pwrite函数。
mi_dynrec.c:255
 /* wrapper for mysql_file_pwrite in case if mmap isn't used */
size_t mi_nommap_pwrite (MI_INFO * info, const uchar * Buffer,
                      size_t Count , my_off_t offset, myf MyFlags)

而这个函数调用mysql_file_pwrite函数。这里就比较清楚了,实际操作就是写文件了。确定的是写文件失败了。而之所以写文件的位置是/tmp,通过查看发现,该表有复杂的sql查询,用到了临时表。并且临时表的大小甚至达到了1G,导致了/tmp下的空间不足,,从而导致错误。

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template