mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix for bug #31207: Test "join_nested" shows different strategy on IA64
CPUs / Intel's ICC compile The bug is a combination of two problems: 1. IA64/ICC MySQL binaries use glibc's qsort(), not the one in mysys. 2. The order relation implemented by join_tab_cmp() is not transitive, i.e. it is possible to choose such a, b and c that (a < b) && (b < c) but (c < a). This implies that result of a sort using the relation implemented by join_tab_cmp() depends on the order in which elements are compared, i.e. the result is implementation-specific. Since choose_plan() uses qsort() to pre-sort the join tables using join_tab_cmp() as a compare function, the results of the sorting may vary depending on qsort() implementation. It is neither possible nor important to implement a better ordering algorithm in join_tab_cmp(). Therefore the only way to fix it is to force our own qsort() to be used by renaming it to my_qsort(), so we don't depend on linker to decide that. This patch also "fixes" bug #20530: qsort redefinition violates the standard.
This commit is contained in:
@ -3159,8 +3159,8 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
|
||||
ROR_SCAN_INFO's.
|
||||
Step 2: Get best ROR-intersection using an approximate algorithm.
|
||||
*/
|
||||
qsort(tree->ror_scans, tree->n_ror_scans, sizeof(ROR_SCAN_INFO*),
|
||||
(qsort_cmp)cmp_ror_scan_info);
|
||||
my_qsort(tree->ror_scans, tree->n_ror_scans, sizeof(ROR_SCAN_INFO*),
|
||||
(qsort_cmp)cmp_ror_scan_info);
|
||||
DBUG_EXECUTE("info",print_ror_scans_arr(param->table, "ordered",
|
||||
tree->ror_scans,
|
||||
tree->ror_scans_end););
|
||||
@ -3349,8 +3349,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
|
||||
bitmap_get_first(&(*scan)->covered_fields);
|
||||
}
|
||||
|
||||
qsort(ror_scan_mark, ror_scans_end-ror_scan_mark, sizeof(ROR_SCAN_INFO*),
|
||||
(qsort_cmp)cmp_ror_scan_info_covering);
|
||||
my_qsort(ror_scan_mark, ror_scans_end-ror_scan_mark, sizeof(ROR_SCAN_INFO*),
|
||||
(qsort_cmp)cmp_ror_scan_info_covering);
|
||||
|
||||
DBUG_EXECUTE("info", print_ror_scans_arr(param->table,
|
||||
"remaining scans",
|
||||
|
Reference in New Issue
Block a user