mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#21554 (sp_cache.cc: violates C++ aliasing rules)
The problem reported is a compile bug, reported by the development GCC team with GCC 4.2. The original issue can no longer be reproduced in MySQL 5.1, since the configure script no longer define HAVE_ATOMIC_ADD, which caused the Linux atomic functions to be used (and cause a problem with an invalid cast). This patch implements some code cleanup for 5.1 only, which was identified during the investigation of this issue. With this patch, statistics maintained in THD::status_var are by definition owned by the running thread, and do not need to be protected against race conditions. These statistics are maintained by the status_var_* helpers, which do not require any lock. include/my_global.h: General cleanup of thread_safe_increment / statistic_increment include/my_pthread.h: General cleanup of thread_safe_increment / statistic_increment sql/filesort.cc: General cleanup of thread_safe_increment / statistic_increment sql/handler.cc: General cleanup of thread_safe_increment / statistic_increment sql/sql_insert.cc: General cleanup of thread_safe_increment / statistic_increment sql/sql_parse.cc: General cleanup of thread_safe_increment / statistic_increment sql/sql_prepare.cc: General cleanup of thread_safe_increment / statistic_increment sql/sql_select.cc: General cleanup of thread_safe_increment / statistic_increment
This commit is contained in:
@ -6282,8 +6282,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
join->thd->server_status|=SERVER_QUERY_NO_GOOD_INDEX_USED;
|
||||
tab->read_first_record= join_init_quick_read_record;
|
||||
if (statistics)
|
||||
statistic_increment(join->thd->status_var.select_range_check_count,
|
||||
&LOCK_status);
|
||||
status_var_increment(join->thd->status_var.select_range_check_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6293,15 +6292,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
if (tab->select && tab->select->quick)
|
||||
{
|
||||
if (statistics)
|
||||
statistic_increment(join->thd->status_var.select_range_count,
|
||||
&LOCK_status);
|
||||
status_var_increment(join->thd->status_var.select_range_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
if (statistics)
|
||||
statistic_increment(join->thd->status_var.select_scan_count,
|
||||
&LOCK_status);
|
||||
status_var_increment(join->thd->status_var.select_scan_count);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -6309,15 +6306,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
if (tab->select && tab->select->quick)
|
||||
{
|
||||
if (statistics)
|
||||
statistic_increment(join->thd->status_var.select_full_range_join_count,
|
||||
&LOCK_status);
|
||||
status_var_increment(join->thd->status_var.select_full_range_join_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
if (statistics)
|
||||
statistic_increment(join->thd->status_var.select_full_join_count,
|
||||
&LOCK_status);
|
||||
status_var_increment(join->thd->status_var.select_full_join_count);
|
||||
}
|
||||
}
|
||||
if (!table->no_keyread)
|
||||
@ -9377,7 +9372,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
(int) distinct, (int) save_sum_fields,
|
||||
(ulong) rows_limit,test(group)));
|
||||
|
||||
statistic_increment(thd->status_var.created_tmp_tables, &LOCK_status);
|
||||
status_var_increment(thd->status_var.created_tmp_tables);
|
||||
|
||||
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
|
||||
temp_pool_slot = bitmap_lock_set_next(&temp_pool);
|
||||
@ -10249,8 +10244,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
|
||||
table->db_stat=0;
|
||||
goto err;
|
||||
}
|
||||
statistic_increment(table->in_use->status_var.created_tmp_disk_tables,
|
||||
&LOCK_status);
|
||||
status_var_increment(table->in_use->status_var.created_tmp_disk_tables);
|
||||
share->db_record_offset= 1;
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
|
Reference in New Issue
Block a user