3439 Mayank Prasad 2012-02-16
WL#5767 : Performance_schema, Statements Digest.
Details:
- Added code to distinguish between IDENT and IDENT_QUOTED tokens.
- Modified test case and result files accordingly.
modified:
mysql-test/suite/perfschema/include/digest_execution.inc
mysql-test/suite/perfschema/r/start_server_no_digests.result
mysql-test/suite/perfschema/r/statement_digest.result
mysql-test/suite/perfschema/r/statement_digest_consumers.result
mysql-test/suite/perfschema/r/statement_digest_consumers2.result
storage/perfschema/pfs_digest.cc
storage/perfschema/pfs_digest.h
3438 Marc Alff 2012-02-16
Code cleanup (dos2unix), test cleanup
modified:
mysql-test/suite/perfschema/r/statement_digest.result
mysql-test/suite/perfschema/r/statement_digest_consumers.result
mysql-test/suite/perfschema/r/statement_digest_long_query.result
storage/perfschema/pfs.cc
=== modified file 'mysql-test/suite/perfschema/include/digest_execution.inc'
--- a/mysql-test/suite/perfschema/include/digest_execution.inc 2012-02-12 21:48:28 +0000
+++ b/mysql-test/suite/perfschema/include/digest_execution.inc 2012-02-16 12:57:06 +0000
@@ -6,6 +6,7 @@
# SQL Queries to test normalizations.
# -----------------------------------
SELECT 1 FROM t1;
+SELECT 1 FROM `t1`;
SELECT 1,2 FROM t1;
SELECT 1, 2, 3, 4 FROM t1;
SELECT 1 FROM t2;
=== modified file 'mysql-test/suite/perfschema/r/start_server_no_digests.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_digests.result 2012-02-12 21:48:28 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_digests.result 2012-02-16 12:57:06 +0000
@@ -14,6 +14,8 @@ TRUNCATE TABLE performance_schema.events
####################################
SELECT 1 FROM t1;
1
+SELECT 1 FROM `t1`;
+1
SELECT 1,2 FROM t1;
1 2
SELECT 1, 2, 3, 4 FROM t1;
=== modified file 'mysql-test/suite/perfschema/r/statement_digest.result'
--- a/mysql-test/suite/perfschema/r/statement_digest.result 2012-02-16 11:50:07 +0000
+++ b/mysql-test/suite/perfschema/r/statement_digest.result 2012-02-16 12:57:06 +0000
@@ -14,6 +14,8 @@ TRUNCATE TABLE performance_schema.events
####################################
SELECT 1 FROM t1;
1
+SELECT 1 FROM `t1`;
+1
SELECT 1,2 FROM t1;
1 2
SELECT 1, 2, 3, 4 FROM t1;
@@ -66,6 +68,7 @@ SELECT digest, digest_text, count_star F
digest digest_text count_star
29570e463ee5c23d TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
043b89731c01112f SELECT ? FROM t1 1
+454eba8b93c9ca0a SELECT ? FROM `t1` 1
d7ee0ef93ad9fa8d SELECT ?, ... FROM t1 2
a9a476e33c41ccf6 SELECT ? FROM t2 1
e0ec2ba9bfa25ce9 SELECT ?, ... FROM t2 2
=== modified file 'mysql-test/suite/perfschema/r/statement_digest_consumers.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result 2012-02-16 11:50:07 +0000
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result 2012-02-16 12:57:06 +0000
@@ -28,6 +28,8 @@ TRUNCATE TABLE performance_schema.events
####################################
SELECT 1 FROM t1;
1
+SELECT 1 FROM `t1`;
+1
SELECT 1,2 FROM t1;
1 2
SELECT 1, 2, 3, 4 FROM t1;
@@ -80,6 +82,7 @@ SELECT digest, digest_text, count_star F
digest digest_text count_star
29570e463ee5c23d TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
043b89731c01112f SELECT ? FROM t1 1
+454eba8b93c9ca0a SELECT ? FROM `t1` 1
d7ee0ef93ad9fa8d SELECT ?, ... FROM t1 2
a9a476e33c41ccf6 SELECT ? FROM t2 1
e0ec2ba9bfa25ce9 SELECT ?, ... FROM t2 2
=== modified file 'mysql-test/suite/perfschema/r/statement_digest_consumers2.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers2.result 2012-02-12 21:48:28 +0000
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers2.result 2012-02-16 12:57:06 +0000
@@ -28,6 +28,8 @@ TRUNCATE TABLE performance_schema.events
####################################
SELECT 1 FROM t1;
1
+SELECT 1 FROM `t1`;
+1
SELECT 1,2 FROM t1;
1 2
SELECT 1, 2, 3, 4 FROM t1;
=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc 2012-02-11 20:33:44 +0000
+++ b/storage/perfschema/pfs_digest.cc 2012-02-16 12:57:06 +0000
@@ -339,9 +339,19 @@ void get_digest_text(char* digest_text,
{
/* All identifiers are printed with their name. */
case IDENT:
+ read_identifier(&digest_text, ¤t_byte,
+ token_array, (uint)available_bytes_to_write,1);
+ *digest_text= ' ';
+ digest_text++;
+ break;
case IDENT_QUOTED:
+ *digest_text= '`';
+ digest_text++;
+ available_bytes_to_write--;
read_identifier(&digest_text, ¤t_byte,
- token_array, (uint)available_bytes_to_write);
+ token_array, (uint)available_bytes_to_write,2);
+ *digest_text= '`';
+ digest_text++;
*digest_text= ' ';
digest_text++;
break;
=== modified file 'storage/perfschema/pfs_digest.h'
--- a/storage/perfschema/pfs_digest.h 2012-02-11 20:33:44 +0000
+++ b/storage/perfschema/pfs_digest.h 2012-02-16 12:57:06 +0000
@@ -135,7 +135,7 @@ inline void store_token(PFS_digest_stora
Function to read an identifier from token array.
*/
inline void read_identifier(char **dest, int *index, char *src,
- uint available_bytes_to_write)
+ uint available_bytes_to_write, uint offset)
{
uint length;
int remaining_bytes= PFS_MAX_DIGEST_STORAGE_SIZE - *index;
@@ -144,17 +144,18 @@ inline void read_identifier(char **dest,
Read ID's length.
Make sure that space to read ID's length from, is available.
*/
- if(remaining_bytes >= PFS_SIZE_OF_A_TOKEN)
+ if(remaining_bytes >= PFS_SIZE_OF_A_TOKEN &&
+ available_bytes_to_write > offset)
{
read_token(&length, index, src);
/*
Make sure not to overflow digest_text buffer while writing
identifier name.
- +/-1 is to make sure extra space for ' '.
+ +/-offset is to make sure extra space for ''' and ' '.
*/
- length= available_bytes_to_write >= length+1 ?
+ length= available_bytes_to_write >= length+offset ?
length :
- available_bytes_to_write-1;
+ available_bytes_to_write-offset;
strncpy(*dest, src + *index, length);
*index= *index + length;
*dest= *dest + length;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3438 to 3439) WL#5767 | Mayank Prasad | 16 Feb |