3245 Jorgen Loland 2011-01-03
WL#4800: Remove opt_trace.h from includes in opt_range.h
modified:
sql/opt_range.h
sql/sql_delete.cc
sql/sql_help.cc
sql/sql_prepare.cc
sql/sql_update.cc
3244 Jorgen Loland 2011-01-03
WL#4800: Followup patch: revert print_quick() and friends to
how they are in next-mr-opt-backporting.
modified:
sql/opt_range.cc
sql/opt_range.h
3243 Jorgen Loland 2010-12-22
Added todo item
modified:
WL4800_TODO.txt
3242 Jorgen Loland 2010-12-21
WL#4800:
Revert print_quick() and friends to how they are in
next-mr-opt-backporting, i.e., remove optimizer tracing from
this function since tracing of quick is performed in
TABLE_READ_PLAN::trace_basic_info() instead.
@ WL4800_TODO.txt
Update todo-list
@ sql/opt_range.cc
Revert print_quick() and friends to how they are in next-mr-opt-backporting.
modified:
WL4800_TODO.txt
sql/opt_range.cc
=== modified file 'WL4800_TODO.txt'
--- a/WL4800_TODO.txt 2010-12-21 07:34:33 +0000
+++ b/WL4800_TODO.txt 2010-12-22 09:51:47 +0000
@@ -59,3 +59,6 @@ range access anyway.
(1)CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b), KEY b (b));
INSERT INTO t1 VALUES (1,1),(1,2),(1,0),(1,3);
SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
+
+Make --opt-trace-protocol dump traces to a separate file so that mtr
+can run with it without failing all tests.
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2010-12-21 07:34:33 +0000
+++ b/sql/opt_range.cc 2011-01-03 11:14:55 +0000
@@ -792,13 +792,16 @@ TABLE_READ_PLAN *get_best_disjunct_quick
static
TRP_GROUP_MIN_MAX *get_best_group_min_max(PARAM *param, SEL_TREE *tree,
double read_time);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,
const char *msg);
static void print_ror_scans_arr(TABLE *table, const char *msg,
struct st_ror_scan_info **start,
struct st_ror_scan_info **end);
static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg);
+#endif
+
+#ifdef OPTIMIZER_TRACE
static void append_range(String *out,
const KEY_PART_INFO *key_parts,
const uchar *min_key, const uchar *max_key,
@@ -2415,7 +2418,6 @@ int SQL_SELECT::test_quick_select(THD *t
DBUG_PRINT("enter",("keys_to_use: %lu prev_tables: %lu const_tables: %lu",
(ulong) keys_to_use.to_ulonglong(), (ulong) prev_tables,
(ulong) const_tables));
- //DBUG_PRINT("info", ("records: %lu", (ulong) head->file->stats.records));
delete quick;
quick=0;
needed_reg.clear_all();
@@ -2587,7 +2589,6 @@ int SQL_SELECT::test_quick_select(THD *t
*/
if (tree->type != SEL_TREE::KEY && tree->type != SEL_TREE::KEY_SMALLER)
{
- DBUG_ASSERT(tree->type == SEL_TREE::ALWAYS); //anything else possible?
trace_range.add("range_scan_possible", false);
if (tree->type == SEL_TREE::ALWAYS)
trace_range.add_alnum("cause", "condition_always_true");
@@ -5348,10 +5349,10 @@ static TRP_RANGE *get_key_scans_params(P
read_plan->is_ror= tree->ror_scans_map.is_set(idx);
read_plan->read_cost= read_time;
read_plan->mrr_buf_size= best_buf_size;
- //DBUG_PRINT("info",
- // ("Returning range plan for key %s, cost %g, records %lu",
- // param->table->key_info[param->real_keynr[idx]].name,
- // read_plan->read_cost, (ulong) read_plan->records));
+ DBUG_PRINT("info",
+ ("Returning range plan for key %s, cost %g, records %lu",
+ param->table->key_info[param->real_keynr[idx]].name,
+ read_plan->read_cost, (ulong) read_plan->records));
}
}
else
@@ -12254,12 +12255,12 @@ static void print_ror_scans_arr(TABLE *t
#endif /* !DBUG_OFF */
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
-
/*****************************************************************************
** Append a range for a single keypart into a stream.
*****************************************************************************/
+#ifdef OPTIMIZER_TRACE
+
/**
Print a key into a stream
@@ -12346,6 +12347,8 @@ static void append_range(String *out,
}
}
+#endif //OPTIMIZER_TRACE
+
/*****************************************************************************
** Print a quick range for debugging
** TODO:
@@ -12353,6 +12356,8 @@ static void append_range(String *out,
** of locking the DEBUG stream !
*****************************************************************************/
+#ifndef DBUG_OFF
+
static void
print_multiple_key_values(KEY_PART *key_part, const uchar *key,
uint used_length)
@@ -12408,10 +12413,6 @@ static void print_quick(QUICK_SELECT_I *
quick->dbug_dump(0, TRUE);
dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
- /**
- @todo problem: with optimizer trace on and --debug not used, this prints
- to stderr
- */
fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf));
DBUG_UNLOCK_FILE;
@@ -12546,7 +12547,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_du
}
-#endif /* !DBUG_OFF || OPTIMIZER_TRACE */
+#endif /* !DBUG_OFF */
/*****************************************************************************
** Instantiate templates
=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h 2010-11-17 12:27:39 +0000
+++ b/sql/opt_range.h 2011-01-03 13:10:02 +0000
@@ -33,7 +33,6 @@
*/
#include "sql_class.h" // set_var.h: THD
#include "set_var.h" /* Item */
-#include "opt_trace.h"
class JOIN;
class Item_sum;
@@ -355,7 +354,7 @@ public:
Table record buffer used by this quick select.
*/
uchar *record;
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
/*
Print quick select information to DBUG_FILE. Caller is responsible
for locking DBUG_FILE before this call and unlocking it afterwards.
@@ -473,7 +472,7 @@ public:
int get_type() { return QS_TYPE_RANGE; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
void add_info_string(String *str);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
QUICK_SELECT_I *make_reverse(uint used_key_parts_arg);
@@ -571,7 +570,7 @@ public:
void add_keys_and_lengths(String *key_names, String *used_lengths);
void add_info_string(String *str);
bool is_keys_used(const MY_BITMAP *fields);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
@@ -631,7 +630,7 @@ public:
void add_keys_and_lengths(String *key_names, String *used_lengths);
void add_info_string(String *str);
bool is_keys_used(const MY_BITMAP *fields);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
int init_ror_merged_scan(bool reuse_handler);
@@ -686,7 +685,7 @@ public:
void add_keys_and_lengths(String *key_names, String *used_lengths);
void add_info_string(String *str);
bool is_keys_used(const MY_BITMAP *fields);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
@@ -810,7 +809,7 @@ public:
bool unique_key_range() { return false; }
int get_type() { return QS_TYPE_GROUP_MIN_MAX; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
-#if !defined(DBUG_OFF) || defined(OPTIMIZER_TRACE)
+#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
bool is_agg_distinct() { return have_agg_distinct; }
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2010-11-24 18:54:26 +0000
+++ b/sql/sql_delete.cc 2011-01-03 13:10:02 +0000
@@ -35,6 +35,7 @@
#include "sp_head.h"
#include "sql_trigger.h"
#include "transaction.h"
+#include "opt_trace.h" // Opt_trace_object
#include "records.h" // init_read_record,
// end_read_record
=== modified file 'sql/sql_help.cc'
--- a/sql/sql_help.cc 2010-11-17 12:27:39 +0000
+++ b/sql/sql_help.cc 2011-01-03 13:10:02 +0000
@@ -19,6 +19,7 @@
#include "sql_table.h" // primary_key_name
#include "sql_base.h" // REPORT_ALL_ERRORS, setup_tables
#include "opt_range.h" // SQL_SELECT
+#include "opt_trace.h" // Opt_trace_object
#include "records.h" // init_read_record, end_read_record
struct st_find_field
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2010-12-19 14:24:03 +0000
+++ b/sql/sql_prepare.cc 2011-01-03 13:10:02 +0000
@@ -113,6 +113,7 @@ When one supplies long data for a placeh
#include <mysql_com.h>
#endif
#include "lock.h" // MYSQL_OPEN_FORCE_SHARED_MDL
+#include "opt_trace.h" // Opt_trace_object
/**
A result class used to send cursor rows using the binary protocol.
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2010-11-24 18:54:26 +0000
+++ b/sql/sql_update.cc 2011-01-03 13:10:02 +0000
@@ -42,6 +42,7 @@
// mysql_handle_derived,
// mysql_derived_filling
+#include "opt_trace.h" // Opt_trace_object
/* Return 0 if row hasn't changed */
bool compare_record(TABLE *table)
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-next-mr-bugfixing branch (jorgen.loland:3242 to 3245)WL#4800 | Jorgen Loland | 3 Jan |