summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-11-25 18:03:05 +0300
committerAlexander Nozdrin <alik@sun.com>2009-11-25 18:03:05 +0300
commit52c66b56710046034fc631df4f3a165ba5a704f7 (patch)
treeb7488b7a2e23cf4b596766c1c84f64235543757a /sql
parent72a26125e21fc4c654a8a1c9c1841f79f62d4d7a (diff)
parentbe0add42f53b23d8a5e279cb3041a3fc93e375a0 (diff)
downloadmariadb-git-52c66b56710046034fc631df4f3a165ba5a704f7.tar.gz
Manual merge/pull from mysql-next-mr.
Conflicts: - sql/sql_insert.cc
Diffstat (limited to 'sql')
-rw-r--r--sql/derror.cc6
-rw-r--r--sql/des_key_file.cc4
-rw-r--r--sql/discover.cc4
-rw-r--r--sql/field.cc4
-rw-r--r--sql/filesort.cc2
-rw-r--r--sql/ha_ndbcluster.cc4
-rw-r--r--sql/ha_partition.cc28
-rw-r--r--sql/handler.cc27
-rw-r--r--sql/handler.h2
-rw-r--r--sql/hostname.cc28
-rw-r--r--sql/init.cc2
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_strfunc.cc12
-rw-r--r--sql/lock.cc173
-rw-r--r--sql/log.cc23
-rw-r--r--sql/log_event.cc11
-rw-r--r--sql/mysql_priv.h12
-rw-r--r--sql/mysqld.cc43
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/protocol.cc3
-rw-r--r--sql/records.cc6
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/slave.cc9
-rw-r--r--sql/slave.h3
-rw-r--r--sql/sp_head.cc8
-rw-r--r--sql/sp_pcontext.cc40
-rw-r--r--sql/sql_acl.cc101
-rw-r--r--sql/sql_base.cc144
-rw-r--r--sql/sql_cache.cc17
-rw-r--r--sql/sql_class.cc6
-rw-r--r--sql/sql_class.h12
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_db.cc16
-rw-r--r--sql/sql_delete.cc12
-rw-r--r--sql/sql_handler.cc4
-rw-r--r--sql/sql_insert.cc405
-rw-r--r--sql/sql_map.cc16
-rw-r--r--sql/sql_parse.cc42
-rw-r--r--sql/sql_prepare.cc12
-rw-r--r--sql/sql_select.cc10
-rw-r--r--sql/sql_servers.cc6
-rw-r--r--sql/sql_show.cc24
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_table.cc123
-rw-r--r--sql/sql_test.cc28
-rw-r--r--sql/sql_trigger.cc4
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_view.cc8
-rw-r--r--sql/table.cc30
-rw-r--r--sql/tztime.cc8
-rw-r--r--sql/udf_example.c12
-rw-r--r--sql/uniques.cc4
-rw-r--r--sql/unireg.cc14
-rw-r--r--sql/unireg.h2
55 files changed, 753 insertions, 777 deletions
diff --git a/sql/derror.cc b/sql/derror.cc
index 3073f37eba3..95481e3212f 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -143,7 +143,7 @@ Error message file '%s' had only %d error messages,\n\
but it should contain at least %d error messages.\n\
Check that the above file is the right version for this program!",
name,count,error_messages);
- VOID(my_close(file,MYF(MY_WME)));
+ (void) my_close(file,MYF(MY_WME));
DBUG_RETURN(1);
}
@@ -170,7 +170,7 @@ Check that the above file is the right version for this program!",
{
point[i]= *point +uint2korr(head+10+i+i);
}
- VOID(my_close(file,MYF(0)));
+ (void) my_close(file,MYF(0));
DBUG_RETURN(0);
err:
@@ -187,7 +187,7 @@ err:
}
sql_print_error(errmsg, name);
if (file != FERR)
- VOID(my_close(file,MYF(MY_WME)));
+ (void) my_close(file,MYF(MY_WME));
DBUG_RETURN(1);
} /* read_texts */
diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc
index 317cb237360..87ad6ff12b0 100644
--- a/sql/des_key_file.cc
+++ b/sql/des_key_file.cc
@@ -43,7 +43,7 @@ load_des_key_file(const char *file_name)
DBUG_ENTER("load_des_key_file");
DBUG_PRINT("enter",("name: %s",file_name));
- VOID(pthread_mutex_lock(&LOCK_des_key_file));
+ pthread_mutex_lock(&LOCK_des_key_file);
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||
init_io_cache(&io, file, IO_SIZE*2, READ_CACHE, 0, 0, MYF(MY_WME)))
goto error;
@@ -96,7 +96,7 @@ error:
my_close(file,MYF(0));
end_io_cache(&io);
}
- VOID(pthread_mutex_unlock(&LOCK_des_key_file));
+ pthread_mutex_unlock(&LOCK_des_key_file);
DBUG_RETURN(result);
}
#endif /* HAVE_OPENSSL */
diff --git a/sql/discover.cc b/sql/discover.cc
index 56dc00cc5c4..f475cfbf72a 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -82,7 +82,7 @@ int readfrm(const char *name, uchar **frmdata, size_t *len)
err:
if (file > 0)
- VOID(my_close(file,MYF(MY_WME)));
+ (void) my_close(file,MYF(MY_WME));
err_end: /* Here when no file */
DBUG_RETURN (error);
@@ -118,7 +118,7 @@ int writefrm(const char *name, const uchar *frmdata, size_t len)
{
if (my_write(file, frmdata, len,MYF(MY_WME | MY_NABP)))
error= 2;
- VOID(my_close(file,MYF(0)));
+ (void) my_close(file,MYF(0));
}
DBUG_RETURN(error);
} /* writefrm */
diff --git a/sql/field.cc b/sql/field.cc
index 615d081918b..8077336583e 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4200,7 +4200,7 @@ String *Field_float::val_str(String *val_buffer,
char buff[70],*pos=buff;
int decpt,sign,tmp_dec=dec;
- VOID(sfconvert(&nr,tmp_dec,&decpt,&sign,buff));
+ (void) sfconvert(&nr,tmp_dec,&decpt,&sign,buff);
if (sign)
{
*to++='-';
@@ -4559,7 +4559,7 @@ String *Field_double::val_str(String *val_buffer,
char *pos= buff;
int decpt,sign,tmp_dec=dec;
- VOID(fconvert(nr,tmp_dec,&decpt,&sign,buff));
+ (void) fconvert(nr,tmp_dec,&decpt,&sign,buff);
if (sign)
{
*to++='-';
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 8f18471b378..3104e6824b0 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1318,7 +1318,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
if (!(error= (int) read_to_buffer(from_file,buffpek,
rec_length)))
{
- VOID(queue_remove(&queue,0));
+ (void) queue_remove(&queue,0);
reuse_freed_buff(&queue, buffpek, rec_length);
break; /* One buffer have been removed */
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index f83e40ec402..2c54fd3688a 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -6904,7 +6904,7 @@ int ndbcluster_drop_database_impl(const char *path)
while ((tabname=it++))
{
tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1);
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname))
{
const NdbError err= dict->getNdbError();
@@ -6914,7 +6914,7 @@ int ndbcluster_drop_database_impl(const char *path)
ret= ndb_to_mysql_error(&err);
}
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
DBUG_RETURN(ret);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 0d5fc454a0c..2ec92173d14 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -641,7 +641,7 @@ int ha_partition::drop_partitions(const char *path)
part_elem->part_state= PART_IS_DROPPED;
}
} while (++i < num_parts);
- VOID(sync_ddl_log());
+ (void) sync_ddl_log();
DBUG_RETURN(error);
}
@@ -739,7 +739,7 @@ int ha_partition::rename_partitions(const char *path)
part_elem->log_entry= NULL; /* Indicate success */
}
} while (++i < temp_partitions);
- VOID(sync_ddl_log());
+ (void) sync_ddl_log();
}
i= 0;
do
@@ -791,7 +791,7 @@ int ha_partition::rename_partitions(const char *path)
error= ret_error;
else if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
error= 1;
- VOID(sync_ddl_log());
+ (void) sync_ddl_log();
}
file= m_new_file[part];
create_subpartition_name(part_name_buff, path,
@@ -822,7 +822,7 @@ int ha_partition::rename_partitions(const char *path)
error= ret_error;
else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
error= 1;
- VOID(sync_ddl_log());
+ (void) sync_ddl_log();
}
file= m_new_file[i];
create_partition_name(part_name_buff, path,
@@ -840,7 +840,7 @@ int ha_partition::rename_partitions(const char *path)
}
}
} while (++i < num_parts);
- VOID(sync_ddl_log());
+ (void) sync_ddl_log();
DBUG_RETURN(error);
}
@@ -1295,7 +1295,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
DBUG_RETURN(0);
error:
if (create_flag)
- VOID(file->ha_delete_table(part_name));
+ (void) file->ha_delete_table(part_name);
DBUG_RETURN(error);
}
@@ -2210,7 +2210,7 @@ bool ha_partition::create_handler_file(const char *name)
{
result= my_write(file, (uchar *) file_buffer, tot_len_byte,
MYF(MY_WME | MY_NABP)) != 0;
- VOID(my_close(file, MYF(0)));
+ (void) my_close(file, MYF(0));
}
else
result= TRUE;
@@ -2396,7 +2396,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
len_bytes= 4 * len_words;
if (!(file_buffer= (char*) my_malloc(len_bytes, MYF(0))))
goto err1;
- VOID(my_seek(file, 0, MY_SEEK_SET, MYF(0)));
+ my_seek(file, 0, MY_SEEK_SET, MYF(0));
if (my_read(file, (uchar *) file_buffer, len_bytes, MYF(MY_NABP)))
goto err2;
@@ -2418,7 +2418,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
if (len_words != (tot_partition_words + tot_name_words + 4))
goto err3;
name_buffer_ptr= file_buffer + 16 + 4 * tot_partition_words;
- VOID(my_close(file, MYF(0)));
+ (void) my_close(file, MYF(0));
m_file_buffer= file_buffer; // Will be freed in clear_handler_file()
m_name_buffer_ptr= name_buffer_ptr;
@@ -2443,7 +2443,7 @@ err3:
err2:
my_free(file_buffer, MYF(0));
err1:
- VOID(my_close(file, MYF(0)));
+ (void) my_close(file, MYF(0));
DBUG_RETURN(TRUE);
}
@@ -5844,9 +5844,9 @@ void ha_partition::late_extra_cache(uint partition_id)
DBUG_VOID_RETURN;
file= m_file[partition_id];
if (m_extra_cache_size == 0)
- VOID(file->extra(HA_EXTRA_CACHE));
+ (void) file->extra(HA_EXTRA_CACHE);
else
- VOID(file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size));
+ (void) file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size);
DBUG_VOID_RETURN;
}
@@ -5870,7 +5870,7 @@ void ha_partition::late_extra_no_cache(uint partition_id)
if (!m_extra_cache)
DBUG_VOID_RETURN;
file= m_file[partition_id];
- VOID(file->extra(HA_EXTRA_NO_CACHE));
+ (void) file->extra(HA_EXTRA_NO_CACHE);
DBUG_VOID_RETURN;
}
@@ -6675,7 +6675,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table)
if (!partition_init)
{
partition_init++;
- VOID(pthread_mutex_init(&partition_mutex, MY_MUTEX_INIT_FAST));
+ pthread_mutex_init(&partition_mutex, MY_MUTEX_INIT_FAST);
(void) hash_init(&partition_open_tables, system_charset_info, 32, 0, 0,
(hash_get_key) partition_get_key, 0, 0);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index ad7e1ecfa80..17a92b00b4f 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -992,7 +992,7 @@ int ha_prepare(THD *thd)
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_prepare");
-#ifdef USING_TRANSACTIONS
+
if (ha_info)
{
for (; ha_info; ha_info= ha_info->next())
@@ -1018,7 +1018,7 @@ int ha_prepare(THD *thd)
}
}
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -1146,7 +1146,7 @@ int ha_commit_trans(THD *thd, bool all)
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(2);
}
-#ifdef USING_TRANSACTIONS
+
if (ha_info)
{
uint rw_ha_count;
@@ -1227,7 +1227,6 @@ end:
/* Free resources and perform other cleanup even for 'empty' transactions. */
else if (is_real_trans)
thd->transaction.cleanup();
-#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
@@ -1249,7 +1248,7 @@ int ha_commit_one_phase(THD *thd, bool all)
bool is_real_trans=all || thd->transaction.all.ha_list == 0;
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
DBUG_ENTER("ha_commit_one_phase");
-#ifdef USING_TRANSACTIONS
+
if (ha_info)
{
for (; ha_info; ha_info= ha_info_next)
@@ -1279,7 +1278,7 @@ int ha_commit_one_phase(THD *thd, bool all)
/* Free resources and perform other cleanup even for 'empty' transactions. */
if (is_real_trans)
thd->transaction.cleanup();
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -1319,7 +1318,7 @@ int ha_rollback_trans(THD *thd, bool all)
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
}
-#ifdef USING_TRANSACTIONS
+
if (ha_info)
{
/* Close all cursors that can not survive ROLLBACK */
@@ -1350,7 +1349,6 @@ int ha_rollback_trans(THD *thd, bool all)
/* Always cleanup. Even if there nht==0. There may be savepoints. */
if (is_real_trans)
thd->transaction.cleanup();
-#endif /* USING_TRANSACTIONS */
if (all)
thd->transaction_rollback_request= FALSE;
@@ -1386,7 +1384,7 @@ int ha_rollback_trans(THD *thd, bool all)
int ha_autocommit_or_rollback(THD *thd, int error)
{
DBUG_ENTER("ha_autocommit_or_rollback");
-#ifdef USING_TRANSACTIONS
+
if (thd->transaction.stmt.ha_list)
{
if (!error)
@@ -1404,7 +1402,6 @@ int ha_autocommit_or_rollback(THD *thd, int error)
thd->variables.tx_isolation=thd->session_tx_isolation;
}
else
-#endif
{
if (!error)
RUN_HOOK(transaction, after_commit, (thd, FALSE));
@@ -1812,7 +1809,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
&thd->transaction.all);
Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_savepoint");
-#ifdef USING_TRANSACTIONS
+
for (; ha_info; ha_info= ha_info->next())
{
int err;
@@ -1836,7 +1833,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
engines are prepended to the beginning of the list.
*/
sv->ha_list= trans->ha_list;
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -3017,7 +3014,7 @@ static bool update_frm_version(TABLE *table)
}
err:
if (file >= 0)
- VOID(my_close(file,MYF(MY_WME)));
+ (void) my_close(file,MYF(MY_WME));
DBUG_RETURN(result);
}
@@ -3650,7 +3647,7 @@ int ha_create_table(THD *thd, const char *path,
name= get_canonical_filename(table.file, share.path.str, name_buff);
error= table.file->ha_create(name, &table, create_info);
- VOID(closefrm(&table, 0));
+ (void) closefrm(&table, 0);
if (error)
{
strxmov(name_buff, db, ".", table_name, NullS);
@@ -3721,7 +3718,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
get_canonical_filename(table.file, path, path);
error=table.file->ha_create(path, &table, &create_info);
- VOID(closefrm(&table, 1));
+ (void) closefrm(&table, 1);
DBUG_RETURN(error != 0);
}
diff --git a/sql/handler.h b/sql/handler.h
index 05a9e13653c..5f028796cf3 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -31,8 +31,6 @@
#define NO_HASH /* Not yet implemented */
#endif
-#define USING_TRANSACTIONS
-
// the following is for checking tables
#define HA_ADMIN_ALREADY_DONE 1
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 45b10d16ce2..b498c548e61 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -87,7 +87,7 @@ static void add_hostname(struct in_addr *in,const char *name)
{
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
{
- VOID(pthread_mutex_lock(&hostname_cache->lock));
+ pthread_mutex_lock(&hostname_cache->lock);
host_entry *entry;
if (!(entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
{
@@ -106,7 +106,7 @@ static void add_hostname(struct in_addr *in,const char *name)
(void) hostname_cache->add(entry);
}
}
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ pthread_mutex_unlock(&hostname_cache->lock);
}
}
@@ -118,20 +118,20 @@ inline void add_wrong_ip(struct in_addr *in)
void inc_host_errors(struct in_addr *in)
{
- VOID(pthread_mutex_lock(&hostname_cache->lock));
+ pthread_mutex_lock(&hostname_cache->lock);
host_entry *entry;
if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
entry->errors++;
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ pthread_mutex_unlock(&hostname_cache->lock);
}
void reset_host_errors(struct in_addr *in)
{
- VOID(pthread_mutex_lock(&hostname_cache->lock));
+ pthread_mutex_lock(&hostname_cache->lock);
host_entry *entry;
if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
entry->errors=0;
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ pthread_mutex_unlock(&hostname_cache->lock);
}
/* Deal with systems that don't defined INADDR_LOOPBACK */
@@ -153,7 +153,7 @@ char * ip_to_hostname(struct in_addr *in, uint *errors)
/* Check first if we have name in cache */
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
{
- VOID(pthread_mutex_lock(&hostname_cache->lock));
+ pthread_mutex_lock(&hostname_cache->lock);
if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
{
char *name;
@@ -162,10 +162,10 @@ char * ip_to_hostname(struct in_addr *in, uint *errors)
else
name=my_strdup(entry->hostname,MYF(0));
*errors= entry->errors;
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ pthread_mutex_unlock(&hostname_cache->lock);
DBUG_RETURN(name);
}
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ pthread_mutex_unlock(&hostname_cache->lock);
}
struct hostent *hp, *check;
@@ -214,10 +214,10 @@ char * ip_to_hostname(struct in_addr *in, uint *errors)
}
my_gethostbyname_r_free();
#else
- VOID(pthread_mutex_lock(&LOCK_hostname));
+ pthread_mutex_lock(&LOCK_hostname);
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
{
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
if (errno == HOST_NOT_FOUND || errno == NO_DATA)
@@ -227,17 +227,17 @@ char * ip_to_hostname(struct in_addr *in, uint *errors)
}
if (!hp->h_name[0]) // Don't allow empty hostnames
{
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
DBUG_PRINT("error",("Got an empty hostname"));
goto add_wrong_ip_and_return;
}
if (!(name=my_strdup(hp->h_name,MYF(0))))
{
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
DBUG_RETURN(0); // out of memory
}
check=gethostbyname(name);
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
if (!check)
{
DBUG_PRINT("error",("gethostbyname returned %d",errno));
diff --git a/sql/init.cc b/sql/init.cc
index afda36b6b9d..cada907b013 100644
--- a/sql/init.cc
+++ b/sql/init.cc
@@ -40,7 +40,7 @@ void unireg_init(ulong options)
my_abort_hook=unireg_abort; /* Abort with close of databases */
#endif
- VOID(strmov(reg_ext,".frm"));
+ (void) strmov(reg_ext,".frm");
reg_ext_length= 4;
specialflag=SPECIAL_SAME_DB_NAME | options; /* Set options from argv */
DBUG_VOID_RETURN;
diff --git a/sql/item.cc b/sql/item.cc
index f8fd82fda67..8fef62aacc1 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1196,7 +1196,7 @@ void Item_case_expr::print(String *str, enum_query_type)
{
if (str->reserve(MAX_INT_WIDTH + sizeof("case_expr@")))
return; /* purecov: inspected */
- VOID(str->append(STRING_WITH_LEN("case_expr@")));
+ (void) str->append(STRING_WITH_LEN("case_expr@"));
str->qs_append(m_case_expr_id);
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 981b4bf0b92..9e0fe0b2562 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4187,7 +4187,7 @@ void Item_cond::neg_arguments(THD *thd)
if (!(new_item= new Item_func_not(item)))
return; // Fatal OEM error
}
- VOID(li.replace(new_item));
+ (void) li.replace(new_item);
}
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d4ef55e5609..923b943c950 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -465,18 +465,18 @@ String *Item_func_des_encrypt::val_str(String *str)
if (arg_count == 1)
{
/* Protect against someone doing FLUSH DES_KEY_FILE */
- VOID(pthread_mutex_lock(&LOCK_des_key_file));
+ pthread_mutex_lock(&LOCK_des_key_file);
keyschedule= des_keyschedule[key_number=des_default_key];
- VOID(pthread_mutex_unlock(&LOCK_des_key_file));
+ pthread_mutex_unlock(&LOCK_des_key_file);
}
else if (args[1]->result_type() == INT_RESULT)
{
key_number= (uint) args[1]->val_int();
if (key_number > 9)
goto error;
- VOID(pthread_mutex_lock(&LOCK_des_key_file));
+ pthread_mutex_lock(&LOCK_des_key_file);
keyschedule= des_keyschedule[key_number];
- VOID(pthread_mutex_unlock(&LOCK_des_key_file));
+ pthread_mutex_unlock(&LOCK_des_key_file);
}
else
{
@@ -566,9 +566,9 @@ String *Item_func_des_decrypt::val_str(String *str)
key_number > 9)
goto error;
- VOID(pthread_mutex_lock(&LOCK_des_key_file));
+ pthread_mutex_lock(&LOCK_des_key_file);
keyschedule= des_keyschedule[key_number];
- VOID(pthread_mutex_unlock(&LOCK_des_key_file));
+ pthread_mutex_unlock(&LOCK_des_key_file);
}
else
{
diff --git a/sql/lock.cc b/sql/lock.cc
index c0cda1dbf03..56ae94ddc39 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -90,7 +90,6 @@ extern HASH open_cache;
static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
uint flags, TABLE **write_locked);
-static void reset_lock_data(MYSQL_LOCK *sql_lock);
static int lock_external(THD *thd, TABLE **table,uint count);
static int unlock_external(THD *thd, TABLE **table,uint count);
static void print_lock_error(int error, const char *);
@@ -194,6 +193,60 @@ int mysql_lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags)
DBUG_RETURN(0);
}
+
+/**
+ Reset lock type in lock data and free.
+
+ @param mysql_lock Lock structures to reset.
+
+ @note After a locking error we want to quit the locking of the table(s).
+ The test case in the bug report for Bug #18544 has the following
+ cases: 1. Locking error in lock_external() due to InnoDB timeout.
+ 2. Locking error in get_lock_data() due to missing write permission.
+ 3. Locking error in wait_if_global_read_lock() due to lock conflict.
+
+ @note In all these cases we have already set the lock type into the lock
+ data of the open table(s). If the table(s) are in the open table
+ cache, they could be reused with the non-zero lock type set. This
+ could lead to ignoring a different lock type with the next lock.
+
+ @note Clear the lock type of all lock data. This ensures that the next
+ lock request will set its lock type properly.
+*/
+
+
+static void reset_lock_data(MYSQL_LOCK *sql_lock)
+{
+ THR_LOCK_DATA **ldata, **ldata_end;
+ DBUG_ENTER("reset_lock_data");
+
+ /* Clear the lock type of all lock data to avoid reusage. */
+ for (ldata= sql_lock->locks, ldata_end= ldata + sql_lock->lock_count;
+ ldata < ldata_end;
+ ldata++)
+ {
+ /* Reset lock type. */
+ (*ldata)->type= TL_UNLOCK;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Reset lock type in lock data and free.
+
+ @param mysql_lock Lock structures to reset.
+
+*/
+
+static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock)
+{
+ reset_lock_data(*mysql_lock);
+ my_free(*mysql_lock, MYF(0));
+ *mysql_lock= 0;
+}
+
+
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
uint flags, bool *need_reopen)
{
@@ -224,16 +277,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
if (wait_if_global_read_lock(thd, 1, 1))
{
/* Clear the lock type of all lock data to avoid reusage. */
- reset_lock_data(sql_lock);
- my_free((uchar*) sql_lock,MYF(0));
- sql_lock=0;
+ reset_lock_data_and_free(&sql_lock);
break;
}
if (thd->version != refresh_version)
{
/* Clear the lock type of all lock data to avoid reusage. */
- reset_lock_data(sql_lock);
- my_free((uchar*) sql_lock,MYF(0));
+ reset_lock_data_and_free(&sql_lock);
goto retry;
}
}
@@ -248,9 +298,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
Someone has issued SET GLOBAL READ_ONLY=1 and we want a write lock.
We do not wait for READ_ONLY=0, and fail.
*/
- reset_lock_data(sql_lock);
- my_free((uchar*) sql_lock, MYF(0));
- sql_lock=0;
+ reset_lock_data_and_free(&sql_lock);
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
break;
}
@@ -261,14 +309,11 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
sql_lock->table_count))
{
/* Clear the lock type of all lock data to avoid reusage. */
- reset_lock_data(sql_lock);
- my_free((uchar*) sql_lock,MYF(0));
- sql_lock=0;
+ reset_lock_data_and_free(&sql_lock);
break;
}
- thd_proc_info(thd, "Table lock");
DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info));
- thd->locked=1;
+ thd_proc_info(thd, "Locked");
/* Copy the lock data array. thr_multi_lock() reorders its contens. */
memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks,
sql_lock->lock_count * sizeof(*sql_lock->locks));
@@ -280,23 +325,16 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
if (rc > 1) /* a timeout or a deadlock */
{
if (sql_lock->table_count)
- VOID(unlock_external(thd, sql_lock->table, sql_lock->table_count));
+ (void) unlock_external(thd, sql_lock->table, sql_lock->table_count);
+ reset_lock_data_and_free(&sql_lock);
my_error(rc, MYF(0));
- my_free((uchar*) sql_lock,MYF(0));
- sql_lock= 0;
break;
}
else if (rc == 1) /* aborted */
{
- /*
- reset_lock_data is required here. If thr_multi_lock fails it
- resets lock type for tables, which were locked before (and
- including) one that caused error. Lock type for other tables
- preserved.
- */
- reset_lock_data(sql_lock);
thd->some_tables_deleted=1; // Try again
sql_lock->lock_count= 0; // Locks are already freed
+ // Fall through: unlock, reset lock data, free and retry
}
else if (!thd->some_tables_deleted || (flags & MYSQL_LOCK_IGNORE_FLUSH))
{
@@ -304,23 +342,30 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
Thread was killed or lock aborted. Let upper level close all
used tables and retry or give error.
*/
- thd->locked=0;
break;
}
else if (!thd->open_tables)
{
// Only using temporary tables, no need to unlock
thd->some_tables_deleted=0;
- thd->locked=0;
break;
}
thd_proc_info(thd, 0);
- /* some table was altered or deleted. reopen tables marked deleted */
- mysql_unlock_tables(thd,sql_lock);
- thd->locked=0;
+ /* going to retry, unlock all tables */
+ if (sql_lock->lock_count)
+ thr_multi_unlock(sql_lock->locks, sql_lock->lock_count);
+
+ if (sql_lock->table_count)
+ (void) unlock_external(thd, sql_lock->table, sql_lock->table_count);
+
+ /*
+ If thr_multi_lock fails it resets lock type for tables, which
+ were locked before (and including) one that caused error. Lock
+ type for other tables preserved.
+ */
+ reset_lock_data_and_free(&sql_lock);
retry:
- sql_lock=0;
if (flags & MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN)
{
*need_reopen= TRUE;
@@ -388,7 +433,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (sql_lock->lock_count)
thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
if (sql_lock->table_count)
- VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
+ (void) unlock_external(thd,sql_lock->table,sql_lock->table_count);
my_free((uchar*) sql_lock,MYF(0));
DBUG_VOID_RETURN;
}
@@ -452,7 +497,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
/* Unlock all read locked tables */
if (i != found)
{
- VOID(unlock_external(thd,table,i-found));
+ (void) unlock_external(thd,table,i-found);
sql_lock->table_count=found;
}
/* Fix the lock positions in TABLE */
@@ -863,8 +908,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
my_error(ER_OPEN_AS_READONLY,MYF(0),table->alias);
/* Clear the lock type of the lock data that are stored already. */
sql_lock->lock_count= (uint) (locks - sql_lock->locks);
- reset_lock_data(sql_lock);
- my_free((uchar*) sql_lock,MYF(0));
+ reset_lock_data_and_free(&sql_lock);
DBUG_RETURN(0);
}
}
@@ -905,42 +949,6 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
}
-/**
- Reset lock type in lock data.
-
- After a locking error we want to quit the locking of the table(s).
- The test case in the bug report for Bug #18544 has the following
- cases:
- -# Locking error in lock_external() due to InnoDB timeout.
- -# Locking error in get_lock_data() due to missing write permission.
- -# Locking error in wait_if_global_read_lock() due to lock conflict.
-
- In all these cases we have already set the lock type into the lock
- data of the open table(s). If the table(s) are in the open table
- cache, they could be reused with the non-zero lock type set. This
- could lead to ignoring a different lock type with the next lock.
-
- Clear the lock type of all lock data. This ensures that the next
- lock request will set its lock type properly.
-
- @param sql_lock The MySQL lock.
-*/
-
-static void reset_lock_data(MYSQL_LOCK *sql_lock)
-{
- THR_LOCK_DATA **ldata;
- THR_LOCK_DATA **ldata_end;
-
- for (ldata= sql_lock->locks, ldata_end= ldata + sql_lock->lock_count;
- ldata < ldata_end;
- ldata++)
- {
- /* Reset lock type. */
- (*ldata)->type= TL_UNLOCK;
- }
-}
-
-
/*****************************************************************************
Lock table based on the name.
This is used when we need total access to a closed, not open table
@@ -970,7 +978,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
if (wait_if_global_read_lock(thd, 0, 1))
DBUG_RETURN(1);
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if ((lock_retcode = lock_table_name(thd, table_list, TRUE)) < 0)
goto end;
if (lock_retcode && wait_for_locked_table_names(thd, table_list))
@@ -1020,6 +1028,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
char key[MAX_DBKEY_LENGTH];
char *db= table_list->db;
uint key_length;
+ bool found_locked_table= FALSE;
HASH_SEARCH_STATE state;
DBUG_ENTER("lock_table_name");
DBUG_PRINT("enter",("db: %s name: %s", db, table_list->table_name));
@@ -1035,6 +1044,13 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
table = (TABLE*) my_hash_next(&open_cache,(uchar*) key,
key_length, &state))
{
+ if (table->reginfo.lock_type < TL_WRITE)
+ {
+ if (table->in_use == thd)
+ found_locked_table= TRUE;
+ continue;
+ }
+
if (table->in_use == thd)
{
DBUG_PRINT("info", ("Table is in use"));
@@ -1045,6 +1061,17 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
}
}
+ if (thd->locked_tables && thd->locked_tables->table_count &&
+ ! find_temporary_table(thd, table_list->db, table_list->table_name))
+ {
+ if (found_locked_table)
+ my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_list->alias);
+ else
+ my_error(ER_TABLE_NOT_LOCKED, MYF(0), table_list->alias);
+
+ DBUG_RETURN(-1);
+ }
+
if (!(table= table_cache_insert_placeholder(thd, key, key_length)))
DBUG_RETURN(-1);
@@ -1595,8 +1622,8 @@ bool make_global_read_lock_block_commit(THD *thd)
void broadcast_refresh(void)
{
- VOID(pthread_cond_broadcast(&COND_refresh));
- VOID(pthread_cond_broadcast(&COND_global_read_lock));
+ pthread_cond_broadcast(&COND_refresh);
+ pthread_cond_broadcast(&COND_global_read_lock);
}
/**
diff --git a/sql/log.cc b/sql/log.cc
index e34b54f5c3b..94949ebef40 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2909,7 +2909,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
thread. If the transaction involved MyISAM tables, it should go
into binlog even on rollback.
*/
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
/* Save variables so that we can reopen the log */
save_name=name;
@@ -2989,7 +2989,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
my_free((uchar*) save_name, MYF(0));
err:
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
pthread_mutex_unlock(&LOCK_index);
pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
@@ -4084,12 +4084,11 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
(!binlog_filter->db_ok(local_db)))
{
- VOID(pthread_mutex_unlock(&LOCK_log));
+ pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(0);
}
#endif /* HAVE_REPLICATION */
-#if defined(USING_TRANSACTIONS)
/*
Should we write to the binlog cache or to the binlog on disk?
Write to the binlog cache if:
@@ -4124,7 +4123,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
LOCK_log.
*/
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
/*
@@ -4547,7 +4546,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
bool incident)
{
DBUG_ENTER("MYSQL_BIN_LOG::write(THD *, IO_CACHE *, Log_event *)");
- VOID(pthread_mutex_lock(&LOCK_log));
+ pthread_mutex_lock(&LOCK_log);
/* NULL would represent nothing to replicate after ROLLBACK */
DBUG_ASSERT(commit_event != NULL);
@@ -4636,7 +4635,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
else
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
}
- VOID(pthread_mutex_unlock(&LOCK_log));
+ pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(0);
@@ -4646,7 +4645,7 @@ err:
write_error= 1;
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
}
- VOID(pthread_mutex_unlock(&LOCK_log));
+ pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(1);
}
@@ -4866,7 +4865,7 @@ bool flush_error_log()
char err_renamed[FN_REFLEN], *end;
end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
strmov(end, "-old");
- VOID(pthread_mutex_lock(&LOCK_error_log));
+ pthread_mutex_lock(&LOCK_error_log);
#ifdef __WIN__
char err_temp[FN_REFLEN+4];
/*
@@ -4913,7 +4912,7 @@ bool flush_error_log()
else
result= 1;
#endif
- VOID(pthread_mutex_unlock(&LOCK_error_log));
+ pthread_mutex_unlock(&LOCK_error_log);
}
return result;
}
@@ -4988,7 +4987,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
DBUG_ENTER("print_buffer_to_file");
DBUG_PRINT("enter",("buffer: %s", buffer));
- VOID(pthread_mutex_lock(&LOCK_error_log));
+ pthread_mutex_lock(&LOCK_error_log);
skr= my_time(0);
localtime_r(&skr, &tm_tmp);
@@ -5007,7 +5006,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
fflush(stderr);
- VOID(pthread_mutex_unlock(&LOCK_error_log));
+ pthread_mutex_unlock(&LOCK_error_log);
DBUG_VOID_RETURN;
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 2c8f7d8d761..cc2b4667115 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3056,9 +3056,9 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
{
thd->set_time((time_t)when);
thd->set_query((char*)query_arg, q_len_arg);
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
thd->query_id = next_query_id();
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
thd->variables.pseudo_thread_id= thread_id; // for temp tables
DBUG_PRINT("query",("%s", thd->query()));
@@ -3895,7 +3895,6 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
int ret= 0;
DBUG_ENTER("Format_description_log_event::do_apply_event");
-#ifdef USING_TRANSACTIONS
/*
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died
@@ -3917,7 +3916,7 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
"its binary log, thus rolled back too.");
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 1);
}
-#endif
+
/*
If this event comes from ourselves, there is no cleaning task to
perform, we don't call Start_log_event_v3::do_apply_event()
@@ -4581,9 +4580,9 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
if (rpl_filter->db_ok(thd->db))
{
thd->set_time((time_t)when);
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
thd->query_id = next_query_id();
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
thd->warning_info->opt_clear_warning_info(thd->query_id);
TABLE_LIST tables;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index ad937144ab0..0f1553374f1 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -428,17 +428,7 @@ protected:
#if defined(__WIN__)
#undef FLUSH_TIME
#define FLUSH_TIME 1800 /**< Flush every half hour */
-
-#define INTERRUPT_PRIOR -2
-#define CONNECT_PRIOR -1
-#define WAIT_PRIOR 0
-#define QUERY_PRIOR 2
-#else
-#define INTERRUPT_PRIOR 10
-#define CONNECT_PRIOR 9
-#define WAIT_PRIOR 8
-#define QUERY_PRIOR 6
-#endif /* __WIN92__ */
+#endif /* __WIN__ */
/* Bits from testflag */
#define TEST_PRINT_CACHED_TABLES 1
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3a3eee9737d..8b0b5635337 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -48,10 +48,6 @@
#endif
#endif
-#ifndef DEFAULT_SKIP_THREAD_PRIORITY
-#define DEFAULT_SKIP_THREAD_PRIORITY 0
-#endif
-
#include <thr_alarm.h>
#include <ft_global.h>
#include <errmsg.h>
@@ -1043,14 +1039,14 @@ static void close_server_sock()
{
ip_sock=INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
- VOID(shutdown(tmp_sock, SHUT_RDWR));
+ (void) shutdown(tmp_sock, SHUT_RDWR);
#if defined(__NETWARE__)
/*
The following code is disabled for normal systems as it causes MySQL
to hang on AIX 4.3 during shutdown
*/
DBUG_PRINT("info",("calling closesocket on TCP/IP socket"));
- VOID(closesocket(tmp_sock));
+ (void) closesocket(tmp_sock);
#endif
}
tmp_sock=unix_sock;
@@ -1058,16 +1054,16 @@ static void close_server_sock()
{
unix_sock=INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on unix socket"));
- VOID(shutdown(tmp_sock, SHUT_RDWR));
+ (void) shutdown(tmp_sock, SHUT_RDWR);
#if defined(__NETWARE__)
/*
The following code is disabled for normal systems as it may cause MySQL
to hang on AIX 4.3 during shutdown
*/
DBUG_PRINT("info",("calling closesocket on unix/IP socket"));
- VOID(closesocket(tmp_sock));
+ (void) closesocket(tmp_sock);
#endif
- VOID(unlink(mysqld_unix_port));
+ (void) unlink(mysqld_unix_port);
}
DBUG_VOID_RETURN;
#endif
@@ -2471,7 +2467,8 @@ and this may fail.\n\n");
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
- fprintf(stderr, "threads_connected=%u\n", thread_count);
+ fprintf(stderr, "thread_count=%u\n", thread_count);
+ fprintf(stderr, "connection_count=%u\n", connection_count);
fprintf(stderr, "It is possible that mysqld could use up to \n\
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
@@ -2680,8 +2677,6 @@ static void start_signal_handler(void)
#if !defined(HAVE_DEC_3_2_THREADS)
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM);
(void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_attr_setprio(&thr_attr,INTERRUPT_PRIOR);
#if defined(__ia64__) || defined(__ia64)
/*
Peculiar things with ia64 platforms - it seems we only have half the
@@ -2801,8 +2796,6 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
abort_loop=1; // mark abort for threads
#ifdef USE_ONE_SIGNAL_HAND
pthread_t tmp;
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_attr_setprio(&connection_attrib,INTERRUPT_PRIOR);
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
(void*) &sig))
sql_print_error("Can't create thread to kill server");
@@ -3629,8 +3622,6 @@ static int init_thread_environment()
(void) pthread_attr_setdetachstate(&connection_attrib,
PTHREAD_CREATE_DETACHED);
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR);
if (pthread_key_create(&THR_THD,NULL) ||
pthread_key_create(&THR_MALLOC,NULL))
@@ -4338,8 +4329,6 @@ int main(int argc, char **argv)
unireg_abort(1); // Will do exit
init_signals();
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
#if defined(__ia64__) || defined(__ia64)
/*
Peculiar things with ia64 platforms - it seems we only have half the
@@ -5029,8 +5018,6 @@ void handle_connections_sockets()
LINT_INIT(new_sock);
- (void) my_pthread_getprio(pthread_self()); // For debugging
-
FD_ZERO(&clientFDs);
if (ip_sock != INVALID_SOCKET)
{
@@ -5189,7 +5176,7 @@ void handle_connections_sockets()
if (!(thd= new THD))
{
(void) shutdown(new_sock, SHUT_RDWR);
- VOID(closesocket(new_sock));
+ (void) closesocket(new_sock);
continue;
}
if (!(vio_tmp=vio_new(new_sock,
@@ -6453,8 +6440,9 @@ Can't be set to 1 if --log-slave-updates is used.",
{"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-thread-priority", OPT_SKIP_PRIOR,
- "Don't give threads different priorities. Deprecated option.", 0, 0, 0, GET_NO_ARG, NO_ARG,
- DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
+ "Don't give threads different priorities. This option is deprecated "
+ "because it has no effect; the implied behavior is already the default.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
"The location where the slave should put its temporary files when \
@@ -7625,7 +7613,7 @@ SHOW_VAR status_vars[]= {
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
#endif
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH},
- {"Threads_connected", (char*) &thread_count, SHOW_INT},
+ {"Threads_connected", (char*) &connection_count, SHOW_INT},
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
{"Threads_running", (char*) &thread_running, SHOW_INT},
{"Uptime", (char*) &show_starttime, SHOW_FUNC},
@@ -7922,9 +7910,6 @@ static int mysql_init_variables(void)
#ifdef HAVE_SMEM
shared_memory_base_name= default_shared_memory_base_name;
#endif
-#if !defined(my_pthread_setprio) && !defined(HAVE_PTHREAD_SETSCHEDPARAM)
- opt_specialflag |= SPECIAL_NO_PRIOR;
-#endif
#if defined(__WIN__) || defined(__NETWARE__)
/* Allow Win32 and NetWare users to move MySQL anywhere */
@@ -8208,8 +8193,8 @@ mysqld_get_one_option(int optid,
case (int) OPT_SKIP_PRIOR:
opt_specialflag|= SPECIAL_NO_PRIOR;
sql_print_warning("The --skip-thread-priority startup option is deprecated "
- "and will be removed in MySQL 7.0. MySQL 6.0 and up do not "
- "give threads different priorities.");
+ "and will be removed in MySQL 7.0. This option has no effect "
+ "as the implied behavior is already the default.");
break;
case (int) OPT_SKIP_LOCK:
opt_external_locking=0;
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 393ffcb2115..0bb2243080a 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -730,7 +730,7 @@ class SQL_SELECT :public Sql_alloc {
class FT_SELECT: public QUICK_RANGE_SELECT {
public:
FT_SELECT(THD *thd, TABLE *table, uint key) :
- QUICK_RANGE_SELECT (thd, table, key, 1) { VOID(init()); }
+ QUICK_RANGE_SELECT (thd, table, key, 1) { (void) init(); }
~FT_SELECT() { file->ft_end(); }
int init() { return error=file->ft_init(); }
int reset() { return 0; }
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ca6aa3a6052..ced44a6e972 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -247,6 +247,7 @@ net_send_ok(THD *thd,
if (!error)
error= net_flush(net);
+
thd->stmt_da->can_overwrite_status= FALSE;
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
@@ -406,6 +407,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
buff[2]= '#';
pos= (uchar*) strmov((char*) buff+3, sqlstate);
}
+
converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
@@ -414,6 +416,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
length= (uint) (strmake((char*) pos, (char*)converted_err,
MYSQL_ERRMSG_SIZE - 1) - (char*) buff);
err= (char*) buff;
+
DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
length));
}
diff --git a/sql/records.cc b/sql/records.cc
index 8fd63d104a4..9ec19c55841 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -178,7 +178,7 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE &&
!table->sort.addon_field)
- VOID(table->file->extra(HA_EXTRA_MMAP));
+ (void) table->file->extra(HA_EXTRA_MMAP);
if (table->sort.addon_field)
{
@@ -266,8 +266,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD) ||
(use_record_cache < 0 &&
!(table->file->ha_table_flags() & HA_NOT_DELETE_WITH_CACHE))))
- VOID(table->file->extra_opt(HA_EXTRA_CACHE,
- thd->variables.read_buff_size));
+ (void) table->file->extra_opt(HA_EXTRA_CACHE,
+ thd->variables.read_buff_size);
}
/* Condition pushdown to storage engine */
if (thd->variables.engine_condition_pushdown &&
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 36597658077..1028e5441ae 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1395,12 +1395,10 @@ static void fix_thd_mem_root(THD *thd, enum_var_type type)
static void fix_trans_mem_root(THD *thd, enum_var_type type)
{
-#ifdef USING_TRANSACTIONS
if (type != OPT_GLOBAL)
reset_root_defaults(&thd->transaction.mem_root,
thd->variables.trans_alloc_block_size,
thd->variables.trans_prealloc_size);
-#endif
}
diff --git a/sql/slave.cc b/sql/slave.cc
index d49031ef066..2c4ece941d8 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -612,8 +612,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock,
pthread_cond_t *start_cond,
volatile uint *slave_running,
volatile ulong *slave_run_id,
- Master_info* mi,
- bool high_priority)
+ Master_info* mi)
{
pthread_t th;
ulong start_id;
@@ -643,8 +642,6 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock,
}
start_id= *slave_run_id;
DBUG_PRINT("info",("Creating new slave thread"));
- if (high_priority)
- my_pthread_attr_setprio(&connection_attrib,CONNECT_PRIOR);
if (pthread_create(&th, &connection_attrib, h_func, (void*)mi))
{
if (start_lock)
@@ -707,13 +704,13 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
error=start_slave_thread(handle_slave_io,lock_io,lock_cond_io,
cond_io,
&mi->slave_running, &mi->slave_run_id,
- mi, 1); //high priority, to read the most possible
+ mi);
if (!error && (thread_mask & SLAVE_SQL))
{
error=start_slave_thread(handle_slave_sql,lock_sql,lock_cond_sql,
cond_sql,
&mi->rli.slave_running, &mi->rli.slave_run_id,
- mi, 0);
+ mi);
if (error)
terminate_slave_threads(mi, thread_mask & SLAVE_IO, !need_slave_mutex);
}
diff --git a/sql/slave.h b/sql/slave.h
index eff0fa49f61..8fb44007032 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -164,8 +164,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
pthread_cond_t* start_cond,
volatile uint *slave_running,
volatile ulong *slave_run_id,
- Master_info* mi,
- bool high_priority);
+ Master_info* mi);
/* If fd is -1, dump to NET */
int mysql_table_dump(THD* thd, const char* db,
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 33b487d9177..1a0c2743812 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1769,9 +1769,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
as one select and not resetting THD::user_var_events before
each invocation.
*/
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
q= global_query_id;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
mysql_bin_log.start_union_events(thd, q + 1);
binlog_save_options= thd->options;
thd->options&= ~OPTION_BIN_LOG;
@@ -2737,9 +2737,9 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
*/
thd->lex= m_lex;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
thd->query_id= next_query_id();
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
if (thd->prelocked_mode == NON_PRELOCKED)
{
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 31c307ebe74..48ceb1371ca 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -63,21 +63,21 @@ sp_pcontext::sp_pcontext()
m_context_handlers(0), m_parent(NULL), m_pboundary(0),
m_label_scope(LABEL_DEFAULT_SCOPE)
{
- VOID(my_init_dynamic_array(&m_vars, sizeof(sp_variable_t *),
+ (void) my_init_dynamic_array(&m_vars, sizeof(sp_variable_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_case_expr_id_lst, sizeof(int),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_case_expr_id_lst, sizeof(int),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_conds, sizeof(sp_cond_type_t *),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_conds, sizeof(sp_cond_type_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_cursors, sizeof(LEX_STRING),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_cursors, sizeof(LEX_STRING),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_handlers, sizeof(sp_cond_type_t *),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_handlers, sizeof(sp_cond_type_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
m_label.empty();
m_children.empty();
@@ -91,21 +91,21 @@ sp_pcontext::sp_pcontext(sp_pcontext *prev, label_scope_type label_scope)
m_context_handlers(0), m_parent(prev), m_pboundary(0),
m_label_scope(label_scope)
{
- VOID(my_init_dynamic_array(&m_vars, sizeof(sp_variable_t *),
+ (void) my_init_dynamic_array(&m_vars, sizeof(sp_variable_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_case_expr_id_lst, sizeof(int),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_case_expr_id_lst, sizeof(int),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_conds, sizeof(sp_cond_type_t *),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_conds, sizeof(sp_cond_type_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_cursors, sizeof(LEX_STRING),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_cursors, sizeof(LEX_STRING),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
- VOID(my_init_dynamic_array(&m_handlers, sizeof(sp_cond_type_t *),
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
+ (void) my_init_dynamic_array(&m_handlers, sizeof(sp_cond_type_t *),
PCONTEXT_ARRAY_INIT_ALLOC,
- PCONTEXT_ARRAY_INCREMENT_ALLOC));
+ PCONTEXT_ARRAY_INCREMENT_ALLOC);
m_label.empty();
m_children.empty();
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 895cba93638..e64b70467f1 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -325,7 +325,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0,
FALSE);
table->use_all_columns();
- VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50));
+ (void) my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50);
while (!(read_record_info.read_record(&read_record_info)))
{
ACL_HOST host;
@@ -365,7 +365,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
host.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL;
}
#endif
- VOID(push_dynamic(&acl_hosts,(uchar*) &host));
+ (void) push_dynamic(&acl_hosts,(uchar*) &host);
}
my_qsort((uchar*) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
@@ -374,7 +374,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0,FALSE);
table->use_all_columns();
- VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100));
+ (void) my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100);
password_length= table->field[2]->field_length /
table->field[2]->charset()->mbmaxlen;
if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
@@ -549,7 +549,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
user.access|= SUPER_ACL | EXECUTE_ACL;
#endif
}
- VOID(push_dynamic(&acl_users,(uchar*) &user));
+ (void) push_dynamic(&acl_users,(uchar*) &user);
if (!user.host.hostname ||
(user.host.hostname[0] == wild_many && !user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect
@@ -562,7 +562,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0,FALSE);
table->use_all_columns();
- VOID(my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100));
+ (void) my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100);
while (!(read_record_info.read_record(&read_record_info)))
{
ACL_DB db;
@@ -612,7 +612,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
}
#endif
- VOID(push_dynamic(&acl_dbs,(uchar*) &db));
+ (void) push_dynamic(&acl_dbs,(uchar*) &db);
}
my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
sizeof(ACL_DB),(qsort_cmp) acl_compare);
@@ -705,7 +705,7 @@ my_bool acl_reload(THD *thd)
}
if ((old_initialized=initialized))
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
old_acl_hosts=acl_hosts;
old_acl_users=acl_users;
@@ -732,7 +732,7 @@ my_bool acl_reload(THD *thd)
delete_dynamic(&old_acl_dbs);
}
if (old_initialized)
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
end:
close_thread_tables(thd);
DBUG_RETURN(return_val);
@@ -884,7 +884,7 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh,
DBUG_RETURN(0);
}
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
/*
Find acl entry in user database. Note, that find_acl_user is not the same,
@@ -1063,7 +1063,7 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh,
else
*sctx->priv_host= 0;
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
DBUG_RETURN(res);
}
@@ -1110,7 +1110,7 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
DBUG_RETURN(FALSE);
}
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
sctx->master_access= 0;
sctx->db_access= 0;
@@ -1164,7 +1164,7 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
else
*sctx->priv_host= 0;
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
DBUG_RETURN(res);
}
@@ -1253,7 +1253,7 @@ static void acl_insert_user(const char *user, const char *host,
set_user_salt(&acl_user, password, password_len);
- VOID(push_dynamic(&acl_users,(uchar*) &acl_user));
+ (void) push_dynamic(&acl_users,(uchar*) &acl_user);
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 */
@@ -1319,7 +1319,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
acl_db.db=strdup_root(&mem,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,(uchar*) &acl_db));
+ (void) push_dynamic(&acl_dbs,(uchar*) &acl_db);
my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
sizeof(ACL_DB),(qsort_cmp) acl_compare);
}
@@ -1343,7 +1343,7 @@ ulong acl_get(const char *host, const char *ip,
acl_entry *entry;
DBUG_ENTER("acl_get");
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db);
if (lower_case_table_names)
{
@@ -1355,7 +1355,7 @@ ulong acl_get(const char *host, const char *ip,
key_length)))
{
db_access=entry->access;
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
DBUG_PRINT("exit", ("access: 0x%lx", db_access));
DBUG_RETURN(db_access);
}
@@ -1409,7 +1409,7 @@ exit:
memcpy((uchar*) entry->key,key,key_length);
acl_cache->add(entry);
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
DBUG_PRINT("exit", ("access: 0x%lx", db_access & host_access));
DBUG_RETURN(db_access & host_access);
}
@@ -1425,10 +1425,11 @@ exit:
static void init_check_host(void)
{
DBUG_ENTER("init_check_host");
- VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip),
- acl_users.elements,1));
- VOID(my_hash_init(&acl_check_hosts,system_charset_info,acl_users.elements,0,0,
- (my_hash_get_key) check_get_key,0,0));
+ (void) my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip),
+ acl_users.elements,1);
+ (void) my_hash_init(&acl_check_hosts,system_charset_info,
+ acl_users.elements, 0, 0,
+ (my_hash_get_key) check_get_key, 0, 0);
if (!allow_all_hosts)
{
for (uint i=0 ; i < acl_users.elements ; i++)
@@ -1490,12 +1491,12 @@ bool acl_check_host(const char *host, const char *ip)
{
if (allow_all_hosts)
return 0;
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
if ((host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
(ip && my_hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))))
{
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
return 0; // Found host
}
for (uint i=0 ; i < acl_wild_hosts.elements ; i++)
@@ -1503,11 +1504,11 @@ bool acl_check_host(const char *host, const char *ip)
acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,i,acl_host_and_ip*);
if (compare_hostname(acl, host, ip))
{
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
return 0; // Host ok
}
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
return 1; // Host is not allowed
}
@@ -1621,11 +1622,11 @@ bool change_password(THD *thd, const char *host, const char *user,
if (!(table= open_ltable(thd, &tables, TL_WRITE, 0)))
DBUG_RETURN(1);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
ACL_USER *acl_user;
if (!(acl_user= find_acl_user(host, user, TRUE)))
{
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
goto end;
}
@@ -1637,12 +1638,12 @@ bool change_password(THD *thd, const char *host, const char *user,
acl_user->user ? acl_user->user : "",
new_password, new_password_len))
{
- VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
+ pthread_mutex_unlock(&acl_cache->lock); /* purecov: deadcode */
goto end;
}
acl_cache->clear(1); // Clear locked hostname cache
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
result= 0;
if (mysql_bin_log.is_open())
{
@@ -1683,9 +1684,9 @@ bool is_acl_user(const char *host, const char *user)
if (!initialized)
return TRUE;
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
res= find_acl_user(host, user, TRUE) != NULL;
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
return res;
}
@@ -3443,7 +3444,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
/* go through users in user_list */
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
grant_version++;
int result=0;
@@ -3475,7 +3476,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
}
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
if (!result)
{
@@ -4634,12 +4635,12 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
rw_rdlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
acl_user= find_acl_user(lex_user->host.str, lex_user->user.str, TRUE);
if (!acl_user)
{
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
rw_unlock(&LOCK_grant);
my_error(ER_NONEXISTING_GRANT, MYF(0),
@@ -4657,7 +4658,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
{
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
rw_unlock(&LOCK_grant);
DBUG_RETURN(TRUE);
@@ -4968,7 +4969,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
end:
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
rw_unlock(&LOCK_grant);
my_eof(thd);
@@ -5766,7 +5767,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
while ((tmp_user_name= user_list++))
{
@@ -5796,7 +5797,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
}
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
if (result)
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr_safe());
@@ -5848,7 +5849,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
while ((tmp_user_name= user_list++))
{
@@ -5869,7 +5870,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
if (result)
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
@@ -5920,7 +5921,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
while ((tmp_user_from= user_list++))
{
@@ -5954,7 +5955,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
if (result)
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe());
@@ -6001,7 +6002,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
LEX_USER *lex_user, *tmp_lex_user;
List_iterator <LEX_USER> user_list(list);
@@ -6140,7 +6141,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
} while (revoked);
}
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
int binlog_error=
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
@@ -6251,7 +6252,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
thd->push_internal_handler(&error_handler);
rw_wrlock(&LOCK_grant);
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
/*
This statement will be replicated as a statement, even when using
@@ -6289,7 +6290,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
}
} while (revoked);
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
@@ -6330,7 +6331,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
combo->user.str= sctx->user;
- VOID(pthread_mutex_lock(&acl_cache->lock));
+ pthread_mutex_lock(&acl_cache->lock);
if ((au= find_acl_user(combo->host.str=(char*)sctx->host_or_ip,combo->user.str,FALSE)))
goto found_acl;
@@ -6341,11 +6342,11 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
if((au= find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE)))
goto found_acl;
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
DBUG_RETURN(TRUE);
found_acl:
- VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&acl_cache->lock);
bzero((char*)tables, sizeof(TABLE_LIST));
user_list.empty();
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 8cb35e3c447..5033224e6ed 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -438,7 +438,7 @@ found:
oldest_unused_share->next)
{
pthread_mutex_lock(&oldest_unused_share->mutex);
- VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
+ my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
}
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
@@ -714,7 +714,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
TABLE_LIST table_list;
DBUG_ENTER("list_open_tables");
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
bzero((char*) &table_list,sizeof(table_list));
start_list= &open_list;
open_list=0;
@@ -767,7 +767,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
start_list= &(*start_list)->next;
*start_list=0;
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(open_list);
}
@@ -787,7 +787,7 @@ void intern_close_table(TABLE *table)
free_io_cache(table);
delete table->triggers;
if (table->file) // Not true if name lock
- VOID(closefrm(table, 1)); // close file
+ (void) closefrm(table, 1); // close file
DBUG_VOID_RETURN;
}
@@ -864,7 +864,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
if (!have_lock)
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (!tables)
{
refresh_version++; // Force close of open tables
@@ -874,14 +874,14 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
if (my_hash_delete(&open_cache,(uchar*) unused_tables))
printf("Warning: Couldn't delete open table from hash\n");
#else
- VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
+ (void) my_hash_delete(&open_cache,(uchar*) unused_tables);
#endif
}
/* Free table shares */
while (oldest_unused_share->next)
{
pthread_mutex_lock(&oldest_unused_share->mutex);
- VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
+ (void) my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
}
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu",
refresh_version));
@@ -1019,7 +1019,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
}
}
if (!have_lock)
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (wait_for_refresh)
{
pthread_mutex_lock(&thd->mysys_var->mutex);
@@ -1049,7 +1049,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
bzero(&tmp, sizeof(TABLE_LIST));
if (!have_lock)
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
for (idx= 0; idx < table_def_cache.records; idx++)
{
@@ -1082,7 +1082,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
result= close_cached_tables(thd, tables, TRUE, FALSE, FALSE);
if (!have_lock)
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (if_wait_for_refresh)
{
@@ -1199,7 +1199,7 @@ static void close_open_tables(THD *thd)
safe_mutex_assert_not_owner(&LOCK_open);
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
DBUG_PRINT("info", ("thd->open_tables: 0x%lx", (long) thd->open_tables));
@@ -1209,7 +1209,7 @@ static void close_open_tables(THD *thd)
/* Free tables to hold down open files */
while (open_cache.records > table_cache_size && unused_tables)
- VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
+ my_hash_delete(&open_cache,(uchar*) unused_tables); /* purecov: tested */
check_unused();
if (found_old_table)
{
@@ -1217,7 +1217,7 @@ static void close_open_tables(THD *thd)
broadcast_refresh();
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
@@ -1395,7 +1395,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
if (table->needs_reopen_or_name_lock() ||
thd->version != refresh_version || !table->db_stat)
{
- VOID(my_hash_delete(&open_cache,(uchar*) table));
+ my_hash_delete(&open_cache,(uchar*) table);
found_old_table=1;
}
else
@@ -1684,20 +1684,42 @@ TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
for (;;)
{
- if (((! (res= find_table_in_global_list(table_list, d_name, t_name))) &&
- (! (res= mysql_lock_have_duplicate(thd, table, table_list)))) ||
- ((!res->table || res->table != table->table) &&
- (!check_alias || !(lower_case_table_names ?
+ /*
+ Table is unique if it is present only once in the global list
+ of tables and once in the list of table locks.
+ */
+ if (! (res= find_table_in_global_list(table_list, d_name, t_name)) &&
+ ! (res= mysql_lock_have_duplicate(thd, table, table_list)))
+ break;
+
+ /* Skip if same underlying table. */
+ if (res->table && (res->table == table->table))
+ goto next;
+
+ /* Skip if table alias does not match. */
+ if (check_alias)
+ {
+ if (lower_case_table_names ?
my_strcasecmp(files_charset_info, t_alias, res->alias) :
- strcmp(t_alias, res->alias))) &&
- res->select_lex && !res->select_lex->exclude_from_table_unique_test &&
- !res->prelocking_placeholder))
+ strcmp(t_alias, res->alias))
+ goto next;
+ }
+
+ /*
+ Skip if marked to be excluded (could be a derived table) or if
+ entry is a prelocking placeholder.
+ */
+ if (res->select_lex &&
+ !res->select_lex->exclude_from_table_unique_test &&
+ !res->prelocking_placeholder)
break;
+
/*
If we found entry of this table or table of SELECT which already
processed in derived table or top select of multi-update/multi-delete
(exclude_from_table_unique_test) or prelocking placeholder.
*/
+next:
table_list= res->next_global;
DBUG_PRINT("info",
("found same copy of table or table which we should skip"));
@@ -2103,7 +2125,7 @@ void unlink_open_table(THD *thd, TABLE *find, bool unlock)
/* Remove table from open_tables list. */
*prev= list->next;
/* Close table. */
- VOID(my_hash_delete(&open_cache,(uchar*) list)); // Close table
+ my_hash_delete(&open_cache,(uchar*) list); // Close table
}
else
{
@@ -2145,14 +2167,14 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
else
{
handlerton *table_type= table->s->db_type();
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
/*
unlink_open_table() also tells threads waiting for refresh or close
that something has happened.
*/
unlink_open_table(thd, table, FALSE);
quick_rm_table(table_type, db_name, table_name, 0);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
}
@@ -2407,24 +2429,24 @@ bool lock_table_name_if_not_cached(THD *thd, const char *db,
DBUG_ENTER("lock_table_name_if_not_cached");
key_length= (uint)(strmov(strmov(key, db) + 1, table_name) - key) + 1;
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (my_hash_search(&open_cache, (uchar *)key, key_length))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_PRINT("info", ("Table is cached, name-lock is not obtained"));
*table= 0;
DBUG_RETURN(FALSE);
}
if (!(*table= table_cache_insert_placeholder(thd, key, key_length)))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(TRUE);
}
(*table)->open_placeholder= 1;
(*table)->next= thd->open_tables;
thd->open_tables= *table;
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(FALSE);
}
@@ -2678,15 +2700,15 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*/
TABLE tab;
table= &tab;
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (!open_unireg_entry(thd, table, table_list, alias,
key, key_length, mem_root, 0))
{
DBUG_ASSERT(table_list->view != 0);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(0); // VIEW
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
}
/*
@@ -2719,7 +2741,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
on disk.
*/
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
/*
If it's the first table from a list of tables used in a query,
@@ -2737,7 +2759,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
/* Someone did a refresh while thread was opening tables */
if (refresh)
*refresh=1;
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(0);
}
@@ -2803,7 +2825,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
/* Avoid self-deadlocks by detecting self-dependencies. */
if (table->open_placeholder && table->in_use == thd)
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
my_error(ER_UPDATE_TABLE_USED, MYF(0), table->s->table_name.str);
DBUG_RETURN(0);
}
@@ -2844,7 +2866,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
else
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
/*
There is a refresh in progress for this table.
@@ -2877,7 +2899,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
DBUG_PRINT("tcache", ("opening new table"));
/* Free cache if too big */
while (open_cache.records > table_cache_size && unused_tables)
- VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
+ my_hash_delete(&open_cache,(uchar*) unused_tables); /* purecov: tested */
if (table_list->create)
{
@@ -2885,7 +2907,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (check_if_table_exists(thd, table_list, &exists))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(NULL);
}
@@ -2896,7 +2918,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*/
if (!(table= table_cache_insert_placeholder(thd, key, key_length)))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(NULL);
}
/*
@@ -2907,7 +2929,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table->open_placeholder= 1;
table->next= thd->open_tables;
thd->open_tables= table;
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(table);
}
/* Table exists. Let us try to open it. */
@@ -2916,7 +2938,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(NULL);
}
@@ -2925,7 +2947,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (error > 0)
{
my_free((uchar*)table, MYF(0));
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(NULL);
}
if (table_list->view || error < 0)
@@ -2938,18 +2960,18 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table_list->view= (LEX*)1;
my_free((uchar*)table, MYF(0));
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(0); // VIEW
}
DBUG_PRINT("info", ("inserting table '%s'.'%s' 0x%lx into the cache",
table->s->db.str, table->s->table_name.str,
(long) table));
- VOID(my_hash_insert(&open_cache,(uchar*) table));
+ (void) my_hash_insert(&open_cache,(uchar*) table);
}
check_unused(); // Debugging call
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (refresh)
{
table->next=thd->open_tables; /* Link into simple list */
@@ -3088,13 +3110,13 @@ bool reopen_table(TABLE *table)
fix_merge_after_open(table->child_l, table->child_last_l,
tmp.child_l, tmp.child_last_l))
{
- VOID(closefrm(&tmp, 1)); // close file, free everything
+ (void) closefrm(&tmp, 1); // close file, free everything
goto end;
}
delete table->triggers;
if (table->file)
- VOID(closefrm(table, 1)); // close file, free everything
+ (void) closefrm(table, 1); // close file, free everything
*table= tmp;
table->default_column_bitmaps();
@@ -3335,7 +3357,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old)
*/
if (table->child_l || table->parent)
detach_merge_children(table, TRUE);
- VOID(my_hash_delete(&open_cache,(uchar*) table));
+ my_hash_delete(&open_cache,(uchar*) table);
error=1;
}
else
@@ -3364,7 +3386,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old)
{
while (err_tables)
{
- VOID(my_hash_delete(&open_cache, (uchar*) err_tables));
+ my_hash_delete(&open_cache, (uchar*) err_tables);
err_tables= err_tables->next;
}
}
@@ -3646,7 +3668,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
else
{
/* We already have a name lock, remove copy */
- VOID(my_hash_delete(&open_cache,(uchar*) table));
+ my_hash_delete(&open_cache,(uchar*) table);
}
}
else
@@ -4257,7 +4279,7 @@ void detach_merge_children(TABLE *table, bool clear_refs)
*/
if ((first_detach= parent->children_attached))
{
- VOID(parent->file->extra(HA_EXTRA_DETACH_CHILDREN));
+ (void) parent->file->extra(HA_EXTRA_DETACH_CHILDREN);
parent->children_attached= FALSE;
DBUG_PRINT("myrg", ("detached parent: '%s'.'%s' 0x%lx", parent->s->db.str,
parent->s->table_name.str, (long) parent));
@@ -8359,7 +8381,7 @@ my_bool mysql_rm_tmp_tables(void)
So we hide error messages which happnes during deleting of these
files(MYF(0)).
*/
- VOID(my_delete(filePath, MYF(0)));
+ (void) my_delete(filePath, MYF(0));
}
}
my_dirend(dirp);
@@ -8401,7 +8423,7 @@ void remove_db_from_cache(const char *db)
}
}
while (unused_tables && !unused_tables->s->version)
- VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
+ my_hash_delete(&open_cache,(uchar*) unused_tables);
}
@@ -8525,7 +8547,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
}
}
while (unused_tables && !unused_tables->s->version)
- VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
+ my_hash_delete(&open_cache,(uchar*) unused_tables);
DBUG_PRINT("info", ("Removing table from table_def_cache"));
/* Remove table from table definition cache if it's not in use */
@@ -8538,7 +8560,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
if (share->ref_count == 0)
{
pthread_mutex_lock(&share->mutex);
- VOID(my_hash_delete(&table_def_cache, (uchar*) share));
+ my_hash_delete(&table_def_cache, (uchar*) share);
}
}
@@ -8715,12 +8737,12 @@ int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_ENTER("abort_and_upgrade_locks");
lpt->old_lock_type= lpt->table->reginfo.lock_type;
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
/* If MERGE child, forward lock handling to parent. */
mysql_lock_abort(lpt->thd, lpt->table->parent ? lpt->table->parent :
lpt->table, TRUE);
- VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags));
- VOID(pthread_mutex_unlock(&LOCK_open));
+ (void) remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags);
+ pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(0);
}
@@ -8742,10 +8764,10 @@ int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt)
/* purecov: begin deadcode */
void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt)
{
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name,
RTFC_WAIT_OTHER_THREAD_FLAG);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
/* If MERGE child, forward lock handling to parent. */
mysql_lock_downgrade_write(lpt->thd, lpt->table->parent ? lpt->table->parent :
lpt->table, lpt->old_lock_type);
@@ -8784,7 +8806,7 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table
DBUG_ENTER("mysql_wait_completed_table");
key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1;
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
HASH_SEARCH_STATE state;
for (table= (TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length,
&state) ;
@@ -8842,7 +8864,7 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table
*/
mysql_lock_abort(lpt->thd, my_table->parent ? my_table->parent : my_table,
FALSE);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index ed6f593cc2e..fb370cbd16a 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2126,8 +2126,8 @@ ulong Query_cache::init_cache()
DUMP(this);
- VOID(my_hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0,
- query_cache_query_get_key, 0, 0));
+ (void) my_hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0,
+ query_cache_query_get_key, 0, 0);
#ifndef FN_NO_CASE_SENCE
/*
If lower_case_table_names!=0 then db and table names are already
@@ -2137,8 +2137,8 @@ ulong Query_cache::init_cache()
lower_case_table_names == 0 then we should distinguish my_table
and MY_TABLE cases and so again can use binary collation.
*/
- VOID(my_hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0,
- query_cache_table_get_key, 0, 0));
+ (void) my_hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0,
+ query_cache_table_get_key, 0, 0);
#else
/*
On windows, OS/2, MacOS X with HFS+ or any other case insensitive
@@ -2148,10 +2148,11 @@ ulong Query_cache::init_cache()
file system) and so should use case insensitive collation for
comparison.
*/
- VOID(my_hash_init(&tables,
- lower_case_table_names ? &my_charset_bin :
- files_charset_info,
- def_table_hash_size, 0, 0,query_cache_table_get_key, 0, 0));
+ (void) my_hash_init(&tables,
+ lower_case_table_names ? &my_charset_bin :
+ files_charset_info,
+ def_table_hash_size, 0, 0,query_cache_table_get_key,
+ 0, 0);
#endif
queries_in_cache = 0;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a944b65e74d..ee5c27c3a00 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -483,7 +483,7 @@ THD::THD()
catalog= (char*)"std"; // the only catalog we have for now
main_security_ctx.init();
security_ctx= &main_security_ctx;
- locked=some_tables_deleted=no_errors=password= 0;
+ some_tables_deleted=no_errors=password= 0;
query_start_used= 0;
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
@@ -936,11 +936,9 @@ void THD::init_for_queries()
reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size);
-#ifdef USING_TRANSACTIONS
reset_root_defaults(&transaction.mem_root,
variables.trans_alloc_block_size,
variables.trans_prealloc_size);
-#endif
transaction.xid_state.xid.null();
transaction.xid_state.in_thd=1;
}
@@ -1059,9 +1057,7 @@ THD::~THD()
DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy();
safeFree(db);
-#ifdef USING_TRANSACTIONS
free_root(&transaction.mem_root,MYF(0));
-#endif
mysys_var=0; // Safety (shouldn't be needed)
pthread_mutex_destroy(&LOCK_thd_data);
#ifndef DBUG_OFF
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 794f3d04310..a57cd02a55b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1434,19 +1434,13 @@ public:
*/
if (!xid_state.rm_error)
xid_state.xid.null();
-#ifdef USING_TRANSACTIONS
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
-#endif
}
st_transactions()
{
-#ifdef USING_TRANSACTIONS
bzero((char*)this, sizeof(*this));
xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
-#else
- xid_state.xa_state= XA_NOTR;
-#endif
}
} transaction;
Field *dup_field;
@@ -1696,7 +1690,7 @@ public:
bool slave_thread, one_shot_set;
/* tells if current statement should binlog row-based(1) or stmt-based(0) */
bool current_stmt_binlog_row_based;
- bool locked, some_tables_deleted;
+ bool some_tables_deleted;
bool last_cuted_field;
bool no_errors, password;
/**
@@ -1932,11 +1926,7 @@ public:
}
inline bool active_transaction()
{
-#ifdef USING_TRANSACTIONS
return server_status & SERVER_STATUS_IN_TRANS;
-#else
- return 0;
-#endif
}
inline bool fill_derived_tables()
{
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 959209df412..f5f962a02a3 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -410,7 +410,7 @@ check_user(THD *thd, enum enum_server_command command,
pthread_mutex_lock(&LOCK_connection_count);
bool count_ok= connection_count <= max_connections ||
(thd->main_security_ctx.master_access & SUPER_ACL);
- VOID(pthread_mutex_unlock(&LOCK_connection_count));
+ pthread_mutex_unlock(&LOCK_connection_count);
if (!count_ok)
{ // too many connections
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index b8b68e1086e..51098987e81 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -643,7 +643,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
goto exit2;
}
- VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
+ pthread_mutex_lock(&LOCK_mysql_create_db);
/* Check directory */
path_len= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
@@ -757,7 +757,7 @@ not_silent:
}
exit:
- VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
+ pthread_mutex_unlock(&LOCK_mysql_create_db);
start_waiting_global_read_lock(thd);
exit2:
DBUG_RETURN(error);
@@ -788,7 +788,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if ((error=wait_if_global_read_lock(thd,0,1)))
goto exit2;
- VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
+ pthread_mutex_lock(&LOCK_mysql_create_db);
/*
Recreate db options file: /dbpath/.db.opt
@@ -835,7 +835,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
my_ok(thd, result);
exit:
- VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
+ pthread_mutex_unlock(&LOCK_mysql_create_db);
start_waiting_global_read_lock(thd);
exit2:
DBUG_RETURN(error);
@@ -887,7 +887,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
goto exit2;
}
- VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
+ pthread_mutex_lock(&LOCK_mysql_create_db);
length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
@@ -1047,7 +1047,7 @@ exit:
*/
if (thd->db && !strcmp(thd->db, db) && error == 0)
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
- VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
+ pthread_mutex_unlock(&LOCK_mysql_create_db);
start_waiting_global_read_lock(thd);
exit2:
DBUG_RETURN(error);
@@ -1160,9 +1160,9 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
goto err;
table_list->db= (char*) (table_list+1);
table_list->table_name= strmov(table_list->db, db) + 1;
- VOID(filename_to_tablename(file->name, table_list->table_name,
+ (void) filename_to_tablename(file->name, table_list->table_name,
MYSQL50_TABLE_NAME_PREFIX_LENGTH +
- strlen(file->name) + 1));
+ strlen(file->name) + 1);
table_list->alias= table_list->table_name; // If lower_case_table_names=2
table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
/* Link into list */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 23470b4abc9..abdf545ccb9 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1167,10 +1167,10 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
// crashes, replacement works. *(path + path_length - reg_ext_length)=
// '\0';
path[path_length - reg_ext_length] = 0;
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
error= ha_create_table(thd, path, table_list->db, table_list->table_name,
&create_info, 1);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
query_cache_invalidate3(thd, table_list, 0);
end:
@@ -1186,15 +1186,15 @@ end:
if (!error)
my_ok(thd); // This should return record count
}
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
unlock_table_name(thd, table_list);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
else if (error)
{
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
unlock_table_name(thd, table_list);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
DBUG_RETURN(error);
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index ab3f2797405..da5ee93fcb9 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -143,14 +143,14 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables,
{
(*table_ptr)->file->ha_index_or_rnd_end();
if (! is_locked)
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (close_thread_table(thd, table_ptr))
{
/* Tell threads waiting for refresh that something has happened */
broadcast_refresh();
}
if (! is_locked)
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
else if (tables->table)
{
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 6315c4f3500..96a1004a23a 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1033,7 +1033,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
- VOID(bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0));
+ (void) bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
bitmap_clear_all(&used_fields);
view->contain_auto_increment= 0;
@@ -1766,11 +1766,11 @@ public:
pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
pthread_cond_init(&cond,NULL);
pthread_cond_init(&cond_client,NULL);
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
delayed_insert_threads++;
delayed_lock= global_system_variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY : TL_WRITE;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
}
~Delayed_insert()
{
@@ -1780,7 +1780,7 @@ public:
delete row;
if (table)
close_thread_tables(&thd);
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
pthread_mutex_destroy(&mutex);
pthread_cond_destroy(&cond);
pthread_cond_destroy(&cond_client);
@@ -1789,8 +1789,8 @@ public:
thd.security_ctx->user= thd.security_ctx->host=0;
thread_count--;
delayed_insert_threads--;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
- VOID(pthread_cond_broadcast(&COND_thread_count)); /* Tell main we are ready */
+ pthread_mutex_unlock(&LOCK_thread_count);
+ pthread_cond_broadcast(&COND_thread_count); /* Tell main we are ready */
}
/* The following is for checking when we can delete ourselves */
@@ -2262,7 +2262,7 @@ static void end_delayed_insert(THD *thd)
void kill_delayed_threads(void)
{
- VOID(pthread_mutex_lock(&LOCK_delayed_insert)); // For unlink from list
+ pthread_mutex_lock(&LOCK_delayed_insert); // For unlink from list
I_List_iterator<Delayed_insert> it(delayed_threads);
Delayed_insert *di;
@@ -2287,196 +2287,7 @@ void kill_delayed_threads(void)
pthread_mutex_unlock(&di->thd.mysys_var->mutex);
}
}
- VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
-}
-
-
-static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
-{
- DBUG_ENTER("handle_delayed_insert_impl");
- thd->thread_stack= (char*) &thd;
- if (init_thr_lock() || thd->store_globals())
- {
- /* Can't use my_error since store_globals has perhaps failed */
- thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES), NULL);
- thd->fatal_error();
- goto err;
- }
-
- thd->lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
- /*
- Statement-based replication of INSERT DELAYED has problems with RAND()
- and user vars, so in mixed mode we go to row-based.
- */
- thd->lex->set_stmt_unsafe();
- thd->set_current_stmt_binlog_row_based_if_mixed();
-
- /* Open table */
- if (!(di->table= open_n_lock_single_table(thd, &di->table_list,
- TL_WRITE_DELAYED)))
- {
- thd->fatal_error(); // Abort waiting inserts
- goto err;
- }
- if (!(di->table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
- {
- my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR),
- di->table_list.table_name);
- goto err;
- }
- if (di->table->triggers)
- {
- /*
- Table has triggers. This is not an error, but we do
- not support triggers with delayed insert. Terminate the delayed
- thread without an error and thus request lock upgrade.
- */
- goto err;
- }
- di->table->copy_blobs=1;
-
- /* Tell client that the thread is initialized */
- pthread_cond_signal(&di->cond_client);
-
- /* Now wait until we get an insert or lock to handle */
- /* We will not abort as long as a client thread uses this thread */
-
- for (;;)
- {
- if (thd->killed == THD::KILL_CONNECTION)
- {
- uint lock_count;
- /*
- Remove this from delay insert list so that no one can request a
- table from this
- */
- pthread_mutex_unlock(&di->mutex);
- pthread_mutex_lock(&LOCK_delayed_insert);
- di->unlink();
- lock_count=di->lock_count();
- pthread_mutex_unlock(&LOCK_delayed_insert);
- pthread_mutex_lock(&di->mutex);
- if (!lock_count && !di->tables_in_use && !di->stacked_inserts)
- break; // Time to die
- }
-
- if (!di->status && !di->stacked_inserts)
- {
- struct timespec abstime;
- set_timespec(abstime, delayed_insert_timeout);
-
- /* Information for pthread_kill */
- di->thd.mysys_var->current_mutex= &di->mutex;
- di->thd.mysys_var->current_cond= &di->cond;
- thd_proc_info(&(di->thd), "Waiting for INSERT");
-
- DBUG_PRINT("info",("Waiting for someone to insert rows"));
- while (!thd->killed)
- {
- int error;
-#if defined(HAVE_BROKEN_COND_TIMEDWAIT)
- error=pthread_cond_wait(&di->cond,&di->mutex);
-#else
- error=pthread_cond_timedwait(&di->cond,&di->mutex,&abstime);
-#ifdef EXTRA_DEBUG
- if (error && error != EINTR && error != ETIMEDOUT)
- {
- fprintf(stderr, "Got error %d from pthread_cond_timedwait\n",error);
- DBUG_PRINT("error",("Got error %d from pthread_cond_timedwait",
- error));
- }
-#endif
-#endif
- if (thd->killed || di->status)
- break;
- if (error == ETIMEDOUT || error == ETIME)
- {
- thd->killed= THD::KILL_CONNECTION;
- break;
- }
- }
- /* We can't lock di->mutex and mysys_var->mutex at the same time */
- pthread_mutex_unlock(&di->mutex);
- pthread_mutex_lock(&di->thd.mysys_var->mutex);
- di->thd.mysys_var->current_mutex= 0;
- di->thd.mysys_var->current_cond= 0;
- pthread_mutex_unlock(&di->thd.mysys_var->mutex);
- pthread_mutex_lock(&di->mutex);
- }
- thd_proc_info(&(di->thd), 0);
-
- if (di->tables_in_use && ! thd->lock)
- {
- bool not_used;
- /*
- Request for new delayed insert.
- Lock the table, but avoid to be blocked by a global read lock.
- If we got here while a global read lock exists, then one or more
- inserts started before the lock was requested. These are allowed
- to complete their work before the server returns control to the
- client which requested the global read lock. The delayed insert
- handler will close the table and finish when the outstanding
- inserts are done.
- */
- if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1,
- MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK,
- &not_used)))
- {
- /* Fatal error */
- di->dead= 1;
- thd->killed= THD::KILL_CONNECTION;
- }
- pthread_cond_broadcast(&di->cond_client);
- }
- if (di->stacked_inserts)
- {
- if (di->handle_inserts())
- {
- /* Some fatal error */
- di->dead= 1;
- thd->killed= THD::KILL_CONNECTION;
- }
- }
- di->status=0;
- if (!di->stacked_inserts && !di->tables_in_use && thd->lock)
- {
- /*
- No one is doing a insert delayed
- Unlock table so that other threads can use it
- */
- MYSQL_LOCK *lock=thd->lock;
- thd->lock=0;
- pthread_mutex_unlock(&di->mutex);
- /*
- We need to release next_insert_id before unlocking. This is
- enforced by handler::ha_external_lock().
- */
- di->table->file->ha_release_auto_increment();
- mysql_unlock_tables(thd, lock);
- ha_autocommit_or_rollback(thd, 0);
- di->group_count=0;
- pthread_mutex_lock(&di->mutex);
- }
- if (di->tables_in_use)
- pthread_cond_broadcast(&di->cond_client); // If waiting clients
- }
-
-err:
- /*
- mysql_lock_tables() can potentially start a transaction and write
- a table map. In the event of an error, that transaction has to be
- rolled back. We only need to roll back a potential statement
- transaction, since real transactions are rolled back in
- close_thread_tables().
-
- TODO: This is not true any more, table maps are generated on the
- first call to ha_*_row() instead. Remove code that are used to
- cover for the case outlined above.
- */
- ha_autocommit_or_rollback(thd, 1);
-
- DBUG_VOID_RETURN;
+ pthread_mutex_unlock(&LOCK_delayed_insert); // For unlink from list
}
@@ -2512,11 +2323,201 @@ pthread_handler_t handle_delayed_insert(void *arg)
/* Can't use my_error since store_globals has not yet been called */
thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
ER(ER_OUT_OF_RESOURCES), NULL);
- goto end;
}
- handle_delayed_insert_impl(thd, di);
+ else
+ {
+ DBUG_ENTER("handle_delayed_insert");
+ thd->thread_stack= (char*) &thd;
+ if (init_thr_lock() || thd->store_globals())
+ {
+ /* Can't use my_error since store_globals has perhaps failed */
+ thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES), NULL);
+ thd->fatal_error();
+ goto err;
+ }
+
+ /*
+ Open table requires an initialized lex in case the table is
+ partitioned. The .frm file contains a partial SQL string which is
+ parsed using a lex, that depends on initialized thd->lex.
+ */
+ lex_start(thd);
+ thd->lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
+ /*
+ Statement-based replication of INSERT DELAYED has problems with RAND()
+ and user vars, so in mixed mode we go to row-based.
+ */
+ thd->lex->set_stmt_unsafe();
+ thd->set_current_stmt_binlog_row_based_if_mixed();
+
+ /* Open table */
+ if (!(di->table= open_n_lock_single_table(thd, &di->table_list,
+ TL_WRITE_DELAYED)))
+ {
+ thd->fatal_error(); // Abort waiting inserts
+ goto err;
+ }
+ if (!(di->table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
+ {
+ my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR),
+ di->table_list.table_name);
+ goto err;
+ }
+ if (di->table->triggers)
+ {
+ /*
+ Table has triggers. This is not an error, but we do
+ not support triggers with delayed insert. Terminate the delayed
+ thread without an error and thus request lock upgrade.
+ */
+ goto err;
+ }
+ di->table->copy_blobs=1;
+
+ /* Tell client that the thread is initialized */
+ pthread_cond_signal(&di->cond_client);
+
+ /* Now wait until we get an insert or lock to handle */
+ /* We will not abort as long as a client thread uses this thread */
+
+ for (;;)
+ {
+ if (thd->killed == THD::KILL_CONNECTION)
+ {
+ uint lock_count;
+ /*
+ Remove this from delay insert list so that no one can request a
+ table from this
+ */
+ pthread_mutex_unlock(&di->mutex);
+ pthread_mutex_lock(&LOCK_delayed_insert);
+ di->unlink();
+ lock_count=di->lock_count();
+ pthread_mutex_unlock(&LOCK_delayed_insert);
+ pthread_mutex_lock(&di->mutex);
+ if (!lock_count && !di->tables_in_use && !di->stacked_inserts)
+ break; // Time to die
+ }
+
+ if (!di->status && !di->stacked_inserts)
+ {
+ struct timespec abstime;
+ set_timespec(abstime, delayed_insert_timeout);
+
+ /* Information for pthread_kill */
+ di->thd.mysys_var->current_mutex= &di->mutex;
+ di->thd.mysys_var->current_cond= &di->cond;
+ thd_proc_info(&(di->thd), "Waiting for INSERT");
+
+ DBUG_PRINT("info",("Waiting for someone to insert rows"));
+ while (!thd->killed)
+ {
+ int error;
+#if defined(HAVE_BROKEN_COND_TIMEDWAIT)
+ error=pthread_cond_wait(&di->cond,&di->mutex);
+#else
+ error=pthread_cond_timedwait(&di->cond,&di->mutex,&abstime);
+#ifdef EXTRA_DEBUG
+ if (error && error != EINTR && error != ETIMEDOUT)
+ {
+ fprintf(stderr, "Got error %d from pthread_cond_timedwait\n",error);
+ DBUG_PRINT("error",("Got error %d from pthread_cond_timedwait",
+ error));
+ }
+#endif
+#endif
+ if (thd->killed || di->status)
+ break;
+ if (error == ETIMEDOUT || error == ETIME)
+ {
+ thd->killed= THD::KILL_CONNECTION;
+ break;
+ }
+ }
+ /* We can't lock di->mutex and mysys_var->mutex at the same time */
+ pthread_mutex_unlock(&di->mutex);
+ pthread_mutex_lock(&di->thd.mysys_var->mutex);
+ di->thd.mysys_var->current_mutex= 0;
+ di->thd.mysys_var->current_cond= 0;
+ pthread_mutex_unlock(&di->thd.mysys_var->mutex);
+ pthread_mutex_lock(&di->mutex);
+ }
+ thd_proc_info(&(di->thd), 0);
+
+ if (di->tables_in_use && ! thd->lock)
+ {
+ bool not_used;
+ /*
+ Request for new delayed insert.
+ Lock the table, but avoid to be blocked by a global read lock.
+ If we got here while a global read lock exists, then one or more
+ inserts started before the lock was requested. These are allowed
+ to complete their work before the server returns control to the
+ client which requested the global read lock. The delayed insert
+ handler will close the table and finish when the outstanding
+ inserts are done.
+ */
+ if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1,
+ MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK,
+ &not_used)))
+ {
+ /* Fatal error */
+ di->dead= 1;
+ thd->killed= THD::KILL_CONNECTION;
+ }
+ pthread_cond_broadcast(&di->cond_client);
+ }
+ if (di->stacked_inserts)
+ {
+ if (di->handle_inserts())
+ {
+ /* Some fatal error */
+ di->dead= 1;
+ thd->killed= THD::KILL_CONNECTION;
+ }
+ }
+ di->status=0;
+ if (!di->stacked_inserts && !di->tables_in_use && thd->lock)
+ {
+ /*
+ No one is doing a insert delayed
+ Unlock table so that other threads can use it
+ */
+ MYSQL_LOCK *lock=thd->lock;
+ thd->lock=0;
+ pthread_mutex_unlock(&di->mutex);
+ /*
+ We need to release next_insert_id before unlocking. This is
+ enforced by handler::ha_external_lock().
+ */
+ di->table->file->ha_release_auto_increment();
+ mysql_unlock_tables(thd, lock);
+ ha_autocommit_or_rollback(thd, 0);
+ di->group_count=0;
+ pthread_mutex_lock(&di->mutex);
+ }
+ if (di->tables_in_use)
+ pthread_cond_broadcast(&di->cond_client); // If waiting clients
+ }
+
+ err:
+ /*
+ mysql_lock_tables() can potentially start a transaction and write
+ a table map. In the event of an error, that transaction has to be
+ rolled back. We only need to roll back a potential statement
+ transaction, since real transactions are rolled back in
+ close_thread_tables().
+
+ TODO: This is not true any more, table maps are generated on the
+ first call to ha_*_row() instead. Remove code that are used to
+ cover for the case outlined above.
+ */
+ ha_autocommit_or_rollback(thd, 1);
+
+ DBUG_LEAVE;
+ }
-end:
/*
di should be unlinked from the thread handler list and have no active
clients
@@ -3501,7 +3502,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (reopen_name_locked_table(thd, create_table, FALSE))
{
quick_rm_table(create_info->db_type, create_table->db,
@@ -3510,7 +3511,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
else
table= create_table->table;
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
}
else
{
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 55f9b08d3fe..7f77ce1212d 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -48,12 +48,12 @@ mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length)
if (map && memcmp(map,magic,magic_length))
{
my_error(ER_WRONG_MAGIC, MYF(0), name);
- VOID(my_munmap((char*) map,(size_t)size));
+ (void) my_munmap((char*) map,(size_t)size);
map=0;
}
if (!map)
{
- VOID(my_close(file,MYF(0)));
+ (void) my_close(file,MYF(0));
file= -1;
}
}
@@ -66,8 +66,8 @@ mapped_files::~mapped_files()
#ifdef HAVE_MMAP
if (file >= 0)
{
- VOID(my_munmap((char*) map,(size_t)size));
- VOID(my_close(file,MYF(0)));
+ (void) my_munmap((char*) map,(size_t)size);
+ (void) my_close(file,MYF(0));
file= -1; map=0;
}
my_free(name,MYF(0));
@@ -85,7 +85,7 @@ static I_List<mapped_files> maps_in_use;
mapped_files *map_file(const char * name,uchar *magic,uint magic_length)
{
#ifdef HAVE_MMAP
- VOID(pthread_mutex_lock(&LOCK_mapped_file));
+ pthread_mutex_lock(&LOCK_mapped_file);
I_List_iterator<mapped_files> list(maps_in_use);
mapped_files *map;
char path[FN_REFLEN];
@@ -108,7 +108,7 @@ mapped_files *map_file(const char * name,uchar *magic,uint magic_length)
if (!map->map)
my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
}
- VOID(pthread_mutex_unlock(&LOCK_mapped_file));
+ pthread_mutex_unlock(&LOCK_mapped_file);
return map;
#else
return NULL;
@@ -122,10 +122,10 @@ mapped_files *map_file(const char * name,uchar *magic,uint magic_length)
void unmap_file(mapped_files *map)
{
#ifdef HAVE_MMAP
- VOID(pthread_mutex_lock(&LOCK_mapped_file));
+ pthread_mutex_lock(&LOCK_mapped_file);
if (!map->use_count--)
delete map;
- VOID(pthread_mutex_unlock(&LOCK_mapped_file));
+ pthread_mutex_unlock(&LOCK_mapped_file);
#endif
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 68b00cad891..f744e5e3573 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -511,9 +511,7 @@ static void handle_bootstrap_impl(THD *thd)
break;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
-#ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
-#endif
}
DBUG_VOID_RETURN;
@@ -812,11 +810,7 @@ bool do_command(THD *thd)
net_new_transaction(net);
- packet_length= my_net_read(net);
-#if defined(ENABLED_PROFILING)
- thd->profiling.start_new_query();
-#endif
- if (packet_length == packet_error)
+ if ((packet_length= my_net_read(net)) == packet_error)
{
DBUG_PRINT("info",("Got error %d reading command from socket %s",
net->error,
@@ -873,9 +867,6 @@ bool do_command(THD *thd)
return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
out:
-#if defined(ENABLED_PROFILING)
- thd->profiling.finish_current_query();
-#endif
DBUG_RETURN(return_value);
}
#endif /* EMBEDDED_LIBRARY */
@@ -977,6 +968,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_ENTER("dispatch_command");
DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command));
+#if defined(ENABLED_PROFILING)
+ thd->profiling.start_new_query();
+#endif
MYSQL_COMMAND_START(thd->thread_id, command,
thd->security_ctx->priv_user,
(char *) thd->security_ctx->host_or_ip);
@@ -989,7 +983,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->enable_slow_log= TRUE;
thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
thd->set_time();
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
thd->query_id= global_query_id;
switch( command ) {
@@ -1011,7 +1005,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_running++;
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
/**
Clear the set of flags that are expected to be cleared at the
@@ -1234,9 +1228,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->profiling.set_query_source(thd->query(), thd->query_length());
#endif
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(),QUERY_PRIOR);
-
mysql_parse(thd, thd->query(), thd->query_length(), &end_of_stmt);
while (!thd->killed && (end_of_stmt != NULL) && ! thd->is_error())
@@ -1277,7 +1268,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(char *) thd->security_ctx->host_or_ip);
thd->set_query(beginning_of_next_stmt, length);
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
/*
Count each statement from the client.
*/
@@ -1285,12 +1276,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->query_id= next_query_id();
thd->set_time(); /* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
mysql_parse(thd, beginning_of_next_stmt, length, &end_of_stmt);
}
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(),WAIT_PRIOR);
DBUG_PRINT("info",("query ready"));
break;
}
@@ -1505,8 +1494,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
#endif
#ifndef EMBEDDED_LIBRARY
- VOID(my_net_write(net, (uchar*) buff, length));
- VOID(net_flush(net));
+ (void) my_net_write(net, (uchar*) buff, length);
+ (void) net_flush(net);
thd->stmt_da->disable_status();
#endif
break;
@@ -1601,13 +1590,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd_proc_info(thd, "cleaning up");
thd->set_query(NULL, 0);
thd->command=COM_SLEEP;
- VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
+ pthread_mutex_lock(&LOCK_thread_count); // For process list
thread_running--;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
thd_proc_info(thd, 0);
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+#if defined(ENABLED_PROFILING)
+ thd->profiling.finish_current_query();
+#endif
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
{
int res;
@@ -7189,7 +7181,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
uint error=ER_NO_SUCH_THREAD;
DBUG_ENTER("kill_one_thread");
DBUG_PRINT("enter", ("id=%lu only_kill=%d", id, only_kill_query));
- VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list
+ pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
I_List_iterator<THD> it(threads);
while ((tmp=it++))
{
@@ -7201,7 +7193,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
break;
}
}
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
if (tmp)
{
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 168934206e5..d624c22f43a 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2615,14 +2615,8 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
thd->stmt_arena= stmt;
thd->set_n_backup_statement(stmt, &stmt_backup);
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(), QUERY_PRIOR);
-
cursor->fetch(num_rows);
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(), WAIT_PRIOR);
-
if (!cursor->is_open())
{
stmt->close_cursor();
@@ -3386,14 +3380,8 @@ reexecute:
thd->m_reprepare_observer = &reprepare_observer;
}
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(),QUERY_PRIOR);
-
error= execute(expanded_query, open_cursor) || thd->is_error();
- if (!(specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(), WAIT_PRIOR);
-
thd->m_reprepare_observer= NULL;
if (error && !thd->is_fatal_error && !thd->killed &&
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 52e66ca8b50..f035e28da5c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3954,7 +3954,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
save_pos++;
}
i=(uint) (save_pos-(KEYUSE*) keyuse->buffer);
- VOID(set_dynamic(keyuse,(uchar*) &key_end,i));
+ (void) set_dynamic(keyuse,(uchar*) &key_end,i);
keyuse->elements=i;
}
return FALSE;
@@ -9197,7 +9197,7 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
li.remove();
else if (item != new_item)
{
- VOID(li.replace(new_item));
+ (void) li.replace(new_item);
should_fix_fields=1;
}
if (*cond_value == Item::COND_UNDEF)
@@ -11107,7 +11107,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
if (table)
{
- VOID(table->file->extra(HA_EXTRA_WRITE_CACHE));
+ (void) table->file->extra(HA_EXTRA_WRITE_CACHE);
empty_record(table);
if (table->group && join->tmp_table_param.sum_func_count &&
table->s->keys && !table->file->inited)
@@ -12453,7 +12453,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (end_of_records)
DBUG_RETURN(NESTED_LOOP_OK);
join->first_record=1;
- VOID(test_if_group_changed(join->group_fields));
+ (void) test_if_group_changed(join->group_fields);
}
if (idx < (int) join->send_group_parts)
{
@@ -12716,7 +12716,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (end_of_records)
DBUG_RETURN(NESTED_LOOP_OK);
join->first_record=1;
- VOID(test_if_group_changed(join->group_fields));
+ (void) test_if_group_changed(join->group_fields);
}
if (idx < (int) join->send_group_parts)
{
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index b711a273ae8..cde0a5c5069 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -663,8 +663,8 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options)
server->server_name,
server->server_name_length));
- VOID(my_hash_delete(&servers_cache, (uchar*) server));
-
+ my_hash_delete(&servers_cache, (uchar*) server);
+
error= 0;
end:
@@ -770,7 +770,7 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing,
/*
delete the existing server struct from the server cache
*/
- VOID(my_hash_delete(&servers_cache, (uchar*)existing));
+ my_hash_delete(&servers_cache, (uchar*)existing);
/*
Insert the altered server struct into the server cache
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3af0df73079..babadc34842 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -495,7 +495,7 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
DBUG_PRINT("info",("found: %d files", files->elements));
my_dirend(dirp);
- VOID(ha_find_files(thd, db, path, wild, dir, files));
+ (void) ha_find_files(thd, db, path, wild, dir, files);
DBUG_RETURN(FIND_FILES_OK);
}
@@ -936,7 +936,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
it's a keyword
*/
- VOID(packet->reserve(length*2 + 2));
+ (void) packet->reserve(length*2 + 2);
quote_char= (char) q;
packet->append(&quote_char, 1, system_charset_info);
@@ -1707,8 +1707,6 @@ template class I_List<thread_info>;
static const char *thread_state_info(THD *tmp)
{
- if (tmp->locked)
- return "Locked";
#ifndef EMBEDDED_LIBRARY
if (tmp->net.reading_or_writing)
{
@@ -1757,7 +1755,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_VOID_RETURN;
- VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list
+ pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
if (!thd->killed)
{
I_List_iterator<THD> it(threads);
@@ -1810,7 +1808,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
}
}
}
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
thread_info *thd_info;
time_t now= my_time(0);
@@ -1849,7 +1847,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
user= thd->security_ctx->master_access & PROCESS_ACL ?
NullS : thd->security_ctx->priv_user;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_thread_count);
if (!thd->killed)
{
@@ -1924,13 +1922,13 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
if (schema_table_store_record(thd, table))
{
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(1);
}
}
}
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(0);
}
@@ -2287,7 +2285,7 @@ void calc_sum_of_all_status(STATUS_VAR *to)
DBUG_ENTER("calc_sum_of_all_status");
/* Ensure that thread id not killed during loop */
- VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list
+ pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
I_List_iterator<THD> it(threads);
THD *tmp;
@@ -2299,7 +2297,7 @@ void calc_sum_of_all_status(STATUS_VAR *to)
while ((tmp= it++))
add_to_status(to, &tmp->status_var);
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
}
@@ -2854,9 +2852,9 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
Check that table is relevant in current transaction.
(used for ndb engine, see ndbcluster_find_files(), ha_ndbcluster.cc)
*/
- VOID(ha_find_files(thd, db_name->str, path,
+ (void) ha_find_files(thd, db_name->str, path,
lookup_field_vals->table_value.str, 0,
- table_names));
+ table_names);
}
return 0;
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index a0ea75a0b0a..40040ab0934 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -120,7 +120,7 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
int decpt,sign;
char *pos,*to;
- VOID(fconvert(num,(int) decimals,&decpt,&sign,buff+1));
+ (void) fconvert(num,(int) decimals,&decpt,&sign,buff+1);
if (!my_isdigit(&my_charset_latin1, buff[1]))
{ // Nan or Inf
pos=buff+1;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 691b248fb2e..c6cb4fc6379 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -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 */
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 6c0cb08cc79..d9beb77f546 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -80,7 +80,7 @@ void print_cached_tables(void)
compile_time_assert(TL_WRITE_ONLY+1 == array_elements(lock_descriptions));
/* purecov: begin tested */
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
puts("DB Table Version Thread Open Lock");
for (idx=unused=0 ; idx < open_cache.records ; idx++)
@@ -116,7 +116,7 @@ void print_cached_tables(void)
if (my_hash_check(&open_cache))
printf("Error: File hash table is corrupted\n");
fflush(stdout);
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
/* purecov: end */
return;
}
@@ -155,7 +155,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
}
out.append('\0'); // Purify doesn't like c_ptr()
DBUG_LOCK_FILE;
- VOID(fputs("\nInfo about FILESORT\n",DBUG_FILE));
+ (void) fputs("\nInfo about FILESORT\n",DBUG_FILE);
fprintf(DBUG_FILE,"Sortorder: %s\n",out.ptr());
DBUG_UNLOCK_FILE;
DBUG_VOID_RETURN;
@@ -169,7 +169,7 @@ TEST_join(JOIN *join)
DBUG_ENTER("TEST_join");
DBUG_LOCK_FILE;
- VOID(fputs("\nInfo about JOIN\n",DBUG_FILE));
+ (void) fputs("\nInfo about JOIN\n",DBUG_FILE);
for (i=0 ; i < join->tables ; i++)
{
JOIN_TAB *tab=join->join_tab+i;
@@ -195,17 +195,17 @@ TEST_join(JOIN *join)
tab->select->quick->dbug_dump(18, FALSE);
}
else
- VOID(fputs(" select used\n",DBUG_FILE));
+ (void) fputs(" select used\n",DBUG_FILE);
}
if (tab->ref.key_parts)
{
- VOID(fputs(" refs: ",DBUG_FILE));
+ (void) fputs(" refs: ",DBUG_FILE);
for (ref=0 ; ref < tab->ref.key_parts ; ref++)
{
Item *item=tab->ref.items[ref];
fprintf(DBUG_FILE,"%s ", item->full_name());
}
- VOID(fputc('\n',DBUG_FILE));
+ (void) fputc('\n',DBUG_FILE);
}
}
DBUG_UNLOCK_FILE;
@@ -355,7 +355,7 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
table_lock_info.lock_text=text;
// lock_type is also obtainable from THR_LOCK_DATA
table_lock_info.type=table->reginfo.lock_type;
- VOID(push_dynamic(ar,(uchar*) &table_lock_info));
+ (void) push_dynamic(ar,(uchar*) &table_lock_info);
}
}
}
@@ -380,13 +380,13 @@ static void display_table_locks(void)
LIST *list;
DYNAMIC_ARRAY saved_table_locks;
- VOID(my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO),open_cache.records + 20,50));
- VOID(pthread_mutex_lock(&THR_LOCK_lock));
+ (void) my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO),open_cache.records + 20,50);
+ pthread_mutex_lock(&THR_LOCK_lock);
for (list= thr_lock_thread_list; list; list= list_rest(list))
{
THR_LOCK *lock=(THR_LOCK*) list->data;
- VOID(pthread_mutex_lock(&lock->mutex));
+ pthread_mutex_lock(&lock->mutex);
push_locks_into_array(&saved_table_locks, lock->write.data, FALSE,
"Locked - write");
push_locks_into_array(&saved_table_locks, lock->write_wait.data, TRUE,
@@ -395,9 +395,9 @@ static void display_table_locks(void)
"Locked - read");
push_locks_into_array(&saved_table_locks, lock->read_wait.data, TRUE,
"Waiting - read");
- VOID(pthread_mutex_unlock(&lock->mutex));
+ pthread_mutex_unlock(&lock->mutex);
}
- VOID(pthread_mutex_unlock(&THR_LOCK_lock));
+ pthread_mutex_unlock(&THR_LOCK_lock);
if (!saved_table_locks.elements) goto end;
qsort((uchar*) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
@@ -462,7 +462,7 @@ void mysql_print_status()
calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n");
- VOID(my_getwd(current_dir, sizeof(current_dir),MYF(0)));
+ (void) my_getwd(current_dir, sizeof(current_dir),MYF(0));
printf("Current dir: %s\n", current_dir);
printf("Running threads: %d Stack size: %ld\n", thread_count,
(long) my_thread_stack_size);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 434d17d8e58..96af74df072 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -387,7 +387,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
DBUG_RETURN(TRUE);
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
if (!create)
{
@@ -510,7 +510,7 @@ end:
result= write_bin_log(thd, TRUE, stmt_query.ptr(), stmt_query.length());
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (need_start_waiting)
start_waiting_global_read_lock(thd);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 798d68d6a00..2d768609220 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -782,7 +782,7 @@ int mysql_update(THD *thd,
end_read_record(&info);
delete select;
thd_proc_info(thd, "end");
- VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY));
+ (void) table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
/*
Invalidate the table in the query cache if something changed.
@@ -1857,7 +1857,7 @@ void multi_update::abort()
todo/fixme: do_update() is never called with the arg 1.
should it change the signature to become argless?
*/
- VOID(do_updates());
+ (void) do_updates();
}
}
if (thd->transaction.stmt.modified_non_trans_table)
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 64c1167688c..ebb0615f80e 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -620,7 +620,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
res= TRUE;
goto err;
}
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
res= mysql_register_view(thd, view, mode);
if (mysql_bin_log.is_open())
@@ -667,7 +667,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
res= TRUE;
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (mode != VIEW_CREATE_NEW)
query_cache_invalidate3(thd, view, 0);
start_waiting_global_read_lock(thd);
@@ -1580,7 +1580,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
bool something_wrong= FALSE;
DBUG_ENTER("mysql_drop_view");
- VOID(pthread_mutex_lock(&LOCK_open));
+ pthread_mutex_lock(&LOCK_open);
for (view= views; view; view= view->next_local)
{
TABLE_SHARE *share;
@@ -1658,7 +1658,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
something_wrong= 1;
}
- VOID(pthread_mutex_unlock(&LOCK_open));
+ pthread_mutex_unlock(&LOCK_open);
if (something_wrong)
{
diff --git a/sql/table.cc b/sql/table.cc
index 39a7e163c37..736b89821c4 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -753,7 +753,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
/* Read keyinformation */
key_info_length= (uint) uint2korr(head+28);
- VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0)));
+ my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0));
if (read_string(file,(uchar**) &disk_buff,key_info_length))
goto err; /* purecov: inspected */
if (disk_buff[0] & 0x80)
@@ -1030,7 +1030,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */
- VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0)));
+ my_seek(file,pos,MY_SEEK_SET,MYF(0));
if (my_read(file, head,288,MYF(MY_NABP)))
goto err;
#ifdef HAVE_CRYPTED_FRM
@@ -2056,7 +2056,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
if (names)
{
length=uint2korr(head+4);
- VOID(my_seek(file,64L,MY_SEEK_SET,MYF(0)));
+ my_seek(file,64L,MY_SEEK_SET,MYF(0));
if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4,
MYF(MY_WME))) ||
my_read(file, buf+a_length, (size_t) (length+names*4),
@@ -2135,17 +2135,17 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
while (endpos > maxlength)
{
- VOID(my_seek(file,(ulong) (endpos-bufflength),MY_SEEK_SET,MYF(0)));
+ my_seek(file,(ulong) (endpos-bufflength),MY_SEEK_SET,MYF(0));
if (my_read(file, buff, bufflength, MYF(MY_NABP+MY_WME)))
DBUG_RETURN(0L);
- VOID(my_seek(file,(ulong) (endpos-bufflength+IO_SIZE),MY_SEEK_SET,
- MYF(0)));
+ my_seek(file,(ulong) (endpos-bufflength+IO_SIZE),MY_SEEK_SET,
+ MYF(0));
if ((my_write(file, buff,bufflength,MYF(MY_NABP+MY_WME))))
DBUG_RETURN(0);
endpos-=bufflength; bufflength=IO_SIZE;
}
bzero(buff,IO_SIZE); /* Null new block */
- VOID(my_seek(file,(ulong) maxlength,MY_SEEK_SET,MYF(0)));
+ my_seek(file,(ulong) maxlength,MY_SEEK_SET,MYF(0));
if (my_write(file,buff,bufflength,MYF(MY_NABP+MY_WME)))
DBUG_RETURN(0L);
maxlength+=IO_SIZE; /* Fix old ref */
@@ -2161,11 +2161,11 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
if (n_length == 1 )
{ /* First name */
length++;
- VOID(strxmov((char*) buff,"/",newname,"/",NullS));
+ (void) strxmov((char*) buff,"/",newname,"/",NullS);
}
else
- VOID(strxmov((char*) buff,newname,"/",NullS)); /* purecov: inspected */
- VOID(my_seek(file,63L+(ulong) n_length,MY_SEEK_SET,MYF(0)));
+ (void) strxmov((char*) buff,newname,"/",NullS); /* purecov: inspected */
+ my_seek(file,63L+(ulong) n_length,MY_SEEK_SET,MYF(0));
if (my_write(file, buff, (size_t) length+1,MYF(MY_NABP+MY_WME)) ||
(names && my_write(file,(uchar*) (*formnames->type_names+n_length-1),
names*4, MYF(MY_NABP+MY_WME))) ||
@@ -2174,7 +2174,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
int2store(fileinfo+8,names+1);
int2store(fileinfo+4,n_length+length);
- VOID(my_chsize(file, newpos, 0, MYF(MY_WME)));/* Append file with '\0' */
+ (void) my_chsize(file, newpos, 0, MYF(MY_WME));/* Append file with '\0' */
DBUG_RETURN(newpos);
} /* make_new_entry */
@@ -2528,8 +2528,8 @@ File create_frm(THD *thd, const char *name, const char *db,
{
if (my_write(file,fill, IO_SIZE, MYF(MY_WME | MY_NABP)))
{
- VOID(my_close(file,MYF(0)));
- VOID(my_delete(name,MYF(0)));
+ (void) my_close(file,MYF(0));
+ (void) my_delete(name,MYF(0));
return(-1);
}
}
@@ -2566,8 +2566,8 @@ int
rename_file_ext(const char * from,const char * to,const char * ext)
{
char from_b[FN_REFLEN],to_b[FN_REFLEN];
- VOID(strxmov(from_b,from,ext,NullS));
- VOID(strxmov(to_b,to,ext,NullS));
+ (void) strxmov(from_b,from,ext,NullS);
+ (void) strxmov(to_b,to,ext,NullS);
return (my_rename(from_b,to_b,MYF(MY_WME)));
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 8740a8ec906..dbed1a16982 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1594,7 +1594,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
goto end;
}
init_sql_alloc(&tz_storage, 32 * 1024, 0);
- VOID(pthread_mutex_init(&tz_LOCK, MY_MUTEX_INIT_FAST));
+ pthread_mutex_init(&tz_LOCK, MY_MUTEX_INIT_FAST);
tz_inited= 1;
/* Add 'SYSTEM' time zone to tz_names hash */
@@ -1772,7 +1772,7 @@ void my_tz_free()
if (tz_inited)
{
tz_inited= 0;
- VOID(pthread_mutex_destroy(&tz_LOCK));
+ pthread_mutex_destroy(&tz_LOCK);
my_hash_free(&offset_tzs);
my_hash_free(&tz_names);
free_root(&tz_storage, MYF(0));
@@ -2261,7 +2261,7 @@ my_tz_find(THD *thd, const String *name)
if (!name)
DBUG_RETURN(0);
- VOID(pthread_mutex_lock(&tz_LOCK));
+ pthread_mutex_lock(&tz_LOCK);
if (!str_to_offset(name->ptr(), name->length(), &offset))
{
@@ -2304,7 +2304,7 @@ my_tz_find(THD *thd, const String *name)
}
}
- VOID(pthread_mutex_unlock(&tz_LOCK));
+ pthread_mutex_unlock(&tz_LOCK);
DBUG_RETURN(result_tz);
}
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 4e3dd82c467..73256bb5529 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -767,14 +767,14 @@ char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
return 0;
}
#else
- VOID(pthread_mutex_lock(&LOCK_hostname));
+ pthread_mutex_lock(&LOCK_hostname);
if (!(hostent= gethostbyname((char*) name_buff)))
{
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
*null_value= 1;
return 0;
}
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
#endif
memcpy_fixed((char*) &in,(char*) *hostent->h_addr_list, sizeof(in.s_addr));
*res_length= (ulong) (strmov(result, inet_ntoa(in)) - result);
@@ -871,14 +871,14 @@ char *reverse_lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
return 0;
}
#else
- VOID(pthread_mutex_lock(&LOCK_hostname));
+ pthread_mutex_lock(&LOCK_hostname);
if (!(hp= gethostbyaddr((char*) &taddr, sizeof(taddr), AF_INET)))
{
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
*null_value= 1;
return 0;
}
- VOID(pthread_mutex_unlock(&LOCK_hostname));
+ pthread_mutex_unlock(&LOCK_hostname);
#endif
*res_length=(ulong) (strmov(result,hp->h_name) - result);
return result;
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 7b6b628f924..f7c290ae61d 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -66,8 +66,8 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
*/
max_elements= (ulong) (max_in_memory_size /
ALIGN_SIZE(sizeof(TREE_ELEMENT)+size));
- VOID(open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
- MYF(MY_WME)));
+ (void) open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
+ MYF(MY_WME));
}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index f08c64a3182..8328cf735b5 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -199,7 +199,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
key_buff_length= uint4korr(fileinfo+47);
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
- VOID(get_form_pos(file,fileinfo,&formnames));
+ (void) get_form_pos(file,fileinfo,&formnames);
if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
goto err;
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
@@ -262,9 +262,9 @@ bool mysql_create_frm(THD *thd, const char *file_name,
my_pwrite(file, keybuff, key_info_length,
(ulong) uint2korr(fileinfo+6),MYF_RW))
goto err;
- VOID(my_seek(file,
+ my_seek(file,
(ulong) uint2korr(fileinfo+6)+ (ulong) key_buff_length,
- MY_SEEK_SET,MYF(0)));
+ MY_SEEK_SET,MYF(0));
if (make_empty_rec(thd,file,ha_legacy_type(create_info->db_type),
create_info->table_options,
create_fields,reclength, data_offset, db_file))
@@ -310,7 +310,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
}
}
- VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
+ my_seek(file,filepos,MY_SEEK_SET,MYF(0));
if (my_write(file, forminfo, 288, MYF_RW) ||
my_write(file, screen_buff, info_length, MYF_RW) ||
pack_fields(file, create_fields, data_offset))
@@ -324,7 +324,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if (!crypted || my_pwrite(file,&tmp,1,26,MYF_RW)) // Mark crypted
goto err;
uint read_length=uint2korr(forminfo)-256;
- VOID(my_seek(file,filepos+256,MY_SEEK_SET,MYF(0)));
+ my_seek(file,filepos+256,MY_SEEK_SET,MYF(0));
if (read_string(file,(uchar**) &disk_buff,read_length))
goto err;
crypted->encode(disk_buff,read_length);
@@ -371,7 +371,7 @@ err:
my_free(screen_buff, MYF(0));
my_free(keybuff, MYF(0));
err2:
- VOID(my_close(file,MYF(MY_WME)));
+ (void) my_close(file,MYF(MY_WME));
err3:
my_delete(file_name,MYF(0));
DBUG_RETURN(1);
@@ -425,7 +425,7 @@ int rea_create_table(THD *thd, const char *path,
DBUG_RETURN(0);
err_handler:
- VOID(file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info));
+ (void) file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info);
my_delete(frm_name, MYF(0));
DBUG_RETURN(1);
} /* rea_create_table */
diff --git a/sql/unireg.h b/sql/unireg.h
index a390b755772..80c6ad23907 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -126,7 +126,7 @@
#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
#define SPECIAL_ENGLISH 32 /* English error messages */
#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */
-#define SPECIAL_NO_PRIOR 128 /* Don't prioritize threads */
+#define SPECIAL_NO_PRIOR 128 /* Obsolete */
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
#define SPECIAL_SHORT_LOG_FORMAT 1024