Merge lp:~tsarev/percona-server/test55_716210 into lp:percona-server/5.5

Proposed by Oleg Tsarev
Status: Work in progress
Proposed branch: lp:~tsarev/percona-server/test55_716210
Merge into: lp:percona-server/5.5
Diff against target: 231 lines (+153/-14) (has conflicts)
1 file modified
patches/slow_extended.patch (+153/-14)
Text conflict in patches/slow_extended.patch
To merge this branch: bzr merge lp:~tsarev/percona-server/test55_716210
Reviewer Review Type Date Requested Status
Percona developers Pending
Review via email: mp+74180@code.launchpad.net

Description of the change

Fixed bug #716210 - incorrect last_errno in slow-query-log

To post a comment you must log in.
Revision history for this message
Oleg Tsarev (tsarev) wrote :

Unmerged revisions

156. By Oleg Tsarev

Fixed bug #716210 - incorrect last_errno in slow-query-log

155. By Oleg Tsarev

ported test percona_log_slow_parse_error for bug #716210 from lp:~longbow/percona-server/test_716210

152. By Stewart Smith

merge 5.5.15 rebase

151. By Stewart Smith

use S3 download site

150. By Stewart Smith

merge a few quilt related fixes to misc scripts we use

149. By Stewart Smith

merge atomic_cas_64 fix

148. By Stewart Smith

merge compiler warning fix for innodb comparison of unsigned expression always true

147. By Stewart Smith

