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:
@ -248,8 +248,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
||||
#endif
|
||||
VOID(push_dynamic(&acl_hosts,(gptr) &host));
|
||||
}
|
||||
qsort((gptr) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
|
||||
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
|
||||
my_qsort((gptr) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
|
||||
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
|
||||
end_read_record(&read_record_info);
|
||||
freeze_size(&acl_hosts);
|
||||
|
||||
@ -421,8 +421,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
||||
allow_all_hosts=1; // Anyone can connect
|
||||
}
|
||||
}
|
||||
qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
|
||||
sizeof(ACL_USER),(qsort_cmp) acl_compare);
|
||||
my_qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
|
||||
sizeof(ACL_USER),(qsort_cmp) acl_compare);
|
||||
end_read_record(&read_record_info);
|
||||
freeze_size(&acl_users);
|
||||
|
||||
@ -479,8 +479,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
||||
#endif
|
||||
VOID(push_dynamic(&acl_dbs,(gptr) &db));
|
||||
}
|
||||
qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
|
||||
sizeof(ACL_DB),(qsort_cmp) acl_compare);
|
||||
my_qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
|
||||
sizeof(ACL_DB),(qsort_cmp) acl_compare);
|
||||
end_read_record(&read_record_info);
|
||||
freeze_size(&acl_dbs);
|
||||
init_check_host();
|
||||
@ -1110,8 +1110,8 @@ static void acl_insert_user(const char *user, const char *host,
|
||||
if (!acl_user.host.hostname ||
|
||||
(acl_user.host.hostname[0] == wild_many && !acl_user.host.hostname[1]))
|
||||
allow_all_hosts=1; // Anyone can connect /* purecov: tested */
|
||||
qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
|
||||
sizeof(ACL_USER),(qsort_cmp) acl_compare);
|
||||
my_qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
|
||||
sizeof(ACL_USER),(qsort_cmp) acl_compare);
|
||||
|
||||
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
|
||||
rebuild_check_host();
|
||||
@ -1173,8 +1173,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
|
||||
acl_db.access=privileges;
|
||||
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
|
||||
VOID(push_dynamic(&acl_dbs,(gptr) &acl_db));
|
||||
qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
|
||||
sizeof(ACL_DB),(qsort_cmp) acl_compare);
|
||||
my_qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
|
||||
sizeof(ACL_DB),(qsort_cmp) acl_compare);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user