From: ramil Date: May 12 2006 10:43am Subject: bk commit into 5.0 tree (ramil:1.2127) BUG#10210 List-Archive: http://lists.mysql.com/commits/6297 X-Bug: 10210 Message-Id: <200605121043.k4CAhFsp041564@myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2127 06/05/12 15:43:08 ramil@stripped +2 -0 Fix for bug #10210: running SHOW STATUS increments counters it shouldn't sql/sql_select.cc 1.414 06/05/12 15:42:58 ramil@stripped +14 -0 Fix for bug #10210: running SHOW STATUS increments counters it shouldn't - save status variables before 'show status' processing then restore it. sql/sql_class.h 1.289 06/05/12 15:42:58 ramil@stripped +5 -0 Fix for bug #10210: running SHOW STATUS increments counters it shouldn't - save status variables before 'show status' processing then restore it. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: ramil # Host: myoffice.izhnet.ru # Root: /usr/home/ram/work/5.0.b10210 --- 1.288/sql/sql_class.h 2006-04-13 12:25:52 +05:00 +++ 1.289/sql/sql_class.h 2006-05-12 15:42:58 +05:00 @@ -651,6 +651,11 @@ typedef struct system_status_var #define last_system_status_var com_stmt_close +/* + Size of the buffer used to save/restore status variables +*/ + +#define status_var_buf_size offsetof(STATUS_VAR, last_query_cost) void free_tmp_table(THD *thd, TABLE *entry); --- 1.413/sql/sql_select.cc 2006-05-08 04:21:08 +05:00 +++ 1.414/sql/sql_select.cc 2006-05-12 15:42:58 +05:00 @@ -1835,6 +1835,7 @@ mysql_select(THD *thd, Item ***rref_poin { bool err; bool free_join= 1; + byte *saved_status_var= 0; DBUG_ENTER("mysql_select"); select_lex->context.resolve_in_select_list= TRUE; @@ -1884,6 +1885,13 @@ mysql_select(THD *thd, Item ***rref_poin } } + if ((thd->lex->orig_sql_command == SQLCOM_SHOW_STATUS) && + (saved_status_var= (byte*) thd->alloc(status_var_buf_size))) + { + /* Save status variables */ + memcpy(saved_status_var, &thd->status_var, status_var_buf_size); + } + if ((err= join->optimize())) { goto err; // 1 @@ -1917,6 +1925,12 @@ mysql_select(THD *thd, Item ***rref_poin } err: + if ((thd->lex->orig_sql_command == SQLCOM_SHOW_STATUS) && saved_status_var) + { + /* Restore status variables */ + memcpy(&thd->status_var, saved_status_var, status_var_buf_size); + } + if (free_join) { thd->proc_info="end";