3438 Mayank Prasad 2012-02-10
WL#5767 : Performance Schema, Statements Digest
Details:
- Added new and modified existing test cases.
added:
mysql-test/include/digest_cleanup.inc
mysql-test/include/digest_execution.inc
mysql-test/include/digest_setup.inc
mysql-test/suite/perfschema/r/statement_digest_consumers2.result
mysql-test/suite/perfschema/t/statement_digest_consumers-master.opt
mysql-test/suite/perfschema/t/statement_digest_consumers.test
mysql-test/suite/perfschema/t/statement_digest_consumers2-master.opt
mysql-test/suite/perfschema/t/statement_digest_consumers2.test
modified:
mysql-test/suite/perfschema/r/start_server_no_digests.result
mysql-test/suite/perfschema/r/statements_digest.result
mysql-test/suite/perfschema/t/disabled.def
mysql-test/suite/perfschema/t/start_server_no_digests.test
mysql-test/suite/perfschema/t/statements_digest.test
3437 Marc Alff 2012-02-09
Revised the add_token interface
modified:
include/mysql/psi/psi.h
include/mysql/psi/psi_abi_v0.h.pp
include/mysql/psi/psi_abi_v1.h.pp
include/mysql/psi/psi_abi_v2.h.pp
mysys/psi_noop.c
sql/sql_lex.cc
storage/perfschema/pfs_digest.cc
storage/perfschema/pfs_digest.h
=== added file 'mysql-test/include/digest_cleanup.inc'
--- a/mysql-test/include/digest_cleanup.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/digest_cleanup.inc 2012-02-10 10:13:58 +0000
@@ -0,0 +1,11 @@
+--echo ####################################
+--echo # CLEANUP
+--echo ####################################
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+drop table if exists t4;
+drop table if exists t5;
+drop database if exists statements_digest;
+--enable_warnings
=== added file 'mysql-test/include/digest_execution.inc'
--- a/mysql-test/include/digest_execution.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/digest_execution.inc 2012-02-10 10:13:58 +0000
@@ -0,0 +1,80 @@
+--echo ####################################
+--echo # EXECUTION
+--echo ####################################
+
+# -----------------------------------
+# SQL Queries to test normalizations.
+# -----------------------------------
+select 1 from t1;
+select 1,2 from t1;
+select 1, 2, 3, 4 from t1;
+select 1 from t2;
+select 1,2 from t2;
+select 1, 2, 3, 4 from t2;
+
+# (NUM) => (#)
+insert into t1 values (1);
+insert into t2 values (1);
+
+# (NUM,NUM) => (#,#)
+insert into t3 values (1, 2);
+insert into t4 values (1, 2);
+# (NUM,NUM,NUM) => (#,#)
+insert into t5 values (1, 2, 3);
+
+# (NUM),(NUM) => (#),(#)
+insert into t1 values (1), (2), (3);
+# (NUM),(NUM),(NUM) => (#),(#)
+insert into t1 values (1), (2), (3), (4);
+
+# (NUM,NUM),(NUM,NUM) => (#,#),(#,#)
+insert into t3 values (1, 2), (3, 4), (5, 6);
+# (NUM,NUM,NUM),(NUM,NUM,NUM),(NUM,NUM,NUM) => (#,#),(#,#)
+insert into t5 values (1, 2, 3), (4, 5, 6), (7, 8, 9);
+
+# -----------------------------------------------------------------------
+# Test case for handling spaces in statement.
+# -----------------------------------------------------------------------
+
+SELECT 1 + 1;
+
+# -----------------------------------------------------------------------
+# Test case for handling comments.
+# -----------------------------------------------------------------------
+
+# comment starting with "--"
+# TODO : SELECT 1; -- This comment continues to the end of line
+# comment starting from "#"
+SELECT 1; # This comment continues to the end of line
+
+# Inline comment
+SELECT 1 /* This is an inline comment */ + 1;
+
+# Multiple line comments
+ SELECT 1+
+ /*
+ this is a
+ multiple-line comment
+ */
+ 1;
+
+
+# -----------------------------------------------------------------------
+# Tests to show how the digest behaves with tokens that can have multiple
+# names (such as DATABASE = "DATABASE" or "SCHEMA", SUBSTRING, STD_SYM,
+# VARIANCE_SYM ... )
+# -----------------------------------------------------------------------
+
+--disable_warnings
+create schema statements_digest_temp;
+drop schema statements_digest_temp;
+create database statements_digest_temp;
+drop database statements_digest_temp;
+# TODO : add more
+--enable_warnings
+
+# -----------------------------------------------------------------------
+# Tests to show how the digest tables behaves when it is full (special NULL
+# entry)
+# -----------------------------------------------------------------------
+# TODO:
=== added file 'mysql-test/include/digest_setup.inc'
--- a/mysql-test/include/digest_setup.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/digest_setup.inc 2012-02-10 10:13:58 +0000
@@ -0,0 +1,18 @@
+--echo ####################################
+--echo # SETUP
+--echo ####################################
+# Database setup
+--disable_warnings
+create database statements_digest;
+--enable_warnings
+use statements_digest;
+
+# Table set up for queries
+--disable_warnings
+create table t1(a int);
+create table t2(a int);
+create table t3(a int, b int);
+create table t4(a int, b int);
+create table t5(a int, b int, c int);
+--enable_warnings
+
=== modified file 'mysql-test/suite/perfschema/r/start_server_no_digests.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_digests.result 2012-01-17 10:15:06 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_digests.result 2012-02-10 10:13:58 +0000
@@ -8,12 +8,10 @@ create table t2(a int);
create table t3(a int, b int);
create table t4(a int, b int);
create table t5(a int, b int, c int);
+truncate table performance_schema.events_statements_summary_by_digest;
####################################
# EXECUTION
####################################
-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;
@@ -64,13 +62,11 @@ drop database statements_digest_temp;
####################################
# QUERYING PS STATEMENT DIGEST
####################################
-use performance_schema;
-select DIGEST, DIGEST_TEXT, COUNT_STAR from events_statements_summary_by_digest;
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
DIGEST DIGEST_TEXT COUNT_STAR
####################################
# CLEANUP
####################################
-use statements_digest;
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
=== added file 'mysql-test/suite/perfschema/r/statement_digest_consumers2.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers2.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers2.result 2012-02-10 10:13:58 +0000
@@ -0,0 +1,93 @@
+####################################
+# SETUP
+####################################
+create database statements_digest;
+use statements_digest;
+create table t1(a int);
+create table t2(a int);
+create table t3(a int, b int);
+create table t4(a int, b int);
+create table t5(a int, b int, c int);
+select * from performance_schema.setup_consumers;
+NAME ENABLED
+events_stages_current YES
+events_stages_history YES
+events_stages_history_long YES
+events_statements_current YES
+events_statements_history YES
+events_statements_history_long YES
+events_waits_current YES
+events_waits_history YES
+events_waits_history_long YES
+global_instrumentation YES
+thread_instrumentation YES
+statements_digest NO
+truncate table performance_schema.events_statements_summary_by_digest;
+####################################
+# EXECUTION
+####################################
+select 1 from t1;
+1
+select 1,2 from t1;
+1 2
+select 1, 2, 3, 4 from t1;
+1 2 3 4
+select 1 from t2;
+1
+select 1,2 from t2;
+1 2
+select 1, 2, 3, 4 from t2;
+1 2 3 4
+insert into t1 values (1);
+insert into t2 values (1);
+insert into t3 values (1, 2);
+insert into t4 values (1, 2);
+insert into t5 values (1, 2, 3);
+insert into t1 values (1), (2), (3);
+insert into t1 values (1), (2), (3), (4);
+insert into t3 values (1, 2), (3, 4), (5, 6);
+insert into t5 values (1, 2, 3), (4, 5, 6), (7, 8, 9);
+SELECT 1 + 1;
+1 + 1
+2
+SELECT 1;
+1
+1
+SELECT 1 /* This is an inline comment */ + 1;
+1 /* This is an inline comment */ + 1
+2
+SELECT 1+
+/*
+this is a
+multiple-line comment
+*/
+1;
+1+
+/*
+this is a
+multiple-line comment
+*/
+1
+2
+create schema statements_digest_temp;
+drop schema statements_digest_temp;
+create database statements_digest_temp;
+drop database statements_digest_temp;
+####################################
+# QUERYING PS STATEMENT DIGEST
+####################################
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
+DIGEST DIGEST_TEXT COUNT_STAR
+NULL NULL 0
+select DIGEST, DIGEST_TEXT from performance_schema.events_statements_current;
+DIGEST DIGEST_TEXT
+NULL NULL
+####################################
+# CLEANUP
+####################################
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+drop table if exists t4;
+drop table if exists t5;
+drop database if exists statements_digest;
=== modified file 'mysql-test/suite/perfschema/r/statements_digest.result'
--- a/mysql-test/suite/perfschema/r/statements_digest.result 2012-02-08 11:51:37 +0000
+++ b/mysql-test/suite/perfschema/r/statements_digest.result 2012-02-10 10:13:58 +0000
@@ -8,12 +8,10 @@ create table t2(a int);
create table t3(a int, b int);
create table t4(a int, b int);
create table t5(a int, b int, c int);
+truncate table performance_schema.events_statements_summary_by_digest;
####################################
# EXECUTION
####################################
-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;
@@ -64,8 +62,7 @@ drop database statements_digest_temp;
####################################
# QUERYING PS STATEMENT DIGEST
####################################
-use performance_schema;
-select DIGEST, DIGEST_TEXT, COUNT_STAR from events_statements_summary_by_digest;
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
DIGEST DIGEST_TEXT COUNT_STAR
NULL NULL 0
bb399912758e2135 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
@@ -85,11 +82,9 @@ edc61a0866ec47da INSERT INTO t5 VALUES (
a68272fa2b30c2e3 SELECT ? 1
49d23ec9aebe975b CREATE SCHEMA statements_digest_temp 2
d42c9738d3d96889 DROP SCHEMA statements_digest_temp 2
-33c8d4d29d3c02f3 USE performance_schema 1
####################################
# CLEANUP
####################################
-use statements_digest;
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
=== modified file 'mysql-test/suite/perfschema/t/disabled.def'
--- a/mysql-test/suite/perfschema/t/disabled.def 2011-11-16 15:31:08 +0000
+++ b/mysql-test/suite/perfschema/t/disabled.def 2012-02-10 10:13:58 +0000
@@ -9,3 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+statement_digest_consumers : Mayank, working on it.
=== modified file 'mysql-test/suite/perfschema/t/start_server_no_digests.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_digests.test 2012-01-17 10:15:06 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_digests.test 2012-02-10 10:13:58 +0000
@@ -7,6 +7,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
+
--source ./suite/perfschema/t/statements_digest.test
# Expect no digest
=== added file 'mysql-test/suite/perfschema/t/statement_digest_consumers-master.opt'
--- a/mysql-test/suite/perfschema/t/statement_digest_consumers-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_digest_consumers-master.opt 2012-02-10 10:13:58 +0000
@@ -0,0 +1,2 @@
+--performance_schema_consumer_statements_digest=1
+--performance_schema_consumer_events_statements_current=0
=== added file 'mysql-test/suite/perfschema/t/statement_digest_consumers.test'
--- a/mysql-test/suite/perfschema/t/statement_digest_consumers.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_digest_consumers.test 2012-02-10 10:13:58 +0000
@@ -0,0 +1,34 @@
+# ----------------------------------------------------
+# Tests for the performance schema statement Digests.
+# ----------------------------------------------------
+
+# Test case to show behavior of statements digest in combination of different
+# consumers enabled/disabled
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Initial Setup for Digest
+--source include/digest_setup.inc
+
+# -----------------------------------------
+# Consumer State |
+# -----------------------------------------
+# statements_digest Disabled |
+# events_statement_current Enabled |
+# -----------------------------------------
+
+select * from performance_schema.setup_consumers;
+
+truncate table performance_schema.events_statements_summary_by_digest;
+
+# Executing queries
+--source include/digest_execution.inc
+
+--echo ####################################
+--echo # QUERYING PS STATEMENT DIGEST
+--echo ####################################
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
+
+# Cleanup for Digest
+--source include/digest_cleanup.inc
=== added file 'mysql-test/suite/perfschema/t/statement_digest_consumers2-master.opt'
--- a/mysql-test/suite/perfschema/t/statement_digest_consumers2-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_digest_consumers2-master.opt 2012-02-10 10:13:58 +0000
@@ -0,0 +1,2 @@
+--performance_schema_consumer_statements_digest=0
+--performance_schema_consumer_events_statements_current=1
=== added file 'mysql-test/suite/perfschema/t/statement_digest_consumers2.test'
--- a/mysql-test/suite/perfschema/t/statement_digest_consumers2.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_digest_consumers2.test 2012-02-10 10:13:58 +0000
@@ -0,0 +1,37 @@
+# ----------------------------------------------------
+# Tests for the performance schema statement Digests.
+# ----------------------------------------------------
+
+# Test case to show behavior of statements digest in combination of different
+# consumers enabled/disabled
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Initial Setup for Digest
+--source include/digest_setup.inc
+
+# -----------------------------------------
+# Consumer State |
+# -----------------------------------------
+# statements_digest Enabled |
+# events_statement_current Disabled |
+# global_implementation Disabled ? |
+# thread_implementation Disabled ? |
+# -----------------------------------------
+
+select * from performance_schema.setup_consumers;
+
+truncate table performance_schema.events_statements_summary_by_digest;
+
+# Executing queries
+--source include/digest_execution.inc
+
+--echo ####################################
+--echo # QUERYING PS STATEMENT DIGEST
+--echo ####################################
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
+select DIGEST, DIGEST_TEXT from performance_schema.events_statements_current;
+
+# Cleanup for Digest
+--source include/digest_cleanup.inc
=== modified file 'mysql-test/suite/perfschema/t/statements_digest.test'
--- a/mysql-test/suite/perfschema/t/statements_digest.test 2012-01-16 19:07:57 +0000
+++ b/mysql-test/suite/perfschema/t/statements_digest.test 2012-02-10 10:13:58 +0000
@@ -5,125 +5,18 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---echo ####################################
---echo # SETUP
---echo ####################################
-# Database setup
---disable_warnings
-create database statements_digest;
---enable_warnings
-use statements_digest;
-
-# Table set up for queries
---disable_warnings
-create table t1(a int);
-create table t2(a int);
-create table t3(a int, b int);
-create table t4(a int, b int);
-create table t5(a int, b int, c int);
---enable_warnings
-
---echo ####################################
---echo # EXECUTION
---echo ####################################
-# Enable statements_digest consumer
-update performance_schema.setup_consumers
- set enabled='YES' where name='statements_digest';
+# Initial Setup for Digest
+--source include/digest_setup.inc
truncate table performance_schema.events_statements_summary_by_digest;
-# -----------------------------------
-# SQL Queries to test normalizations.
-# -----------------------------------
-select 1 from t1;
-select 1,2 from t1;
-select 1, 2, 3, 4 from t1;
-select 1 from t2;
-select 1,2 from t2;
-select 1, 2, 3, 4 from t2;
-
-# (NUM) => (#)
-insert into t1 values (1);
-insert into t2 values (1);
-
-# (NUM,NUM) => (#,#)
-insert into t3 values (1, 2);
-insert into t4 values (1, 2);
-# (NUM,NUM,NUM) => (#,#)
-insert into t5 values (1, 2, 3);
-
-# (NUM),(NUM) => (#),(#)
-insert into t1 values (1), (2), (3);
-# (NUM),(NUM),(NUM) => (#),(#)
-insert into t1 values (1), (2), (3), (4);
-
-# (NUM,NUM),(NUM,NUM) => (#,#),(#,#)
-insert into t3 values (1, 2), (3, 4), (5, 6);
-# (NUM,NUM,NUM),(NUM,NUM,NUM),(NUM,NUM,NUM) => (#,#),(#,#)
-insert into t5 values (1, 2, 3), (4, 5, 6), (7, 8, 9);
-
-# -----------------------------------------------------------------------
-# Test case for handling spaces in statement.
-# -----------------------------------------------------------------------
-SELECT 1 + 1;
-
-# -----------------------------------------------------------------------
-# Test case for handling comments.
-# -----------------------------------------------------------------------
-
-# comment starting with "--"
-# TODO : SELECT 1; -- This comment continues to the end of line
-# comment starting from "#"
-SELECT 1; # This comment continues to the end of line
-
-# Inline comment
-SELECT 1 /* This is an inline comment */ + 1;
-
-# Multiple line comments
- SELECT 1+
- /*
- this is a
- multiple-line comment
- */
- 1;
-
-
-# -----------------------------------------------------------------------
-# Tests to show how the digest behaves with tokens that can have multiple
-# names (such as DATABASE = "DATABASE" or "SCHEMA", SUBSTRING, STD_SYM,
-# VARIANCE_SYM ... )
-# -----------------------------------------------------------------------
-
---disable_warnings
-create schema statements_digest_temp;
-drop schema statements_digest_temp;
-create database statements_digest_temp;
-drop database statements_digest_temp;
-# TODO : add more
---enable_warnings
-
-# -----------------------------------------------------------------------
-# Tests to show how the digest tables behaves when it is full (special NULL
-# entry)
-# -----------------------------------------------------------------------
-# TODO:
+# Executing queries
+--source include/digest_execution.inc
--echo ####################################
--echo # QUERYING PS STATEMENT DIGEST
--echo ####################################
+select DIGEST, DIGEST_TEXT, COUNT_STAR from performance_schema.events_statements_summary_by_digest;
-use performance_schema;
-select DIGEST, DIGEST_TEXT, COUNT_STAR from events_statements_summary_by_digest;
-
---echo ####################################
---echo # CLEANUP
---echo ####################################
-use statements_digest;
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
-drop table if exists t3;
-drop table if exists t4;
-drop table if exists t5;
-drop database if exists statements_digest;
---enable_warnings
+# Cleanup for Digest
+--source include/digest_cleanup.inc
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3437 to 3438) WL#5767 | Mayank Prasad | 10 Feb |