mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fixed wrong counting of global Memory_used
This commit is contained in:
@@ -822,6 +822,20 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
|
||||
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
|
||||
STATUS_VAR *dec_var);
|
||||
|
||||
/*
|
||||
Update global_memory_used. We have to do this with atomic_add as the
|
||||
global value can change outside of LOCK_status.
|
||||
*/
|
||||
inline void update_global_memory_status(int64 size)
|
||||
{
|
||||
DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
|
||||
(longlong) global_status_var.global_memory_used,
|
||||
size));
|
||||
// workaround for gcc 4.2.4-1ubuntu4 -fPIE (from DEB_BUILD_HARDENING=1)
|
||||
int64 volatile * volatile ptr= &global_status_var.global_memory_used;
|
||||
my_atomic_add64_explicit(ptr, size, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
/**
|
||||
Get collation by name, send error to client on failure.
|
||||
@param name Collation name
|
||||
@@ -3836,9 +3850,11 @@ public:
|
||||
|
||||
void add_status_to_global()
|
||||
{
|
||||
DBUG_ASSERT(status_in_global == 0);
|
||||
mysql_mutex_lock(&LOCK_status);
|
||||
add_to_status(&global_status_var, &status_var);
|
||||
/* Mark that this THD status has already been added in global status */
|
||||
status_var.global_memory_used= 0;
|
||||
status_in_global= 1;
|
||||
mysql_mutex_unlock(&LOCK_status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user