您好,欢迎访问一九零五行业门户网

MySQL源码中的BUG

今天在深入学习mysql查询优化器的过程中,发现一个低级的错误,应该是开发人员出于笔误导致的,当然这个错误不会出现问题,仅仅会
今天在深入学习mysql查询优化器的过程中,发现一个低级的错误,应该是开发人员出于笔误导致的,当然这个错误不会出现问题,仅仅会在debug环境下,输出trace信息的时候会误导开发人员。
现公布如下:
本文基于mysql-5.5.20源代码进行调试开发。
sql_select.cc文件的5439行,代码如下:
print_planidxrecord_count其中通过查看print_plan函数可以发现,,输入参数:read_time和record_count的顺序是错误的。print_plan函数在sql_test.cc的266行定义如下:
/*
 print_plan()
    the structure providing all context info for
                 the query
    read_time the cost of the best partial plan
    record_count estimatethe number of records returned by the best
                 partial plan
    idx length of the partial qeppositions';
                 also an indexthebest_ref';
    info commentappear above the printout
*/
void
print_planuint idxdouble read_time,
           double current_read_timechar *info)因此,sql_select.cc文件的5439行的代码应该讲read_time和record_count的顺序颠倒。修改后的代码如下:
print_planidxread_time由于这个错误,会在打印输出的debug trace信息中感到困惑。
其它类似信息

推荐信息