From: Marc Alff Date: July 16 2010 12:29am Subject: bzr commit into mysql-trunk-bugfixing branch (marc.alff:3115) Bug#53566 List-Archive: http://lists.mysql.com/commits/113715 X-Bug: 53566 Message-Id: <20100716002903.23CB345E80@linux-su11.site> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6723444923749239834==" --===============6723444923749239834== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/malff/BZR_TREE/mysql-trunk-bugfixing-cleanup/ based on revid:marc.alff@stripped 3115 Marc Alff 2010-07-15 Bug#53566 SHOW ENGINE PERFORMANCE_SCHEMA STATUS reports less memory than really used Backporting the fix from myql-next-mr (5.6) to mysql-trunk (5.5) modified: storage/perfschema/pfs_engine_table.cc storage/perfschema/pfs_global.cc storage/perfschema/pfs_global.h === modified file 'storage/perfschema/pfs_engine_table.cc' --- a/storage/perfschema/pfs_engine_table.cc 2010-07-16 00:06:33 +0000 +++ b/storage/perfschema/pfs_engine_table.cc 2010-07-16 00:28:52 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_engine_table.cc @@ -35,6 +35,7 @@ /* For show status */ #include "pfs_column_values.h" #include "pfs_instr.h" +#include "pfs_global.h" #include "sql_base.h" // close_thread_tables #include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT @@ -677,6 +678,7 @@ bool pfs_show_status(handlerton *hton, T case 40: name= "(PFS_FILE_HANDLE).MEMORY"; size= file_handle_max * sizeof(PFS_file*); + total_memory+= size; break; case 41: name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE"; @@ -691,13 +693,41 @@ bool pfs_show_status(handlerton *hton, T size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain); total_memory+= size; break; + case 44: + name= "(PFS_TABLE_SHARE).ROW_SIZE"; + size= sizeof(PFS_table_share); + break; + case 45: + name= "(PFS_TABLE_SHARE).ROW_COUNT"; + size= table_share_max; + break; + case 46: + name= "(PFS_TABLE_SHARE).MEMORY"; + size= table_share_max * sizeof(PFS_table_share); + total_memory+= size; + break; + case 47: + name= "(PFS_TABLE).ROW_SIZE"; + size= sizeof(PFS_table); + break; + case 48: + name= "(PFS_TABLE).ROW_COUNT"; + size= table_max; + break; + case 49: + name= "(PFS_TABLE).MEMORY"; + size= table_max * sizeof(PFS_table); + total_memory+= size; + break; /* This case must be last, for aggregation in total_memory. */ - case 44: + case 50: name= "PERFORMANCE_SCHEMA.MEMORY"; size= total_memory; + /* This will fail if something is not advertised here */ + DBUG_ASSERT(size == pfs_allocated_memory); break; default: goto end; === modified file 'storage/perfschema/pfs_global.cc' --- a/storage/perfschema/pfs_global.cc 2010-01-12 01:47:27 +0000 +++ b/storage/perfschema/pfs_global.cc 2010-07-16 00:28:52 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_global.cc @@ -26,6 +26,7 @@ #include bool pfs_initialized= false; +ulonglong pfs_allocated_memory= 0; /** Memory allocation for the performance schema. @@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags) DBUG_ASSERT(size > 0); void *ptr= malloc(size); - if (ptr && (flags & MY_ZEROFILL)) + if (likely(ptr != NULL)) + pfs_allocated_memory+= size; + if (likely((ptr != NULL) && (flags & MY_ZEROFILL))) memset(ptr, 0, size); return ptr; } === modified file 'storage/perfschema/pfs_global.h' --- a/storage/perfschema/pfs_global.h 2010-01-12 01:47:27 +0000 +++ b/storage/perfschema/pfs_global.h 2010-07-16 00:28:52 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H @@ -22,6 +22,7 @@ */ extern bool pfs_initialized; +extern ulonglong pfs_allocated_memory; void *pfs_malloc(size_t size, myf flags); #define PFS_MALLOC_ARRAY(n, T, f) \ --===============6723444923749239834== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/marc.alff@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: marc.alff@stripped # target_branch: file:///home/malff/BZR_TREE/mysql-trunk-bugfixing-\ # cleanup/ # testament_sha1: dae72fe013ea8fa549ecbc59d479f1434daa1f3c # timestamp: 2010-07-15 18:29:03 -0600 # base_revision_id: marc.alff@stripped\ # 48q5mmrlmvjre677 # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWTjABPQABDvfgFAQeX///3/n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