From: Mayank Prasad Date: February 15 2012 1:38pm Subject: bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3435 to 3436) WL#5767 List-Archive: http://lists.mysql.com/commits/142889 Message-Id: <201202151338.q1FDcPoH006698@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3436 Mayank Prasad 2012-02-15 WL#5767 : Performance Schema, Statements Digest. Details: - Added code to collect digest only for successful statements. - Modified table events_statements_summary_by_digest definition as per modifed specs. - Modified test result accordingly. modified: mysql-test/suite/perfschema/r/table_schema.result scripts/mysql_system_tables.sql storage/perfschema/pfs.cc 3435 Mayank Prasad 2012-02-14 WL#5767 : Performance Schema, Statements Digest. Details: - Fix failing test cases on gcov. modified: mysql-test/suite/perfschema/include/digest_setup.inc mysql-test/suite/perfschema/t/statement_digest_long_query.test === modified file 'mysql-test/suite/perfschema/r/table_schema.result' --- a/mysql-test/suite/perfschema/r/table_schema.result 2012-02-02 12:04:43 +0000 +++ b/mysql-test/suite/perfschema/r/table_schema.result 2012-02-15 13:37:08 +0000 @@ -245,8 +245,8 @@ def performance_schema events_statements def performance_schema events_statements_summary_by_digest SUM_SORT_SCAN 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references def performance_schema events_statements_summary_by_digest SUM_NO_INDEX_USED 25 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references def performance_schema events_statements_summary_by_digest SUM_NO_GOOD_INDEX_USED 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references -def performance_schema events_statements_summary_by_digest FIRST_SEEN 27 0000-00-00 00:00:00.000000 NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) select,insert,update,references -def performance_schema events_statements_summary_by_digest LAST_SEEN 28 0000-00-00 00:00:00.000000 NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) select,insert,update,references +def performance_schema events_statements_summary_by_digest FIRST_SEEN 27 0000-00-00 00:00:00 NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select,insert,update,references +def performance_schema events_statements_summary_by_digest LAST_SEEN 28 0000-00-00 00:00:00 NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select,insert,update,references def performance_schema events_statements_summary_by_host_by_event_name HOST 1 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references def performance_schema events_statements_summary_by_host_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references def performance_schema events_statements_summary_by_host_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references === modified file 'scripts/mysql_system_tables.sql' --- a/scripts/mysql_system_tables.sql 2012-02-02 12:04:43 +0000 +++ b/scripts/mysql_system_tables.sql 2012-02-15 13:37:08 +0000 @@ -1541,8 +1541,8 @@ SET @cmd="CREATE TABLE performance_schem "SUM_SORT_SCAN BIGINT unsigned not null," "SUM_NO_INDEX_USED BIGINT unsigned not null," "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null," - "FIRST_SEEN TIMESTAMP(6) default 0," - "LAST_SEEN TIMESTAMP(6) default 0" + "FIRST_SEEN TIMESTAMP(0) default 0," + "LAST_SEEN TIMESTAMP(0) default 0" ")ENGINE=PERFORMANCE_SCHEMA;"; === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2012-02-13 12:38:43 +0000 +++ b/storage/perfschema/pfs.cc 2012-02-15 13:37:08 +0000 @@ -4551,24 +4551,26 @@ static void end_statement_v1(PSI_stateme /* Aggregate to EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME */ stat= & event_name_array[index]; - /* Set digest stat. */ - digest_storage= &state->m_digest_state.m_digest_storage; - - /* - Calculate MD5 Hash of the tokens received. - */ - PFS_digest_hash digest_hash; - MY_MD5_HASH(digest_hash.m_md5, - (unsigned char *)digest_storage->m_token_array, - (uint) sizeof(digest_storage->m_token_array)); - - /* - Populate PFS_statements_digest_stat with computed digest information. - */ - digest_stat_ptr= find_or_create_digest(thread, digest_hash, digest_storage); - if(digest_stat_ptr) + /* Do not calculate digest if statement is not successful. */ + if(!da->is_error()) { - digest_stat= &(digest_stat_ptr->m_stat); + /* Set digest stat. */ + digest_storage= &state->m_digest_state.m_digest_storage; + + /* Calculate MD5 Hash of the tokens received. */ + PFS_digest_hash digest_hash; + MY_MD5_HASH(digest_hash.m_md5, + (unsigned char *)digest_storage->m_token_array, + (uint) sizeof(digest_storage->m_token_array)); + + /* + Populate PFS_statements_digest_stat with computed digest information. + */ + digest_stat_ptr= find_or_create_digest(thread, digest_hash, digest_storage); + if(digest_stat_ptr) + { + digest_stat= &(digest_stat_ptr->m_stat); + } } if (flags & STATE_FLAG_EVENT) @@ -4619,24 +4621,27 @@ static void end_statement_v1(PSI_stateme PFS_thread *thread= reinterpret_cast (state->m_thread); DBUG_ASSERT(thread != NULL); - /* Set digest stat. */ - digest_storage= &state->m_digest_state.m_digest_storage; - - /* - Calculate MD5 Hash of the tokens received. - */ - PFS_digest_hash digest_hash; - MY_MD5_HASH(digest_hash.m_md5, - (unsigned char *)digest_storage->m_token_array, - (uint) sizeof(digest_storage->m_token_array)); - - /* - Populate PFS_statements_digest_stat with computed digest information. - */ - digest_stat_ptr= find_or_create_digest(thread, digest_hash, digest_storage); - if(digest_stat_ptr) + /* Do not calculate digest if statement is not successful. */ + if(!da->is_error()) { - digest_stat= &(digest_stat_ptr->m_stat); + /* Set digest stat. */ + digest_storage= &state->m_digest_state.m_digest_storage; + + /* Calculate MD5 Hash of the tokens received. */ + PFS_digest_hash digest_hash; + MY_MD5_HASH(digest_hash.m_md5, + (unsigned char *)digest_storage->m_token_array, + (uint) sizeof(digest_storage->m_token_array)); + + /* + Populate PFS_statements_digest_stat with computed digest information. + */ + digest_stat_ptr= find_or_create_digest(thread, digest_hash, + digest_storage); + if(digest_stat_ptr) + { + digest_stat= &(digest_stat_ptr->m_stat); + } } event_name_array= global_instr_class_statements_array; No bundle (reason: useless for push emails).