mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge branch '10.0' into 10.1
This commit is contained in:
@ -195,7 +195,7 @@ int main(int argc, char **argv)
|
||||
die("database creation failed");
|
||||
}
|
||||
|
||||
printf("Creation of the database was successfull");
|
||||
printf("Creation of the database was successful");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,11 @@ static void die(const char *fmt, ...)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#define WRITE_LOG(fmt,...) {\
|
||||
char log_buf[1024]; \
|
||||
snprintf(log_buf,sizeof(log_buf), fmt, __VA_ARGS__);\
|
||||
WriteFile(logfile_handle,log_buf, strlen(log_buf), 0 , 0);\
|
||||
}
|
||||
|
||||
/*
|
||||
spawn-like function to run subprocesses.
|
||||
@ -187,17 +192,22 @@ static intptr_t run_tool(int wait_flag, const char *program,...)
|
||||
{
|
||||
char tmpdir[FN_REFLEN];
|
||||
GetTempPath(FN_REFLEN, tmpdir);
|
||||
sprintf_s(logfile_path, "%s\\mysql_upgrade_service.%s.log", tmpdir,
|
||||
sprintf_s(logfile_path, "%smysql_upgrade_service.%s.log", tmpdir,
|
||||
opt_service);
|
||||
logfile_handle= CreateFile(logfile_path, GENERIC_WRITE, FILE_SHARE_READ,
|
||||
NULL, TRUNCATE_EXISTING, 0, NULL);
|
||||
if (!logfile_handle)
|
||||
SECURITY_ATTRIBUTES attr= {0};
|
||||
attr.nLength= sizeof(SECURITY_ATTRIBUTES);
|
||||
attr.bInheritHandle= TRUE;
|
||||
logfile_handle= CreateFile(logfile_path, FILE_APPEND_DATA,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, &attr, CREATE_ALWAYS, 0, NULL);
|
||||
if (logfile_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
die("Cannot open log file %s, windows error %u",
|
||||
logfile_path, GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LOG("Executing %s\r\n", cmdline);
|
||||
|
||||
/* Start child process */
|
||||
STARTUPINFO si= {0};
|
||||
si.cb= sizeof(si);
|
||||
@ -458,7 +468,7 @@ int main(int argc, char **argv)
|
||||
log("Phase 3/8: Starting mysqld for upgrade");
|
||||
mysqld_process= (HANDLE)run_tool(P_NOWAIT, mysqld_path,
|
||||
defaults_file_param, "--skip-networking", "--skip-grant-tables",
|
||||
"--enable-named-pipe", socket_param, NULL);
|
||||
"--enable-named-pipe", socket_param,"--skip-slave-start", NULL);
|
||||
|
||||
if (mysqld_process == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -6207,6 +6207,9 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
|
||||
column reference. See create_view_field() for details.
|
||||
*/
|
||||
item= nj_col->create_item(thd);
|
||||
if (!item)
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
/*
|
||||
*ref != NULL means that *ref contains the item that we need to
|
||||
replace. If the item was aliased by the user, set the alias to
|
||||
|
@ -987,6 +987,7 @@ SQL_HANDLER *mysql_ha_read_prepare(THD *thd, TABLE_LIST *tables,
|
||||
if (!(handler= mysql_ha_find_handler(thd, tables->alias)))
|
||||
DBUG_RETURN(0);
|
||||
tables->table= handler->table; // This is used by fix_fields
|
||||
handler->table->pos_in_table_list= tables;
|
||||
if (mysql_ha_fix_cond_and_key(handler, mode, keyname, key_expr, cond, 1))
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(handler);
|
||||
|
@ -1250,10 +1250,19 @@ JOIN::optimize_inner()
|
||||
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
|
||||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
|
||||
{ /* Impossible cond */
|
||||
DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
|
||||
"Impossible HAVING" : "Impossible WHERE"));
|
||||
zero_result_cause= having_value == Item::COND_FALSE ?
|
||||
"Impossible HAVING" : "Impossible WHERE";
|
||||
if (unit->select_limit_cnt)
|
||||
{
|
||||
DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
|
||||
"Impossible HAVING" : "Impossible WHERE"));
|
||||
zero_result_cause= having_value == Item::COND_FALSE ?
|
||||
"Impossible HAVING" : "Impossible WHERE";
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("info", ("Zero limit"));
|
||||
zero_result_cause= "Zero limit";
|
||||
conds= 0;
|
||||
}
|
||||
table_count= top_join_tab_count= 0;
|
||||
error= 0;
|
||||
goto setup_subq_exit;
|
||||
@ -25465,21 +25474,18 @@ void JOIN::set_allowed_join_cache_types()
|
||||
|
||||
void JOIN::save_query_plan(Join_plan_state *save_to)
|
||||
{
|
||||
if (keyuse.elements)
|
||||
{
|
||||
DYNAMIC_ARRAY tmp_keyuse;
|
||||
/* Swap the current and the backup keyuse internal arrays. */
|
||||
tmp_keyuse= keyuse;
|
||||
keyuse= save_to->keyuse; /* keyuse is reset to an empty array. */
|
||||
save_to->keyuse= tmp_keyuse;
|
||||
DYNAMIC_ARRAY tmp_keyuse;
|
||||
/* Swap the current and the backup keyuse internal arrays. */
|
||||
tmp_keyuse= keyuse;
|
||||
keyuse= save_to->keyuse; /* keyuse is reset to an empty array. */
|
||||
save_to->keyuse= tmp_keyuse;
|
||||
|
||||
for (uint i= 0; i < table_count; i++)
|
||||
{
|
||||
save_to->join_tab_keyuse[i]= join_tab[i].keyuse;
|
||||
join_tab[i].keyuse= NULL;
|
||||
save_to->join_tab_checked_keys[i]= join_tab[i].checked_keys;
|
||||
join_tab[i].checked_keys.clear_all();
|
||||
}
|
||||
for (uint i= 0; i < table_count; i++)
|
||||
{
|
||||
save_to->join_tab_keyuse[i]= join_tab[i].keyuse;
|
||||
join_tab[i].keyuse= NULL;
|
||||
save_to->join_tab_checked_keys[i]= join_tab[i].checked_keys;
|
||||
join_tab[i].checked_keys.clear_all();
|
||||
}
|
||||
memcpy((uchar*) save_to->best_positions, (uchar*) best_positions,
|
||||
sizeof(POSITION) * (table_count + 1));
|
||||
@ -25517,20 +25523,17 @@ void JOIN::reset_query_plan()
|
||||
|
||||
void JOIN::restore_query_plan(Join_plan_state *restore_from)
|
||||
{
|
||||
if (restore_from->keyuse.elements)
|
||||
DYNAMIC_ARRAY tmp_keyuse;
|
||||
tmp_keyuse= keyuse;
|
||||
keyuse= restore_from->keyuse;
|
||||
restore_from->keyuse= tmp_keyuse;
|
||||
|
||||
for (uint i= 0; i < table_count; i++)
|
||||
{
|
||||
DYNAMIC_ARRAY tmp_keyuse;
|
||||
tmp_keyuse= keyuse;
|
||||
keyuse= restore_from->keyuse;
|
||||
restore_from->keyuse= tmp_keyuse;
|
||||
|
||||
for (uint i= 0; i < table_count; i++)
|
||||
{
|
||||
join_tab[i].keyuse= restore_from->join_tab_keyuse[i];
|
||||
join_tab[i].checked_keys= restore_from->join_tab_checked_keys[i];
|
||||
}
|
||||
|
||||
join_tab[i].keyuse= restore_from->join_tab_keyuse[i];
|
||||
join_tab[i].checked_keys= restore_from->join_tab_checked_keys[i];
|
||||
}
|
||||
|
||||
memcpy((uchar*) best_positions, (uchar*) restore_from->best_positions,
|
||||
sizeof(POSITION) * (table_count + 1));
|
||||
/* Restore SJM nests */
|
||||
|
@ -5957,8 +5957,11 @@ drop_create_field:
|
||||
continue;
|
||||
|
||||
/* Check if the table already has a PRIMARY KEY */
|
||||
bool dup_primary_key= key->type == Key::PRIMARY &&
|
||||
table->s->primary_key != MAX_KEY;
|
||||
bool dup_primary_key=
|
||||
key->type == Key::PRIMARY &&
|
||||
table->s->primary_key != MAX_KEY &&
|
||||
(keyname= table->s->key_info[table->s->primary_key].name) &&
|
||||
my_strcasecmp(system_charset_info, keyname, primary_key_name) == 0;
|
||||
if (dup_primary_key)
|
||||
goto remove_key;
|
||||
|
||||
|
10
sql/table.cc
10
sql/table.cc
@ -5426,6 +5426,8 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
|
||||
Item_direct_view_ref(thd, &view->view->select_lex.context,
|
||||
field_ref, view->alias,
|
||||
name, view));
|
||||
if (!item)
|
||||
return NULL;
|
||||
/*
|
||||
Force creation of nullable item for the result tmp table for outer joined
|
||||
views/derived tables.
|
||||
@ -7356,7 +7358,15 @@ int TABLE_LIST::fetch_number_of_rows()
|
||||
{
|
||||
int error= 0;
|
||||
if (jtbm_subselect)
|
||||
{
|
||||
if (jtbm_subselect->is_jtbm_merged)
|
||||
{
|
||||
table->file->stats.records= jtbm_subselect->jtbm_record_count;
|
||||
set_if_bigger(table->file->stats.records, 2);
|
||||
table->used_stat_records= table->file->stats.records;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (is_materialized_derived() && !fill_me)
|
||||
|
||||
{
|
||||
|
Reference in New Issue
Block a user