Merge lp:~tsarev/percona-server/test51_716210 into lp:percona-server/5.1

Proposed by Oleg Tsarev
Status: Superseded
Proposed branch: lp:~tsarev/percona-server/test51_716210
Merge into: lp:percona-server/5.1
Diff against target: 319 lines (+76/-27)
6 files modified
patches/bug580324.patch (+3/-3)
patches/response_time_distribution.patch (+3/-3)
patches/show_slave_status_nolock.patch (+2/-2)
patches/show_temp_51.patch (+3/-3)
patches/slow_extended.patch (+53/-4)
patches/userstat.patch (+12/-12)
To merge this branch: bzr merge lp:~tsarev/percona-server/test51_716210
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Laurynas Biveinis (community) Approve
Review via email: mp+74998@code.launchpad.net

This proposal supersedes a proposal from 2011-09-06.

This proposal has been superseded by a proposal from 2011-09-29.

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 : Posted in a previous version of this proposal
Revision history for this message
Oleg Tsarev (tsarev) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

LGTM provided that Jenkins result are clean

review: Approve
Revision history for this message
Alexey Kopytov (akopytov) wrote :

last_errno is not the only variable that has to be reset for admin commands after a failing statement. Most other counters from slow_extended are affected by the same problem.

Here's an test case:

create table t1(a int primary key);
insert into t1 values (1), (2), (3);
insert into t1 select * from t1 order by rand();

The last statement will fail ER_DUP_ENTRY, and the next admin command will have the same Last_errno, Rows_{sent,examined,affected,read}, Bytes_sent, Tmp_tables, Tmp_disk_tables and Tmp_table_sizes.

I'm fairly sure InnoDB stats have the same problem.

Some comments on the test case:

- with use_global_long_query_time=1 do you really need to create a separate connection?
- please replace 1050 with ER_TABLE_EXISTS_ERROR.

review: Needs Fixing

Unmerged revisions

282. By Oleg Tsarev

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

281. By Oleg Tsarev

1) move tests from mysql-test/ to patches
2) remove install_tests script and call of script from Makefile

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'patches/bug580324.patch'
--- patches/bug580324.patch 2011-08-09 13:35:34 +0000
+++ patches/bug580324.patch 2011-09-12 13:47:56 +0000
@@ -24,7 +24,7 @@
24 int4store(key + key_length, thd->server_id);24 int4store(key + key_length, thd->server_id);
25--- a/sql/sql_parse.cc25--- a/sql/sql_parse.cc
26+++ b/sql/sql_parse.cc26+++ b/sql/sql_parse.cc
27@@ -1342,10 +1342,12 @@27@@ -1343,10 +1343,12 @@
28 break;28 break;
29 #else29 #else
30 {30 {
@@ -39,7 +39,7 @@
39 39
40 /* used as fields initializator */40 /* used as fields initializator */
41 lex_start(thd);41 lex_start(thd);
42@@ -1357,26 +1359,22 @@42@@ -1358,26 +1360,22 @@
43 /*43 /*
44 We have name + wildcard in packet, separated by endzero44 We have name + wildcard in packet, separated by endzero
45 */45 */
@@ -77,7 +77,7 @@
77 77
78 if (is_schema_db(table_list.db, table_list.db_length))78 if (is_schema_db(table_list.db, table_list.db_length))
79 {79 {
80@@ -1385,9 +1383,6 @@80@@ -1386,9 +1384,6 @@
81 table_list.schema_table= schema_table;81 table_list.schema_table= schema_table;
82 }82 }
83 83
8484
=== modified file 'patches/response_time_distribution.patch'
--- patches/response_time_distribution.patch 2011-07-30 23:07:03 +0000
+++ patches/response_time_distribution.patch 2011-09-12 13:47:56 +0000
@@ -3119,7 +3119,7 @@
3119 3119
3120 /**3120 /**
3121 @defgroup Runtime_Environment Runtime Environment3121 @defgroup Runtime_Environment Runtime Environment
3122@@ -1777,6 +1778,7 @@3122@@ -1778,6 +1779,7 @@
3123 3123
3124 ulonglong end_utime_of_query= thd->current_utime();3124 ulonglong end_utime_of_query= thd->current_utime();
3125 ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);3125 ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);
@@ -3127,7 +3127,7 @@
3127 3127
3128 /*3128 /*
3129 Low long_query_time value most likely means user is debugging stuff and even3129 Low long_query_time value most likely means user is debugging stuff and even
3130@@ -1947,6 +1949,7 @@3130@@ -1948,6 +1950,7 @@
3131 case SCH_CHARSETS:3131 case SCH_CHARSETS:
3132 case SCH_ENGINES:3132 case SCH_ENGINES:
3133 case SCH_COLLATIONS:3133 case SCH_COLLATIONS:
@@ -3135,7 +3135,7 @@
3135 case SCH_COLLATION_CHARACTER_SET_APPLICABILITY:3135 case SCH_COLLATION_CHARACTER_SET_APPLICABILITY:
3136 case SCH_USER_PRIVILEGES:3136 case SCH_USER_PRIVILEGES:
3137 case SCH_SCHEMA_PRIVILEGES:3137 case SCH_SCHEMA_PRIVILEGES:
3138@@ -7306,6 +7309,12 @@3138@@ -7307,6 +7310,12 @@
3139 init_global_index_stats();3139 init_global_index_stats();
3140 pthread_mutex_unlock(&LOCK_global_index_stats);3140 pthread_mutex_unlock(&LOCK_global_index_stats);
3141 }3141 }
31423142
=== modified file 'patches/show_slave_status_nolock.patch'
--- patches/show_slave_status_nolock.patch 2011-09-06 08:23:51 +0000
+++ patches/show_slave_status_nolock.patch 2011-09-12 13:47:56 +0000
@@ -56,7 +56,7 @@
56 sql_command_flags[SQLCOM_SHOW_CREATE_PROC]= CF_STATUS_COMMAND;56 sql_command_flags[SQLCOM_SHOW_CREATE_PROC]= CF_STATUS_COMMAND;
57 sql_command_flags[SQLCOM_SHOW_CREATE_FUNC]= CF_STATUS_COMMAND;57 sql_command_flags[SQLCOM_SHOW_CREATE_FUNC]= CF_STATUS_COMMAND;
58 sql_command_flags[SQLCOM_SHOW_CREATE_TRIGGER]= CF_STATUS_COMMAND;58 sql_command_flags[SQLCOM_SHOW_CREATE_TRIGGER]= CF_STATUS_COMMAND;
59@@ -2589,12 +2590,16 @@59@@ -2590,12 +2591,16 @@
60 pthread_mutex_unlock(&LOCK_active_mi);60 pthread_mutex_unlock(&LOCK_active_mi);
61 break;61 break;
62 }62 }
@@ -74,7 +74,7 @@
74 if (active_mi != NULL)74 if (active_mi != NULL)
75 {75 {
76 res = show_master_info(thd, active_mi);76 res = show_master_info(thd, active_mi);
77@@ -2605,7 +2610,10 @@77@@ -2606,7 +2611,10 @@
78 WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));78 WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
79 my_ok(thd);79 my_ok(thd);
80 }80 }
8181
=== modified file 'patches/show_temp_51.patch'
--- patches/show_temp_51.patch 2011-09-06 08:23:51 +0000
+++ patches/show_temp_51.patch 2011-09-12 13:47:56 +0000
@@ -38,7 +38,7 @@
38 sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND |38 sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND |
39 CF_SHOW_TABLE_COMMAND |39 CF_SHOW_TABLE_COMMAND |
40 CF_REEXECUTION_FRAGILE);40 CF_REEXECUTION_FRAGILE);
41@@ -1875,6 +1878,8 @@41@@ -1876,6 +1879,8 @@
42 42
43 case SCH_TABLE_NAMES:43 case SCH_TABLE_NAMES:
44 case SCH_TABLES:44 case SCH_TABLES:
@@ -47,7 +47,7 @@
47 case SCH_VIEWS:47 case SCH_VIEWS:
48 case SCH_TRIGGERS:48 case SCH_TRIGGERS:
49 case SCH_EVENTS:49 case SCH_EVENTS:
50@@ -2374,6 +2379,7 @@50@@ -2375,6 +2380,7 @@
51 }51 }
52 case SQLCOM_SHOW_DATABASES:52 case SQLCOM_SHOW_DATABASES:
53 case SQLCOM_SHOW_TABLES:53 case SQLCOM_SHOW_TABLES:
@@ -55,7 +55,7 @@
55 case SQLCOM_SHOW_TRIGGERS:55 case SQLCOM_SHOW_TRIGGERS:
56 case SQLCOM_SHOW_TABLE_STATUS:56 case SQLCOM_SHOW_TABLE_STATUS:
57 case SQLCOM_SHOW_OPEN_TABLES:57 case SQLCOM_SHOW_OPEN_TABLES:
58@@ -5527,6 +5533,8 @@58@@ -5528,6 +5534,8 @@
59 59
60 case SCH_TABLE_NAMES:60 case SCH_TABLE_NAMES:
61 case SCH_TABLES:61 case SCH_TABLES:
6262
=== modified file 'patches/slow_extended.patch'
--- patches/slow_extended.patch 2011-08-09 13:35:34 +0000
+++ patches/slow_extended.patch 2011-09-12 13:47:56 +0000
@@ -1388,7 +1388,15 @@
1388 1388
1389 const char *any_db="*any*"; // Special symbol for check_access1389 const char *any_db="*any*"; // Special symbol for check_access
1390 1390
1391@@ -1700,6 +1701,50 @@1391@@ -999,6 +1000,7 @@
1392 the slow log only if opt_log_slow_admin_statements is set.
1393 */
1394 thd->enable_slow_log= TRUE;
1395+ thd->last_errno= 0;
1396 thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
1397 thd->set_time();
1398 if (!thd->is_valid_time())
1399@@ -1700,6 +1702,50 @@
1392 DBUG_RETURN(error);1400 DBUG_RETURN(error);
1393 }1401 }
1394 1402
@@ -1439,7 +1447,7 @@
1439 1447
1440 void log_slow_statement(THD *thd)1448 void log_slow_statement(THD *thd)
1441 {1449 {
1442@@ -1713,17 +1758,51 @@1450@@ -1713,17 +1759,51 @@
1443 if (unlikely(thd->in_sub_stmt))1451 if (unlikely(thd->in_sub_stmt))
1444 DBUG_VOID_RETURN; // Don't set time for sub stmt1452 DBUG_VOID_RETURN; // Don't set time for sub stmt
1445 1453
@@ -1494,7 +1502,7 @@
1494 ((thd->server_status &1502 ((thd->server_status &
1495 (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&1503 (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
1496 opt_log_queries_not_using_indexes &&1504 opt_log_queries_not_using_indexes &&
1497@@ -2099,6 +2178,9 @@1505@@ -2099,6 +2179,9 @@
1498 context.resolve_in_table_list_only(select_lex->1506 context.resolve_in_table_list_only(select_lex->
1499 table_list.first);1507 table_list.first);
1500 1508
@@ -1504,7 +1512,7 @@
1504 /*1512 /*
1505 Reset warning count for each query that uses tables1513 Reset warning count for each query that uses tables
1506 A better approach would be to reset this for any commands1514 A better approach would be to reset this for any commands
1507@@ -5827,6 +5909,21 @@1515@@ -5827,6 +5910,21 @@
1508 thd->rand_used= 0;1516 thd->rand_used= 0;
1509 thd->sent_row_count= thd->examined_row_count= 0;1517 thd->sent_row_count= thd->examined_row_count= 0;
1510 1518
@@ -2575,3 +2583,44 @@
2575 /* Intvar event post-header */2583 /* Intvar event post-header */
2576 2584
2577 /* Intvar event data */2585 /* Intvar event data */
2586--- /dev/null
2587+++ b/mysql-test/r/percona_log_slow_parse_error.result
2588@@ -0,0 +1,11 @@
2589+SET GLOBAL long_query_time=0;
2590+SET GLOBAL use_global_long_query_time=1;
2591+SET GLOBAL log_slow_timestamp_every=1;
2592+DROP TABLE IF EXISTS t1;
2593+CREATE TABLE t1 (a INT);
2594+[log_start.inc] percona.slow_extended.error_on_quit
2595+CREATE TABLE t1 (a INT);
2596+ERROR 42S01: Table 't1' already exists
2597+[log_stop.inc] percona.slow_extended.error_on_quit
2598+[log_grep.inc] file: percona.slow_extended.error_on_quit pattern: Last_errno: 1050
2599+[log_grep.inc] lines: 1
2600--- /dev/null
2601+++ b/mysql-test/t/percona_log_slow_parse_error.test
2602@@ -0,0 +1,24 @@
2603+--let log_file=percona.slow_extended.error_on_quit
2604+
2605+SET GLOBAL long_query_time=0;
2606+SET GLOBAL use_global_long_query_time=1;
2607+SET GLOBAL log_slow_timestamp_every=1;
2608+
2609+connect (conn1,localhost,root,,);
2610+connection conn1;
2611+--disable_warnings
2612+DROP TABLE IF EXISTS t1;
2613+--enable_warnings
2614+CREATE TABLE t1 (a INT);
2615+--source include/log_start.inc
2616+--error 1050
2617+CREATE TABLE t1 (a INT);
2618+disconnect conn1;
2619+connection default;
2620+--source include/log_stop.inc
2621+--let grep_pattern = Last_errno: 1050
2622+--source include/log_grep.inc
2623+SET GLOBAL long_query_time=default;
2624+SET GLOBAL use_global_long_query_time=default;
2625+SET GLOBAL log_slow_timestamp_every=default;
2626+DROP TABLE t1;
25782627
=== modified file 'patches/userstat.patch'
--- patches/userstat.patch 2011-09-06 08:23:51 +0000
+++ patches/userstat.patch 2011-09-12 13:47:56 +0000
@@ -1759,7 +1759,7 @@
1759 /*1759 /*
1760 Commands which always take a long time are logged into1760 Commands which always take a long time are logged into
1761 the slow log only if opt_log_slow_admin_statements is set.1761 the slow log only if opt_log_slow_admin_statements is set.
1762@@ -1921,6 +1933,13 @@1762@@ -1922,6 +1934,13 @@
1763 thd->profiling.discard_current_query();1763 thd->profiling.discard_current_query();
1764 #endif1764 #endif
1765 break;1765 break;
@@ -1773,7 +1773,7 @@
1773 case SCH_OPEN_TABLES:1773 case SCH_OPEN_TABLES:
1774 case SCH_VARIABLES:1774 case SCH_VARIABLES:
1775 case SCH_STATUS:1775 case SCH_STATUS:
1776@@ -2077,6 +2096,7 @@1776@@ -2078,6 +2097,7 @@
1777 thd->security_ctx->priv_host)) &&1777 thd->security_ctx->priv_host)) &&
1778 check_global_access(thd, SUPER_ACL))1778 check_global_access(thd, SUPER_ACL))
1779 {1779 {
@@ -1781,7 +1781,7 @@
1781 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");1781 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
1782 DBUG_RETURN(TRUE);1782 DBUG_RETURN(TRUE);
1783 }1783 }
1784@@ -5418,6 +5438,7 @@1784@@ -5419,6 +5439,7 @@
1785 if (!no_errors)1785 if (!no_errors)
1786 {1786 {
1787 const char *db_name= db ? db : thd->db;1787 const char *db_name= db ? db : thd->db;
@@ -1789,7 +1789,7 @@
1789 my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),1789 my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1790 sctx->priv_user, sctx->priv_host, db_name);1790 sctx->priv_user, sctx->priv_host, db_name);
1791 }1791 }
1792@@ -5450,12 +5471,15 @@1792@@ -5451,12 +5472,15 @@
1793 { // We can never grant this1793 { // We can never grant this
1794 DBUG_PRINT("error",("No possible access"));1794 DBUG_PRINT("error",("No possible access"));
1795 if (!no_errors)1795 if (!no_errors)
@@ -1805,7 +1805,7 @@
1805 DBUG_RETURN(TRUE); /* purecov: tested */1805 DBUG_RETURN(TRUE); /* purecov: tested */
1806 }1806 }
1807 1807
1808@@ -5481,11 +5505,15 @@1808@@ -5482,11 +5506,15 @@
1809 1809
1810 DBUG_PRINT("error",("Access denied"));1810 DBUG_PRINT("error",("Access denied"));
1811 if (!no_errors)1811 if (!no_errors)
@@ -1821,7 +1821,7 @@
1821 DBUG_RETURN(TRUE); /* purecov: tested */1821 DBUG_RETURN(TRUE); /* purecov: tested */
1822 }1822 }
1823 1823
1824@@ -5514,6 +5542,7 @@1824@@ -5515,6 +5543,7 @@
1825 1825
1826 if (!thd->col_access && check_grant_db(thd, dst_db_name))1826 if (!thd->col_access && check_grant_db(thd, dst_db_name))
1827 {1827 {
@@ -1829,7 +1829,7 @@
1829 my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),1829 my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1830 thd->security_ctx->priv_user,1830 thd->security_ctx->priv_user,
1831 thd->security_ctx->priv_host,1831 thd->security_ctx->priv_host,
1832@@ -5595,9 +5624,12 @@1832@@ -5596,9 +5625,12 @@
1833 (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))1833 (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
1834 {1834 {
1835 if (!no_errors)1835 if (!no_errors)
@@ -1842,7 +1842,7 @@
1842 return TRUE;1842 return TRUE;
1843 }1843 }
1844 /*1844 /*
1845@@ -5760,6 +5792,7 @@1845@@ -5761,6 +5793,7 @@
1846 if ((thd->security_ctx->master_access & want_access))1846 if ((thd->security_ctx->master_access & want_access))
1847 return 0;1847 return 0;
1848 get_privilege_desc(command, sizeof(command), want_access);1848 get_privilege_desc(command, sizeof(command), want_access);
@@ -1850,7 +1850,7 @@
1850 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);1850 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
1851 return 1;1851 return 1;
1852 #else1852 #else
1853@@ -6134,6 +6167,32 @@1853@@ -6135,6 +6168,32 @@
1854 lex_start(thd);1854 lex_start(thd);
1855 mysql_reset_thd_for_next_command(thd);1855 mysql_reset_thd_for_next_command(thd);
1856 1856
@@ -1883,7 +1883,7 @@
1883 if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)1883 if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
1884 {1884 {
1885 LEX *lex= thd->lex;1885 LEX *lex= thd->lex;
1886@@ -6214,6 +6273,43 @@1886@@ -6215,6 +6274,43 @@
1887 *found_semicolon= NULL;1887 *found_semicolon= NULL;
1888 }1888 }
1889 1889
@@ -1927,7 +1927,7 @@
1927 DBUG_VOID_RETURN;1927 DBUG_VOID_RETURN;
1928 }1928 }
1929 1929
1930@@ -7086,6 +7182,13 @@1930@@ -7087,6 +7183,13 @@
1931 if (flush_error_log())1931 if (flush_error_log())
1932 result=1;1932 result=1;
1933 }1933 }
@@ -1941,7 +1941,7 @@
1941 #ifdef HAVE_QUERY_CACHE1941 #ifdef HAVE_QUERY_CACHE
1942 if (options & REFRESH_QUERY_CACHE_FREE)1942 if (options & REFRESH_QUERY_CACHE_FREE)
1943 {1943 {
1944@@ -7186,6 +7289,40 @@1944@@ -7187,6 +7290,40 @@
1945 #endif1945 #endif
1946 if (options & REFRESH_USER_RESOURCES)1946 if (options & REFRESH_USER_RESOURCES)
1947 reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */1947 reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */

Subscribers

People subscribed via source and target branches