merge fix of innodb_bug60049 test failure. The master thread should purge if purge_thread seems already exited in shutdown state.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'patches/slow_extended.patch'
--- patches/slow_extended.patch 2011-09-03 15:15:31 +0000
+++ patches/slow_extended.patch 2011-09-06 08:42:58 +0000
@@ -549,15 +549,16 @@
549 549
550 /**550 /**
551 Dumps a text description of a thread, its security context551 Dumps a text description of a thread, its security context
552@@ -912,6 +943,7 @@552@@ -907,6 +938,8 @@
553 const char* msg,
554 MYSQL_ERROR ** cond_hdl)
555 {
556+ last_errno= sql_errno;
557+
558 if (!m_internal_handler)
559 {
553 *cond_hdl= NULL;560 *cond_hdl= NULL;
554 return FALSE;561@@ -3656,6 +3689,12 @@
555 }
556+ last_errno= sql_errno;
557
558 for (Internal_error_handler *error_handler= m_internal_handler;
559 error_handler;
560@@ -3656,6 +3688,12 @@
561 first_successful_insert_id_in_prev_stmt;562 first_successful_insert_id_in_prev_stmt;
562 backup->first_successful_insert_id_in_cur_stmt= 563 backup->first_successful_insert_id_in_cur_stmt=
563 first_successful_insert_id_in_cur_stmt;564 first_successful_insert_id_in_cur_stmt;
@@ -570,7 +571,7 @@
570 571
571 if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&572 if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
572 !is_current_stmt_binlog_format_row())573 !is_current_stmt_binlog_format_row())
573@@ -3676,6 +3714,14 @@574@@ -3676,6 +3715,14 @@
574 cuted_fields= 0;575 cuted_fields= 0;
575 transaction.savepoints= 0;576 transaction.savepoints= 0;
576 first_successful_insert_id_in_cur_stmt= 0;577 first_successful_insert_id_in_cur_stmt= 0;
@@ -585,7 +586,7 @@
585 }586 }
586 587
587 588
588@@ -3738,6 +3784,12 @@589@@ -3738,6 +3785,12 @@
589 */590 */
590 examined_row_count+= backup->examined_row_count;591 examined_row_count+= backup->examined_row_count;
591 cuted_fields+= backup->cuted_fields;592 cuted_fields+= backup->cuted_fields;
@@ -714,7 +715,15 @@
714 }715 }
715--- a/sql/sql_parse.cc716--- a/sql/sql_parse.cc
716+++ b/sql/sql_parse.cc717+++ b/sql/sql_parse.cc
717@@ -1430,7 +1430,6 @@718@@ -888,6 +888,7 @@
719 the slow log only if opt_log_slow_admin_statements is set.
720 */
721 thd->enable_slow_log= TRUE;
722+ thd->last_errno= 0;
723 thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
724 thd->set_time();
725 if (!thd->is_valid_time())
726@@ -1430,7 +1431,6 @@
718 DBUG_RETURN(error);727 DBUG_RETURN(error);
719 }728 }
720 729
@@ -722,7 +731,7 @@
722 void log_slow_statement(THD *thd)731 void log_slow_statement(THD *thd)
723 {732 {
724 DBUG_ENTER("log_slow_statement");733 DBUG_ENTER("log_slow_statement");
725@@ -1443,6 +1442,42 @@734@@ -1443,6 +1443,42 @@
726 if (unlikely(thd->in_sub_stmt))735 if (unlikely(thd->in_sub_stmt))
727 DBUG_VOID_RETURN; // Don't set time for sub stmt736 DBUG_VOID_RETURN; // Don't set time for sub stmt
728 737
@@ -765,7 +774,7 @@
765 /*774 /*
766 Do not log administrative statements unless the appropriate option is775 Do not log administrative statements unless the appropriate option is
767 set.776 set.
768@@ -1879,6 +1914,9 @@777@@ -1879,6 +1915,9 @@
769 context.resolve_in_table_list_only(select_lex->778 context.resolve_in_table_list_only(select_lex->
770 table_list.first);779 table_list.first);
771 780
@@ -775,7 +784,7 @@
775 /*784 /*
776 Reset warning count for each query that uses tables785 Reset warning count for each query that uses tables
777 A better approach would be to reset this for any commands786 A better approach would be to reset this for any commands
778@@ -5297,6 +5335,21 @@787@@ -5297,6 +5336,21 @@
779 thd->rand_used= 0;788 thd->rand_used= 0;
780 thd->sent_row_count= thd->examined_row_count= 0;789 thd->sent_row_count= thd->examined_row_count= 0;
781 790
@@ -1242,6 +1251,7 @@
1242 };1251 };
1243 1252
1244 # endif /* HAVE_PROFILING */1253 # endif /* HAVE_PROFILING */
1254<<<<<<< TREE
1245--- /dev/null1255--- /dev/null
1246+++ b/mysql-test/include/grep.inc1256+++ b/mysql-test/include/grep.inc
1247@@ -0,0 +1,16 @@1257@@ -0,0 +1,16 @@
@@ -2337,3 +2347,132 @@
2337+show global variables like 'slow_query_log_use_global_control';2347+show global variables like 'slow_query_log_use_global_control';
2338+2348+
2339+set global slow_query_log_use_global_control='long_query_time';2349+set global slow_query_log_use_global_control='long_query_time';
2350=======
2351--- /dev/null
2352+++ b/mysql-test/include/log_start.inc
2353@@ -0,0 +1,16 @@
2354+--let slow_query_log_file_old=`SELECT Variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE Variable_name = 'slow_query_log_file';`
2355+--let slow_query_log_old=`SELECT Variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE Variable_name = 'slow_query_log';`
2356+--disable_query_log
2357+--let log_file_full_path = $MYSQLTEST_VARDIR/$log_file
2358+SET GLOBAL slow_query_log=0;
2359+perl;
2360+ $log_file_full_path= $ENV{'log_file_full_path'};
2361+ unlink $log_file_full_path;
2362+ open(FILE, '>', $log_file_full_path)
2363+ or die "Cannot create log file $log_file_full_path, reason: $!";
2364+ close(FILE);
2365+EOF
2366+--echo [log_start.inc] $log_file
2367+EVAL SET GLOBAL slow_query_log_file="$log_file_full_path";
2368+SET GLOBAL slow_query_log=1;
2369+--enable_query_log
2370--- /dev/null
2371+++ b/mysql-test/include/log_stop.inc
2372@@ -0,0 +1,7 @@
2373+--disable_query_log
2374+FLUSH LOGS;
2375+SET GLOBAL slow_query_log=0;
2376+--echo [log_stop.inc] $log_file
2377+EVAL SET GLOBAL slow_query_log_file= "$slow_query_log_file_old";
2378+EVAL SET GLOBAL slow_query_log= $slow_query_log_old ;
2379+--enable_query_log
2380--- /dev/null
2381+++ b/mysql-test/r/percona_slow_extended_log_error.result
2382@@ -0,0 +1,11 @@
2383+SET GLOBAL long_query_time=0;
2384+SET GLOBAL slow_query_log_timestamp_always=ON;
2385+SET long_query_time=0;
2386+DROP TABLE IF EXISTS t1;
2387+CREATE TABLE t1 (a INT);
2388+[log_start.inc] percona.slow_extended.error_on_quit
2389+CREATE TABLE t1 (a INT);
2390+ERROR 42S01: Table 't1' already exists
2391+[log_stop.inc] percona.slow_extended.error_on_quit
2392+[log_grep.inc] file: percona.slow_extended.error_on_quit pattern: Last_errno: 1050
2393+[log_grep.inc] lines: 1
2394--- /dev/null
2395+++ b/mysql-test/t/percona_slow_extended_log_error.test
2396@@ -0,0 +1,23 @@
2397+--let log_file=percona.slow_extended.error_on_quit
2398+
2399+SET GLOBAL long_query_time=0;
2400+SET GLOBAL slow_query_log_timestamp_always=ON;
2401+
2402+connect (conn1,localhost,root,,);
2403+connection conn1;
2404+SET long_query_time=0;
2405+--disable_warnings
2406+DROP TABLE IF EXISTS t1;
2407+--enable_warnings
2408+CREATE TABLE t1 (a INT);
2409+--source include/log_start.inc
2410+--error 1050
2411+CREATE TABLE t1 (a INT);
2412+disconnect conn1;
2413+connection default;
2414+--source include/log_stop.inc
2415+--let grep_pattern = Last_errno: 1050
2416+--source include/log_grep.inc
2417+SET GLOBAL long_query_time=default;
2418+SET GLOBAL slow_query_log_timestamp_always=default;
2419+DROP TABLE t1;
2420--- /dev/null
2421+++ b/mysql-test/include/log_grep.inc
2422@@ -0,0 +1,17 @@
2423+--disable_query_log
2424+--echo [log_grep.inc] file: $log_file pattern: $grep_pattern
2425+perl;
2426+ $log_file= $ENV{'log_file'};
2427+ $log_file_full_path= $ENV{'log_file_full_path'};
2428+ $grep_pattern= $ENV{'grep_pattern'};
2429+
2430+ open(FILE, "$log_file_full_path")
2431+ or die("Cannot open file $log_file_full_path: $!\n");
2432+
2433+ $lines = 0;
2434+ while(<FILE>) {
2435+ $lines++ if (/$grep_pattern/);
2436+ }
2437+ close(FILE);
2438+ print "[log_grep.inc] lines: $lines\n";
2439+EOF
2440--- /dev/null
2441+++ b/mysql-test/r/percona_log_slow_parse_error.result
2442@@ -0,0 +1,10 @@
2443+SET GLOBAL long_query_time=0;
2444+SET GLOBAL slow_query_log_use_global_control='long_query_time';
2445+DROP TABLE IF EXISTS t1;
2446+CREATE TABLE t1 (a INT);
2447+[log_start.inc] percona.slow_extended.log_slow_parse_error
2448+CREATE TABLE t1 (a INT);
2449+ERROR 42S01: Table 't1' already exists
2450+[log_stop.inc] percona.slow_extended.log_slow_parse_error
2451+[log_grep.inc] file: percona.slow_extended.log_slow_parse_error pattern: Last_errno: 1050
2452+[log_grep.inc] lines: 1
2453--- /dev/null
2454+++ b/mysql-test/t/percona_log_slow_parse_error.test
2455@@ -0,0 +1,22 @@
2456+--let log_file=percona.slow_extended.log_slow_parse_error
2457+
2458+SET GLOBAL long_query_time=0;
2459+SET GLOBAL slow_query_log_use_global_control='long_query_time';
2460+
2461+connect (conn1,localhost,root,,);
2462+connection conn1;
2463+--disable_warnings
2464+DROP TABLE IF EXISTS t1;
2465+--enable_warnings
2466+CREATE TABLE t1 (a INT);
2467+--source include/log_start.inc
2468+--error 1050
2469+CREATE TABLE t1 (a INT);
2470+disconnect conn1;
2471+connection default;
2472+--source include/log_stop.inc
2473+--let grep_pattern = Last_errno: 1050
2474+--source include/log_grep.inc
2475+SET GLOBAL long_query_time=default;
2476+SET GLOBAL slow_query_log_use_global_control='';
2477+DROP TABLE t1;
2478>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches