3410 Mayank Prasad 2011-12-29
WL#5767 : Performance Schema, Statement Digest
Details:
- implemented delete_all_rows function for
events_statements_summary_by_digest table.
- Modified test case to show digest iformation
for relevent queries only.
modified:
mysql-test/suite/perfschema/r/statements_digest.result
mysql-test/suite/perfschema/t/statements_digest.test
storage/perfschema/pfs_digest.cc
storage/perfschema/pfs_digest.h
storage/perfschema/table_esms_by_digest.cc
3409 Mayank Prasad 2011-12-28
WL#5767: Performance Schema, Statements Digest
Details:
- Addressed code review comment from Marc
- Added a test case for Statement Digest
added:
mysql-test/suite/perfschema/r/statements_digest.result
mysql-test/suite/perfschema/t/statements_digest.test
modified:
storage/perfschema/pfs_digest.cc
=== modified file 'mysql-test/suite/perfschema/r/statements_digest.result'
--- a/mysql-test/suite/perfschema/r/statements_digest.result 2011-12-28 15:56:31 +0000
+++ b/mysql-test/suite/perfschema/r/statements_digest.result 2011-12-29 12:08:32 +0000
@@ -13,6 +13,7 @@ create table t5(a int, b int, c int);
####################################
update performance_schema.setup_consumers
set enabled='YES' where name='statements_digest';
+truncate table performance_schema.events_statements_summary_by_digest;
select 1 from t1;
1
select 1,2 from t1;
@@ -40,23 +41,14 @@ insert into t5 values (1, 2, 3), (4, 5,
use performance_schema;
select DIGEST, DIGEST_TEXT, COUNT_STAR from events_statements_summary_by_digest;
DIGEST DIGEST_TEXT COUNT_STAR
-d653d1281782b5e6 SHOW SLAVE STATUS 1
-09f222399f1ff5cc SELECT # = # 1
-169ffc24ec704d77 CREATE DEFINER = ID @ ID PROCEDURE ID ( ) BEGIN IF ( ( SELECT COUNT ( * ) FROM ID . ID WHERE ENGINE = # AND ID = # ) = # ) THEN BEGIN BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END ; SELECT * FROM ID . ID WHERE ID = # ORDER BY NAME ; END ; SELECT * FROM ID . ID ORDER BY NAME ; SELECT * FROM ID . ID ORDER BY SYSTEM_USER , HOST ; SELECT * FROM ID . ID ORDER BY ID , ID , ID ; END ; END IF ; END 2
-4b76d252a0165dc8 SELECT ID ( ) LIKE # AS # 1
-9f5fb719d3e76d05 SELECT COUNT ( * ) FROM ID . ID WHERE ( ID = # OR ID = # ) AND ENGINE = # 1
-5057d979ab43ca33 CREATE SCHEMA ID 1
-e465b463797ef48f USE ID 2
-6bd5a0ecf894b7da CREATE TABLE ID ( ID INTEGER ) 2
-8ac419795130a28b CREATE TABLE ID ( ID INTEGER , ID INTEGER ) 2
-0e486b6cac8061e8 CREATE TABLE ID ( ID INTEGER , ID INTEGER , ID INTEGER ) 1
-5c8520ef69799e72 UPDATE ID . ID SET ID = # WHERE NAME = # 1
+cf5ae1f41d7f6cc0 TRUNCATE TABLE ID . ID 1
89098056976d499b SELECT # FROM ID 2
67d4fdbc91c296f6 SELECT #,# FROM ID 4
fcca45f32a578e33 INSERT INTO ID VALUES (#) 2
de4735d2ec38cc75 INSERT INTO ID VALUES (#,#) 3
aefa0a1987e628a2 INSERT INTO ID VALUES (#),(#) 2
078fc2c78d15c811 INSERT INTO ID VALUES (#,#),(#,#) 2
+e465b463797ef48f USE ID 1
####################################
# CLEANUP
####################################
=== modified file 'mysql-test/suite/perfschema/t/statements_digest.test'
--- a/mysql-test/suite/perfschema/t/statements_digest.test 2011-12-28 15:56:31 +0000
+++ b/mysql-test/suite/perfschema/t/statements_digest.test 2011-12-29 12:08:32 +0000
@@ -30,6 +30,7 @@ create table t5(a int, b int, c int);
update performance_schema.setup_consumers
set enabled='YES' where name='statements_digest';
+truncate table performance_schema.events_statements_summary_by_digest;
# SQL Queries to test normalizations
select 1 from t1;
select 1,2 from t1;
=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc 2011-12-28 15:56:31 +0000
+++ b/storage/perfschema/pfs_digest.cc 2011-12-29 12:08:32 +0000
@@ -41,7 +41,7 @@ bool flag_statements_digest= true;
Current index in Stat array where new record is to be inserted.
index 0 is reserved for "all else" case when entire array is full.
*/
-int digest_index= 1;
+unsigned int digest_index= 1;
static LF_HASH digest_hash;
static bool digest_hash_inited= false;
@@ -337,6 +337,7 @@ static void get_digest_text(char* digest
digest_text++;
}
}
+ *digest_text= '\0';
}
struct PSI_digest_locker* pfs_digest_start_v1(PSI_statement_locker *locker)
=== modified file 'storage/perfschema/pfs_digest.h'
--- a/storage/perfschema/pfs_digest.h 2011-12-08 14:30:18 +0000
+++ b/storage/perfschema/pfs_digest.h 2011-12-29 12:08:32 +0000
@@ -29,6 +29,8 @@
#define START_TOKEN_NUMBER 258
extern bool flag_statements_digest;
+extern unsigned int statements_digest_size;
+extern unsigned int digest_index;
struct PFS_thread;
/**
=== modified file 'storage/perfschema/table_esms_by_digest.cc'
--- a/storage/perfschema/table_esms_by_digest.cc 2011-12-07 12:16:49 +0000
+++ b/storage/perfschema/table_esms_by_digest.cc 2011-12-29 12:08:32 +0000
@@ -196,7 +196,27 @@ table_esms_by_digest::create(void)
int
table_esms_by_digest::delete_all_rows(void)
{
- /* TBD */
+ uint index;
+
+ /*
+ Reset statements_digest_stat_array.
+ */
+ for (index= 0; index < statements_digest_size; index++)
+ {
+ statements_digest_stat_array[index].m_digest[0]= '\0';
+ statements_digest_stat_array[index].m_digest_length= 0;
+ statements_digest_stat_array[index].m_digest_text[0]= '\0';;
+ statements_digest_stat_array[index].m_digest_text_length= 0;
+ statements_digest_stat_array[index].m_md5_hash.m_md5[0]= '\0';
+ statements_digest_stat_array[index].m_stat.reset();
+ }
+
+ /*
+ Reset index which indicates where the next calculated digest informationi
+ to be inserted in statements_digest_stat_array.
+ */
+ digest_index= 1;
+
return 0;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3409 to 3410) WL#5767 | Mayank Prasad | 29 Dec |