Commit 67864001 authored by Georgi Kodinov's avatar Georgi Kodinov

Bug #53493 : add_to_status does not handle the longlong fields in STATUS_VAR

bytes_received/bytes_sent are ulonglong so they cannot be handled by the 
ulong handling code in add_to_status/add_diff_to_status().

Fixed by adding code to handle these two variables in 
add_to_status()/add_diff_to_status() and making sure they are not a subject
to the ulong handling code.
parent 1919414f
...@@ -1063,6 +1063,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) ...@@ -1063,6 +1063,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
while (to != end) while (to != end)
*(to++)+= *(from++); *(to++)+= *(from++);
to_var->bytes_received+= from_var->bytes_received;
to_var->bytes_sent+= from_var->bytes_sent;
} }
/* /*
...@@ -1088,6 +1091,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, ...@@ -1088,6 +1091,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
while (to != end) while (to != end)
*(to++)+= *(from++) - *(dec++); *(to++)+= *(from++) - *(dec++);
to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;;
to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent;
} }
......
...@@ -405,12 +405,14 @@ struct system_variables ...@@ -405,12 +405,14 @@ struct system_variables
}; };
/* per thread status variables */ /**
Per thread status variables.
Must be long/ulong up to last_system_status_var so that
add_to_status/add_diff_to_status can work.
*/
typedef struct system_status_var typedef struct system_status_var
{ {
ulonglong bytes_received;
ulonglong bytes_sent;
ulong com_other; ulong com_other;
ulong com_stat[(uint) SQLCOM_END]; ulong com_stat[(uint) SQLCOM_END];
ulong created_tmp_disk_tables; ulong created_tmp_disk_tables;
...@@ -466,13 +468,14 @@ typedef struct system_status_var ...@@ -466,13 +468,14 @@ typedef struct system_status_var
Number of statements sent from the client Number of statements sent from the client
*/ */
ulong questions; ulong questions;
ulonglong bytes_received;
ulonglong bytes_sent;
/* /*
IMPORTANT! IMPORTANT!
SEE last_system_status_var DEFINITION BELOW. SEE last_system_status_var DEFINITION BELOW.
Below 'last_system_status_var' are all variables which doesn't make any Below 'last_system_status_var' are all variables that cannot be handled
sense to add to the /global/ status variable counter. automatically by add_to_status()/add_diff_to_status().
Status variables which it does not make sense to add to
global status variable counter
*/ */
double last_query_cost; double last_query_cost;
} STATUS_VAR; } STATUS_VAR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment