MDEV-3834 Crossgrade from MySQL 5.6.7 to MariaDB 10.0 fails due to non-existing mysql.host table
Treat the host table as optional, don't abort when it's missing
This commit is contained in:
parent
47f5632d60
commit
1679fe1c3e
@ -750,11 +750,13 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
|||||||
acl_cache->clear(1); // Clear locked hostname cache
|
acl_cache->clear(1); // Clear locked hostname cache
|
||||||
|
|
||||||
init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
|
init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
|
||||||
|
(void) my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50);
|
||||||
|
if (tables[0].table) // "host" table may not exist (e.g. in MySQL 5.6.7+)
|
||||||
|
{
|
||||||
if (init_read_record(&read_record_info, thd, table= tables[0].table,
|
if (init_read_record(&read_record_info, thd, table= tables[0].table,
|
||||||
NULL, 1, 1, FALSE))
|
NULL, 1, 1, FALSE))
|
||||||
goto end;
|
goto end;
|
||||||
table->use_all_columns();
|
table->use_all_columns();
|
||||||
(void) my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50);
|
|
||||||
while (!(read_record_info.read_record(&read_record_info)))
|
while (!(read_record_info.read_record(&read_record_info)))
|
||||||
{
|
{
|
||||||
ACL_HOST host;
|
ACL_HOST host;
|
||||||
@ -799,6 +801,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
|||||||
my_qsort((uchar*) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
|
my_qsort((uchar*) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
|
||||||
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
|
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
|
||||||
end_read_record(&read_record_info);
|
end_read_record(&read_record_info);
|
||||||
|
}
|
||||||
freeze_size(&acl_hosts);
|
freeze_size(&acl_hosts);
|
||||||
|
|
||||||
if (init_read_record(&read_record_info, thd, table=tables[1].table,
|
if (init_read_record(&read_record_info, thd, table=tables[1].table,
|
||||||
@ -1173,7 +1176,7 @@ my_bool acl_reload(THD *thd)
|
|||||||
tables[2].next_local= tables[2].next_global= tables + 3;
|
tables[2].next_local= tables[2].next_global= tables + 3;
|
||||||
tables[0].open_type= tables[1].open_type= tables[2].open_type=
|
tables[0].open_type= tables[1].open_type= tables[2].open_type=
|
||||||
tables[3].open_type= OT_BASE_ONLY;
|
tables[3].open_type= OT_BASE_ONLY;
|
||||||
tables[3].open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
|
tables[0].open_strategy= tables[3].open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
|
||||||
|
|
||||||
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
|
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user