Commit 0c4cf3c7 authored by Sergei Golubchik's avatar Sergei Golubchik

small cleanup

parent 9c089b04
...@@ -4083,6 +4083,7 @@ handler *mysql_create_frm_image(THD *thd, ...@@ -4083,6 +4083,7 @@ handler *mysql_create_frm_image(THD *thd,
MYF(0)); MYF(0));
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
} }
if (check_engine(thd, db, table_name, create_info)) if (check_engine(thd, db, table_name, create_info))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
...@@ -4328,8 +4329,6 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -4328,8 +4329,6 @@ bool mysql_create_table_no_lock(THD *thd,
DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d", DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d",
db, table_name, internal_tmp_table)); db, table_name, internal_tmp_table));
alias= table_case_name(create_info, table_name);
file= mysql_create_frm_image(thd, db, table_name, create_info, alter_info, file= mysql_create_frm_image(thd, db, table_name, create_info, alter_info,
create_table_mode, &frm); create_table_mode, &frm);
...@@ -4354,6 +4353,8 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -4354,6 +4353,8 @@ bool mysql_create_table_no_lock(THD *thd,
check_partition_dirs(thd->lex->part_info)) check_partition_dirs(thd->lex->part_info))
goto err; goto err;
alias= table_case_name(create_info, table_name);
/* Check if table exists */ /* Check if table exists */
if (create_info->tmp_table()) if (create_info->tmp_table())
{ {
...@@ -4460,41 +4461,32 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, ...@@ -4460,41 +4461,32 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
Alter_info *alter_info) Alter_info *alter_info)
{ {
bool result; const char *db= create_table->db;
const char *table_name= create_table->table_name;
bool is_trans= FALSE; bool is_trans= FALSE;
DBUG_ENTER("mysql_create_table"); DBUG_ENTER("mysql_create_table");
/* /* Open or obtain an exclusive metadata lock on table being created */
Open or obtain an exclusive metadata lock on table being created.
*/
if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0)) if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0))
{ {
/* is_error() may be 0 if table existed and we generated a warning */ /* is_error() may be 0 if table existed and we generated a warning */
result= thd->is_error(); DBUG_RETURN(thd->is_error());
goto end;
} }
/* Got lock. */ /* Got lock. */
DEBUG_SYNC(thd, "locked_table_name"); DEBUG_SYNC(thd, "locked_table_name");
promote_first_timestamp_column(&alter_info->create_list); promote_first_timestamp_column(&alter_info->create_list);
result= mysql_create_table_no_lock(thd, create_table->db, if (mysql_create_table_no_lock(thd, db, table_name, create_info,
create_table->table_name, create_info, alter_info, &is_trans, C_ORDINARY_CREATE))
alter_info, &is_trans, C_ORDINARY_CREATE); DBUG_RETURN(1);
/* /* In RBR we don't need to log CREATE TEMPORARY TABLE */
Don't write statement if: if (thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
- Table creation has failed DBUG_RETURN(0);
- Row-based logging is used and we are creating a temporary table
Otherwise, the statement shall be binlogged.
*/
if (!result &&
(!thd->is_current_stmt_binlog_format_row() ||
(thd->is_current_stmt_binlog_format_row() &&
!(create_info->tmp_table()))))
result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
end: bool result;
result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
DBUG_RETURN(result); DBUG_RETURN(result);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment