• Alexey Kopytov's avatar
    Bug #48537: difference of index selection between rpm binary · e0f29aa0
    Alexey Kopytov authored
                and .tar.gz, windows vs linux..
    
    On Intel x86 machines index selection by the MySQL query
    optimizer could sometimes depend on the compiler version and
    optimization flags used to build the server binary.
    
    The problem was a result of a known issue with floating point
    calculations on x86: since internal FPU precision (80 bit)
    differs from precision used by programs (32-bit float or 64-bit
    double), the result of calculating a complex expression may
    depend on how FPU registers are allocated by the compiler and
    whether intermediate values are spilled from FPU to memory. In
    this particular case compiler versions and optimization flags
    had an effect on cost calculation when choosing the best index
    in best_access_path().
    
    A possible solution to this problem which has already been
    implemented in mysql-trunk is to limit FPU internal precision
    to 64 bits. So the fix is a backport of the relevant code to
    5.1 from mysql-trunk.
    
    configure.in:
      Configure check for fpu_control.h
    mysql-test/r/explain.result:
      Test case for bug #48537.
    mysql-test/t/explain.test:
      Test case for bug #48537.
    sql/mysqld.cc:
      Backport of the code to switch FPU on x86 to 64-bit precision.
    e0f29aa0
mysqld.cc 327 KB