您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页MySQL源码中的BUG

MySQL源码中的BUG

来源:爱go旅游网

今天在深入学习MySQL查询优化器的过程中,发现一个低级的错误,应该是开发人员出于笔误导致的,当然这个错误不会出现问题,仅仅会

今天在深入学习MySQL查询优化器的过程中,发现一个低级的错误,应该是开发人员出于笔误导致的,当然这个错误不会出现问题,仅仅会在debug环境下,输出trace信息的时候会误导开发人员。

现公布如下:

本文基于mysql-5.5.20源代码进行调试开发。

sql_select.cc文件的39行,代码如下:

  • 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文件的39行的代码应该讲read_time和record_count的顺序颠倒。修改后的代码如下:

  • print_planidxread_time

    由于这个错误,会在打印输出的debug trace信息中感到困惑。

    linux

  • Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

    违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

    本站由北京市万商天勤律师事务所王兴未律师提供法律服务