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. --- sql/sql_select.cc | 73 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 30 deletions(-) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3d2f46a9982..cb8f39084df 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -599,6 +599,7 @@ JOIN::optimize() if (thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS) thd->status_var.last_query_cost= 0.0; + THD_PROC_INFO(thd, "optimizing"); row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR : unit->select_limit_cnt); /* select_limit is used to decide if we are likely to scan the whole table */ @@ -702,14 +703,14 @@ JOIN::optimize() thd->fatal_error(); error= res; DBUG_PRINT("error",("Error from opt_sum_query")); - DBUG_RETURN(1); + DBUG_RETURN(1); } if (res < 0) { DBUG_PRINT("info",("No matching min/max row")); - zero_result_cause= "No matching min/max row"; - error=0; - DBUG_RETURN(0); + zero_result_cause= "No matching min/max row"; + error=0; + DBUG_RETURN(0); } DBUG_PRINT("info",("Select tables optimized away")); zero_result_cause= "Select tables optimized away"; @@ -745,7 +746,7 @@ JOIN::optimize() sort_by_table= get_sort_by_table(order, group_list, select_lex->leaf_tables); /* Calculate how to do the join */ - thd->proc_info= "statistics"; + THD_PROC_INFO(thd, "statistics"); if (make_join_statistics(this, select_lex->leaf_tables, conds, &keyuse) || thd->is_fatal_error) { @@ -755,7 +756,7 @@ JOIN::optimize() /* Remove distinct if only const tables */ select_distinct= select_distinct && (const_tables != tables); - thd->proc_info= "preparing"; + THD_PROC_INFO(thd, "preparing"); if (result->initialize_tables(this)) { DBUG_PRINT("error",("Error: initialize_tables() failed")); @@ -1102,8 +1103,9 @@ JOIN::optimize() join_tab[const_tables].type != JT_REF_OR_NULL && (order && simple_order || group_list && simple_group)) { - if (add_ref_to_table_cond(thd,&join_tab[const_tables])) + if (add_ref_to_table_cond(thd,&join_tab[const_tables])) { DBUG_RETURN(1); + } } if (!(select_options & SELECT_BIG_RESULT) && @@ -1161,7 +1163,7 @@ JOIN::optimize() if (need_tmp) { DBUG_PRINT("info",("Creating tmp table")); - thd->proc_info="Creating tmp table"; + THD_PROC_INFO(thd, "creating temporary table"); init_items_ref_array(); @@ -1190,7 +1192,9 @@ JOIN::optimize() select_options, tmp_rows_limit, (char *) ""))) + { DBUG_RETURN(1); + } /* We don't have to store rows in temp table that doesn't match HAVING if: @@ -1210,28 +1214,35 @@ JOIN::optimize() if (group_list && simple_group) { DBUG_PRINT("info",("Sorting for group")); - thd->proc_info="Sorting for group"; + THD_PROC_INFO(thd, "sorting for group"); if (create_sort_index(thd, this, group_list, HA_POS_ERROR, HA_POS_ERROR) || alloc_group_fields(this, group_list) || make_sum_func_list(all_fields, fields_list, 1) || setup_sum_funcs(thd, sum_funcs)) - DBUG_RETURN(1); + { + DBUG_RETURN(1); + } group_list=0; } else { if (make_sum_func_list(all_fields, fields_list, 0) || setup_sum_funcs(thd, sum_funcs)) - DBUG_RETURN(1); + { + DBUG_RETURN(1); + } + if (!group_list && ! exec_tmp_table1->distinct && order && simple_order) { - DBUG_PRINT("info",("Sorting for order")); - thd->proc_info="Sorting for order"; - if (create_sort_index(thd, this, order, + DBUG_PRINT("info",("Sorting for order")); + THD_PROC_INFO(thd, "Sorting for order"); + if (create_sort_index(thd, this, order, HA_POS_ERROR, HA_POS_ERROR)) - DBUG_RETURN(1); - order=0; + { + DBUG_RETURN(1); + } + order=0; } } @@ -1354,6 +1365,7 @@ JOIN::exec() int tmp_error; DBUG_ENTER("JOIN::exec"); + THD_PROC_INFO(thd, "executing"); error= 0; if (procedure) { @@ -1493,7 +1505,7 @@ JOIN::exec() curr_tmp_table= exec_tmp_table1; /* Copy data to the temporary table */ - thd->proc_info= "Copying to tmp table"; + THD_PROC_INFO(thd, "Copying to tmp table"); DBUG_PRINT("info", ("%s", thd->proc_info)); if ((tmp_error= do_select(curr_join, (List *) 0, curr_tmp_table, 0))) { @@ -1616,7 +1628,7 @@ JOIN::exec() } if (curr_join->group_list) { - thd->proc_info= "Creating sort index"; + THD_PROC_INFO(thd, "Creating sort index"); if (curr_join->join_tab == join_tab && save_join_tab()) { DBUG_VOID_RETURN; @@ -1630,7 +1642,7 @@ JOIN::exec() sortorder= curr_join->sortorder; } - thd->proc_info="Copying to group table"; + THD_PROC_INFO(thd, "Copying to group table"); DBUG_PRINT("info", ("%s", thd->proc_info)); tmp_error= -1; if (curr_join != this) @@ -1686,7 +1698,7 @@ JOIN::exec() curr_join->join_free(); /* Free quick selects */ if (curr_join->select_distinct && ! curr_join->group_list) { - thd->proc_info="Removing duplicates"; + THD_PROC_INFO(thd, "Removing duplicates"); if (curr_join->tmp_having) curr_join->tmp_having->update_used_tables(); if (remove_duplicates(curr_join, curr_tmp_table, @@ -1747,7 +1759,7 @@ JOIN::exec() if (curr_join->group_list || curr_join->order) { DBUG_PRINT("info",("Sorting for send_fields")); - thd->proc_info="Sorting result"; + THD_PROC_INFO(thd, "Sorting result"); /* If we have already done the group, add HAVING to sorted table */ if (curr_join->tmp_having && ! curr_join->group_list && ! curr_join->sort_and_group) @@ -1871,7 +1883,7 @@ JOIN::exec() } else { - thd->proc_info="Sending data"; + THD_PROC_INFO(thd, "Sending data"); DBUG_PRINT("info", ("%s", thd->proc_info)); result->send_fields((procedure ? curr_join->procedure_fields_list : *curr_fields_list), @@ -2019,7 +2031,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, { if (!(join= new JOIN(thd, fields, select_options, result))) DBUG_RETURN(TRUE); - thd->proc_info="init"; + THD_PROC_INFO(thd, "init"); thd->used_tables=0; // Updated by setup_fields if (err= join->prepare(rref_pointer_array, tables, wild_num, conds, og_num, order, group, having, proc_param, @@ -2064,8 +2076,9 @@ mysql_select(THD *thd, Item ***rref_pointer_array, err: if (free_join) { - thd->proc_info="end"; + THD_PROC_INFO(thd, "cleaning up"); err|= select_lex->cleanup(); + THD_PROC_INFO(thd, "end"); DBUG_RETURN(err || thd->net.report_error); } DBUG_RETURN(join->error); @@ -9745,7 +9758,7 @@ free_tmp_table(THD *thd, TABLE *entry) DBUG_PRINT("enter",("table: %s",entry->alias)); save_proc_info=thd->proc_info; - thd->proc_info="removing tmp table"; + THD_PROC_INFO(thd, "removing tmp table"); if (entry->file) { @@ -9773,7 +9786,7 @@ free_tmp_table(THD *thd, TABLE *entry) bitmap_clear_bit(&temp_pool, entry->temp_pool_slot); free_root(&own_root, MYF(0)); /* the table is allocated in its own root */ - thd->proc_info=save_proc_info; + THD_PROC_INFO(thd, save_proc_info); DBUG_VOID_RETURN; } @@ -9803,7 +9816,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, DBUG_RETURN(1); // End of memory save_proc_info=thd->proc_info; - thd->proc_info="converting HEAP to MyISAM"; + THD_PROC_INFO(thd, "converting HEAP to MyISAM"); if (create_myisam_tmp_table(&new_table,param, thd->lex->select_lex.options | thd->options)) @@ -9856,8 +9869,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, table->s= &table->share_not_to_be_used; table->file->change_table_ptr(table); if (save_proc_info) - thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ? - "Copying to tmp table on disk" : save_proc_info); + THD_PROC_INFO(thd, (!strcmp(save_proc_info,"Copying to tmp table") ? + "Copying to tmp table on disk" : save_proc_info)); DBUG_RETURN(0); err: @@ -9869,7 +9882,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, new_table.file->delete_table(new_table.s->table_name); delete new_table.file; err2: - thd->proc_info=save_proc_info; + THD_PROC_INFO(thd, save_proc_info); DBUG_RETURN(1); } -- 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. --- sql/sql_select.cc | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ada440fbc2d..c9e334b7784 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -598,7 +598,7 @@ JOIN::optimize() if (thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS) thd->status_var.last_query_cost= 0.0; - THD_PROC_INFO(thd, "optimizing"); + thd_proc_info(thd, "optimizing"); row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR : unit->select_limit_cnt); /* select_limit is used to decide if we are likely to scan the whole table */ @@ -745,7 +745,7 @@ JOIN::optimize() sort_by_table= get_sort_by_table(order, group_list, select_lex->leaf_tables); /* Calculate how to do the join */ - THD_PROC_INFO(thd, "statistics"); + thd_proc_info(thd, "statistics"); if (make_join_statistics(this, select_lex->leaf_tables, conds, &keyuse) || thd->is_fatal_error) { @@ -755,7 +755,7 @@ JOIN::optimize() /* Remove distinct if only const tables */ select_distinct= select_distinct && (const_tables != tables); - THD_PROC_INFO(thd, "preparing"); + thd_proc_info(thd, "preparing"); if (result->initialize_tables(this)) { DBUG_PRINT("error",("Error: initialize_tables() failed")); @@ -1162,7 +1162,7 @@ JOIN::optimize() if (need_tmp) { DBUG_PRINT("info",("Creating tmp table")); - THD_PROC_INFO(thd, "creating temporary table"); + thd_proc_info(thd, "Creating tmp table"); init_items_ref_array(); @@ -1213,7 +1213,7 @@ JOIN::optimize() if (group_list && simple_group) { DBUG_PRINT("info",("Sorting for group")); - THD_PROC_INFO(thd, "sorting for group"); + thd_proc_info(thd, "Sorting for group"); if (create_sort_index(thd, this, group_list, HA_POS_ERROR, HA_POS_ERROR) || alloc_group_fields(this, group_list) || @@ -1234,9 +1234,8 @@ JOIN::optimize() if (!group_list && ! exec_tmp_table1->distinct && order && simple_order) { - DBUG_PRINT("info",("Sorting for order")); - THD_PROC_INFO(thd, "Sorting for order"); - if (create_sort_index(thd, this, order, + thd_proc_info(thd, "Sorting for order"); + if (create_sort_index(thd, this, order, HA_POS_ERROR, HA_POS_ERROR)) { DBUG_RETURN(1); @@ -1364,7 +1363,7 @@ JOIN::exec() int tmp_error; DBUG_ENTER("JOIN::exec"); - THD_PROC_INFO(thd, "executing"); + thd_proc_info(thd, "executing"); error= 0; if (procedure) { @@ -1504,7 +1503,7 @@ JOIN::exec() curr_tmp_table= exec_tmp_table1; /* Copy data to the temporary table */ - THD_PROC_INFO(thd, "Copying to tmp table"); + thd_proc_info(thd, "Copying to tmp table"); DBUG_PRINT("info", ("%s", thd->proc_info)); if ((tmp_error= do_select(curr_join, (List *) 0, curr_tmp_table, 0))) { @@ -1627,7 +1626,7 @@ JOIN::exec() } if (curr_join->group_list) { - THD_PROC_INFO(thd, "Creating sort index"); + thd_proc_info(thd, "Creating sort index"); if (curr_join->join_tab == join_tab && save_join_tab()) { DBUG_VOID_RETURN; @@ -1641,7 +1640,7 @@ JOIN::exec() sortorder= curr_join->sortorder; } - THD_PROC_INFO(thd, "Copying to group table"); + thd_proc_info(thd, "Copying to group table"); DBUG_PRINT("info", ("%s", thd->proc_info)); tmp_error= -1; if (curr_join != this) @@ -1697,7 +1696,7 @@ JOIN::exec() curr_join->join_free(); /* Free quick selects */ if (curr_join->select_distinct && ! curr_join->group_list) { - THD_PROC_INFO(thd, "Removing duplicates"); + thd_proc_info(thd, "Removing duplicates"); if (curr_join->tmp_having) curr_join->tmp_having->update_used_tables(); if (remove_duplicates(curr_join, curr_tmp_table, @@ -1758,7 +1757,7 @@ JOIN::exec() if (curr_join->group_list || curr_join->order) { DBUG_PRINT("info",("Sorting for send_fields")); - THD_PROC_INFO(thd, "Sorting result"); + thd_proc_info(thd, "Sorting result"); /* If we have already done the group, add HAVING to sorted table */ if (curr_join->tmp_having && ! curr_join->group_list && ! curr_join->sort_and_group) @@ -1882,7 +1881,7 @@ JOIN::exec() } else { - THD_PROC_INFO(thd, "Sending data"); + thd_proc_info(thd, "Sending data"); DBUG_PRINT("info", ("%s", thd->proc_info)); result->send_fields((procedure ? curr_join->procedure_fields_list : *curr_fields_list), @@ -2030,7 +2029,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, { if (!(join= new JOIN(thd, fields, select_options, result))) DBUG_RETURN(TRUE); - THD_PROC_INFO(thd, "init"); + thd_proc_info(thd, "init"); thd->used_tables=0; // Updated by setup_fields if (err= join->prepare(rref_pointer_array, tables, wild_num, conds, og_num, order, group, having, proc_param, @@ -2075,9 +2074,9 @@ mysql_select(THD *thd, Item ***rref_pointer_array, err: if (free_join) { - THD_PROC_INFO(thd, "cleaning up"); + thd_proc_info(thd, "end"); err|= select_lex->cleanup(); - THD_PROC_INFO(thd, "end"); + thd_proc_info(thd, "end"); DBUG_RETURN(err || thd->net.report_error); } DBUG_RETURN(join->error); @@ -9807,7 +9806,7 @@ free_tmp_table(THD *thd, TABLE *entry) DBUG_PRINT("enter",("table: %s",entry->alias)); save_proc_info=thd->proc_info; - THD_PROC_INFO(thd, "removing tmp table"); + thd_proc_info(thd, "removing tmp table"); if (entry->file) { @@ -9835,7 +9834,7 @@ free_tmp_table(THD *thd, TABLE *entry) bitmap_clear_bit(&temp_pool, entry->temp_pool_slot); free_root(&own_root, MYF(0)); /* the table is allocated in its own root */ - THD_PROC_INFO(thd, save_proc_info); + thd_proc_info(thd, save_proc_info); DBUG_VOID_RETURN; } @@ -9865,7 +9864,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, DBUG_RETURN(1); // End of memory save_proc_info=thd->proc_info; - THD_PROC_INFO(thd, "converting HEAP to MyISAM"); + thd_proc_info(thd, "converting HEAP to MyISAM"); if (create_myisam_tmp_table(&new_table,param, thd->lex->select_lex.options | thd->options)) @@ -9918,8 +9917,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, table->s= &table->share_not_to_be_used; table->file->change_table_ptr(table); if (save_proc_info) - THD_PROC_INFO(thd, (!strcmp(save_proc_info,"Copying to tmp table") ? - "Copying to tmp table on disk" : save_proc_info)); + thd_proc_info(thd, (!strcmp(save_proc_info,"Copying to tmp table") ? + "Copying to tmp table on disk" : save_proc_info)); DBUG_RETURN(0); err: @@ -9931,7 +9930,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, new_table.file->delete_table(new_table.s->table_name); delete new_table.file; err2: - THD_PROC_INFO(thd, save_proc_info); + thd_proc_info(thd, save_proc_info); DBUG_RETURN(1); } -- cgit v1.2.1 From 9e2fd8caada234497a4f5c2c28aafeb66fe2b3b2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Feb 2007 13:11:36 -0500 Subject: Some changes suggested Serg, from message <20070223210659.GA24202@janus.mylan> configure.in: Use smarter autoconf help macro. sql/set_var.cc: Make a local variable static. sql/sql_lex.cc: Don't include CPP condition where it saves little time and decreases legibility. sql/sql_parse.cc: Use the name of the query in the error, instead of describing the feature. sql/sql_profile.cc: Update copyright. Make I_S schema table columns uppercase. sql/sql_profile.h: Update copyright. sql/sql_select.cc: Chagne tab indentation to spaces. --- sql/sql_select.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c9e334b7784..1ee84ca9e3d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1234,8 +1234,8 @@ JOIN::optimize() if (!group_list && ! exec_tmp_table1->distinct && order && simple_order) { - thd_proc_info(thd, "Sorting for order"); - if (create_sort_index(thd, this, order, + thd_proc_info(thd, "Sorting for order"); + if (create_sort_index(thd, this, order, HA_POS_ERROR, HA_POS_ERROR)) { DBUG_RETURN(1); -- cgit v1.2.1