Inconsistent ResultSet is obtained for different Execution Plans

Description

Attached test case shows inconsistent retrieved rows when different execution plans are used. It affects MySQL Community and Percona Server 5.7.23. It couldn't be reproduced on version 5.6.

Environment

None

AFFECTED CS IDs

237160

Attachments

1

Smart Checklist

Activity

Show:

Yura Sorokin May 15, 2019 at 2:44 PM

Fixed in upstream 5.7.27

Inner tables of different semijoin nests were interleaved during
materialization, which could lead to a different result for the
same query when it used a different query plan. To keep this
from occurring, a check is added to prevent such interleaving.

Yura Sorokin December 10, 2018 at 2:49 PM

The problem seems to also exist in 5.6 branch.

Yura Sorokin December 7, 2018 at 10:48 AM

The problem was indeed fixed in 8.0 as part of the WL#9158 "Join Order Hints" (https://dev.mysql.com/worklog/task/?id=9158) implementation,

https://github.com/mysql/mysql-server/commit/d2d91c3286b9ac3b95ef0e5036c5319aa4ffeda2#diff-ead09da11b16650e2fdf35b48a0214c7

The 'sql/sql_planner.cc' part of this commit can be straightforwardly backported to 5.7.

Yura Sorokin December 6, 2018 at 3:11 PM

The problem can also be reproduced with MySQL Server 8.0.0 but not with MySQL Server 8.0.1.

Done

Details

Assignee

Reporter

Time tracking

1w 2d 11m logged

Priority

Smart Checklist

Created October 3, 2018 at 8:59 PM
Updated March 6, 2024 at 12:47 PM
Resolved December 12, 2018 at 3:28 PM