diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-10-25 17:17:21 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-10-25 17:17:21 +0300 |
commit | cbd0da66e48a2ea31917dae0b49a4ca6092959e7 (patch) | |
tree | 9efc2c0f3e1c0cd367255fce203c15190d13888f /sql/sql_select.cc | |
parent | a02551b0ba220cb138cf3e9cddd82539620c6432 (diff) | |
parent | 909cdafd35c05b56e47d2c791149a5dd85621870 (diff) | |
download | mariadb-git-cbd0da66e48a2ea31917dae0b49a4ca6092959e7.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 46e1a912250..5075673dcc2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8125,9 +8125,11 @@ best_extension_by_limited_search(JOIN *join, best_access_path(join, s, remaining_tables, idx, disable_jbuf, record_count, join->positions + idx, &loose_scan_pos); - /* Compute the cost of extending the plan with 's' */ - - current_record_count= record_count * position->records_read; + /* Compute the cost of extending the plan with 's', avoid overflow */ + if (position->records_read < DBL_MAX / record_count) + current_record_count= record_count * position->records_read; + else + current_record_count= DBL_MAX; current_read_time=read_time + position->read_time + current_record_count / (double) TIME_FOR_COMPARE; |