1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Manual merge/pull from mysql-next-mr.

Conflicts:
  - sql/sql_insert.cc
This commit is contained in:
Alexander Nozdrin
2009-11-25 18:03:05 +03:00
161 changed files with 1611 additions and 1362 deletions

View File

@ -493,9 +493,9 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP
strnmov(tbbuff, table_name, sizeof(tbbuff));
else
VOID(tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)));
(void) tablename_to_filename(table_name, tbbuff, sizeof(tbbuff));
VOID(tablename_to_filename(db, dbbuff, sizeof(dbbuff)));
(void) tablename_to_filename(db, dbbuff, sizeof(dbbuff));
char *end = buff + bufflen;
/* Don't add FN_ROOTDIR if mysql_data_home already includes it */
@ -695,7 +695,7 @@ static bool write_ddl_log_header()
sql_print_error("Error writing ddl log header");
DBUG_RETURN(TRUE);
}
VOID(sync_ddl_log());
(void) sync_ddl_log();
DBUG_RETURN(error);
}
@ -763,7 +763,7 @@ static uint read_ddl_log_header()
global_ddl_log.first_free= NULL;
global_ddl_log.first_used= NULL;
global_ddl_log.num_entries= 0;
VOID(pthread_mutex_init(&LOCK_gdl, MY_MUTEX_INIT_FAST));
pthread_mutex_init(&LOCK_gdl, MY_MUTEX_INIT_FAST);
global_ddl_log.do_release= true;
DBUG_RETURN(entry_no);
}
@ -845,7 +845,7 @@ static bool init_ddl_log()
global_ddl_log.inited= TRUE;
if (write_ddl_log_header())
{
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
(void) my_close(global_ddl_log.file_id, MYF(MY_WME));
global_ddl_log.inited= FALSE;
DBUG_RETURN(TRUE);
}
@ -922,7 +922,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
strxmov(to_path, ddl_log_entry->name, par_ext, NullS);
VOID(my_delete(to_path, MYF(MY_WME)));
(void) my_delete(to_path, MYF(MY_WME));
#endif
}
else
@ -935,7 +935,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
}
if ((deactivate_ddl_log_entry(ddl_log_entry->entry_pos)))
break;
VOID(sync_ddl_log());
(void) sync_ddl_log();
error= FALSE;
if (ddl_log_entry->action_type == DDL_LOG_DELETE_ACTION)
break;
@ -959,7 +959,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
#ifdef WITH_PARTITION_STORAGE_ENGINE
strxmov(to_path, ddl_log_entry->name, par_ext, NullS);
strxmov(from_path, ddl_log_entry->from_name, par_ext, NullS);
VOID(my_rename(from_path, to_path, MYF(MY_WME)));
(void) my_rename(from_path, to_path, MYF(MY_WME));
#endif
}
else
@ -970,7 +970,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
}
if ((deactivate_ddl_log_entry(ddl_log_entry->entry_pos)))
break;
VOID(sync_ddl_log());
(void) sync_ddl_log();
error= FALSE;
break;
}
@ -1099,7 +1099,7 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
}
if (write_header && !error)
{
VOID(sync_ddl_log());
(void) sync_ddl_log();
if (write_ddl_log_header())
error= TRUE;
}
@ -1156,7 +1156,7 @@ bool write_execute_ddl_log_entry(uint first_entry,
any log entries before, we are only here to write the execute
entry to indicate it is done.
*/
VOID(sync_ddl_log());
(void) sync_ddl_log();
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_LOG_EXECUTE_CODE;
}
else
@ -1180,7 +1180,7 @@ bool write_execute_ddl_log_entry(uint first_entry,
release_ddl_log_memory_entry(*active_entry);
DBUG_RETURN(TRUE);
}
VOID(sync_ddl_log());
(void) sync_ddl_log();
if (write_header)
{
if (write_ddl_log_header())
@ -1372,7 +1372,7 @@ static void close_ddl_log()
DBUG_ENTER("close_ddl_log");
if (global_ddl_log.file_id >= 0)
{
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
(void) my_close(global_ddl_log.file_id, MYF(MY_WME));
global_ddl_log.file_id= (File) -1;
}
DBUG_VOID_RETURN;
@ -1432,7 +1432,7 @@ void execute_ddl_log_recovery()
}
close_ddl_log();
create_ddl_log_file_name(file_name);
VOID(my_delete(file_name, MYF(0)));
(void) my_delete(file_name, MYF(0));
global_ddl_log.recovery_phase= FALSE;
delete thd;
/* Remember that we don't have a THD */
@ -1474,7 +1474,7 @@ void release_ddl_log()
close_ddl_log();
global_ddl_log.inited= 0;
pthread_mutex_unlock(&LOCK_gdl);
VOID(pthread_mutex_destroy(&LOCK_gdl));
pthread_mutex_destroy(&LOCK_gdl);
global_ddl_log.do_release= false;
DBUG_VOID_RETURN;
}
@ -1653,7 +1653,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
completing this we write a new phase to the log entry that will
deactivate it.
*/
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (my_delete(frm_name, MYF(MY_WME)) ||
#ifdef WITH_PARTITION_STORAGE_ENGINE
lpt->table->file->ha_create_handler_files(path, shadow_path,
@ -1706,11 +1706,11 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
#endif
err:
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
#ifdef WITH_PARTITION_STORAGE_ENGINE
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos);
part_info->frm_log_entry= NULL;
VOID(sync_ddl_log());
(void) sync_ddl_log();
#endif
}
@ -1768,7 +1768,8 @@ int write_bin_log(THD *thd, bool clear_error,
If a table is in use, we will wait for all users to free the table
before dropping it
Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set.
Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set, but
not if under LOCK TABLES.
RETURN
FALSE OK. In this case ok packet is sent to user
@ -1779,7 +1780,7 @@ int write_bin_log(THD *thd, bool clear_error,
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary)
{
bool error= FALSE, need_start_waiters= FALSE;
bool error= FALSE, need_start_waiting= FALSE;
Drop_table_error_handler err_handler(thd->get_internal_handler());
DBUG_ENTER("mysql_rm_table");
@ -1787,13 +1788,9 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
if (!drop_temporary)
{
if ((error= wait_if_global_read_lock(thd, 0, 1)))
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->table_name);
if (!thd->locked_tables &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
DBUG_RETURN(TRUE);
}
else
need_start_waiters= TRUE;
}
/*
@ -1806,7 +1803,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
thd->pop_internal_handler();
if (need_start_waiters)
if (need_start_waiting)
start_waiting_global_read_lock(thd);
if (error)
@ -3875,7 +3872,7 @@ bool mysql_create_table_no_lock(THD *thd,
goto err;
}
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (!access(path,F_OK))
@ -3991,7 +3988,7 @@ bool mysql_create_table_no_lock(THD *thd,
error= write_create_table_bin_log(thd, create_info, internal_tmp_table);
unlock_and_end:
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
err:
thd_proc_info(thd, "After create");
@ -4245,7 +4242,7 @@ void wait_while_table_is_used(THD *thd, TABLE *table,
safe_mutex_assert_owner(&LOCK_open);
VOID(table->file->extra(function));
(void) table->file->extra(function);
/* Mark all tables that are in use as 'old' */
mysql_lock_abort(thd, table, TRUE); /* end threads waiting on lock */
@ -4327,7 +4324,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table,
char* table_name= table->table_name;
char* db= table->db;
VOID(tablename_to_filename(table->table_name, uname, sizeof(uname) - 1));
tablename_to_filename(table->table_name, uname, sizeof(uname) - 1);
if (fn_format_relative_to_data_home(src_path, uname, backup_dir, reg_ext))
DBUG_RETURN(-1); // protect buffer overflow
@ -5340,12 +5337,12 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
Also some engines (e.g. NDB cluster) require that LOCK_open should be held
during the call to ha_create_table(). See bug #28614 for more info.
*/
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (src_table->schema_table)
{
if (mysql_create_like_schema_frm(thd, src_table, dst_path, create_info))
{
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
goto err;
}
}
@ -5355,7 +5352,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
my_error(ER_BAD_DB_ERROR,MYF(0),db);
else
my_error(ER_CANT_CREATE_FILE,MYF(0),dst_path,my_errno);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
goto err;
}
@ -5384,7 +5381,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
if (thd->variables.keep_files_on_create)
create_info->options|= HA_CREATE_KEEP_FILES;
err= ha_create_table(thd, dst_path, db, table_name, create_info, 1);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
@ -5458,13 +5455,13 @@ binlog:
of this function.
*/
table->table= name_lock;
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (reopen_name_locked_table(thd, table, FALSE))
{
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
goto err;
}
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
int result __attribute__((unused))=
store_create_info(thd, table, &query,
@ -6609,7 +6606,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (wait_if_global_read_lock(thd,0,1))
DBUG_RETURN(TRUE);
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (lock_table_names(thd, table_list))
{
error= 1;
@ -6794,17 +6791,17 @@ view_err:
while the fact that the table is still open gives us protection
from concurrent DDL statements.
*/
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
/* COND_refresh will be signaled in close_thread_tables() */
break;
case DISABLE:
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
/* COND_refresh will be signaled in close_thread_tables() */
break;
@ -6821,7 +6818,7 @@ view_err:
table->alias);
}
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
/*
Unlike to the above case close_cached_table() below will remove ALL
instances of TABLE from table cache (it will also remove table lock
@ -6860,8 +6857,8 @@ view_err:
else if (Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias))
{
VOID(mysql_rename_table(old_db_type, new_db, new_alias, db,
table_name, 0));
(void) mysql_rename_table(old_db_type, new_db, new_alias, db,
table_name, 0);
error= -1;
}
}
@ -6888,7 +6885,7 @@ view_err:
}
if (name_lock)
unlink_open_table(thd, name_lock, FALSE);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
table_list->table= NULL; // For query cache
query_cache_invalidate3(thd, table_list, 0);
DBUG_RETURN(error);
@ -7249,9 +7246,9 @@ view_err:
}
else
{
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
thd_proc_info(thd, "manage keys");
alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff);
@ -7382,11 +7379,11 @@ view_err:
intern_close_table(new_table);
my_free(new_table,MYF(0));
}
VOID(pthread_mutex_lock(&LOCK_open));
pthread_mutex_lock(&LOCK_open);
if (error)
{
VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
VOID(pthread_mutex_unlock(&LOCK_open));
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
pthread_mutex_unlock(&LOCK_open);
goto err;
}
@ -7441,7 +7438,7 @@ view_err:
FN_TO_IS_TMP))
{
error=1;
VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
}
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
new_alias, FN_FROM_IS_TMP) ||
@ -7454,10 +7451,10 @@ view_err:
{
/* Try to get everything back. */
error=1;
VOID(quick_rm_table(new_db_type,new_db,new_alias, 0));
VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
VOID(mysql_rename_table(old_db_type, db, old_name, db, alias,
FN_FROM_IS_TMP));
(void) quick_rm_table(new_db_type,new_db,new_alias, 0);
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
(void) mysql_rename_table(old_db_type, db, old_name, db, alias,
FN_FROM_IS_TMP);
}
if (error)
@ -7509,7 +7506,7 @@ view_err:
}
}
VOID(quick_rm_table(old_db_type, db, old_name, FN_IS_TMP));
(void) quick_rm_table(old_db_type, db, old_name, FN_IS_TMP);
if (thd->locked_tables && new_name == table_name && new_db == db)
{
@ -7519,7 +7516,7 @@ view_err:
if (error)
goto err_with_placeholders;
}
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
thd_proc_info(thd, "end");
@ -7588,10 +7585,8 @@ err1:
close_temporary_table(thd, new_table, 1, 1);
}
else
VOID(quick_rm_table(new_db_type, new_db, tmp_name,
create_info->frm_only
? FN_IS_TMP | FRM_ONLY
: FN_IS_TMP));
(void) quick_rm_table(new_db_type, new_db, tmp_name,
create_info->frm_only ? FN_IS_TMP | FRM_ONLY : FN_IS_TMP);
err:
/*
@ -7644,7 +7639,7 @@ err_with_placeholders:
unlink_open_table(thd, table, FALSE);
if (name_lock)
unlink_open_table(thd, name_lock, FALSE);
VOID(pthread_mutex_unlock(&LOCK_open));
pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(TRUE);
}
/* mysql_alter_table */