From: Marc Alff Date: March 28 2012 8:32am Subject: bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3482 to 3483) List-Archive: http://lists.mysql.com/commits/143334 Message-Id: <201203280832.q2S8WAnT014958@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3483 Marc Alff 2012-03-28 Performance tuning, in progress modified: config.h.cmake configure.cmake storage/perfschema/pfs_account.cc storage/perfschema/pfs_account.h storage/perfschema/pfs_digest.cc storage/perfschema/pfs_digest.h storage/perfschema/pfs_engine_table.cc storage/perfschema/pfs_global.cc storage/perfschema/pfs_global.h storage/perfschema/pfs_host.cc storage/perfschema/pfs_host.h storage/perfschema/pfs_instr.cc storage/perfschema/pfs_instr.h storage/perfschema/pfs_instr_class.cc storage/perfschema/pfs_instr_class.h storage/perfschema/pfs_setup_actor.cc storage/perfschema/pfs_setup_actor.h storage/perfschema/pfs_setup_object.cc storage/perfschema/pfs_setup_object.h storage/perfschema/pfs_user.cc storage/perfschema/pfs_user.h strings/ctype-bin.c 3482 Marc Alff 2012-03-26 [merge] Merge mysql-trunk --> mysql-trunk-pfs-tuning added: BUILD/README modified: BUILD/compile-pentium BUILD/compile-pentium-debug BUILD/compile-pentium-debug-max BUILD/compile-pentium-debug-max-no-ndb BUILD/compile-pentium-gcov BUILD/compile-pentium-gprof BUILD/compile-pentium-valgrind-max BUILD/compile-pentium-valgrind-max-no-ndb BUILD/compile-pentium64 INSTALL-SOURCE INSTALL-WIN-SOURCE cmake/make_dist.cmake.in cmake/mysql_version.cmake cmake/package_name.cmake include/my_md5.h mysql-test/collections/default.experimental mysql-test/collections/default.weekly mysql-test/collections/disabled-per-push.list mysql-test/r/lowercase_table2.result mysql-test/suite/innodb/t/disabled.def mysql-test/suite/rpl/t/rpl_alter_repository.test mysql-test/suite/rpl/t/rpl_gtid_parallel.test mysql-test/suite/rpl/t/rpl_gtid_stress_failover.test mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test mysql-test/suite/rpl/t/rpl_mixed_mts_crash_safe.test mysql-test/suite/rpl/t/rpl_mixed_mts_rec_crash_safe.test mysql-test/suite/rpl/t/rpl_mixed_mts_rec_crash_safe_checksum.test mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test mysql-test/suite/rpl/t/rpl_non_direct_row_mixing_engines.test mysql-test/suite/rpl/t/rpl_non_direct_stm_mixing_engines.test mysql-test/suite/rpl/t/rpl_row_mixing_engines.test mysql-test/suite/rpl/t/rpl_row_mts_crash_safe.test mysql-test/suite/rpl/t/rpl_row_mts_rec_crash_safe.test mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test mysql-test/suite/rpl/t/rpl_stm_mixed_crash_safe.test mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test mysql-test/suite/rpl/t/rpl_stm_mts_crash_safe.test mysql-test/suite/rpl/t/rpl_stm_mts_rec_crash_safe.test mysql-test/t/lowercase_table2.test sql/md5.cc sql/sql_table.cc sql/sql_view.cc support-files/CMakeLists.txt === modified file 'config.h.cmake' --- a/config.h.cmake 2012-03-01 09:17:31 +0000 +++ b/config.h.cmake 2012-03-28 08:29:33 +0000 @@ -203,6 +203,7 @@ #cmakedefine HAVE_POLL 1 #cmakedefine HAVE_PORT_CREATE 1 #cmakedefine HAVE_POSIX_FALLOCATE 1 +#cmakedefine HAVE_POSIX_MEMALIGN 1 #cmakedefine HAVE_PREAD 1 #cmakedefine HAVE_PAUSE_INSTRUCTION 1 #cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1 === modified file 'configure.cmake' --- a/configure.cmake 2012-03-14 01:50:20 +0000 +++ b/configure.cmake 2012-03-28 08:29:33 +0000 @@ -436,6 +436,7 @@ CHECK_FUNCTION_EXISTS (perror HAVE_PERRO CHECK_FUNCTION_EXISTS (poll HAVE_POLL) CHECK_FUNCTION_EXISTS (port_create HAVE_PORT_CREATE) CHECK_FUNCTION_EXISTS (posix_fallocate HAVE_POSIX_FALLOCATE) +CHECK_FUNCTION_EXISTS (posix_memalign HAVE_POSIX_MEMALIGN) CHECK_FUNCTION_EXISTS (pread HAVE_PREAD) CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE) CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE) === modified file 'storage/perfschema/pfs_account.cc' --- a/storage/perfschema/pfs_account.cc 2011-08-25 07:53:21 +0000 +++ b/storage/perfschema/pfs_account.cc 2012-03-28 08:29:33 +0000 @@ -45,7 +45,7 @@ static PFS_single_stat *account_instr_cl static PFS_stage_stat *account_instr_class_stages_array= NULL; static PFS_statement_stat *account_instr_class_statements_array= NULL; -static LF_HASH account_hash; +LF_HASH account_hash; static bool account_hash_inited= false; /** @@ -145,10 +145,11 @@ C_MODE_END */ int init_account_hash(void) { - if (! account_hash_inited) + if ((! account_hash_inited) && (account_max > 0)) { lf_hash_init(&account_hash, sizeof(PFS_account*), LF_HASH_UNIQUE, 0, 0, account_hash_get_key, &my_charset_bin); + account_hash.size= account_max; account_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_account.h' --- a/storage/perfschema/pfs_account.h 2011-05-18 23:29:02 +0000 +++ b/storage/perfschema/pfs_account.h 2012-03-28 08:29:33 +0000 @@ -46,7 +46,7 @@ struct PFS_account_key uint m_key_length; }; -struct PFS_account : PFS_connection_slice +struct PFS_ALIGNED PFS_account : PFS_connection_slice { public: inline void init_refcount(void) @@ -115,6 +115,8 @@ extern ulong account_lost; extern PFS_account *account_array; +extern LF_HASH account_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_digest.cc' --- a/storage/perfschema/pfs_digest.cc 2012-02-28 15:57:52 +0000 +++ b/storage/perfschema/pfs_digest.cc 2012-03-28 08:29:33 +0000 @@ -70,7 +70,7 @@ bool flag_statements_digest= true; */ volatile uint32 digest_index= 1; -static LF_HASH digest_hash; +LF_HASH digest_hash; static bool digest_hash_inited= false; /** @@ -137,11 +137,12 @@ C_MODE_END */ int init_digest_hash(void) { - if (! digest_hash_inited) + if ((! digest_hash_inited) && (digest_max > 0)) { lf_hash_init(&digest_hash, sizeof(PFS_statements_digest_stat*), LF_HASH_UNIQUE, 0, 0, digest_hash_get_key, &my_charset_bin); + digest_hash.size= digest_max; digest_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_digest.h' --- a/storage/perfschema/pfs_digest.h 2012-02-28 15:57:52 +0000 +++ b/storage/perfschema/pfs_digest.h 2012-03-28 08:29:33 +0000 @@ -44,7 +44,7 @@ struct PFS_digest_hash }; /** A statement digest stat record. */ -struct PFS_statements_digest_stat +struct PFS_ALIGNED PFS_statements_digest_stat { /** Digest MD5 Hash. @@ -218,4 +218,6 @@ inline void store_token_identifier(PSI_d } } +extern LF_HASH digest_hash; + #endif === modified file 'storage/perfschema/pfs_engine_table.cc' --- a/storage/perfschema/pfs_engine_table.cc 2012-02-28 14:40:36 +0000 +++ b/storage/perfschema/pfs_engine_table.cc 2012-03-28 08:29:33 +0000 @@ -1330,12 +1330,78 @@ bool pfs_show_status(handlerton *hton, T name= "events_statements_summary_by_digest.memory"; size= digest_max * sizeof(PFS_statements_digest_stat); total_memory+= size; - break; + break; + + case 137: + name= "(account_hash).count"; + size= account_hash.count; + break; + case 138: + name= "(account_hash).size"; + size= account_hash.size; + break; + case 139: + name= "(digest_hash).count"; + size= digest_hash.count; + break; + case 140: + name= "(digest_hash).size"; + size= digest_hash.size; + break; + case 141: + name= "(filename_hash).count"; + size= filename_hash.count; + break; + case 142: + name= "(filename_hash).size"; + size= filename_hash.size; + break; + case 143: + name= "(host_hash).count"; + size= host_hash.count; + break; + case 144: + name= "(host_hash).size"; + size= host_hash.size; + break; + case 145: + name= "(setup_actor_hash).count"; + size= setup_actor_hash.count; + break; + case 146: + name= "(setup_actor_hash).size"; + size= setup_actor_hash.size; + break; + case 147: + name= "(setup_object_hash).count"; + size= setup_object_hash.count; + break; + case 148: + name= "(setup_object_hash).size"; + size= setup_object_hash.size; + break; + case 149: + name= "(table_share_hash).count"; + size= table_share_hash.count; + break; + case 150: + name= "(table_share_hash).size"; + size= table_share_hash.size; + break; + case 151: + name= "(user_hash).count"; + size= user_hash.count; + break; + case 152: + name= "(user_hash).size"; + size= user_hash.size; + break; + /* This case must be last, for aggregation in total_memory. */ - case 137: + case 153: name= "performance_schema.memory"; size= total_memory; /* This will fail if something is not advertised here */ === modified file 'storage/perfschema/pfs_global.cc' --- a/storage/perfschema/pfs_global.cc 2011-08-19 15:20:56 +0000 +++ b/storage/perfschema/pfs_global.cc 2012-03-28 08:29:33 +0000 @@ -25,6 +25,7 @@ #include #include +#include #ifdef __WIN__ #include @@ -45,10 +46,19 @@ void *pfs_malloc(size_t size, myf flags) DBUG_ASSERT(! pfs_initialized); DBUG_ASSERT(size > 0); - void *ptr= malloc(size); - if (likely(ptr != NULL)) - pfs_allocated_memory+= size; - if (likely((ptr != NULL) && (flags & MY_ZEROFILL))) + void *ptr; + +#ifdef HAVE_POSIX_MEMALIGN + if (unlikely(posix_memalign(& ptr, PFS_ALIGNEMENT, size))) + return NULL; +#else + ptr= malloc(size); + if (unlikely(ptr == NULL)) + return NULL; +#endif + + pfs_allocated_memory+= size; + if (flags & MY_ZEROFILL) memset(ptr, 0, size); return ptr; } === modified file 'storage/perfschema/pfs_global.h' --- a/storage/perfschema/pfs_global.h 2011-07-26 00:39:25 +0000 +++ b/storage/perfschema/pfs_global.h 2012-03-28 08:29:33 +0000 @@ -16,6 +16,9 @@ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H +#include "my_global.h" +#include "my_compiler.h" + /** @file storage/perfschema/pfs_global.h Miscellaneous global dependencies (declarations). @@ -26,6 +29,14 @@ extern bool pfs_initialized; /** Total memory allocated by the performance schema, in bytes. */ extern ulonglong pfs_allocated_memory; +#ifdef HAVE_POSIX_MEMALIGN +#define PFS_ALIGNEMENT 128 +#define PFS_ALIGNED MY_ALIGNED(PFS_ALIGNEMENT) +#else +#error "Really ? What platform is this ?" +#define PFS_ALIGNED +#endif /* HAVE_POSIX_MEMALIGN */ + void *pfs_malloc(size_t size, myf flags); /** === modified file 'storage/perfschema/pfs_host.cc' --- a/storage/perfschema/pfs_host.cc 2011-08-25 07:53:21 +0000 +++ b/storage/perfschema/pfs_host.cc 2012-03-28 08:29:33 +0000 @@ -42,7 +42,7 @@ static PFS_single_stat *host_instr_class static PFS_stage_stat *host_instr_class_stages_array= NULL; static PFS_statement_stat *host_instr_class_statements_array= NULL; -static LF_HASH host_hash; +LF_HASH host_hash; static bool host_hash_inited= false; /** @@ -146,10 +146,11 @@ C_MODE_END */ int init_host_hash(void) { - if (! host_hash_inited) + if ((! host_hash_inited) && (host_max > 0)) { lf_hash_init(&host_hash, sizeof(PFS_host*), LF_HASH_UNIQUE, 0, 0, host_hash_get_key, &my_charset_bin); + host_hash.size= host_max; host_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_host.h' --- a/storage/perfschema/pfs_host.h 2011-05-18 23:29:02 +0000 +++ b/storage/perfschema/pfs_host.h 2012-03-28 08:29:33 +0000 @@ -44,7 +44,7 @@ struct PFS_host_key uint m_key_length; }; -struct PFS_host : PFS_connection_slice +struct PFS_ALIGNED PFS_host : PFS_connection_slice { public: inline void init_refcount(void) @@ -105,6 +105,8 @@ extern ulong host_lost; extern PFS_host *host_array; +extern LF_HASH host_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_instr.cc' --- a/storage/perfschema/pfs_instr.cc 2012-03-23 10:09:24 +0000 +++ b/storage/perfschema/pfs_instr.cc 2012-03-28 08:29:33 +0000 @@ -159,7 +159,7 @@ static PFS_events_statements *thread_sta static PFS_events_statements *thread_statements_stack_array= NULL; /** Hash table for instrumented files. */ -static LF_HASH filename_hash; +LF_HASH filename_hash; /** True if filename_hash is initialized. */ static bool filename_hash_inited= false; @@ -491,10 +491,11 @@ C_MODE_END */ int init_file_hash(void) { - if (! filename_hash_inited) + if ((! filename_hash_inited) && (file_max > 0)) { lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE, 0, 0, filename_hash_get_key, &my_charset_bin); + filename_hash.size= file_max; filename_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_instr.h' --- a/storage/perfschema/pfs_instr.h 2012-03-23 10:09:24 +0000 +++ b/storage/perfschema/pfs_instr.h 2012-03-28 08:29:33 +0000 @@ -34,6 +34,8 @@ struct PFS_socket_class; #else #include #endif +#include "my_global.h" +#include "my_compiler.h" #include "pfs_lock.h" #include "pfs_stat.h" #include "pfs_instr_class.h" @@ -68,7 +70,7 @@ struct PFS_instr }; /** Instrumented mutex implementation. @see PSI_mutex. */ -struct PFS_mutex : public PFS_instr +struct PFS_ALIGNED PFS_mutex : public PFS_instr { /** Mutex identity, typically a pthread_mutex_t. */ const void *m_identity; @@ -91,7 +93,7 @@ struct PFS_mutex : public PFS_instr }; /** Instrumented rwlock implementation. @see PSI_rwlock. */ -struct PFS_rwlock : public PFS_instr +struct PFS_ALIGNED PFS_rwlock : public PFS_instr { /** RWLock identity, typically a pthread_rwlock_t. */ const void *m_identity; @@ -126,7 +128,7 @@ struct PFS_rwlock : public PFS_instr }; /** Instrumented cond implementation. @see PSI_cond. */ -struct PFS_cond : public PFS_instr +struct PFS_ALIGNED PFS_cond : public PFS_instr { /** Condition identity, typically a pthread_cond_t. */ const void *m_identity; @@ -139,7 +141,7 @@ struct PFS_cond : public PFS_instr }; /** Instrumented File and FILE implementation. @see PSI_file. */ -struct PFS_file : public PFS_instr +struct PFS_ALIGNED PFS_file : public PFS_instr { uint32 get_version() { return m_lock.get_version(); } @@ -159,7 +161,7 @@ struct PFS_file : public PFS_instr }; /** Instrumented table implementation. @see PSI_table. */ -struct PFS_table +struct PFS_ALIGNED PFS_table { /** True if table io instrumentation is enabled. @@ -262,7 +264,7 @@ private: }; /** Instrumented socket implementation. @see PSI_socket. */ -struct PFS_socket : public PFS_instr +struct PFS_ALIGNED PFS_socket : public PFS_instr { uint32 get_version() { return m_lock.get_version(); } @@ -384,7 +386,7 @@ private: /** Instrumented thread implementation. @see PSI_thread. */ -struct PFS_thread : PFS_connection_slice +struct PFS_ALIGNED PFS_thread : PFS_connection_slice { static PFS_thread* get_current_thread(void); @@ -637,6 +639,8 @@ void update_socket_derived_flags(); /** Update derived flags for all instruments. */ void update_instruments_derived_flags(); +extern LF_HASH filename_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_instr_class.cc' --- a/storage/perfschema/pfs_instr_class.cc 2012-03-23 10:09:24 +0000 +++ b/storage/perfschema/pfs_instr_class.cc 2012-03-28 08:29:33 +0000 @@ -165,7 +165,7 @@ enum_timer_name *class_timers[] = @sa table_share_hash_get_key @sa get_table_share_hash_pins */ -static LF_HASH table_share_hash; +LF_HASH table_share_hash; /** True if table_share_hash is initialized. */ static bool table_share_hash_inited= false; @@ -384,6 +384,7 @@ int init_table_share_hash(void) { lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE, 0, 0, table_share_hash_get_key, &my_charset_bin); + table_share_hash.size= table_share_max; table_share_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_instr_class.h' --- a/storage/perfschema/pfs_instr_class.h 2012-03-23 10:09:24 +0000 +++ b/storage/perfschema/pfs_instr_class.h 2012-03-28 08:29:33 +0000 @@ -16,7 +16,10 @@ #ifndef PFS_INSTR_CLASS_H #define PFS_INSTR_CLASS_H +#include "my_global.h" #include "mysql_com.h" /* NAME_LEN */ +#include "lf.h" +#include "pfs_global.h" /** @file storage/perfschema/pfs_instr_class.h @@ -166,7 +169,7 @@ struct PFS_instr_class struct PFS_mutex; /** Instrumentation metadata for a MUTEX. */ -struct PFS_mutex_class : public PFS_instr_class +struct PFS_ALIGNED PFS_mutex_class : public PFS_instr_class { /** Lock statistics. @@ -180,7 +183,7 @@ struct PFS_mutex_class : public PFS_inst struct PFS_rwlock; /** Instrumentation metadata for a RWLOCK. */ -struct PFS_rwlock_class : public PFS_instr_class +struct PFS_ALIGNED PFS_rwlock_class : public PFS_instr_class { /** Read lock statistics. @@ -199,7 +202,7 @@ struct PFS_rwlock_class : public PFS_ins struct PFS_cond; /** Instrumentation metadata for a COND. */ -struct PFS_cond_class : public PFS_instr_class +struct PFS_ALIGNED PFS_cond_class : public PFS_instr_class { /** Condition usage statistics. @@ -211,7 +214,7 @@ struct PFS_cond_class : public PFS_instr }; /** Instrumentation metadata of a thread. */ -struct PFS_thread_class +struct PFS_ALIGNED PFS_thread_class { /** True if this thread instrument is enabled. */ bool m_enabled; @@ -247,7 +250,7 @@ struct PFS_table_key }; /** Instrumentation metadata for a table share. */ -struct PFS_table_share +struct PFS_ALIGNED PFS_table_share { public: uint32 get_version() @@ -350,7 +353,7 @@ extern PFS_instr_class global_idle_class struct PFS_file; /** Instrumentation metadata for a file. */ -struct PFS_file_class : public PFS_instr_class +struct PFS_ALIGNED PFS_file_class : public PFS_instr_class { /** File usage statistics. */ PFS_file_stat m_file_stat; @@ -359,21 +362,21 @@ struct PFS_file_class : public PFS_instr }; /** Instrumentation metadata for a stage. */ -struct PFS_stage_class : public PFS_instr_class +struct PFS_ALIGNED PFS_stage_class : public PFS_instr_class { /** Stage usage statistics. */ PFS_stage_stat m_stage_stat; }; /** Instrumentation metadata for a statement. */ -struct PFS_statement_class : public PFS_instr_class +struct PFS_ALIGNED PFS_statement_class : public PFS_instr_class { }; struct PFS_socket; /** Instrumentation metadata for a socket. */ -struct PFS_socket_class : public PFS_instr_class +struct PFS_ALIGNED PFS_socket_class : public PFS_instr_class { /** Socket usage statistics. */ PFS_socket_stat m_socket_stat; @@ -494,6 +497,8 @@ void reset_socket_class_io(); /** Update derived flags for all table shares. */ void update_table_share_derived_flags(PFS_thread *thread); +extern LF_HASH table_share_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_setup_actor.cc' --- a/storage/perfschema/pfs_setup_actor.cc 2011-08-25 07:53:21 +0000 +++ b/storage/perfschema/pfs_setup_actor.cc 2012-03-28 08:29:33 +0000 @@ -43,7 +43,7 @@ ulong setup_actor_max; PFS_setup_actor *setup_actor_array= NULL; /** Hash table for setup_actor records. */ -static LF_HASH setup_actor_hash; +LF_HASH setup_actor_hash; /** True if @c setup_actor_hash is initialized. */ static bool setup_actor_hash_inited= false; @@ -100,10 +100,11 @@ C_MODE_END */ int init_setup_actor_hash(void) { - if (! setup_actor_hash_inited) + if ((! setup_actor_hash_inited) && (setup_actor_max > 0)) { lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE, 0, 0, setup_actor_hash_get_key, &my_charset_bin); + setup_actor_hash.size= setup_actor_max; setup_actor_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_setup_actor.h' --- a/storage/perfschema/pfs_setup_actor.h 2011-06-30 15:50:45 +0000 +++ b/storage/perfschema/pfs_setup_actor.h 2012-03-28 08:29:33 +0000 @@ -49,7 +49,7 @@ struct PFS_setup_actor_key }; /** A setup_actor record. */ -struct PFS_setup_actor +struct PFS_ALIGNED PFS_setup_actor { /** Internal lock. */ pfs_lock m_lock; @@ -92,6 +92,8 @@ extern ulong setup_actor_max; extern PFS_setup_actor *setup_actor_array; +extern LF_HASH setup_actor_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_setup_object.cc' --- a/storage/perfschema/pfs_setup_object.cc 2011-08-25 07:53:21 +0000 +++ b/storage/perfschema/pfs_setup_object.cc 2012-03-28 08:29:33 +0000 @@ -39,7 +39,7 @@ ulong setup_object_max; PFS_setup_object *setup_object_array= NULL; -static LF_HASH setup_object_hash; +LF_HASH setup_object_hash; static bool setup_object_hash_inited= false; /** @@ -95,10 +95,11 @@ C_MODE_END */ int init_setup_object_hash(void) { - if (! setup_object_hash_inited) + if ((! setup_object_hash_inited) && (setup_object_max > 0)) { lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE, 0, 0, setup_object_hash_get_key, &my_charset_bin); + setup_object_hash.size= setup_object_max; setup_object_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_setup_object.h' --- a/storage/perfschema/pfs_setup_object.h 2011-07-06 18:58:53 +0000 +++ b/storage/perfschema/pfs_setup_object.h 2012-03-28 08:29:33 +0000 @@ -45,7 +45,7 @@ struct PFS_setup_object_key }; /** A setup_object record. */ -struct PFS_setup_object +struct PFS_ALIGNED PFS_setup_object { enum_object_type get_object_type() { @@ -96,6 +96,8 @@ extern ulong setup_object_max; extern PFS_setup_object *setup_object_array; +extern LF_HASH setup_object_hash; + /** @} */ #endif === modified file 'storage/perfschema/pfs_user.cc' --- a/storage/perfschema/pfs_user.cc 2011-08-25 07:53:21 +0000 +++ b/storage/perfschema/pfs_user.cc 2012-03-28 08:29:33 +0000 @@ -42,7 +42,7 @@ static PFS_single_stat *user_instr_class static PFS_stage_stat *user_instr_class_stages_array= NULL; static PFS_statement_stat *user_instr_class_statements_array= NULL; -static LF_HASH user_hash; +LF_HASH user_hash; static bool user_hash_inited= false; /** @@ -146,10 +146,11 @@ C_MODE_END */ int init_user_hash(void) { - if (! user_hash_inited) + if ((! user_hash_inited) && (user_max > 0)) { lf_hash_init(&user_hash, sizeof(PFS_user*), LF_HASH_UNIQUE, 0, 0, user_hash_get_key, &my_charset_bin); + user_hash.size= user_max; user_hash_inited= true; } return 0; === modified file 'storage/perfschema/pfs_user.h' --- a/storage/perfschema/pfs_user.h 2011-05-18 23:29:02 +0000 +++ b/storage/perfschema/pfs_user.h 2012-03-28 08:29:33 +0000 @@ -44,7 +44,7 @@ struct PFS_user_key uint m_key_length; }; -struct PFS_user : public PFS_connection_slice +struct PFS_ALIGNED PFS_user : public PFS_connection_slice { public: inline void init_refcount(void) @@ -108,6 +108,8 @@ extern ulong user_lost; extern PFS_user *user_array; +extern LF_HASH user_hash; + /** @} */ #endif === modified file 'strings/ctype-bin.c' --- a/strings/ctype-bin.c 2011-12-09 21:08:37 +0000 +++ b/strings/ctype-bin.c 2012-03-28 08:29:33 +0000 @@ -299,15 +299,23 @@ void my_hash_sort_bin(const CHARSET_INFO const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; - + register ulong nr1_0; + register ulong nr2_0; + key+= len; - + + nr1_0= nr1[0]; + nr2_0= nr2[0]; + for (; pos < (uchar*) key ; pos++) { - nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint)*pos)) + (nr1[0] << 8); - nr2[0]+=3; + nr1_0^=(ulong) ((((uint) nr1_0 & 63)+nr2_0) * + ((uint)*pos)) + (nr1_0 << 8); + nr2_0+=3; } + + nr1[0]= nr1_0; + nr2[0]= nr2_0; } No bundle (reason: useless for push emails).