From 66dfd85cf4d55e6d87e8bb81b8fc8450eb9b3f67 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Jan 2007 17:15:10 -0500 Subject: Bug#24795: Add SHOW PROFILE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch contributed by Jeremy Cole. CLA received Oct 2006 by Kaj Arnö Add rudimentary query profiling support. libmysqld/Makefile.am: Add profile file to source list. sql/Makefile.am: Add profiling files to source and header lists. sql/ha_archive.cc: Macro-ized other discovered instances of setting proc_info. sql/ha_myisam.cc: Macroize setting thread-state info sql/item_func.cc: Macro-ized other discovered instances of setting proc_info. sql/lex.h: Add lexer info for profiling. sql/lock.cc: Macroize setting thread-state info sql/log_event.cc: Macro-ized other discovered instances of setting proc_info. sql/mysql_priv.h: Set constants for profiling. sql/repl_failsafe.cc: Macro-ized other discovered instances of setting proc_info. sql/slave.cc: Macro-ized other discovered instances of setting proc_info. sql/sp_head.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_base.cc: Macroize setting thread-state info --- Macro-ized other discovered instances of setting proc_info. sql/sql_cache.cc: Macroize setting thread-state info sql/sql_class.cc: Integrate profiling. sql/sql_class.h: Instantiate profiling object. sql/sql_delete.cc: Macroize setting thread-state info sql/sql_insert.cc: Macroize setting thread-state info --- Macro-ized other discovered instances of setting proc_info. sql/sql_lex.cc: Initialize profiling. sql/sql_lex.h: Define lex tokens and allocate space for profiling options. sql/sql_parse.cc: Integrate profiling. --- Macro-ized other discovered instances of setting proc_info. sql/sql_repl.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_select.cc: Macroize setting thread-state info. Clean up some lines. sql/sql_show.cc: Macro-ized other discovered instances of setting proc_info. --- Revert bad use of macro. sql/sql_table.cc: Macroize setting thread-state info sql/sql_update.cc: Macroize setting thread-state info sql/sql_view.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_yacc.yy: Add parser info for profiling. --- Fix new YACC shift/reduce conflict. (Now at 249.) mysql-test/r/profile.result: Test profiling code. --- A not-very-useful result. mysql-test/t/profile.test: Test profiling code. --- Test syntax, but not values of profiles code. sql/sql_profile.cc: Add profiling code. --- Add wishlist comment. sql/sql_profile.h: Add profiling code. --- Changed the value of the macro so that it's syntactically equivalent to a single statement. --- mysql-test/r/profile.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/profile.test | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 mysql-test/r/profile.result create mode 100644 mysql-test/t/profile.test (limited to 'mysql-test') diff --git a/mysql-test/r/profile.result b/mysql-test/r/profile.result new file mode 100644 index 00000000000..8a4db348445 --- /dev/null +++ b/mysql-test/r/profile.result @@ -0,0 +1,30 @@ +create table t1 ( +a int, +b int +); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (5,1), (6,null), (7, 4); +select sum(a) from t1; +select sum(a) from t1 group by b; +select sum(a) + sum(b) from t1 group by b; +select max(x) from (select sum(a) as x from t1 group by b) as teeone; +show profiles; +show profile for query 8; +show profile cpu, block io for query 8; +show profile cpu for query 8; +show profile cpu for query 9 limit 2 offset 2; +show profile cpu for query 10 limit 0; +show profile cpu for query 65534; +show profile memory; +show profile block io; +show profile context switches; +show profile page faults; +show profile ipc; +show profile swaps limit 1 offset 2; +show profile source; +show profile all for query 0 limit 0; +drop table t1; +End of 5.0 tests diff --git a/mysql-test/t/profile.test b/mysql-test/t/profile.test new file mode 100644 index 00000000000..4cf2a3aa92f --- /dev/null +++ b/mysql-test/t/profile.test @@ -0,0 +1,39 @@ + +create table t1 ( + a int, + b int +); +--disable_result_log +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (5,1), (6,null), (7, 4); +select sum(a) from t1; +select sum(a) from t1 group by b; +select sum(a) + sum(b) from t1 group by b; +select max(x) from (select sum(a) as x from t1 group by b) as teeone; + +# Merely verify that commands work. Checking values is impossible, right? +show profiles; +show profile for query 8; +show profile cpu, block io for query 8; +show profile cpu for query 8; +show profile cpu for query 9 limit 2 offset 2; +show profile cpu for query 10 limit 0; +show profile cpu for query 65534; +show profile memory; +show profile block io; +show profile context switches; +show profile page faults; +show profile ipc; +show profile swaps limit 1 offset 2; +show profile source; +show profile all for query 0 limit 0; +--enable_result_log + +drop table t1; + + +## +--echo End of 5.0 tests -- cgit v1.2.1 From 351b966462232060eb27288275508453406b6401 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Jan 2007 09:50:16 -0500 Subject: Bug#24822: Patch: uptime_since_flush_status Provide the number of seconds since flush as a new status variable named "Uptime_since_flush_status". --- Override the post-flush value, as a second could pass between the two statements. mysql-test/r/information_schema.result: Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. mysql-test/t/information_schema.test: Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. sql/mysql_priv.h: Add variable to hold previous flush time. sql/mysqld.cc: Add variable to hold previous flush time. Insert name for referring to it, and initialize the value. sql/sql_show.cc: Yield value of elapsed time since flush when asked. sql/structs.h: Add new show-flush-time to SHOW types enumeration. --- mysql-test/r/information_schema.result | 7 +++++++ mysql-test/t/information_schema.test | 13 ++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 21d7bfb1b21..d4fd536003a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1269,3 +1269,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY system NULL NULL NULL NULL 0 const row not found 2 DERIVED tables ALL NULL NULL NULL NULL 2 drop view v1; +show global status like "Uptime_%"; +Variable_name Value +Uptime_since_flush_status # +flush status; +show global status like "Uptime_%"; +Variable_name Value +Uptime_since_flush_status # diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 623ccee49e4..a4cf3b497be 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -971,9 +971,6 @@ SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT= DROP TABLE bug23037; DROP FUNCTION get_value; - - - # # Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash # @@ -987,4 +984,14 @@ explain select * from v1; explain select * from (select table_name from information_schema.tables) as a; drop view v1; +# +# Bug#24822: Patch: uptime_since_flush_status +# +--replace_column 2 # +show global status like "Uptime_%"; +flush status; +--replace_column 2 # +show global status like "Uptime_%"; # Almost certainly zero + + # End of 5.0 tests. -- cgit v1.2.1 From 607c224969df2aa13f6b236440e02713a18e6c34 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Feb 2007 10:03:08 -0500 Subject: Prevent bugs by making DBUG_* expressions syntactically equivalent to a single statement. --- Bug#24795: SHOW PROFILE Profiling is only partially functional on some architectures. Where there is no getrusage() system call, presently Null values are returned where it would be required. Notably, Windows needs some love applied to make it as useful. Syntax this adds: SHOW PROFILES SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n] where "n" is an integer and "types" is zero or many (comma-separated) of "CPU" "MEMORY" (not presently supported) "BLOCK IO" "CONTEXT SWITCHES" "PAGE FAULTS" "IPC" "SWAPS" "SOURCE" "ALL" It also adds a session variable (boolean) "profiling", set to "no" by default, and (integer) profiling_history_size, set to 15 by default. This patch abstracts setting THDs' "proc_info" behind a macro that can be used as a hook into the profiling code when profiling support is compiled in. All future code in this line should use that mechanism for setting thd->proc_info. --- Tests are now set to omit the statistics. --- Adds an Information_schema table, "profiling" for access to "show profile" data. --- Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795 into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community --- Fix merge problems. --- Fixed one bug in the query_source being NULL. Updated test results. --- Include more thorough profiling tests. Improve support for prepared statements. Use session-specific query IDs, starting at zero. --- Selecting from I_S.profiling is no longer quashed in profiling, as requested by Giuseppe. Limit the size of captured query text. No longer log queries that are zero length. BitKeeper/deleted/.del-profile.result: Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result BitKeeper/deleted/.del-profile.test: Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test BitKeeper/deleted/.del-sql_profile.cc: Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc BitKeeper/deleted/.del-sql_profile.h: Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h configure.in: Add a configure-time option to enable/disable query profiling. The default is enabled. include/my_dbug.h: DBUG_* statements should be syntactically equivalent to a single statement. myisam/mi_open.c: DBUG_* statements should be syntactically equivalent to a single statement. mysql-test/r/information_schema.result: Updated (re-recorded) tests that I missed somehow. I verified these for correctness. mysql-test/r/information_schema_db.result: Updated test results I missed. mysql-test/r/mysqlshow.result: Fix merge problems. ndb/src/ndbapi/DictCache.cpp: DBUG_* statements should be syntactically equivalent to a single statement. sql/ha_archive.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/ha_berkeley.cc: Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/ha_myisam.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/ha_myisammrg.cc: DBUG_* statements should be syntactically equivalent to a single statement. sql/ha_ndbcluster.cc: DBUG_* statements should be syntactically equivalent to a single statement. sql/item_cmpfunc.cc: DBUG_* statements should be syntactically equivalent to a single statement. sql/item_func.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/lock.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/log_event.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/mysql_priv.h: Use 64-bit constants for the 64-bit bit field. Add a new option bit for whether profiling is active or not. sql/mysqld.cc: Add semicolon to DBUG statement. Add a new system variable and set it. --- Set the minimum, which is zero and not 50. sql/repl_failsafe.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/set_var.cc: Make a new system global variable and session variable, to determine behavior of profiling. --- Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/set_var.h: The THD::options bit field is ulonglong, not ulong. sql/slave.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. --- Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/sp_head.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/sql_base.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. --- Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/sql_cache.cc: DBUG_* statements should be syntactically equivalent to a single statement. --- Fix merge problems. sql/sql_class.cc: Insert a pointer to the current thread in the profiling code. --- Manual merge, undoing first patch. --- Fix merge problems. sql/sql_class.h: Create a new system variable, profiling_history_size, and add a member to THD to hold profiling information about this thread's execution. --- Manual merge, undoing first patch. sql/sql_delete.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. --- Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/sql_insert.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. --- Fix merge problems. sql/sql_lex.cc: Initialize profiling options to empty. --- Manual merge, undoing first patch. sql/sql_lex.h: Add info to the lexer object so that we can hold data that comes from parsing statements. Reuse memory addresses of uints that can't occur in the same state- ment. This is dangerous because it involves knowledge of what symbols are never used together, which is information stored obliquely in another file. --- Manual merge, undoing first patch. sql/sql_parse.cc: Add hooks to the parser to jump to profiling code. If profiling is not present, then return an error message upon being used. --- Manual merge, undoing first patch. --- Fix merge problems. --- Include patch backported to 5.0-global. THD::options is a ulonglong, not ulong. sql/sql_prepare.cc: From prepared statement execution, set the query source in the profiler, as we can't get it from thd . --- Make it less expensive to limit the size of the queries. sql/sql_repl.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/sql_select.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. --- Fix merge problems. sql/sql_show.cc: Abstract setting thread-info into a function or macro. Also, remove "static" qualification on schema_table_store_record() so that external functions may use it. --- Manual merge, undoing first patch. sql/sql_table.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/sql_update.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/sql_view.cc: Abstract setting thread-info into a function or macro. --- Manual merge, undoing first patch. sql/sql_yacc.yy: Add new lexer symbols and insert new grammatical rules necessary to retreive profiling information. --- Manual merge, undoing first patch. --- Fix merge problems. sql/table.h: Add enum item for query profiling. BitKeeper/deleted/.del-profiling-master.opt: New BitKeeper file ``mysql-test/t/profiling-master.opt'' mysql-test/r/profiling.result: New BitKeeper file ``mysql-test/r/profiling.result'' --- Include more verbose that describes the queries so far. Include Giuseppe's tests. --- Selecting from I_S.profiling is no longer quashed in profiling, as requested by Giuseppe. mysql-test/t/profiling.test: New BitKeeper file ``mysql-test/t/profiling.test'' --- Include more verbose that describes the queries so far. Include Giuseppe's tests. --- Selecting from I_S.profiling is no longer quashed in profiling, as requested by Giuseppe. sql/sql_profile.cc: New BitKeeper file ``sql/sql_profile.cc'' --- If query_source is NULL, as can sometimes happen, then don't try to copy that memory. --- Make each new session use its own numbering of query_ids, and not show the global-pool numbers to the user. Provide a way for prepared statements to set the query_source. --- Selecting from I_S.profiling is no longer quashed in profiling, as requested by Giuseppe. Limit the size of captured query text. No longer log queries that are zero length. sql/sql_profile.h: New BitKeeper file ``sql/sql_profile.h'' --- Make each new session use its own numbering of query_ids, and not show the global-pool numbers to the user. Provide a way for prepared statements to set the query_source. --- Make it less expensive to limit the size of the queries. --- mysql-test/r/information_schema.result | 11 +- mysql-test/r/information_schema_db.result | 1 + mysql-test/r/mysqlshow.result | 2 + mysql-test/r/profile.result | 30 --- mysql-test/r/profiling.result | 365 ++++++++++++++++++++++++++++++ mysql-test/t/profile.test | 39 ---- mysql-test/t/profiling.test | 195 ++++++++++++++++ 7 files changed, 570 insertions(+), 73 deletions(-) delete mode 100644 mysql-test/r/profile.result create mode 100644 mysql-test/r/profiling.result delete mode 100644 mysql-test/t/profile.test create mode 100644 mysql-test/t/profiling.test (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index d4fd536003a..742d35d4ce7 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -42,6 +42,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLUMNS COLUMN_PRIVILEGES KEY_COLUMN_USAGE +PROFILING ROUTINES SCHEMATA SCHEMA_PRIVILEGES @@ -730,7 +731,7 @@ CREATE TABLE t_crashme ( f1 BIGINT); CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; count(*) -101 +102 drop view a2, a1; drop table t_crashme; select table_schema,table_name, column_name from @@ -801,7 +802,7 @@ delete from mysql.db where user='mysqltest_4'; flush privileges; SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 16 +information_schema 17 mysql 17 create table t1 (i int, j int); create trigger trg1 before insert on t1 for each row @@ -1094,8 +1095,8 @@ table_schema='information_schema' and (column_type = 'varchar(7)' or column_type = 'varchar(20)') group by column_type order by num; column_type group_concat(table_schema, '.', table_name) num -varchar(20) information_schema.COLUMNS 1 -varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2 +varchar(20) information_schema.COLUMNS,information_schema.PROFILING 2 +varchar(7) information_schema.PROFILING,information_schema.PROFILING,information_schema.PROFILING,information_schema.ROUTINES,information_schema.VIEWS 5 create table t1(f1 char(1) not null, f2 char(9) not null) default character set utf8; select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from @@ -1192,6 +1193,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA +PROFILING Query_id ROUTINES ROUTINE_SCHEMA SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA @@ -1223,6 +1225,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA +PROFILING Query_id ROUTINES ROUTINE_SCHEMA SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 40773a7afc1..dcd48d3aa46 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -11,6 +11,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLUMNS COLUMN_PRIVILEGES KEY_COLUMN_USAGE +PROFILING ROUTINES SCHEMATA SCHEMA_PRIVILEGES diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result index 2bf8a58de4e..31b4940ec53 100644 --- a/mysql-test/r/mysqlshow.result +++ b/mysql-test/r/mysqlshow.result @@ -85,6 +85,7 @@ Database: information_schema | COLUMNS | | COLUMN_PRIVILEGES | | KEY_COLUMN_USAGE | +| PROFILING | | ROUTINES | | SCHEMATA | | SCHEMA_PRIVILEGES | @@ -106,6 +107,7 @@ Database: INFORMATION_SCHEMA | COLUMNS | | COLUMN_PRIVILEGES | | KEY_COLUMN_USAGE | +| PROFILING | | ROUTINES | | SCHEMATA | | SCHEMA_PRIVILEGES | diff --git a/mysql-test/r/profile.result b/mysql-test/r/profile.result deleted file mode 100644 index 8a4db348445..00000000000 --- a/mysql-test/r/profile.result +++ /dev/null @@ -1,30 +0,0 @@ -create table t1 ( -a int, -b int -); -insert into t1 values (1,1), (2,null), (3, 4); -insert into t1 values (5,1), (6,null), (7, 4); -insert into t1 values (1,1), (2,null), (3, 4); -insert into t1 values (5,1), (6,null), (7, 4); -insert into t1 values (5,1), (6,null), (7, 4); -select sum(a) from t1; -select sum(a) from t1 group by b; -select sum(a) + sum(b) from t1 group by b; -select max(x) from (select sum(a) as x from t1 group by b) as teeone; -show profiles; -show profile for query 8; -show profile cpu, block io for query 8; -show profile cpu for query 8; -show profile cpu for query 9 limit 2 offset 2; -show profile cpu for query 10 limit 0; -show profile cpu for query 65534; -show profile memory; -show profile block io; -show profile context switches; -show profile page faults; -show profile ipc; -show profile swaps limit 1 offset 2; -show profile source; -show profile all for query 0 limit 0; -drop table t1; -End of 5.0 tests diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result new file mode 100644 index 00000000000..f8aa060eee4 --- /dev/null +++ b/mysql-test/r/profiling.result @@ -0,0 +1,365 @@ +show session variables like 'profil%'; +Variable_name Value +profiling OFF +profiling_history_size 15 +select @@profiling; +@@profiling +0 +set global profiling = ON; +ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL +set global profiling_history_size=100; +show global variables like 'profil%'; +Variable_name Value +profiling OFF +profiling_history_size 100 +set session profiling = ON; +set session profiling_history_size=30; +show session variables like 'profil%'; +Variable_name Value +profiling ON +profiling_history_size 30 +select @@profiling; +@@profiling +1 +create table t1 ( +a int, +b int +); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +select max(x) from (select sum(a) as x from t1 group by b) as teeone; +max(x) +20 +insert into t1 select * from t1; +select count(*) from t1; +count(*) +24 +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +select count(*) from t1; +count(*) +192 +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +select count(*) from t1; +count(*) +1536 +select sum(a) from t1; +sum(a) +6144 +select sum(a) from t1 group by b; +sum(a) +2048 +1536 +2560 +select sum(a) + sum(b) from t1 group by b; +sum(a) + sum(b) +NULL +2048 +4608 +select max(x) from (select sum(a) as x from t1 group by b) as teeone; +max(x) +2560 +select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string; +big_string +012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890 +show profiles; +Query_ID Duration Query +0 # set session profiling = ON +1 # set session profiling_history_size=30 +2 # show session variables like 'profil%' +3 # select @@profiling +4 # create table t1 ( +a int, +b int +) +5 # insert into t1 values (1,1), (2,null), (3, 4) +6 # insert into t1 values (5,1), (6,null), (7, 4) +7 # insert into t1 values (1,1), (2,null), (3, 4) +8 # insert into t1 values (5,1), (6,null), (7, 4) +9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +10 # insert into t1 select * from t1 +11 # select count(*) from t1 +12 # insert into t1 select * from t1 +13 # insert into t1 select * from t1 +14 # insert into t1 select * from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 +17 # insert into t1 select * from t1 +18 # insert into t1 select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +show profile for query 15; +show profile cpu for query 15; +show profile cpu, block io for query 15; +show profile cpu for query 9 limit 2 offset 2; +show profile cpu for query 10 limit 0; +show profile cpu for query 65534; +show profile memory; +show profile block io; +show profile context switches; +show profile page faults; +show profile ipc; +show profile swaps limit 1 offset 2; +show profile source; +show profile all for query 0 limit 0; +show profile all for query 15; +select * from information_schema.profiling; +select query_id, state, duration from information_schema.profiling; +select query_id, sum(duration) from information_schema.profiling group by query_id; +select query_id, count(*) from information_schema.profiling group by query_id; +select sum(duration) from information_schema.profiling; +select query_id, count(*), sum(duration) from information_schema.profiling group by query_id; +select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling; +drop table if exists t1, t2, t3; +Warnings: +Note 1051 Unknown table 't2' +Note 1051 Unknown table 't3' +create table t1 (id int ); +create table t2 (id int not null); +create table t3 (id int not null primary key); +insert into t1 values (1), (2), (3); +insert into t2 values (1), (2), (3); +insert into t3 values (1), (2), (3); +show profiles; +Query_ID Duration Query +10 # insert into t1 select * from t1 +11 # select count(*) from t1 +12 # insert into t1 select * from t1 +13 # insert into t1 select * from t1 +14 # insert into t1 select * from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 +17 # insert into t1 select * from t1 +18 # insert into t1 select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +select * from t1; +id +1 +2 +3 +show profiles; +Query_ID Duration Query +11 # select count(*) from t1 +12 # insert into t1 select * from t1 +13 # insert into t1 select * from t1 +14 # insert into t1 select * from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 +17 # insert into t1 select * from t1 +18 # insert into t1 select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 +This ^^ should end in "select * from t1;\" +delete from t1; +insert into t1 values (1), (2), (3); +insert into t1 values (1), (2), (3); +select * from t1; +id +1 +2 +3 +1 +2 +3 +show profiles; +Query_ID Duration Query +15 # select count(*) from t1 +16 # insert into t1 select * from t1 +17 # insert into t1 select * from t1 +18 # insert into t1 select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 +41 # delete from t1 +42 # insert into t1 values (1), (2), (3) +43 # insert into t1 values (1), (2), (3) +44 # select * from t1 +set session profiling = OFF; +select sum(id) from t1; +sum(id) +12 +show profiles; +Query_ID Duration Query +16 # insert into t1 select * from t1 +17 # insert into t1 select * from t1 +18 # insert into t1 select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 +41 # delete from t1 +42 # insert into t1 values (1), (2), (3) +43 # insert into t1 values (1), (2), (3) +44 # select * from t1 +45 # set session profiling = OFF +set session profiling = ON; +select @@profiling; +@@profiling +1 +create function f1() returns varchar(50) return 'hello'; +select @@profiling; +@@profiling +1 +select * from t1 where id <> f1(); +id +1 +2 +3 +1 +2 +3 +select @@profiling; +@@profiling +1 +set session profiling = ON; +drop table if exists t2; +create table t2 (id int not null); +create trigger t2_bi before insert on t2 for each row set @x=0; +select @@profiling; +@@profiling +1 +insert into t2 values (1), (2), (3); +select @@profiling; +@@profiling +1 +set session profiling = ON; +drop table if exists t1, t2; +create table t1 (id int not null primary key); +create table t2 (id int not null primary key, id1 int not null); +select @@profiling; +@@profiling +1 +alter table t2 add foreign key (id1) references t1 (id) on delete cascade; +select @@profiling; +@@profiling +1 +lock table t1 write; +select @@profiling; +@@profiling +1 +unlock table; +select @@profiling; +@@profiling +1 +set autocommit=0; +select @@profiling, @@autocommit; +@@profiling @@autocommit +1 0 +begin; +select @@profiling; +@@profiling +1 +insert into t1 values (1); +insert into t2 values (1,1); +testing referential integrity cascade +delete from t1 where id = 1; +select @@profiling; +@@profiling +1 +testing rollback +rollback; +select @@profiling; +@@profiling +1 +testing commit +begin; +select @@profiling; +@@profiling +1 +commit; +select @@profiling; +@@profiling +1 +drop table if exists t1, t2, t3; +drop view if exists v1; +Warnings: +Note 1051 Unknown table 'test.v1' +drop function if exists f1; +set session profiling = OFF; +End of 5.0 tests diff --git a/mysql-test/t/profile.test b/mysql-test/t/profile.test deleted file mode 100644 index 4cf2a3aa92f..00000000000 --- a/mysql-test/t/profile.test +++ /dev/null @@ -1,39 +0,0 @@ - -create table t1 ( - a int, - b int -); ---disable_result_log -insert into t1 values (1,1), (2,null), (3, 4); -insert into t1 values (5,1), (6,null), (7, 4); -insert into t1 values (1,1), (2,null), (3, 4); -insert into t1 values (5,1), (6,null), (7, 4); -insert into t1 values (5,1), (6,null), (7, 4); -select sum(a) from t1; -select sum(a) from t1 group by b; -select sum(a) + sum(b) from t1 group by b; -select max(x) from (select sum(a) as x from t1 group by b) as teeone; - -# Merely verify that commands work. Checking values is impossible, right? -show profiles; -show profile for query 8; -show profile cpu, block io for query 8; -show profile cpu for query 8; -show profile cpu for query 9 limit 2 offset 2; -show profile cpu for query 10 limit 0; -show profile cpu for query 65534; -show profile memory; -show profile block io; -show profile context switches; -show profile page faults; -show profile ipc; -show profile swaps limit 1 offset 2; -show profile source; -show profile all for query 0 limit 0; ---enable_result_log - -drop table t1; - - -## ---echo End of 5.0 tests diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test new file mode 100644 index 00000000000..ebde8eeffd8 --- /dev/null +++ b/mysql-test/t/profiling.test @@ -0,0 +1,195 @@ +# default is OFF +show session variables like 'profil%'; +select @@profiling; + +# setting global variable is an error +--error ER_LOCAL_VARIABLE +set global profiling = ON; + +# But size is okay +set global profiling_history_size=100; +show global variables like 'profil%'; + +# turn on for testing +set session profiling = ON; +set session profiling_history_size=30; # small enough to overflow + +# verify it is active +show session variables like 'profil%'; +select @@profiling; + +# Profiling is a descriptive look into the way the server operated +# in retrospect. Chad doesn't think it's wise to include the result +# log, as this creates a proscriptive specification about how the +# server should work in the future -- or it forces everyone who +# changes the server significantly to record the test results again, +# and that violates the spirit of our tests. Please don't include +# execution-specific data here, as in all of the "show profile" and +# information_schema.profiling results. + +create table t1 ( + a int, + b int +); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +insert into t1 values (1,1), (2,null), (3, 4); +insert into t1 values (5,1), (6,null), (7, 4); +select max(x) from (select sum(a) as x from t1 group by b) as teeone; +insert into t1 select * from t1; +select count(*) from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +select count(*) from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +select count(*) from t1; +select sum(a) from t1; +select sum(a) from t1 group by b; +select sum(a) + sum(b) from t1 group by b; +select max(x) from (select sum(a) as x from t1 group by b) as teeone; +select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string; + +--enable_result_log +--replace_column 2 # +show profiles; + +--disable_result_log +###--replace_column 2 # 3 # 4 # +show profile for query 15; +###--replace_column 2 # 3 # 4 # +show profile cpu for query 15; +###--replace_column 2 # 3 # 4 # 5 # 6 # +show profile cpu, block io for query 15; +###--replace_column 2 # 3 # 4 # +show profile cpu for query 9 limit 2 offset 2; +show profile cpu for query 10 limit 0; +--error 0,ER_WRONG_ARGUMENTS +show profile cpu for query 65534; +###--replace_column 2 # +show profile memory; +###--replace_column 2 # 3 # 4 # +show profile block io; +###--replace_column 2 # 3 # 4 # +show profile context switches; +###--replace_column 2 # 3 # 4 # +show profile page faults; +###--replace_column 2 # 3 # 4 # +show profile ipc; +###--replace_column 2 # +show profile swaps limit 1 offset 2; +###--replace_column 2 # 5 # +show profile source; +show profile all for query 0 limit 0; +###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 # +show profile all for query 15; +###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 # + +select * from information_schema.profiling; +select query_id, state, duration from information_schema.profiling; +select query_id, sum(duration) from information_schema.profiling group by query_id; +select query_id, count(*) from information_schema.profiling group by query_id; +select sum(duration) from information_schema.profiling; + +# Broken down into number of stages and duration of each query. +select query_id, count(*), sum(duration) from information_schema.profiling group by query_id; +select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling; + + +--enable_result_log +drop table if exists t1, t2, t3; +create table t1 (id int ); +create table t2 (id int not null); +create table t3 (id int not null primary key); +insert into t1 values (1), (2), (3); +insert into t2 values (1), (2), (3); +insert into t3 values (1), (2), (3); + +--replace_column 2 # +show profiles; + +select * from t1; +--replace_column 2 # +show profiles; +--echo This ^^ should end in \"select * from t1;\" + +delete from t1; +insert into t1 values (1), (2), (3); +insert into t1 values (1), (2), (3); + +select * from t1; +--replace_column 2 # +show profiles; + +# Turning profiling off does freeze it +set session profiling = OFF; +select sum(id) from t1; +--replace_column 2 # +show profiles; + +## Verify that the various juggling of THD contexts doesn't affect profiling. + +## Functions +set session profiling = ON; +select @@profiling; +create function f1() returns varchar(50) return 'hello'; +select @@profiling; +select * from t1 where id <> f1(); +select @@profiling; + +## Triggers +set session profiling = ON; +drop table if exists t2; +create table t2 (id int not null); +create trigger t2_bi before insert on t2 for each row set @x=0; +select @@profiling; +insert into t2 values (1), (2), (3); +select @@profiling; + +## ALTER TABLE +set session profiling = ON; +drop table if exists t1, t2; +create table t1 (id int not null primary key); +create table t2 (id int not null primary key, id1 int not null); +select @@profiling; +alter table t2 add foreign key (id1) references t1 (id) on delete cascade; +select @@profiling; + +## Table LOCKing +lock table t1 write; +select @@profiling; +unlock table; +select @@profiling; + +## Transactions +set autocommit=0; +select @@profiling, @@autocommit; +begin; +select @@profiling; +insert into t1 values (1); +insert into t2 values (1,1); +--echo testing referential integrity cascade +delete from t1 where id = 1; +select @@profiling; +--echo testing rollback +--disable_warnings +rollback; +--enable_warnings +select @@profiling; +--echo testing commit +begin; +select @@profiling; +commit; +select @@profiling; + +drop table if exists t1, t2, t3; +drop view if exists v1; +drop function if exists f1; + +## last thing in the file +set session profiling = OFF; + +## +--echo End of 5.0 tests -- cgit v1.2.1 From 89fd0e9f9e2fa26a3e46c5b48f278d395feba245 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Feb 2007 11:30:03 -0500 Subject: Updated column names of I_S table to conform to other I_S uppercase scheme. --- mysql-test/r/information_schema.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 742d35d4ce7..d89514c6060 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1193,7 +1193,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA -PROFILING Query_id +PROFILING QUERY_ID ROUTINES ROUTINE_SCHEMA SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA @@ -1225,7 +1225,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA -PROFILING Query_id +PROFILING QUERY_ID ROUTINES ROUTINE_SCHEMA SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA -- cgit v1.2.1 From 4cb4899fa203a2c483188251e70e67d3ef00f682 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Feb 2007 20:04:58 -0500 Subject: Update to I_S result that now contains PROFILING entry. --- mysql-test/r/information_schema.result | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 0371652b081..b01ed152e33 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1308,6 +1308,7 @@ COLLATION_CHARACTER_SET_APPLICABILITY information_schema.COLLATION_CHARACTER_SET COLUMNS information_schema.COLUMNS 1 COLUMN_PRIVILEGES information_schema.COLUMN_PRIVILEGES 1 KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1 +PROFILING information_schema.PROFILING 1 ROUTINES information_schema.ROUTINES 1 SCHEMATA information_schema.SCHEMATA 1 SCHEMA_PRIVILEGES information_schema.SCHEMA_PRIVILEGES 1 -- cgit v1.2.1 From 8c302fb15718e1745f5d3bcfb080b1d23ccdbb8b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 13:26:19 -0400 Subject: Listing all columns of a particular type tells us nothing at all. The test fails, and it shouldn't. mysql-test/r/information_schema.result: The query to generate this list is pretty bogus in any case. Listing all columns of a particular type tells us nothing at all. --- mysql-test/r/information_schema.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index b01ed152e33..97bb5e4e446 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1096,7 +1096,7 @@ table_schema='information_schema' and group by column_type order by num; column_type group_concat(table_schema, '.', table_name) num varchar(20) information_schema.COLUMNS,information_schema.PROFILING 2 -varchar(7) information_schema.PROFILING,information_schema.PROFILING,information_schema.PROFILING,information_schema.ROUTINES,information_schema.VIEWS 5 +varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2 create table t1(f1 char(1) not null, f2 char(9) not null) default character set utf8; select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from -- cgit v1.2.1 From 892c54a05812ece5d169b9726fea19598dafeea6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 14:05:00 -0400 Subject: The test suite erroneously removes backslashes. --- mysql-test/r/profiling.result | 2 +- mysql-test/t/profiling.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index f8aa060eee4..a1e994220b9 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -198,7 +198,7 @@ Query_ID Duration Query 38 # insert into t2 values (1), (2), (3) 39 # insert into t3 values (1), (2), (3) 40 # select * from t1 -This ^^ should end in "select * from t1;\" +This ^^ should end in "select * from t1;" delete from t1; insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3); diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test index ebde8eeffd8..fd7562f6f16 100644 --- a/mysql-test/t/profiling.test +++ b/mysql-test/t/profiling.test @@ -113,7 +113,7 @@ show profiles; select * from t1; --replace_column 2 # show profiles; ---echo This ^^ should end in \"select * from t1;\" +--echo This ^^ should end in "select * from t1;" delete from t1; insert into t1 values (1), (2), (3); -- cgit v1.2.1 From 992fc6b22c5718fde62eb0c93c296eaec45228ac Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 14:08:09 -0400 Subject: Backport of Igor's patch for Bug#27362, March 22 2007. Fixed bug #27362: crash at evaluation of IN predicate when one of its argument happened to be a decimal expression returning the NULL value. The crash was due to the fact the function in_decimal::set did not take into account that val_decimal() could return 0 if the decimal expression had been evaluated to NULL. mysql-test/r/func_in.result: Added a test case for bug #27362. mysql-test/t/func_in.test: Added a test case for bug #27362. sql/item_cmpfunc.cc: Fixed bug #27362: crash at evaluation of IN predicate when one of its argument happened to be a decimal expression returning the NULL value. The crash was due to the fact the function in_decimal::set did not take into account that val_decimal() could return 0 if the decimal expression had been evaluated to NULL. --- mysql-test/r/func_in.result | 5 +++++ mysql-test/t/func_in.test | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index fad9a7157e1..87855091699 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -470,4 +470,9 @@ a Warnings: Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1 DROP TABLE t1,t2,t3,t4; +CREATE TABLE t1 (id int not null); +INSERT INTO t1 VALUES (1),(2); +SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); +id +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index f9749662ec1..77592d015eb 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -360,4 +360,15 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); DROP TABLE t1,t2,t3,t4; +# +# BUG#27362: IN with a decimal expression that may return NULL +# + +CREATE TABLE t1 (id int not null); +INSERT INTO t1 VALUES (1),(2); + +SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); + +DROP TABLE t1; + --echo End of 5.0 tests -- cgit v1.2.1 From 34a102d909f6bc0e0676e8bb6ff09da691dcbcb6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 18:12:31 -0400 Subject: Backport: Patch contributed by Jocelyn Fournier. CLA received 2007-02-27. B-g#25347: mysqlcheck -A -r doesn't repair table marked as crashed mysqlcheck tests nullness of the engine type to know whether the "table" is a view or not. That also falsely catches tables that are severly damaged. Instead, use SHOW FULL TABLES to test whether a "table" is a view or not. (Don't add new function. Instead, get original data a smarter way.) Make it safe for use against databases before when views appeared. client/mysqlcheck.c: Use SHOW FULL TABLES to test better whether a name in the table list is one of a view. Checking that the engine is NULL is insufficient. Implemented suggestion from jimw that involved removing most of original patch and getting data a better way mysql-test/r/mysqlcheck.result: Verify that tables that have NULL/unreadable engine types are processed and not interpreted as views. mysql-test/t/mysqlcheck.test: Verify that tables that have NULL/unreadable engine types are processed and not interpreted as views. --- mysql-test/r/mysqlcheck.result | 10 ++++++++++ mysql-test/t/mysqlcheck.test | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index b2820df8f4c..81a30267e04 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -41,4 +41,14 @@ test.t1 OK test.t1 OK drop view v1; drop table t1; +create database d_bug25347; +use d_bug25347; +create table t_bug25347 (a int); +create view v_bug25347 as select * from t_bug25347; +removing and creating +d_bug25347.t_bug25347 OK +drop view v_bug25347; +drop table t_bug25347; +drop database d_bug25347; +use test; End of 5.0 tests diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index f4e18d4004f..eb732a05909 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -31,4 +31,20 @@ create view v1 as select * from t1; drop view v1; drop table t1; +# +# Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed +# +create database d_bug25347; +use d_bug25347; +create table t_bug25347 (a int); +create view v_bug25347 as select * from t_bug25347; +--echo removing and creating +--exec rm $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI; +--exec touch $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI; +--exec $MYSQL_CHECK --repair --databases d_bug25347 +drop view v_bug25347; +drop table t_bug25347; +drop database d_bug25347; +use test; + --echo End of 5.0 tests -- cgit v1.2.1 From 46503d161ecc5756f0dd7130969e9ae9df303b31 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 19:50:55 -0400 Subject: Backport: B-g#27501: 5.0 significantly more sys ("kernel") time than 4.1 \ due to getrusage() calls Even if profiling is turned off, the parser makes calls to reset the state at the beginning of each query. That would eventually instantiate a PROFILE_ENTRY, which does indeed capture resource usage. Instead, now check that profiling is active before progressing far into the storage/expiration of old entries in the history. This has the pleasant side-effect that queries to toggle profiling are not recorded in the history. mysql-test/r/profiling.result: Now after we turn off profiling, the beginning of the next query refuses to enter the profiling code and it discards the info. sql/sql_profile.cc: Add the same condition twice: Once to abort storing previous query information and the other to abort initialization for this query that is starting. We do this symmetrically, before and after expiring old history entries, so that the counts are correct. --- mysql-test/r/profiling.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index a1e994220b9..75977f7f2e8 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -248,6 +248,7 @@ sum(id) 12 show profiles; Query_ID Duration Query +15 # select count(*) from t1 16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 @@ -277,7 +278,6 @@ Query_ID Duration Query 42 # insert into t1 values (1), (2), (3) 43 # insert into t1 values (1), (2), (3) 44 # select * from t1 -45 # set session profiling = OFF set session profiling = ON; select @@profiling; @@profiling -- cgit v1.2.1 From 2879da7f847eeda8ebf7cdad769f665fe95f5259 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Apr 2007 19:52:24 -0400 Subject: Unreported minor bug: We start numbering query IDs at zero, which is a special case in "SHOW PROFILE FOR QUERY n". No one can get the zero item (which is always the statement that turns on profiling), because zero represents the final item, internally. Now, order the queries starting at one. mysql-test/r/profiling.result: Renumber the query IDs. sql/sql_profile.cc: Start the profile_id_counter at 1, to overstep the special-case value of zero. Unrelated, but looks similar: don't use -1 to initialize an unsigned integer field. That causes warnings in some environments. --- mysql-test/r/profiling.result | 254 +++++++++++++++++++++--------------------- 1 file changed, 127 insertions(+), 127 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index 75977f7f2e8..50b6fff82b8 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -69,34 +69,34 @@ big_string 012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890 show profiles; Query_ID Duration Query -0 # set session profiling = ON -1 # set session profiling_history_size=30 -2 # show session variables like 'profil%' -3 # select @@profiling -4 # create table t1 ( +1 # set session profiling = ON +2 # set session profiling_history_size=30 +3 # show session variables like 'profil%' +4 # select @@profiling +5 # create table t1 ( a int, b int ) -5 # insert into t1 values (1,1), (2,null), (3, 4) -6 # insert into t1 values (5,1), (6,null), (7, 4) -7 # insert into t1 values (1,1), (2,null), (3, 4) -8 # insert into t1 values (5,1), (6,null), (7, 4) -9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -10 # insert into t1 select * from t1 -11 # select count(*) from t1 -12 # insert into t1 select * from t1 +6 # insert into t1 values (1,1), (2,null), (3, 4) +7 # insert into t1 values (5,1), (6,null), (7, 4) +8 # insert into t1 values (1,1), (2,null), (3, 4) +9 # insert into t1 values (5,1), (6,null), (7, 4) +10 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +11 # insert into t1 select * from t1 +12 # select count(*) from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # select count(*) from t1 -16 # insert into t1 select * from t1 +15 # insert into t1 select * from t1 +16 # select count(*) from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # select count(*) from t1 -20 # select sum(a) from t1 -21 # select sum(a) from t1 group by b -22 # select sum(a) + sum(b) from t1 group by b -23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +19 # insert into t1 select * from t1 +20 # select count(*) from t1 +21 # select sum(a) from t1 +22 # select sum(a) from t1 group by b +23 # select sum(a) + sum(b) from t1 group by b +24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 show profile for query 15; show profile cpu for query 15; show profile cpu, block io for query 15; @@ -131,36 +131,36 @@ insert into t2 values (1), (2), (3); insert into t3 values (1), (2), (3); show profiles; Query_ID Duration Query -10 # insert into t1 select * from t1 -11 # select count(*) from t1 -12 # insert into t1 select * from t1 +11 # insert into t1 select * from t1 +12 # select count(*) from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # select count(*) from t1 -16 # insert into t1 select * from t1 +15 # insert into t1 select * from t1 +16 # select count(*) from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # select count(*) from t1 -20 # select sum(a) from t1 -21 # select sum(a) from t1 group by b -22 # select sum(a) + sum(b) from t1 group by b -23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -25 # select * from information_schema.profiling -26 # select query_id, state, duration from information_schema.profiling -27 # select query_id, sum(duration) from information_schema.profiling group by query_id -28 # select query_id, count(*) from information_schema.profiling group by query_id -29 # select sum(duration) from information_schema.profiling -30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -32 # drop table if exists t1, t2, t3 -33 # SHOW WARNINGS -34 # create table t1 (id int ) -35 # create table t2 (id int not null) -36 # create table t3 (id int not null primary key) -37 # insert into t1 values (1), (2), (3) -38 # insert into t2 values (1), (2), (3) -39 # insert into t3 values (1), (2), (3) +19 # insert into t1 select * from t1 +20 # select count(*) from t1 +21 # select sum(a) from t1 +22 # select sum(a) from t1 group by b +23 # select sum(a) + sum(b) from t1 group by b +24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +26 # select * from information_schema.profiling +27 # select query_id, state, duration from information_schema.profiling +28 # select query_id, sum(duration) from information_schema.profiling group by query_id +29 # select query_id, count(*) from information_schema.profiling group by query_id +30 # select sum(duration) from information_schema.profiling +31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +33 # drop table if exists t1, t2, t3 +34 # SHOW WARNINGS +35 # create table t1 (id int ) +36 # create table t2 (id int not null) +37 # create table t3 (id int not null primary key) +38 # insert into t1 values (1), (2), (3) +39 # insert into t2 values (1), (2), (3) +40 # insert into t3 values (1), (2), (3) select * from t1; id 1 @@ -168,36 +168,36 @@ id 3 show profiles; Query_ID Duration Query -11 # select count(*) from t1 -12 # insert into t1 select * from t1 +12 # select count(*) from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # select count(*) from t1 -16 # insert into t1 select * from t1 +15 # insert into t1 select * from t1 +16 # select count(*) from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # select count(*) from t1 -20 # select sum(a) from t1 -21 # select sum(a) from t1 group by b -22 # select sum(a) + sum(b) from t1 group by b -23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -25 # select * from information_schema.profiling -26 # select query_id, state, duration from information_schema.profiling -27 # select query_id, sum(duration) from information_schema.profiling group by query_id -28 # select query_id, count(*) from information_schema.profiling group by query_id -29 # select sum(duration) from information_schema.profiling -30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -32 # drop table if exists t1, t2, t3 -33 # SHOW WARNINGS -34 # create table t1 (id int ) -35 # create table t2 (id int not null) -36 # create table t3 (id int not null primary key) -37 # insert into t1 values (1), (2), (3) -38 # insert into t2 values (1), (2), (3) -39 # insert into t3 values (1), (2), (3) -40 # select * from t1 +19 # insert into t1 select * from t1 +20 # select count(*) from t1 +21 # select sum(a) from t1 +22 # select sum(a) from t1 group by b +23 # select sum(a) + sum(b) from t1 group by b +24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +26 # select * from information_schema.profiling +27 # select query_id, state, duration from information_schema.profiling +28 # select query_id, sum(duration) from information_schema.profiling group by query_id +29 # select query_id, count(*) from information_schema.profiling group by query_id +30 # select sum(duration) from information_schema.profiling +31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +33 # drop table if exists t1, t2, t3 +34 # SHOW WARNINGS +35 # create table t1 (id int ) +36 # create table t2 (id int not null) +37 # create table t3 (id int not null primary key) +38 # insert into t1 values (1), (2), (3) +39 # insert into t2 values (1), (2), (3) +40 # insert into t3 values (1), (2), (3) +41 # select * from t1 This ^^ should end in "select * from t1;" delete from t1; insert into t1 values (1), (2), (3); @@ -212,72 +212,72 @@ id 3 show profiles; Query_ID Duration Query -15 # select count(*) from t1 -16 # insert into t1 select * from t1 +16 # select count(*) from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # select count(*) from t1 -20 # select sum(a) from t1 -21 # select sum(a) from t1 group by b -22 # select sum(a) + sum(b) from t1 group by b -23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -25 # select * from information_schema.profiling -26 # select query_id, state, duration from information_schema.profiling -27 # select query_id, sum(duration) from information_schema.profiling group by query_id -28 # select query_id, count(*) from information_schema.profiling group by query_id -29 # select sum(duration) from information_schema.profiling -30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -32 # drop table if exists t1, t2, t3 -33 # SHOW WARNINGS -34 # create table t1 (id int ) -35 # create table t2 (id int not null) -36 # create table t3 (id int not null primary key) -37 # insert into t1 values (1), (2), (3) -38 # insert into t2 values (1), (2), (3) -39 # insert into t3 values (1), (2), (3) -40 # select * from t1 -41 # delete from t1 -42 # insert into t1 values (1), (2), (3) +19 # insert into t1 select * from t1 +20 # select count(*) from t1 +21 # select sum(a) from t1 +22 # select sum(a) from t1 group by b +23 # select sum(a) + sum(b) from t1 group by b +24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +26 # select * from information_schema.profiling +27 # select query_id, state, duration from information_schema.profiling +28 # select query_id, sum(duration) from information_schema.profiling group by query_id +29 # select query_id, count(*) from information_schema.profiling group by query_id +30 # select sum(duration) from information_schema.profiling +31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +33 # drop table if exists t1, t2, t3 +34 # SHOW WARNINGS +35 # create table t1 (id int ) +36 # create table t2 (id int not null) +37 # create table t3 (id int not null primary key) +38 # insert into t1 values (1), (2), (3) +39 # insert into t2 values (1), (2), (3) +40 # insert into t3 values (1), (2), (3) +41 # select * from t1 +42 # delete from t1 43 # insert into t1 values (1), (2), (3) -44 # select * from t1 +44 # insert into t1 values (1), (2), (3) +45 # select * from t1 set session profiling = OFF; select sum(id) from t1; sum(id) 12 show profiles; Query_ID Duration Query -15 # select count(*) from t1 -16 # insert into t1 select * from t1 +16 # select count(*) from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # select count(*) from t1 -20 # select sum(a) from t1 -21 # select sum(a) from t1 group by b -22 # select sum(a) + sum(b) from t1 group by b -23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -25 # select * from information_schema.profiling -26 # select query_id, state, duration from information_schema.profiling -27 # select query_id, sum(duration) from information_schema.profiling group by query_id -28 # select query_id, count(*) from information_schema.profiling group by query_id -29 # select sum(duration) from information_schema.profiling -30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -32 # drop table if exists t1, t2, t3 -33 # SHOW WARNINGS -34 # create table t1 (id int ) -35 # create table t2 (id int not null) -36 # create table t3 (id int not null primary key) -37 # insert into t1 values (1), (2), (3) -38 # insert into t2 values (1), (2), (3) -39 # insert into t3 values (1), (2), (3) -40 # select * from t1 -41 # delete from t1 -42 # insert into t1 values (1), (2), (3) +19 # insert into t1 select * from t1 +20 # select count(*) from t1 +21 # select sum(a) from t1 +22 # select sum(a) from t1 group by b +23 # select sum(a) + sum(b) from t1 group by b +24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +26 # select * from information_schema.profiling +27 # select query_id, state, duration from information_schema.profiling +28 # select query_id, sum(duration) from information_schema.profiling group by query_id +29 # select query_id, count(*) from information_schema.profiling group by query_id +30 # select sum(duration) from information_schema.profiling +31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +33 # drop table if exists t1, t2, t3 +34 # SHOW WARNINGS +35 # create table t1 (id int ) +36 # create table t2 (id int not null) +37 # create table t3 (id int not null primary key) +38 # insert into t1 values (1), (2), (3) +39 # insert into t2 values (1), (2), (3) +40 # insert into t3 values (1), (2), (3) +41 # select * from t1 +42 # delete from t1 43 # insert into t1 values (1), (2), (3) -44 # select * from t1 +44 # insert into t1 values (1), (2), (3) +45 # select * from t1 set session profiling = ON; select @@profiling; @@profiling -- cgit v1.2.1 From fcb52609e4727cdf6f246e7817c0fa625749c5c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Apr 2007 09:15:18 -0400 Subject: Changing the state of whether we're recording profiling information halfway through a query (as happens in "SET SESSION PROFILING = ...") has a few side-effects, the worst of which is a memory leak for prepared statements, which poke directly from the parser into the profiling code (we don't have the query text when we need it) and that overwrites a pointer to heap-allocated memory when the previous statement turns on profiling. Instead, now set a flag when we begin a new statement that tracks whether profiling is on _at the start_ of the query. Use that to track whether we gather info. Additionally, use that AND use the state of the profiling variable after the end of a query to know whether to store information about the query that just finished. mysql-test/r/profiling.result: Testing whether profiling is on at the beginning of a query and at the end of a query makes "SET SESSION PROFILING = ..." statements disappear from the profiling. They were never reliable before. sql/sql_profile.cc: Check to see if profiling was enabled at the beginning of this query before trying to store query_source. This avoids a memory leak for prepared statements, which get here by direct means. If profiling was toggled in this query, then don't store this query profile. sql/sql_profile.h: Keep track of whether profiling is on. --- mysql-test/r/profiling.result | 253 +++++++++++++++++++++--------------------- 1 file changed, 126 insertions(+), 127 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index 50b6fff82b8..9f478d68b8d 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -69,34 +69,33 @@ big_string 012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890 show profiles; Query_ID Duration Query -1 # set session profiling = ON -2 # set session profiling_history_size=30 -3 # show session variables like 'profil%' -4 # select @@profiling -5 # create table t1 ( +1 # set session profiling_history_size=30 +2 # show session variables like 'profil%' +3 # select @@profiling +4 # create table t1 ( a int, b int ) -6 # insert into t1 values (1,1), (2,null), (3, 4) -7 # insert into t1 values (5,1), (6,null), (7, 4) -8 # insert into t1 values (1,1), (2,null), (3, 4) -9 # insert into t1 values (5,1), (6,null), (7, 4) -10 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -11 # insert into t1 select * from t1 -12 # select count(*) from t1 +5 # insert into t1 values (1,1), (2,null), (3, 4) +6 # insert into t1 values (5,1), (6,null), (7, 4) +7 # insert into t1 values (1,1), (2,null), (3, 4) +8 # insert into t1 values (5,1), (6,null), (7, 4) +9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +10 # insert into t1 select * from t1 +11 # select count(*) from t1 +12 # insert into t1 select * from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # insert into t1 select * from t1 -16 # select count(*) from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # insert into t1 select * from t1 -20 # select count(*) from t1 -21 # select sum(a) from t1 -22 # select sum(a) from t1 group by b -23 # select sum(a) + sum(b) from t1 group by b -24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 show profile for query 15; show profile cpu for query 15; show profile cpu, block io for query 15; @@ -131,36 +130,36 @@ insert into t2 values (1), (2), (3); insert into t3 values (1), (2), (3); show profiles; Query_ID Duration Query -11 # insert into t1 select * from t1 -12 # select count(*) from t1 +10 # insert into t1 select * from t1 +11 # select count(*) from t1 +12 # insert into t1 select * from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # insert into t1 select * from t1 -16 # select count(*) from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # insert into t1 select * from t1 -20 # select count(*) from t1 -21 # select sum(a) from t1 -22 # select sum(a) from t1 group by b -23 # select sum(a) + sum(b) from t1 group by b -24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -26 # select * from information_schema.profiling -27 # select query_id, state, duration from information_schema.profiling -28 # select query_id, sum(duration) from information_schema.profiling group by query_id -29 # select query_id, count(*) from information_schema.profiling group by query_id -30 # select sum(duration) from information_schema.profiling -31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -33 # drop table if exists t1, t2, t3 -34 # SHOW WARNINGS -35 # create table t1 (id int ) -36 # create table t2 (id int not null) -37 # create table t3 (id int not null primary key) -38 # insert into t1 values (1), (2), (3) -39 # insert into t2 values (1), (2), (3) -40 # insert into t3 values (1), (2), (3) +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) select * from t1; id 1 @@ -168,36 +167,36 @@ id 3 show profiles; Query_ID Duration Query -12 # select count(*) from t1 +11 # select count(*) from t1 +12 # insert into t1 select * from t1 13 # insert into t1 select * from t1 14 # insert into t1 select * from t1 -15 # insert into t1 select * from t1 -16 # select count(*) from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # insert into t1 select * from t1 -20 # select count(*) from t1 -21 # select sum(a) from t1 -22 # select sum(a) from t1 group by b -23 # select sum(a) + sum(b) from t1 group by b -24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -26 # select * from information_schema.profiling -27 # select query_id, state, duration from information_schema.profiling -28 # select query_id, sum(duration) from information_schema.profiling group by query_id -29 # select query_id, count(*) from information_schema.profiling group by query_id -30 # select sum(duration) from information_schema.profiling -31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -33 # drop table if exists t1, t2, t3 -34 # SHOW WARNINGS -35 # create table t1 (id int ) -36 # create table t2 (id int not null) -37 # create table t3 (id int not null primary key) -38 # insert into t1 values (1), (2), (3) -39 # insert into t2 values (1), (2), (3) -40 # insert into t3 values (1), (2), (3) -41 # select * from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 This ^^ should end in "select * from t1;" delete from t1; insert into t1 values (1), (2), (3); @@ -212,72 +211,72 @@ id 3 show profiles; Query_ID Duration Query -16 # select count(*) from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # insert into t1 select * from t1 -20 # select count(*) from t1 -21 # select sum(a) from t1 -22 # select sum(a) from t1 group by b -23 # select sum(a) + sum(b) from t1 group by b -24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -26 # select * from information_schema.profiling -27 # select query_id, state, duration from information_schema.profiling -28 # select query_id, sum(duration) from information_schema.profiling group by query_id -29 # select query_id, count(*) from information_schema.profiling group by query_id -30 # select sum(duration) from information_schema.profiling -31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -33 # drop table if exists t1, t2, t3 -34 # SHOW WARNINGS -35 # create table t1 (id int ) -36 # create table t2 (id int not null) -37 # create table t3 (id int not null primary key) -38 # insert into t1 values (1), (2), (3) -39 # insert into t2 values (1), (2), (3) -40 # insert into t3 values (1), (2), (3) -41 # select * from t1 -42 # delete from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 +41 # delete from t1 +42 # insert into t1 values (1), (2), (3) 43 # insert into t1 values (1), (2), (3) -44 # insert into t1 values (1), (2), (3) -45 # select * from t1 +44 # select * from t1 set session profiling = OFF; select sum(id) from t1; sum(id) 12 show profiles; Query_ID Duration Query -16 # select count(*) from t1 +15 # select count(*) from t1 +16 # insert into t1 select * from t1 17 # insert into t1 select * from t1 18 # insert into t1 select * from t1 -19 # insert into t1 select * from t1 -20 # select count(*) from t1 -21 # select sum(a) from t1 -22 # select sum(a) from t1 group by b -23 # select sum(a) + sum(b) from t1 group by b -24 # select max(x) from (select sum(a) as x from t1 group by b) as teeone -25 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 -26 # select * from information_schema.profiling -27 # select query_id, state, duration from information_schema.profiling -28 # select query_id, sum(duration) from information_schema.profiling group by query_id -29 # select query_id, count(*) from information_schema.profiling group by query_id -30 # select sum(duration) from information_schema.profiling -31 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id -32 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling -33 # drop table if exists t1, t2, t3 -34 # SHOW WARNINGS -35 # create table t1 (id int ) -36 # create table t2 (id int not null) -37 # create table t3 (id int not null primary key) -38 # insert into t1 values (1), (2), (3) -39 # insert into t2 values (1), (2), (3) -40 # insert into t3 values (1), (2), (3) -41 # select * from t1 -42 # delete from t1 +19 # select count(*) from t1 +20 # select sum(a) from t1 +21 # select sum(a) from t1 group by b +22 # select sum(a) + sum(b) from t1 group by b +23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone +24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345 +25 # select * from information_schema.profiling +26 # select query_id, state, duration from information_schema.profiling +27 # select query_id, sum(duration) from information_schema.profiling group by query_id +28 # select query_id, count(*) from information_schema.profiling group by query_id +29 # select sum(duration) from information_schema.profiling +30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id +31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling +32 # drop table if exists t1, t2, t3 +33 # SHOW WARNINGS +34 # create table t1 (id int ) +35 # create table t2 (id int not null) +36 # create table t3 (id int not null primary key) +37 # insert into t1 values (1), (2), (3) +38 # insert into t2 values (1), (2), (3) +39 # insert into t3 values (1), (2), (3) +40 # select * from t1 +41 # delete from t1 +42 # insert into t1 values (1), (2), (3) 43 # insert into t1 values (1), (2), (3) -44 # insert into t1 values (1), (2), (3) -45 # select * from t1 +44 # select * from t1 set session profiling = ON; select @@profiling; @@profiling -- cgit v1.2.1 From d1c5f54ba5420f5b0c286c1ca74abd8989c7cbf9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Apr 2007 16:47:07 -0400 Subject: Use platform-independent mysqltest language. --- mysql-test/t/mysqlcheck.test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index eb732a05909..5efe6ade6bb 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -39,8 +39,9 @@ use d_bug25347; create table t_bug25347 (a int); create view v_bug25347 as select * from t_bug25347; --echo removing and creating ---exec rm $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI; ---exec touch $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI; +--remove_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI +--write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI EOF +EOF --exec $MYSQL_CHECK --repair --databases d_bug25347 drop view v_bug25347; drop table t_bug25347; -- cgit v1.2.1 From a318c75af76c8676cfe45dc154685a6e0e283cfa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Apr 2007 15:00:16 -0400 Subject: Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed Additional changes to test: "flush tables" so that Windows releases the files. mysql-test/r/mysqlcheck.result: Add "flush tables" to get windows to release the files, so that we can test truncation properly. mysql-test/t/mysqlcheck.test: Add "flush tables" to get windows to release the files, so that we can test truncation properly. --- mysql-test/r/mysqlcheck.result | 27 ++++++++++++++++++++++++++- mysql-test/t/mysqlcheck.test | 8 ++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 81a30267e04..1c42b0060f7 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -45,8 +45,33 @@ create database d_bug25347; use d_bug25347; create table t_bug25347 (a int); create view v_bug25347 as select * from t_bug25347; +insert into t_bug25347 values (1),(2),(3); +flush tables; removing and creating -d_bug25347.t_bug25347 OK +d_bug25347.t_bug25347 +error : Incorrect file format 't_bug25347' +insert into t_bug25347 values (4),(5),(6); +ERROR HY000: Incorrect file format 't_bug25347' +d_bug25347.t_bug25347 +warning : Number of rows changed from 0 to 3 +status : OK +insert into t_bug25347 values (7),(8),(9); +select * from t_bug25347; +a +1 +2 +3 +7 +8 +9 +select * from v_bug25347; +a +1 +2 +3 +7 +8 +9 drop view v_bug25347; drop table t_bug25347; drop database d_bug25347; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index 5efe6ade6bb..655ff39001c 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -38,11 +38,19 @@ create database d_bug25347; use d_bug25347; create table t_bug25347 (a int); create view v_bug25347 as select * from t_bug25347; +insert into t_bug25347 values (1),(2),(3); +flush tables; --echo removing and creating --remove_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI --write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI EOF EOF --exec $MYSQL_CHECK --repair --databases d_bug25347 +--error 130 +insert into t_bug25347 values (4),(5),(6); +--exec $MYSQL_CHECK --repair --use-frm --databases d_bug25347 +insert into t_bug25347 values (7),(8),(9); +select * from t_bug25347; +select * from v_bug25347; drop view v_bug25347; drop table t_bug25347; drop database d_bug25347; -- cgit v1.2.1 From 2b4a89561378fb1dca2a70e52afb2ca0562e12ee Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Apr 2007 18:11:55 -0400 Subject: Wrap code specific to the comunity-server in additional CPP #ifdef . Add a new autoconf paremeter --{en,dis}able-community-features . The default is disable for enterprise servers. Though this is a 5.0 tree, it is only to be merged into the 5.0-community tree and the global 5.1 tree, never to the 5.0-enterprise tree. configure.in: Add a new configure parameter, --enable-community-features for community features. mysql-test/t/profiling.test: Add testing for whether profiling is enabled or not. sql/mysqld.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/set_var.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_class.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_class.h: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_parse.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_prepare.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_profile.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_profile.h: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_show.cc: Add "COMMUNITY_SERVER" cpp definition test. mysql-test/include/profiling.inc: Add testing for whether profiling is enabled or not. mysql-test/r/profiling.require: Add testing for whether profiling is enabled or not. --- mysql-test/include/profiling.inc | 4 ++++ mysql-test/r/profiling.require | 2 ++ mysql-test/t/profiling.test | 2 ++ 3 files changed, 8 insertions(+) create mode 100644 mysql-test/include/profiling.inc create mode 100644 mysql-test/r/profiling.require (limited to 'mysql-test') diff --git a/mysql-test/include/profiling.inc b/mysql-test/include/profiling.inc new file mode 100644 index 00000000000..bc2228eaa10 --- /dev/null +++ b/mysql-test/include/profiling.inc @@ -0,0 +1,4 @@ +-- require r/profiling.require +disable_query_log; +show variables like "profiling"; +enable_query_log; diff --git a/mysql-test/r/profiling.require b/mysql-test/r/profiling.require new file mode 100644 index 00000000000..a5f2b71f22a --- /dev/null +++ b/mysql-test/r/profiling.require @@ -0,0 +1,2 @@ +Variable_name Value +profiling OFF diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test index fd7562f6f16..549d075d227 100644 --- a/mysql-test/t/profiling.test +++ b/mysql-test/t/profiling.test @@ -1,3 +1,5 @@ +--source include/profiling.inc + # default is OFF show session variables like 'profil%'; select @@profiling; -- cgit v1.2.1