From: Mayank Prasad Date: November 18 2011 2:41pm Subject: bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3389 to 3390) WL#5767 List-Archive: http://lists.mysql.com/commits/142067 Message-Id: <201111181442.pAIEg2v4002150@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3390 Mayank Prasad 2011-11-18 WL#5767 Details: - Addressed review comments from Marc. - Added stmt stats in digest table - Added initial code for token->string conversion. added: storage/perfschema/ps_lex.h modified: storage/perfschema/pfs.cc storage/perfschema/pfs_digest.cc storage/perfschema/pfs_digest.h storage/perfschema/table_esms_by_digest.cc storage/perfschema/table_events_statements.cc storage/perfschema/table_helper.cc storage/perfschema/table_helper.h 3389 Mayank Prasad 2011-10-13 correction for compilation error for gcov modified: sql/sql_lex.cc storage/perfschema/pfs_digest.cc storage/perfschema/pfs_digest.h storage/perfschema/pfs_events_statements.h === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2011-10-11 07:35:41 +0000 +++ b/storage/perfschema/pfs.cc 2011-11-18 14:39:33 +0000 @@ -43,6 +43,9 @@ #include "my_md5.h" #include "pfs_digest.h" +#include "sql/sql_yacc.h" +#include "sql/lex_symbol.h" + /** @page PAGE_PERFORMANCE_SCHEMA The Performance Schema main page MySQL PERFORMANCE_SCHEMA implementation. @@ -4504,6 +4507,13 @@ static void end_statement_v1(PSI_stateme PFS_statement_stat *event_name_array; uint index= klass->m_event_name_index; PFS_statement_stat *stat; + + /* + Capture statement stats by digest. + */ + PFS_digest_storage *digest_storage; + PFS_statement_stat *digest_stat; + if (flags & STATE_FLAG_THREAD) { PFS_thread *thread= reinterpret_cast (state->m_thread); @@ -4542,6 +4552,23 @@ static void end_statement_v1(PSI_stateme } pfs->m_timer_end= timer_end; + + /* + Set digest stat. + */ + digest_storage= &pfs->m_digest_storage; + // Populate PFS_statements_digest_stat with computed digest information. + pfs->statement_digest_stat_ptr= + find_or_create_digest(thread, digest_storage); +/* + digest_storage->m_digest_hash.m_md5, + digest_storage->m_token_array, + digest_storage->m_token_count, + pfs->m_sqltext, + pfs->m_sqltext_length); +*/ + digest_stat= &(pfs->statement_digest_stat_ptr->m_stat); + if (flag_events_statements_history) insert_events_statements_history(thread, pfs); if (flag_events_statements_history_long) @@ -4553,6 +4580,27 @@ static void end_statement_v1(PSI_stateme } else { + PFS_events_statements *pfs= reinterpret_cast (state->m_statement); + DBUG_ASSERT(pfs != NULL); + + /* + Set digest stat. + */ + digest_storage= &pfs->m_digest_storage; + + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + // Populate PFS_statements_digest_stat with computed digest information. + pfs->statement_digest_stat_ptr= + find_or_create_digest(pfs_thread, digest_storage); +/* + digest_storage->m_digest_hash.m_md5, + digest_storage->m_token_array, + digest_storage->m_token_count, + pfs->m_sqltext, + pfs->m_sqltext_length); +*/ + digest_stat= &(pfs->statement_digest_stat_ptr->m_stat); + event_name_array= global_instr_class_statements_array; /* Aggregate to EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME */ stat= & event_name_array[index]; @@ -4586,6 +4634,32 @@ static void end_statement_v1(PSI_stateme stat->m_no_index_used+= state->m_no_index_used; stat->m_no_good_index_used+= state->m_no_good_index_used; + if (flags & STATE_FLAG_TIMED) + { + digest_stat->aggregate_value(wait_time); + } + else + { + digest_stat->aggregate_counted(); + } + + digest_stat->m_lock_time+= state->m_lock_time; + digest_stat->m_rows_sent+= state->m_rows_sent; + digest_stat->m_rows_examined+= state->m_rows_examined; + digest_stat->m_created_tmp_disk_tables+= state->m_created_tmp_disk_tables; + digest_stat->m_created_tmp_tables+= state->m_created_tmp_tables; + digest_stat->m_select_full_join+= state->m_select_full_join; + digest_stat->m_select_full_range_join+= state->m_select_full_range_join; + digest_stat->m_select_range+= state->m_select_range; + digest_stat->m_select_range_check+= state->m_select_range_check; + digest_stat->m_select_scan+= state->m_select_scan; + digest_stat->m_sort_merge_passes+= state->m_sort_merge_passes; + digest_stat->m_sort_range+= state->m_sort_range; + digest_stat->m_sort_rows+= state->m_sort_rows; + digest_stat->m_sort_scan+= state->m_sort_scan; + digest_stat->m_no_index_used+= state->m_no_index_used; + digest_stat->m_no_good_index_used+= state->m_no_good_index_used; + switch(da->status()) { case Diagnostics_area::DA_EMPTY: @@ -4814,7 +4888,7 @@ static struct PSI_digest_locker* digest_ /* Take out thread specific statement record. And then digest storage information for this statement from it. - */ + */ pfs= reinterpret_cast(statement_state->m_statement); digest_storage= &pfs->m_digest_storage; @@ -4825,7 +4899,7 @@ static struct PSI_digest_locker* digest_ digest_storage->m_token_array[--digest_storage->m_token_count]= 0; /* - Set digest_locker_state's digest storage pointer. + Set digest_locker_state's statement info pointer. */ state->m_statement= pfs; @@ -4892,8 +4966,6 @@ static void digest_end_v1(PSI_digest_loc pfs= reinterpret_cast(state->m_statement); digest_storage= &pfs->m_digest_storage; - //printf("\n statement_text = [%s]\n",pfs->m_sqltext); - /* Calculate MD5 Hash of the tokens recieved. */ @@ -4901,15 +4973,6 @@ static void digest_end_v1(PSI_digest_loc (uint) sizeof(digest_storage->m_token_array)); /* - Populate PFS_statements_digest_stat with computed digest information. - */ - PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); - pfs->statement_digest_stat_ptr= - search_insert_statement_digest(pfs_thread, - digest_storage->m_digest_hash.m_md5, - pfs->m_sqltext, - pfs->m_sqltext_length); - /* Not resetting digest_storage->m_token_count to 0 here as it will be done in digest_start. */ === modified file 'storage/perfschema/pfs_digest.cc' --- a/storage/perfschema/pfs_digest.cc 2011-10-13 10:49:15 +0000 +++ b/storage/perfschema/pfs_digest.cc 2011-11-18 14:39:33 +0000 @@ -23,6 +23,7 @@ #include "pfs_instr.h" #include "pfs_digest.h" #include "pfs_global.h" +#include "ps_lex.h" #include unsigned int statements_digest_size= 0; @@ -39,12 +40,20 @@ int digest_index= 1; static LF_HASH digest_hash; static bool digest_hash_inited= false; + +static void get_digest_text(char* digest_text, + unsigned int* token_array, + int token_count); +static int search_for_token(uint token,char* digest_text); + /** Initialize table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST. @param digest_sizing */ int init_digest(unsigned int statements_digest_sizing) { + unsigned int index; + /* TBD. Allocate memory for statements_digest_stat_array based on performance_schema_digests_size values @@ -57,6 +66,10 @@ int init_digest(unsigned int statements_ statements_digest_stat_array= PFS_MALLOC_ARRAY(statements_digest_size, PFS_statements_digest_stat, MYF(MY_ZEROFILL)); + + for (index= 0; index < statements_digest_size; index++) + statements_digest_stat_array[index].m_stat.reset(); + return (statements_digest_stat_array ? 0 : 1); } @@ -127,10 +140,14 @@ static LF_PINS* get_digest_hash_pins(PFS } PFS_statements_digest_stat* -search_insert_statement_digest(PFS_thread* thread, +find_or_create_digest(PFS_thread* thread, PFS_digest_storage* digest_storage) +/* unsigned char* hash_key, + unsigned int* token_array, + int token_count, char* digest_text, unsigned int digest_text_length) +*/ { /* get digest pin. */ LF_PINS *pins= get_digest_hash_pins(thread); @@ -138,6 +155,10 @@ search_insert_statement_digest(PFS_threa { return NULL; } + + unsigned char* hash_key= digest_storage->m_digest_hash.m_md5; + unsigned int* token_array= digest_storage->m_token_array; + int token_count= digest_storage->m_token_count; PFS_statements_digest_stat **entry; PFS_statements_digest_stat *pfs; @@ -169,9 +190,9 @@ search_insert_statement_digest(PFS_threa */ pfs= &statements_digest_stat_array[digest_index]; - /* Set digest text. */ - memcpy(pfs->m_digest_text, digest_text, digest_text_length); - pfs->m_digest_text_length= digest_text_length; + /* Calculate and set digest text. */ + get_digest_text(pfs->m_digest_text,token_array,token_count); + pfs->m_digest_text_length= strlen(pfs->m_digest_text); /* Set digest hash/LF Hash search key. */ memcpy(pfs->m_md5_hash.m_md5, hash_key, 16); @@ -218,3 +239,84 @@ void reset_esms_by_digest() /*TBD*/ } +/* + This function, iterates token array and updates digest_text. +*/ +static void get_digest_text(char* digest_text, + unsigned int* token_array, + int token_count) +{ + int i= 0,ret; + while(itok || token>end->tok) + { + *digest_text= (char)token; + *(digest_text+1)= '\0'; + return 1; + } + + /* + Apply Binary search on the symbol array. + */ + while((beg <= end) && (mid->tok != token)) + { + if (token < mid->tok) + { + end= mid-1; + sym_count= sym_count/2; + mid= beg+sym_count/2; + } + else + { + beg= mid+1; + sym_count= sym_count/2; + mid= beg+sym_count/2; + } + } + + if (mid->tok == token) + { + int len= strlen(mid->name); + strcpy(digest_text,mid->name); + *(digest_text+len)= ' '; + *(digest_text+len+1)= '\0'; + return len+1; + } + + /* + Token not found. This should never happen. + */ + return -1; +} + === modified file 'storage/perfschema/pfs_digest.h' --- a/storage/perfschema/pfs_digest.h 2011-10-13 10:49:15 +0000 +++ b/storage/perfschema/pfs_digest.h 2011-11-18 14:39:33 +0000 @@ -23,6 +23,7 @@ #include "pfs_column_types.h" #include "lf.h" +#include "pfs_stat.h" extern bool flag_statements_digest; struct PFS_thread; @@ -57,6 +58,11 @@ struct PFS_statements_digest_stat Digest hash/LF Hash search key. */ PFS_digest_hash m_md5_hash; + + /** + Statement stat. + */ + PFS_statement_stat m_stat; }; @@ -66,10 +72,15 @@ void cleanup_digest(); int init_digest_hash(void); void cleanup_digest_hash(void); -PFS_statements_digest_stat* search_insert_statement_digest(PFS_thread*, - unsigned char*, char*, - unsigned int); - +PFS_statements_digest_stat* find_or_create_digest(PFS_thread*, + PFS_digest_storage*); +/* + unsigned char*, + unsigned int*, + int, + char*, + unsigned int); +*/ void reset_esms_by_digest(); === added file 'storage/perfschema/ps_lex.h' --- a/storage/perfschema/ps_lex.h 1970-01-01 00:00:00 +0000 +++ b/storage/perfschema/ps_lex.h 2011-11-18 14:39:33 +0000 @@ -0,0 +1,610 @@ +/* + Draft file for symbol array. To be generated automatically at build time. + Will be removed it next push. +*/ +typedef struct + { + const char* name; + unsigned int tok; + } PS_SYMBOL; + +static PS_SYMBOL symbol[]={ + { "ABORT_SYM",258}, + { "ACCESSIBLE_SYM",259}, + { "ACTION",260}, + { "ADD",261}, + { "ADDDATE_SYM",262}, + { "AFTER_SYM",263}, + { "AGAINST",264}, + { "AGGREGATE_SYM",265}, + { "ALGORITHM_SYM",266}, + { "ALL",267}, + { "ALTER",268}, + { "ANALYZE_SYM",269}, + { "AND_AND_SYM",270}, + { "AND_SYM",271}, + { "ANY_SYM",272}, + { "AS",273}, + { "ASC",274}, + { "ASCII_SYM",275}, + { "ASENSITIVE_SYM",276}, + { "AT_SYM",277}, + { "AUTHORS_SYM",278}, + { "AUTOEXTEND_SIZE_SYM",279}, + { "AUTO_INC",280}, + { "AVG_ROW_LENGTH",281}, + { "AVG_SYM",282}, + { "BACKUP_SYM",283}, + { "BEFORE_SYM",284}, + { "BEGIN_SYM",285}, + { "BETWEEN_SYM",286}, + { "BIGINT",287}, + { "BINARY",288}, + { "BINLOG_SYM",289}, + { "BIN_NUM",290}, + { "BIT_AND",291}, + { "BIT_OR",292}, + { "BIT_SYM",293}, + { "BIT_XOR",294}, + { "BLOB_SYM",295}, + { "BLOCK_SYM",296}, + { "BOOLEAN_SYM",297}, + { "BOOL_SYM",298}, + { "BOTH",299}, + { "BTREE_SYM",300}, + { "BY",301}, + { "BYTE_SYM",302}, + { "CACHE_SYM",303}, + { "CALL_SYM",304}, + { "CASCADE",305}, + { "CASCADED",306}, + { "CASE_SYM",307}, + { "CAST_SYM",308}, + { "CATALOG_NAME_SYM",309}, + { "CHAIN_SYM",310}, + { "CHANGE",311}, + { "CHANGED",312}, + { "CHARSET",313}, + { "CHAR_SYM",314}, + { "CHECKSUM_SYM",315}, + { "CHECK_SYM",316}, + { "CIPHER_SYM",317}, + { "CLASS_ORIGIN_SYM",318}, + { "CLIENT_SYM",319}, + { "CLOSE_SYM",320}, + { "COALESCE",321}, + { "CODE_SYM",322}, + { "COLLATE_SYM",323}, + { "COLLATION_SYM",324}, + { "COLUMNS",325}, + { "COLUMN_SYM",326}, + { "COLUMN_NAME_SYM",327}, + { "COMMENT_SYM",328}, + { "COMMITTED_SYM",329}, + { "COMMIT_SYM",330}, + { "COMPACT_SYM",331}, + { "COMPLETION_SYM",332}, + { "COMPRESSED_SYM",333}, + { "CONCURRENT",334}, + { "CONDITION_SYM",335}, + { "CONNECTION_SYM",336}, + { "CONSISTENT_SYM",337}, + { "CONSTRAINT",338}, + { "CONSTRAINT_CATALOG_SYM",339}, + { "CONSTRAINT_NAME_SYM",340}, + { "CONSTRAINT_SCHEMA_SYM",341}, + { "CONTAINS_SYM",342}, + { "CONTEXT_SYM",343}, + { "CONTINUE_SYM",344}, + { "CONTRIBUTORS_SYM",345}, + { "CONVERT_SYM",346}, + { "COUNT_SYM",347}, + { "CPU_SYM",348}, + { "CREATE",349}, + { "CROSS",350}, + { "CUBE_SYM",351}, + { "CURDATE",352}, + { "CURRENT_USER",353}, + { "CURSOR_SYM",354}, + { "CURSOR_NAME_SYM",355}, + { "CURTIME",356}, + { "DATABASE",357}, + { "DATABASES",358}, + { "DATAFILE_SYM",359}, + { "DATA_SYM",360}, + { "DATETIME",361}, + { "DATE_ADD_INTERVAL",362}, + { "DATE_SUB_INTERVAL",363}, + { "DATE_SYM",364}, + { "DAY_HOUR_SYM",365}, + { "DAY_MICROSECOND_SYM",366}, + { "DAY_MINUTE_SYM",367}, + { "DAY_SECOND_SYM",368}, + { "DAY_SYM",369}, + { "DEALLOCATE_SYM",370}, + { "DECIMAL_NUM",371}, + { "DECIMAL_SYM",372}, + { "DECLARE_SYM",373}, + { "DEFAULT",374}, + { "DEFINER_SYM",375}, + { "DELAYED_SYM",376}, + { "DELAY_KEY_WRITE_SYM",377}, + { "DELETE_SYM",378}, + { "DESC",379}, + { "DESCRIBE",380}, + { "DES_KEY_FILE",381}, + { "DETERMINISTIC_SYM",382}, + { "DIRECTORY_SYM",383}, + { "DISABLE_SYM",384}, + { "DISCARD",385}, + { "DISK_SYM",386}, + { "DISTINCT",387}, + { "DIV_SYM",388}, + { "DOUBLE_SYM",389}, + { "DO_SYM",390}, + { "DROP",391}, + { "DUAL_SYM",392}, + { "DUMPFILE",393}, + { "DUPLICATE_SYM",394}, + { "DYNAMIC_SYM",395}, + { "EACH_SYM",396}, + { "ELSE",397}, + { "ELSEIF_SYM",398}, + { "ENABLE_SYM",399}, + { "ENCLOSED",400}, + { "END",401}, + { "ENDS_SYM",402}, + { "END_OF_INPUT",403}, + { "ENGINES_SYM",404}, + { "ENGINE_SYM",405}, + { "ENUM",406}, + { "EQ",407}, + { "EQUAL_SYM",408}, + { "ERROR_SYM",409}, + { "ERRORS",410}, + { "ESCAPED",411}, + { "ESCAPE_SYM",412}, + { "EVENTS_SYM",413}, + { "EVENT_SYM",414}, + { "EVERY_SYM",415}, + { "EXCHANGE_SYM",416}, + { "EXECUTE_SYM",417}, + { "EXISTS",418}, + { "EXIT_SYM",419}, + { "EXPANSION_SYM",420}, + { "EXTENDED_SYM",421}, + { "EXTENT_SIZE_SYM",422}, + { "EXTRACT_SYM",423}, + { "FALSE_SYM",424}, + { "FAST_SYM",425}, + { "FAULTS_SYM",426}, + { "FETCH_SYM",427}, + { "FILE_SYM",428}, + { "FIRST_SYM",429}, + { "FIXED_SYM",430}, + { "FLOAT_NUM",431}, + { "FLOAT_SYM",432}, + { "FLUSH_SYM",433}, + { "FORCE_SYM",434}, + { "FOREIGN",435}, + { "FOR_SYM",436}, + { "FOUND_SYM",437}, + { "FROM",438}, + { "FULL",439}, + { "FULLTEXT_SYM",440}, + { "FUNCTION_SYM",441}, + { "GE",442}, + { "GENERAL",443}, + { "GEOMETRYCOLLECTION",444}, + { "GEOMETRY_SYM",445}, + { "GET_FORMAT",446}, + { "GLOBAL_SYM",447}, + { "GRANT",448}, + { "GRANTS",449}, + { "GROUP_SYM",450}, + { "GROUP_CONCAT_SYM",451}, + { "GT_SYM",452}, + { "HANDLER_SYM",453}, + { "HASH_SYM",454}, + { "HAVING",455}, + { "HELP_SYM",456}, + { "HEX_NUM",457}, + { "HIGH_PRIORITY",458}, + { "HOST_SYM",459}, + { "HOSTS_SYM",460}, + { "HOUR_MICROSECOND_SYM",461}, + { "HOUR_MINUTE_SYM",462}, + { "HOUR_SECOND_SYM",463}, + { "HOUR_SYM",464}, + { "IDENT",465}, + { "IDENTIFIED_SYM",466}, + { "IDENT_QUOTED",467}, + { "IF",468}, + { "IGNORE_SYM",469}, + { "IGNORE_SERVER_IDS_SYM",470}, + { "IMPORT",471}, + { "INDEXES",472}, + { "INDEX_SYM",473}, + { "INFILE",474}, + { "INITIAL_SIZE_SYM",475}, + { "INNER_SYM",476}, + { "INOUT_SYM",477}, + { "INSENSITIVE_SYM",478}, + { "INSERT",479}, + { "INSERT_METHOD",480}, + { "INSTALL_SYM",481}, + { "INTERVAL_SYM",482}, + { "INTO",483}, + { "INT_SYM",484}, + { "INVOKER_SYM",485}, + { "IN_SYM",486}, + { "IO_SYM",487}, + { "IPC_SYM",488}, + { "IS",489}, + { "ISOLATION",490}, + { "ISSUER_SYM",491}, + { "ITERATE_SYM",492}, + { "JOIN_SYM",493}, + { "KEYS",494}, + { "KEY_BLOCK_SIZE",495}, + { "KEY_SYM",496}, + { "KILL_SYM",497}, + { "LANGUAGE_SYM",498}, + { "LAST_SYM",499}, + { "LE",500}, + { "LEADING",501}, + { "LEAVES",502}, + { "LEAVE_SYM",503}, + { "LEFT",504}, + { "LESS_SYM",505}, + { "LEVEL_SYM",506}, + { "LEX_HOSTNAME",507}, + { "LIKE",508}, + { "LIMIT",509}, + { "LINEAR_SYM",510}, + { "LINES",511}, + { "LINESTRING",512}, + { "LIST_SYM",513}, + { "LOAD",514}, + { "LOCAL_SYM",515}, + { "LOCATOR_SYM",516}, + { "LOCKS_SYM",517}, + { "LOCK_SYM",518}, + { "LOGFILE_SYM",519}, + { "LOGS_SYM",520}, + { "LONGBLOB",521}, + { "LONGTEXT",522}, + { "LONG_NUM",523}, + { "LONG_SYM",524}, + { "LOOP_SYM",525}, + { "LOW_PRIORITY",526}, + { "LT",527}, + { "MASTER_BIND_SYM",528}, + { "MASTER_CONNECT_RETRY_SYM",529}, + { "MASTER_DELAY_SYM",530}, + { "MASTER_HOST_SYM",531}, + { "MASTER_LOG_FILE_SYM",532}, + { "MASTER_LOG_POS_SYM",533}, + { "MASTER_PASSWORD_SYM",534}, + { "MASTER_PORT_SYM",535}, + { "MASTER_RETRY_COUNT_SYM",536}, + { "MASTER_SERVER_ID_SYM",537}, + { "MASTER_SSL_CAPATH_SYM",538}, + { "MASTER_SSL_CA_SYM",539}, + { "MASTER_SSL_CERT_SYM",540}, + { "MASTER_SSL_CIPHER_SYM",541}, + { "MASTER_SSL_CRL_SYM",542}, + { "MASTER_SSL_CRLPATH_SYM",543}, + { "MASTER_SSL_KEY_SYM",544}, + { "MASTER_SSL_SYM",545}, + { "MASTER_SSL_VERIFY_SERVER_CERT_SYM",546}, + { "MASTER_SYM",547}, + { "MASTER_USER_SYM",548}, + { "MASTER_HEARTBEAT_PERIOD_SYM",549}, + { "MATCH",550}, + { "MAX_CONNECTIONS_PER_HOUR",551}, + { "MAX_QUERIES_PER_HOUR",552}, + { "MAX_ROWS",553}, + { "MAX_SIZE_SYM",554}, + { "MAX_SYM",555}, + { "MAX_UPDATES_PER_HOUR",556}, + { "MAX_USER_CONNECTIONS_SYM",557}, + { "MAX_VALUE_SYM",558}, + { "MEDIUMBLOB",559}, + { "MEDIUMINT",560}, + { "MEDIUMTEXT",561}, + { "MEDIUM_SYM",562}, + { "MEMORY_SYM",563}, + { "MERGE_SYM",564}, + { "MESSAGE_TEXT_SYM",565}, + { "MICROSECOND_SYM",566}, + { "MIGRATE_SYM",567}, + { "MINUTE_MICROSECOND_SYM",568}, + { "MINUTE_SECOND_SYM",569}, + { "MINUTE_SYM",570}, + { "MIN_ROWS",571}, + { "MIN_SYM",572}, + { "MODE_SYM",573}, + { "MODIFIES_SYM",574}, + { "MODIFY_SYM",575}, + { "MOD_SYM",576}, + { "MONTH_SYM",577}, + { "MULTILINESTRING",578}, + { "MULTIPOINT",579}, + { "MULTIPOLYGON",580}, + { "MUTEX_SYM",581}, + { "MYSQL_ERRNO_SYM",582}, + { "NAMES_SYM",583}, + { "NAME_SYM",584}, + { "NATIONAL_SYM",585}, + { "NATURAL",586}, + { "NCHAR_STRING",587}, + { "NCHAR_SYM",588}, + { "NDBCLUSTER_SYM",589}, + { "NE",590}, + { "NEG",591}, + { "NEW_SYM",592}, + { "NEXT_SYM",593}, + { "NODEGROUP_SYM",594}, + { "NONE_SYM",595}, + { "NOT2_SYM",596}, + { "NOT_SYM",597}, + { "NOW_SYM",598}, + { "NO_SYM",599}, + { "NO_WAIT_SYM",600}, + { "NO_WRITE_TO_BINLOG",601}, + { "NULL_SYM",602}, + { "NUM",603}, + { "NUMERIC_SYM",604}, + { "NVARCHAR_SYM",605}, + { "OFFSET_SYM",606}, + { "OLD_PASSWORD",607}, + { "ON",608}, + { "ONE_SHOT_SYM",609}, + { "ONE_SYM",610}, + { "OPEN_SYM",611}, + { "OPTIMIZE",612}, + { "OPTIONS_SYM",613}, + { "OPTION",614}, + { "OPTIONALLY",615}, + { "OR2_SYM",616}, + { "ORDER_SYM",617}, + { "OR_OR_SYM",618}, + { "OR_SYM",619}, + { "OUTER",620}, + { "OUTFILE",621}, + { "OUT_SYM",622}, + { "OWNER_SYM",623}, + { "PACK_KEYS_SYM",624}, + { "PAGE_SYM",625}, + { "PARAM_MARKER",626}, + { "PARSER_SYM",627}, + { "PARTIAL",628}, + { "PARTITION_SYM",629}, + { "PARTITIONS_SYM",630}, + { "PARTITIONING_SYM",631}, + { "PASSWORD",632}, + { "PHASE_SYM",633}, + { "PLUGINS_SYM",634}, + { "PLUGIN_SYM",635}, + { "POINT_SYM",636}, + { "POLYGON",637}, + { "PORT_SYM",638}, + { "POSITION_SYM",639}, + { "PRECISION",640}, + { "PREPARE_SYM",641}, + { "PRESERVE_SYM",642}, + { "PREV_SYM",643}, + { "PRIMARY_SYM",644}, + { "PRIVILEGES",645}, + { "PROCEDURE_SYM",646}, + { "PROCESS",647}, + { "PROCESSLIST_SYM",648}, + { "PROFILE_SYM",649}, + { "PROFILES_SYM",650}, + { "PROXY_SYM",651}, + { "PURGE",652}, + { "QUARTER_SYM",653}, + { "QUERY_SYM",654}, + { "QUICK",655}, + { "RANGE_SYM",656}, + { "READS_SYM",657}, + { "READ_ONLY_SYM",658}, + { "READ_SYM",659}, + { "READ_WRITE_SYM",660}, + { "REAL",661}, + { "REBUILD_SYM",662}, + { "RECOVER_SYM",663}, + { "REDOFILE_SYM",664}, + { "REDO_BUFFER_SIZE_SYM",665}, + { "REDUNDANT_SYM",666}, + { "REFERENCES",667}, + { "REGEXP",668}, + { "RELAY",669}, + { "RELAYLOG_SYM",670}, + { "RELAY_LOG_FILE_SYM",671}, + { "RELAY_LOG_POS_SYM",672}, + { "RELAY_THREAD",673}, + { "RELEASE_SYM",674}, + { "RELOAD",675}, + { "REMOVE_SYM",676}, + { "RENAME",677}, + { "REORGANIZE_SYM",678}, + { "REPAIR",679}, + { "REPEATABLE_SYM",680}, + { "REPEAT_SYM",681}, + { "REPLACE",682}, + { "REPLICATION",683}, + { "REQUIRE_SYM",684}, + { "RESET_SYM",685}, + { "RESIGNAL_SYM",686}, + { "RESOURCES",687}, + { "RESTORE_SYM",688}, + { "RESTRICT",689}, + { "RESUME_SYM",690}, + { "RETURNS_SYM",691}, + { "RETURN_SYM",692}, + { "REVERSE_SYM",693}, + { "REVOKE",694}, + { "RIGHT",695}, + { "ROLLBACK_SYM",696}, + { "ROLLUP_SYM",697}, + { "ROUTINE_SYM",698}, + { "ROWS_SYM",699}, + { "ROW_FORMAT_SYM",700}, + { "ROW_SYM",701}, + { "RTREE_SYM",702}, + { "SAVEPOINT_SYM",703}, + { "SCHEDULE_SYM",704}, + { "SCHEMA_NAME_SYM",705}, + { "SECOND_MICROSECOND_SYM",706}, + { "SECOND_SYM",707}, + { "SECURITY_SYM",708}, + { "SELECT_SYM",709}, + { "SENSITIVE_SYM",710}, + { "SEPARATOR_SYM",711}, + { "SERIALIZABLE_SYM",712}, + { "SERIAL_SYM",713}, + { "SESSION_SYM",714}, + { "SERVER_SYM",715}, + { "SERVER_OPTIONS",716}, + { "SET",717}, + { "SET_VAR",718}, + { "SHARE_SYM",719}, + { "SHIFT_LEFT",720}, + { "SHIFT_RIGHT",721}, + { "SHOW",722}, + { "SHUTDOWN",723}, + { "SIGNAL_SYM",724}, + { "SIGNED_SYM",725}, + { "SIMPLE_SYM",726}, + { "SLAVE",727}, + { "SLOW",728}, + { "SMALLINT",729}, + { "SNAPSHOT_SYM",730}, + { "SOCKET_SYM",731}, + { "SONAME_SYM",732}, + { "SOUNDS_SYM",733}, + { "SOURCE_SYM",734}, + { "SPATIAL_SYM",735}, + { "SPECIFIC_SYM",736}, + { "SQLEXCEPTION_SYM",737}, + { "SQLSTATE_SYM",738}, + { "SQLWARNING_SYM",739}, + { "SQL_BIG_RESULT",740}, + { "SQL_BUFFER_RESULT",741}, + { "SQL_CACHE_SYM",742}, + { "SQL_CALC_FOUND_ROWS",743}, + { "SQL_NO_CACHE_SYM",744}, + { "SQL_SMALL_RESULT",745}, + { "SQL_SYM",746}, + { "SQL_THREAD",747}, + { "SSL_SYM",748}, + { "STARTING",749}, + { "STARTS_SYM",750}, + { "START_SYM",751}, + { "STATUS_SYM",752}, + { "STDDEV_SAMP_SYM",753}, + { "STD_SYM",754}, + { "STOP_SYM",755}, + { "STORAGE_SYM",756}, + { "STRAIGHT_JOIN",757}, + { "STRING_SYM",758}, + { "SUBCLASS_ORIGIN_SYM",759}, + { "SUBDATE_SYM",760}, + { "SUBJECT_SYM",761}, + { "SUBPARTITIONS_SYM",762}, + { "SUBPARTITION_SYM",763}, + { "SUBSTRING",764}, + { "SUM_SYM",765}, + { "SUPER_SYM",766}, + { "SUSPEND_SYM",767}, + { "SWAPS_SYM",768}, + { "SWITCHES_SYM",769}, + { "SYSDATE",770}, + { "TABLES",771}, + { "TABLESPACE",772}, + { "TABLE_REF_PRIORITY",773}, + { "TABLE_SYM",774}, + { "TABLE_CHECKSUM_SYM",775}, + { "TABLE_NAME_SYM",776}, + { "TEMPORARY",777}, + { "TEMPTABLE_SYM",778}, + { "TERMINATED",779}, + { "TEXT_STRING",780}, + { "TEXT_SYM",781}, + { "THAN_SYM",782}, + { "THEN_SYM",783}, + { "TIMESTAMP",784}, + { "TIMESTAMP_ADD",785}, + { "TIMESTAMP_DIFF",786}, + { "TIME_SYM",787}, + { "TINYBLOB",788}, + { "TINYINT",789}, + { "TINYTEXT",790}, + { "TO_SYM",791}, + { "TRAILING",792}, + { "TRANSACTION_SYM",793}, + { "TRIGGERS_SYM",794}, + { "TRIGGER_SYM",795}, + { "TRIM",796}, + { "TRUE_SYM",797}, + { "TRUNCATE_SYM",798}, + { "TYPES_SYM",799}, + { "TYPE_SYM",800}, + { "UDF_RETURNS_SYM",801}, + { "ULONGLONG_NUM",802}, + { "UNCOMMITTED_SYM",803}, + { "UNDEFINED_SYM",804}, + { "UNDERSCORE_CHARSET",805}, + { "UNDOFILE_SYM",806}, + { "UNDO_BUFFER_SIZE_SYM",807}, + { "UNDO_SYM",808}, + { "UNICODE_SYM",809}, + { "UNINSTALL_SYM",810}, + { "UNION_SYM",811}, + { "UNIQUE_SYM",812}, + { "UNKNOWN_SYM",813}, + { "UNLOCK_SYM",814}, + { "UNSIGNED",815}, + { "UNTIL_SYM",816}, + { "UPDATE_SYM",817}, + { "UPGRADE_SYM",818}, + { "USAGE",819}, + { "USER",820}, + { "USE_FRM",821}, + { "USE_SYM",822}, + { "USING",823}, + { "UTC_DATE_SYM",824}, + { "UTC_TIMESTAMP_SYM",825}, + { "UTC_TIME_SYM",826}, + { "VALUES",827}, + { "VALUE_SYM",828}, + { "VARBINARY",829}, + { "VARCHAR",830}, + { "VARIABLES",831}, + { "VARIANCE_SYM",832}, + { "VARYING",833}, + { "VAR_SAMP_SYM",834}, + { "VIEW_SYM",835}, + { "WAIT_SYM",836}, + { "WARNINGS",837}, + { "WEEK_SYM",838}, + { "WEIGHT_STRING_SYM",839}, + { "WHEN_SYM",840}, + { "WHERE",841}, + { "WHILE_SYM",842}, + { "WITH",843}, + { "WITH_CUBE_SYM",844}, + { "WITH_ROLLUP_SYM",845}, + { "WORK_SYM",846}, + { "WRAPPER_SYM",847}, + { "WRITE_SYM",848}, + { "X509_SYM",849}, + { "XA_SYM",850}, + { "XML_SYM",851}, + { "XOR",852}, + { "YEAR_MONTH_SYM",853}, + { "YEAR_SYM",854}, + { "ZEROFILL",855} +}; === modified file 'storage/perfschema/table_esms_by_digest.cc' --- a/storage/perfschema/table_esms_by_digest.cc 2011-10-04 12:16:34 +0000 +++ b/storage/perfschema/table_esms_by_digest.cc 2011-11-18 14:39:33 +0000 @@ -258,7 +258,13 @@ void table_esms_by_digest::make_row(PFS_ { m_row_exists= false; m_row.m_digest.make_row(digest_stat); - /* TODO Add code for statements stats */ + + /* + Get statements stats. + */ + time_normalizer *normalizer= time_normalizer::get(statement_timer); + m_row.m_stat.set(normalizer, & digest_stat->m_stat); + m_row_exists= true; } === modified file 'storage/perfschema/table_events_statements.cc' --- a/storage/perfschema/table_events_statements.cc 2011-09-15 12:22:08 +0000 +++ b/storage/perfschema/table_events_statements.cc 2011-11-18 14:39:33 +0000 @@ -365,15 +365,19 @@ void table_events_statements_common::mak */ if(statement->statement_digest_stat_ptr) { + MD5_HASH_TO_STRING(statement->statement_digest_stat_ptr->m_md5_hash.m_md5, + statement->statement_digest_stat_ptr->m_digest); + statement->statement_digest_stat_ptr->m_digest_length= 16; + memcpy(m_row.m_digest.m_digest, statement->statement_digest_stat_ptr->m_digest, - COL_DIGEST_SIZE); + statement->statement_digest_stat_ptr->m_digest_length); m_row.m_digest.m_digest_length= statement->statement_digest_stat_ptr->m_digest_length; memcpy(m_row.m_digest.m_digest_text, statement->statement_digest_stat_ptr->m_digest_text, - COL_DIGEST_TEXT_SIZE); + statement->statement_digest_stat_ptr->m_digest_text_length); m_row.m_digest.m_digest_text_length= statement->statement_digest_stat_ptr->m_digest_text_length; } === modified file 'storage/perfschema/table_helper.cc' --- a/storage/perfschema/table_helper.cc 2011-10-04 12:16:34 +0000 +++ b/storage/perfschema/table_helper.cc 2011-11-18 14:39:33 +0000 @@ -103,17 +103,7 @@ void PFS_account_row::set_field(uint ind int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs) { - /* - Write MD5 hash value in a string to be used as DIGEST for the statement. - */ - sprintf(pfs->m_digest, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x", - pfs->m_md5_hash.m_md5[0], pfs->m_md5_hash.m_md5[1], pfs->m_md5_hash.m_md5[2], - pfs->m_md5_hash.m_md5[3], pfs->m_md5_hash.m_md5[4], pfs->m_md5_hash.m_md5[5], - pfs->m_md5_hash.m_md5[6], pfs->m_md5_hash.m_md5[7], pfs->m_md5_hash.m_md5[8], - pfs->m_md5_hash.m_md5[9], pfs->m_md5_hash.m_md5[10], pfs->m_md5_hash.m_md5[11], - pfs->m_md5_hash.m_md5[12], pfs->m_md5_hash.m_md5[13], pfs->m_md5_hash.m_md5[14], - pfs->m_md5_hash.m_md5[15]); + MD5_HASH_TO_STRING(pfs->m_md5_hash.m_md5, pfs->m_digest); pfs->m_digest_length= 16; memcpy(m_digest, pfs->m_digest, sizeof(m_digest)); === modified file 'storage/perfschema/table_helper.h' --- a/storage/perfschema/table_helper.h 2011-09-13 11:29:39 +0000 +++ b/storage/perfschema/table_helper.h 2011-11-18 14:39:33 +0000 @@ -23,6 +23,18 @@ #include "pfs_instr_class.h" #include "pfs_digest.h" +#define MD5_HASH_TO_STRING(_hash, _str) \ + /* + Write MD5 hash value in a string to be used + as DIGEST for the statement. + */ \ + sprintf(_str, "%02x%02x%02x%02x%02x%02x%02x%02x" \ + "%02x%02x%02x%02x%02x%02x%02x%02x", \ + _hash[0], _hash[1], _hash[2], _hash[3], \ + _hash[4], _hash[5], _hash[6], _hash[7], \ + _hash[8], _hash[9], _hash[10], _hash[11], \ + _hash[12], _hash[13], _hash[14], _hash[15]) + struct PFS_host; struct PFS_user; struct PFS_account; No bundle (reason: useless for push emails).