mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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.
This commit is contained in:
@ -2430,7 +2430,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
||||
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_fetch);
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
@ -2494,7 +2494,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
statistic_increment(thd->status_var.com_stmt_reset, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_reset);
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
@ -2598,7 +2598,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
||||
#endif
|
||||
DBUG_ENTER("mysql_stmt_get_longdata");
|
||||
|
||||
statistic_increment(thd->status_var.com_stmt_send_long_data, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_send_long_data);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
/* Minimal size of long data packet is 6 bytes */
|
||||
if (packet_length <= MYSQL_LONG_DATA_HEADER)
|
||||
@ -2849,7 +2849,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
|
||||
However, it seems handy if com_stmt_prepare is increased always,
|
||||
no matter what kind of prepare is processed.
|
||||
*/
|
||||
statistic_increment(thd->status_var.com_stmt_prepare, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_prepare);
|
||||
|
||||
/*
|
||||
alloc_query() uses thd->memroot && thd->query, so we should call
|
||||
@ -2972,7 +2972,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
||||
Query_arena *old_stmt_arena;
|
||||
bool error= TRUE;
|
||||
|
||||
statistic_increment(thd->status_var.com_stmt_execute, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_execute);
|
||||
|
||||
/* Check if we got an error when sending long data */
|
||||
if (state == Query_arena::ERROR)
|
||||
@ -3094,7 +3094,7 @@ error:
|
||||
bool Prepared_statement::deallocate()
|
||||
{
|
||||
/* We account deallocate in the same manner as mysql_stmt_close */
|
||||
statistic_increment(thd->status_var.com_stmt_close, &LOCK_status);
|
||||
status_var_increment(thd->status_var.com_stmt_close);
|
||||
if (flags & (uint) IS_IN_USE)
|
||||
{
|
||||
my_error(ER_PS_NO_RECURSION, MYF(0));
|
||||
|
Reference in New Issue
Block a user