MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:September 24 2010 9:13am
Subject:bzr push into mysql-next-mr-bugfixing branch (guilhem:3211 to 3212)
View as plain text  
 3212 Guilhem Bichot	2010-09-24
      Fix for test failure. Review comment: swap order of add() parameters

    modified:
      WL4800_TODO.txt
      WL4800_validate_json.py
      mysql-test/include/optimizer_trace.inc
      mysql-test/r/optimizer_trace_no_prot.result
      mysql-test/r/optimizer_trace_ps_prot.result
      sql/item_subselect.cc
      sql/opt_trace.cc
      sql/opt_trace.h
      sql/sql_parse.cc
      sql/sql_select.cc
      sql/sql_test.cc
      unittest/gunit/opt_trace-t.cc
 3211 Guilhem Bichot	2010-09-24
      fix script now that the trace may not start with \n

    modified:
      WL4800_validate_json.py
=== modified file 'WL4800_TODO.txt'
--- a/WL4800_TODO.txt	2010-09-23 20:34:56 +0000
+++ b/WL4800_TODO.txt	2010-09-24 09:11:29 +0000
@@ -44,7 +44,6 @@ opt_trace.cc.
 
 Review comments:
 - parameter for filtering
-- reverse parameters of add()
 - OOA -> structure
 - in doc, mention DUMPFILE instead of OUTFILE
 

=== modified file 'WL4800_validate_json.py'
--- a/WL4800_validate_json.py	2010-09-24 07:00:36 +0000
+++ b/WL4800_validate_json.py	2010-09-24 09:11:29 +0000
@@ -23,7 +23,8 @@ Usage:
 
 It will verify that all optimizer traces of a_file (usually a_file
 is a .result or .reject file which contains
-SELECT * FROM OPTIMIZER_TRACE; ) are JSON-compliant
+SELECT * FROM OPTIMIZER_TRACE; ) are JSON-compliant.
+Exit code is 0 if all ok.
 """ % sys.argv[0]
 
 if len(sys.argv) != 2:
@@ -32,7 +33,10 @@ if len(sys.argv) != 2:
 
 import json, re
 
+retcode=0
+
 def check(trace, first_trace_line):
+    global retcode
     s = "".join(trace)
     try:
         json.loads(s)
@@ -40,6 +44,7 @@ def check(trace, first_trace_line):
         print "error at line", first_trace_line
         print sys.exc_info()
         print s
+        retcode=1
     else:
         print "ok at line", first_trace_line
     print
@@ -67,3 +72,5 @@ for l in all:
         # eliminate /* */ (not valid JSON)
         no_comment = re.sub("/\*.*\*/", "", l)
         trace.append(no_comment)
+
+sys.exit(retcode)

=== modified file 'mysql-test/include/optimizer_trace.inc'
--- a/mysql-test/include/optimizer_trace.inc	2010-09-23 20:34:56 +0000
+++ b/mysql-test/include/optimizer_trace.inc	2010-09-24 09:11:29 +0000
@@ -440,6 +440,7 @@ select * from information_schema.OPTIMIZ
 set optimizer_trace="end_marker=off";
 select 1 union select 2;
 --let $file=$MYSQLTEST_VARDIR/tmp/optimizer_trace.txt
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --eval select TRACE into dumpfile '$file' from information_schema.OPTIMIZER_TRACE;
 # it has been manually checked that this file's content is JSON-compliant
 --cat_file $file

=== modified file 'mysql-test/r/optimizer_trace_no_prot.result'
--- a/mysql-test/r/optimizer_trace_no_prot.result	2010-09-23 20:34:56 +0000
+++ b/mysql-test/r/optimizer_trace_no_prot.result	2010-09-24 09:11:29 +0000
@@ -5046,7 +5046,7 @@ select 1 union select 2;
 1
 1
 2
-select TRACE into dumpfile '/m/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/build_debug/mysql-test/var/tmp/optimizer_trace.txt' from information_schema.OPTIMIZER_TRACE;;
+select TRACE into dumpfile 'MYSQLTEST_VARDIR/tmp/optimizer_trace.txt' from information_schema.OPTIMIZER_TRACE;;
 {
   "top_query": "select 1 union select 2",
   "steps": [

=== modified file 'mysql-test/r/optimizer_trace_ps_prot.result'
--- a/mysql-test/r/optimizer_trace_ps_prot.result	2010-09-23 20:34:56 +0000
+++ b/mysql-test/r/optimizer_trace_ps_prot.result	2010-09-24 09:11:29 +0000
@@ -5022,7 +5022,7 @@ select 1 union select 2;
 1
 1
 2
-select TRACE into dumpfile '/m/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/build_debug/mysql-test/var/tmp/optimizer_trace.txt' from information_schema.OPTIMIZER_TRACE;;
+select TRACE into dumpfile 'MYSQLTEST_VARDIR/tmp/optimizer_trace.txt' from information_schema.OPTIMIZER_TRACE;;
 {
   "top_query": "select 1 union select 2",
   "steps": [

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-09-18 16:25:43 +0000
+++ b/sql/item_subselect.cc	2010-09-24 09:11:29 +0000
@@ -1077,7 +1077,7 @@ Item_in_subselect::single_value_transfor
     {
       OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                         "> ALL/ANY (SELECT)", "SELECT(MIN)");
-      oto1.add(true, "chosen");
+      oto1.add("chosen", true);
       Item_sum_hybrid *item;
       nesting_map save_allow_sum_func;
       if (func->l_op())
@@ -1125,7 +1125,7 @@ Item_in_subselect::single_value_transfor
     {
       OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                         "> ALL/ANY (SELECT)", "MIN (SELECT)");
-      oto1.add(true, "chosen");
+      oto1.add("chosen", true);
       Item_maxmin_subselect *item;
       subs= item= new Item_maxmin_subselect(thd, this, select_lex, func->l_op());
       if (upper_item)
@@ -1231,7 +1231,7 @@ Item_in_subselect::single_value_in_to_ex
 
   OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                     "IN (SELECT)", "EXISTS (CORRELATED SELECT)");
-  oto1.add(true, "chosen");
+  oto1.add("chosen", true);
 
   select_lex->uncacheable|= UNCACHEABLE_DEPENDENT;
   if (join->having || select_lex->with_sum_func ||
@@ -1505,7 +1505,7 @@ Item_in_subselect::row_value_in_to_exist
   DBUG_ENTER("Item_in_subselect::row_value_in_to_exists_transformer");
   OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                     "IN (SELECT)", "EXISTS (CORRELATED SELECT)");
-  oto1.add(true, "chosen");
+  oto1.add("chosen", true);
 
   select_lex->uncacheable|= UNCACHEABLE_DEPENDENT;
   if (is_having_used)
@@ -1910,7 +1910,7 @@ bool Item_in_subselect::setup_engine()
         new_engine= NULL;
         exec_method= EXEC_UNSPECIFIED;
       }
-      oto1.add(new_engine != NULL, "chosen");
+      oto1.add("chosen", new_engine != NULL);
     }
     if (new_engine == NULL)
     {
@@ -3186,7 +3186,7 @@ bool subselect_hash_sj_engine::init_perm
     delete result;
     result= NULL;
     /** @todo remove this once BUG#48213 is merged */
-    poto->add("no_index_in_materialized_result", "cause");
+    poto->add("cause", "no_index_in_materialized_result");
     DBUG_RETURN(TRUE);
   }
   result= tmp_result_sink;

=== modified file 'sql/opt_trace.cc'
--- a/sql/opt_trace.cc	2010-09-23 20:15:10 +0000
+++ b/sql/opt_trace.cc	2010-09-24 09:11:29 +0000
@@ -182,7 +182,7 @@ void Opt_trace_ooa::do_destruct(void)
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(const char *val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, const char *val)
 {
   DBUG_ASSERT(started);
   DBUG_PRINT("opt_trace", ("%s: \"%s\"", key, val));
@@ -201,7 +201,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(con
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(const LEX_STRING *val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, const LEX_STRING *val)
 {
   DBUG_ASSERT(started);
   DBUG_PRINT("opt_trace", ("%s: \"%.*s\"", key, (int)val->length, val->str));
@@ -220,7 +220,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(con
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(bool val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, bool val)
 {
   DBUG_ASSERT(started);
   const char *readable= val ? "true" : "false";
@@ -234,7 +234,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(boo
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(longlong val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, longlong val)
 {
   DBUG_ASSERT(started);
   char buf[22];
@@ -249,7 +249,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(lon
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(ulonglong val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, ulonglong val)
 {
   DBUG_ASSERT(started);
   char buf[22];
@@ -264,7 +264,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(ulo
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(double val, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, double val)
 {
   DBUG_ASSERT(started);
   char buf[32];
@@ -279,7 +279,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(dou
 }
 
 
-Opt_trace_ooa& Opt_trace_ooa::do_add(Item *item, const char *key)
+Opt_trace_ooa& Opt_trace_ooa::do_add(const char *key, Item *item)
 {
   DBUG_ASSERT(started);
   char buff[256];
@@ -293,7 +293,7 @@ Opt_trace_ooa& Opt_trace_ooa::do_add(Ite
     str.append("<null>");
   }
   str.append('\0');
-  return do_add(str.ptr(), key);
+  return do_add(key, str.ptr());
 }
 
 

=== modified file 'sql/opt_trace.h'
--- a/sql/opt_trace.h	2010-09-23 20:15:10 +0000
+++ b/sql/opt_trace.h	2010-09-24 09:11:29 +0000
@@ -183,7 +183,7 @@
   object will describe one single strategy choice.
 
 @verbatim
-  oto.add("FirstMatch", "strategy");
+  oto.add("strategy", "FirstMatch");
 @endverbatim
 
   this adds a key/value pair to the just-created object: key is "strategy",
@@ -191,9 +191,9 @@
   just-created object.
 
 @verbatim
-  oto.add(*current_read_time, "cost").
-    add(*current_record_count, "records");
-  oto.add((pos->sj_strategy == SJ_OPT_FIRST_MATCH), "chosen");
+  oto.add("cost", *current_read_time).
+    add("records", *current_record_count);
+  oto.add("chosen", (pos->sj_strategy == SJ_OPT_FIRST_MATCH));
 @endverbatim
 
   this adds 3 key/value pairs: cost of strategy, number of records produced
@@ -692,11 +692,10 @@ protected:
 public:
 
   /**
-     Adds a value (of string type) to the OOA. If a key is specified, then it
-     is adds the key/value pair (the OOA must thus be an object). If no key is
-     specified, only the value is added (the OOA must thus be an array).
-     @param  value  the value
-     @param  key    the optional key
+     Adds a value (of string type) to the OOA. A key is specified, so it
+     is adds the key/value pair (the OOA must thus be an object).
+     @param  key    key
+     @param  value  value
      @return a reference to the OOA, useful for chaining like this:
      @verbatim add(x,y).add(z,t).add(u,v) @endverbatim
 
@@ -724,68 +723,128 @@ public:
      unusually intensive on the optimizer and thus real-life cases should have
      a smaller penalty. This will be benchmarked with the QA teams.
   */
-  Opt_trace_ooa& add(const char *value, const char *key= NULL)
+  Opt_trace_ooa& add(const char *key, const char *value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(key, value);
   }
-  Opt_trace_ooa& add(const LEX_STRING *value, const char *key= NULL)
+  /**
+     Adds a value (of string type) to the OOA. No key is specified, so it
+     is adds only the value (the OOA must thus be an array).
+     @param  value  value
+     @return a reference to the OOA
+  */
+  Opt_trace_ooa& add(const char *value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(NULL, value);
+  }
+  Opt_trace_ooa& add(const char *key, const LEX_STRING *value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(key, value);
+  }
+  Opt_trace_ooa& add(const LEX_STRING *value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(NULL, value);
   }
   /**
      Add a value (of Item type) to the OOA. The Item should be a condition
      (like a WHERE clause) which will be pretty-printed into the trace. This
      is useful for showing condition transformations (equality propagation
      etc).
+     @param  key    key
      @param  item   the Item
-     @param  key    the optional key
      @return a reference to the OOA
   */
-  Opt_trace_ooa& add(Item *item, const char *key= NULL)
+  Opt_trace_ooa& add(const char *key, Item *item)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(key, item);
+  }
+  Opt_trace_ooa& add(Item *item)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(NULL, item);
+  }
+  Opt_trace_ooa& add(const char *key, bool value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(key, value);
+  }
+  Opt_trace_ooa& add(bool value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(NULL, value);
+  }
+  Opt_trace_ooa& add(const char *key, int value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(key, (longlong)value);
+  }
+  Opt_trace_ooa& add(int value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(NULL, (longlong)value);
+  }
+  Opt_trace_ooa& add(const char *key, uint value)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add(key, (ulonglong)value);
+  }
+  Opt_trace_ooa& add(uint value)
   {
     if (likely(!started))
       return *this;
-    return do_add(item, key);
+    return do_add(NULL, (ulonglong)value);
   }
-  Opt_trace_ooa& add(bool value, const char *key= NULL)
+  Opt_trace_ooa& add(const char *key, longlong value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(key, value);
   }
-  Opt_trace_ooa& add(int value, const char *key= NULL)
+  Opt_trace_ooa& add(longlong value)
   {
     if (likely(!started))
       return *this;
-    return do_add((longlong)value, key);
+    return do_add(NULL, value);
   }
-  Opt_trace_ooa& add(uint value, const char *key= NULL)
+  Opt_trace_ooa& add(const char *key, ulonglong value)
   {
     if (likely(!started))
       return *this;
-    return do_add((ulonglong)value, key);
+    return do_add(key, value);
   }
-  Opt_trace_ooa& add(longlong value, const char *key= NULL)
+  Opt_trace_ooa& add(ulonglong value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(NULL, value);
   }
-  Opt_trace_ooa& add(ulonglong value, const char *key= NULL)
+  Opt_trace_ooa& add(const char *key, double value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(key, value);
   }
-  Opt_trace_ooa& add(double value, const char *key= NULL)
+  Opt_trace_ooa& add(double value)
   {
     if (likely(!started))
       return *this;
-    return do_add(value, key);
+    return do_add(NULL, value);
   }
   /**
      Allocates memory for an OOA in a MEM_ROOT (don't do "delete" on the
@@ -805,13 +864,13 @@ private:
   /** Really does destruction */
   void do_destruct(void);
   /** Really adds to the object. @sa add() */
-  Opt_trace_ooa& do_add(const char *value, const char *key);
-  Opt_trace_ooa& do_add(const LEX_STRING *value, const char *key);
-  Opt_trace_ooa& do_add(Item *item, const char *key);
-  Opt_trace_ooa& do_add(bool value, const char *key);
-  Opt_trace_ooa& do_add(longlong value, const char *key);
-  Opt_trace_ooa& do_add(ulonglong value, const char *key);
-  Opt_trace_ooa& do_add(double value, const char *key);
+  Opt_trace_ooa& do_add(const char *key, const char *value);
+  Opt_trace_ooa& do_add(const char *key, const LEX_STRING *value);
+  Opt_trace_ooa& do_add(const char *key, Item *item);
+  Opt_trace_ooa& do_add(const char *key, bool value);
+  Opt_trace_ooa& do_add(const char *key, longlong value);
+  Opt_trace_ooa& do_add(const char *key, ulonglong value);
+  Opt_trace_ooa& do_add(const char *key, double value);
   /**
      Adds an inner OOA to this OOA.
      @param key  key if the inner OOA is the value of a key/value pair, NULL
@@ -1081,15 +1140,15 @@ public:
   Opt_trace_object(Opt_trace_context *ctx, const char *key= NULL) {}
   static void *operator new(size_t size, MEM_ROOT *mem_root)
   { return (void*) alloc_root(mem_root, (uint) size); }
-  Opt_trace_object& add(const char *value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(const LEX_STRING *value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(Item *item, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(bool value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(int value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(uint value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(longlong value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(ulonglong value, const char *key= NULL) { return *this; }
-  Opt_trace_object& add(double value, const char *key= NULL) { return *this; }
+  Opt_trace_object& add(const char *key, const char *value) { return *this; }
+  Opt_trace_object& add(const char *key, const LEX_STRING *value) { return *this; }
+  Opt_trace_object& add(const char *key, Item *item) { return *this; }
+  Opt_trace_object& add(const char *key, bool value) { return *this; }
+  Opt_trace_object& add(const char *key, int value) { return *this; }
+  Opt_trace_object& add(const char *key, uint value) { return *this; }
+  Opt_trace_object& add(const char *key, longlong value) { return *this; }
+  Opt_trace_object& add(const char *key, ulonglong value) { return *this; }
+  Opt_trace_object& add(const char *key, double value) { return *this; }
 };
 
 class Opt_trace_array
@@ -1098,15 +1157,15 @@ public:
   Opt_trace_array(Opt_trace_context *ctx, const char *key= NULL) {}
   static void *operator new(size_t size, MEM_ROOT *mem_root)
   { return (void*) alloc_root(mem_root, (uint) size); }
-  Opt_trace_array& add(const char *value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(const LEX_STRING *value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(Item *item, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(bool value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(int value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(uint value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(longlong value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(ulonglong value, const char *key= NULL) { return *this; }
-  Opt_trace_array& add(double value, const char *key= NULL) { return *this; }
+  Opt_trace_array& add(const char *value) { return *this; }
+  Opt_trace_array& add(const LEX_STRING *value) { return *this; }
+  Opt_trace_array& add(Item *item) { return *this; }
+  Opt_trace_array& add(bool value) { return *this; }
+  Opt_trace_array& add(int value) { return *this; }
+  Opt_trace_array& add(uint value) { return *this; }
+  Opt_trace_array& add(longlong value) { return *this; }
+  Opt_trace_array& add(ulonglong value) { return *this; }
+  Opt_trace_array& add(double value) { return *this; }
 };
 
 class Opt_trace_disable_I_S
@@ -1145,8 +1204,8 @@ public:
 #define OPT_TRACE_TRANSFO(trace,object_level0,object_level1,select_number,from,to) \
     Opt_trace_object object_level0(trace);                              \
     Opt_trace_object object_level1(trace, "transformation");            \
-    object_level1.add(select_number, "select #").                      \
-      add(from, "from").add(to, "to");
+    object_level1.add("select #", select_number).                                    \
+    add("from", from).add("to", to);
 
 #if !defined(DBUG_OFF) && !defined(OPTIMIZER_TRACE)
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-09-22 20:24:51 +0000
+++ b/sql/sql_parse.cc	2010-09-24 09:11:29 +0000
@@ -2102,7 +2102,7 @@ mysql_execute_command(THD *thd)
       oto= new(thd->mem_root) Opt_trace_object(thd->opt_trace);
       if (oto != NULL)
       {
-        oto->add(&(thd->query_string), "top_query");
+        oto->add("top_query", &(thd->query_string));
         ota= new(thd->mem_root) Opt_trace_array(thd->opt_trace, "steps");
       }
       if ((oto == NULL) || (ota == NULL))

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-23 20:15:10 +0000
+++ b/sql/sql_select.cc	2010-09-24 09:11:29 +0000
@@ -556,7 +556,7 @@ JOIN::prepare(Item ***rref_pointer_array
 
   Opt_trace_object oto0(thd->opt_trace);
   Opt_trace_object oto1(thd->opt_trace, "join_preparation");
-  oto1.add(select_lex->select_number, "select #");
+  oto1.add("select #", select_lex->select_number);
   Opt_trace_array ota(thd->opt_trace, "steps");
 
   /* Check that all tables, fields, conds and order are ok */
@@ -973,13 +973,13 @@ bool resolve_subquery(THD *thd, JOIN *jo
     {
       OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                         "IN (SELECT)", "semijoin");
-      oto1.add(choice == 1, "chosen");
+      oto1.add("chosen", choice == 1);
     }
     if (choice != 1)
     {
       OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1, select_lex->select_number,
                         "IN (SELECT)", "materialization");
-      oto1.add(choice == 2, "chosen");
+      oto1.add("chosen", choice == 2);
     }
   }
 
@@ -1784,14 +1784,14 @@ JOIN::optimize()
 
   Opt_trace_object oto0(trace);
   Opt_trace_object oto1(trace, "join_optimization");
-  oto1.add(select_lex->select_number, "select #");
+  oto1.add("select #", select_lex->select_number);
 
   int rc= JOIN::optimize_steps();
 
   if (zero_result_cause != NULL)
   {
     Opt_trace_object oto2(trace, "empty_result");
-    oto2.add(zero_result_cause, "cause");
+    oto2.add("cause", zero_result_cause);
     /*
       Even with zero matching rows, subqueries in the HAVING clause may
       need to be evaluated if there are aggregate functions in the
@@ -4087,7 +4087,7 @@ bool JOIN::flatten_subqueries()
       OPT_TRACE_TRANSFO(thd->opt_trace, oto0, oto1,
                         (*subq)->get_select_lex()->select_number,
                         "IN (SELECT)", "semijoin");
-      oto1.add(true, "chosen");
+      oto1.add("chosen", true);
       if (convert_subquery_to_semijoin(this, *subq))
         DBUG_RETURN(TRUE);
     }
@@ -4104,8 +4104,8 @@ skip_conversion:
                         (*subq)->get_select_lex()->select_number,
                         "IN (SELECT)", "semijoin");
       if (outer_join_objection)
-        oto1.add("outer_join", "cause");
-      oto1.add(false, "chosen");
+        oto1.add("cause", "outer_join");
+      oto1.add("chosen", false);
     }
     JOIN *child_join= (*subq)->unit->first_select()->join;
     Item_subselect::trans_res res;
@@ -4340,8 +4340,8 @@ int pull_out_semijoin_tables(JOIN *join)
         {
           pulled_tables |= tbl->table->map;
           Opt_trace_object(join->thd->opt_trace).
-            add(tbl->table->alias, "table").
-            add(true, "constant");
+            add("table", tbl->table->alias).
+            add("constant", true);
         }
       }
     }
@@ -4367,8 +4367,8 @@ int pull_out_semijoin_tables(JOIN *join)
             pulled_a_table= TRUE;
             pulled_tables |= tbl->table->map;
             Opt_trace_object(join->thd->opt_trace).
-              add(tbl->table->alias, "table").
-              add(true, "functionally_dependent");
+              add("table", tbl->table->alias).
+              add("functionally_dependent", true);
             /*
               Pulling a table out of uncorrelated subquery in general makes
               makes it correlated. See the NOTE to this function. 
@@ -4932,7 +4932,7 @@ make_join_statistics(JOIN *join, TABLE_L
           continue;
         }
         Opt_trace_object oto1(join->thd->opt_trace);
-        oto1.add(s->table->alias, "table");
+        oto1.add("table", s->table->alias);
         /* Approximate found rows and time to read them */
         s->found_records= s->records= s->table->file->stats.records;
         s->read_time= (ha_rows) s->table->file->scan_time();
@@ -4965,7 +4965,7 @@ make_join_statistics(JOIN *join, TABLE_L
         {
 #ifdef NO_OPT_TRACE_FOR_RANGE_OPT
           Opt_trace_object(join->thd->opt_trace, "more_range_optimizer_trace").
-            add("yes!", "TODO?");
+            add("TODO?", "yes!");
 #endif
           ha_rows records;
           SQL_SELECT *select;
@@ -5009,8 +5009,8 @@ make_join_statistics(JOIN *join, TABLE_L
         }
         else
           Opt_trace_object(join->thd->opt_trace, "table_scan").
-            add(s->found_records, "records").
-            add(s->read_time, "cost");
+            add("records", s->found_records).
+            add("cost", s->read_time);
       }
     }
   }
@@ -6884,7 +6884,7 @@ best_access_path(JOIN      *join,
       DBUG_PRINT("info", ("Considering ref access on key %s",
                           keyuse->table->key_info[keyuse->key].name));
       Opt_trace_object oto1(thd->opt_trace);
-      oto1.add("index", "access_type").add(keyinfo->name, "index");
+      oto1.add("access_type", "index").add("index", keyinfo->name);
 
       /* 
          True if we find some keys from the range optimizer that match more
@@ -6940,7 +6940,7 @@ best_access_path(JOIN      *join,
       */
       if (!found_part && !ft_key && !loose_scan_opt.have_a_case())
       {
-        oto1.add(false, "usable");
+        oto1.add("usable", false);
         goto done_with_index;                  // Nothing usable found
       }
 
@@ -7219,7 +7219,7 @@ best_access_path(JOIN      *join,
         loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp);
 
       } /* not ft_key */
-      oto1.add(tmp, "cost").add(records, "records");
+      oto1.add("cost", tmp).add("records", records);
       /** @todo trace quick_matches_more_parts etc? */
       if (tmp < best_time - records/(double) TIME_FOR_COMPARE ||
           (quick_matches_more_parts && 
@@ -7234,13 +7234,13 @@ best_access_path(JOIN      *join,
         best_ref_depends_map= found_ref;
       }
   done_with_index:
-      oto1.add(best_key == start_key, "chosen");
+      oto1.add("chosen", best_key == start_key);
     } /* for each key */
     records= best_records;
   }
 
   Opt_trace_object oto1(thd->opt_trace);
-  oto1.add("table scan", "access_type");
+  oto1.add("access_type", "table scan");
   /*
     Don't test table scan if it can't be better.
     Prefer key lookup if we would use the same key for scanning.
@@ -7271,27 +7271,27 @@ best_access_path(JOIN      *join,
   */
   if (!(records >= s->found_records || best > s->read_time))            // (1)
   {
-    oto1.add(s->read_time, "cost").add(s->found_records, "records");
+    oto1.add("cost", s->read_time).add("records", s->found_records);
     goto skip_table_scan;
   }
 
   if ((s->quick && best_key && s->quick->index == best_key->key &&      // (2)
        best_max_key_part >= s->table->quick_key_parts[best_key->key]))  // (2)
   {
-    oto1.add(true, "heuristic_index_must_be_cheaper");
+    oto1.add("heuristic_index_must_be_cheaper", true);
     goto skip_table_scan;
   }
 
   if (((s->table->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX) &&     // (3)
        ! s->table->covering_keys.is_clear_all() && best_key && !s->quick))// (3)
   {
-    oto1.add(true, "index_is_covering");
+    oto1.add("index_is_covering", true);
     goto skip_table_scan;
   }
 
   if ((s->table->force_index && best_key && !s->quick))                 // (4)
   {
-    oto1.add(true, "FORCE_INDEX_used");
+    oto1.add("FORCE_INDEX_used", true);
     goto skip_table_scan;
   }
 
@@ -7379,7 +7379,7 @@ best_access_path(JOIN      *join,
       }
     }
 
-    oto1.add(tmp, "cost").add(rows2double(rnd_records), "records");
+    oto1.add("cost", tmp).add("records", rows2double(rnd_records));
     /*
       We estimate the cost of evaluating WHERE clause for found records
       as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus
@@ -7405,7 +7405,7 @@ best_access_path(JOIN      *join,
 
 skip_table_scan:
 
-  oto1.add(best_key == NULL, "chosen");
+  oto1.add("chosen", best_key == NULL);
 
   /* Update the cost information for the current partial plan */
   pos->records_read= records;
@@ -8180,7 +8180,7 @@ best_extension_by_limited_search(JOIN   
       double current_record_count, current_read_time;
       POSITION *position= join->positions + idx;
       Opt_trace_object oto(thd->opt_trace);
-      oto.add(s->table->alias, "table");
+      oto.add("table", s->table->alias);
 
       /* Find the best access method from 's' to the current partial plan */
       POSITION loose_scan_pos;
@@ -8192,8 +8192,8 @@ best_extension_by_limited_search(JOIN   
       current_record_count= record_count * position->records_read;
       current_read_time=    read_time + position->read_time;
 
-      oto.add(current_read_time, "cost_for_plan").
-        add(current_record_count, "records_for_plan");
+      oto.add("cost_for_plan", current_read_time).
+        add("records_for_plan", current_record_count);
 
       if (has_sj)
       {
@@ -8221,7 +8221,7 @@ best_extension_by_limited_search(JOIN   
                                         current_record_count / 
                                         (double) TIME_FOR_COMPARE),
                                        "prune_by_cost"););
-        oto.add(true, "pruned_by_cost");
+        oto.add("pruned_by_cost", true);
         backout_nj_sj_state(remaining_tables, s);
         continue;
       }
@@ -8254,7 +8254,7 @@ best_extension_by_limited_search(JOIN   
                                          read_time,
                                          current_read_time,
                                          "pruned_by_heuristic"););
-          oto.add(true, "pruned_by_heuristic");
+          oto.add("pruned_by_heuristic", true);
           backout_nj_sj_state(remaining_tables, s);
           continue;
         }
@@ -8300,7 +8300,7 @@ best_extension_by_limited_search(JOIN   
                                        read_time,
                                        current_read_time,
                                        "full_plan"););
-        oto.add(true, "chosen");
+        oto.add("chosen", true);
       }
       backout_nj_sj_state(remaining_tables, s);
     }
@@ -8601,8 +8601,8 @@ static bool fix_semijoin_strategies_for_
         Opt_trace_object oto0(join->thd->opt_trace);
         Opt_trace_object oto1(join->thd->opt_trace,
                               "reconsidering_access_paths_for_semijoin");
-        oto1.add("MaterializationScan", "strategy").
-          add(join->best_positions[i].table->table->alias, "table");
+        oto1.add("strategy", "MaterializationScan").
+          add("table", join->best_positions[i].table->table->alias);
         best_access_path(join, join->best_positions[i].table, rem_tables, i, FALSE,
                          prefix_rec_count, join->best_positions + i, &dummy);
         prefix_rec_count *= join->best_positions[i].records_read;
@@ -8638,8 +8638,8 @@ static bool fix_semijoin_strategies_for_
           Opt_trace_object oto0(join->thd->opt_trace);
           Opt_trace_object oto1(join->thd->opt_trace,
                                 "reconsidering_access_paths_for_semijoin");
-          oto1.add("FirstMatch", "strategy").
-            add(join->best_positions[idx].table->table->alias, "table");
+          oto1.add("strategy", "FirstMatch").
+            add("table", join->best_positions[idx].table->table->alias);
           best_access_path(join, join->best_positions[idx].table, 
                            rem_tables, idx, TRUE /* no jbuf */,
                            record_count, join->best_positions + idx, &dummy);
@@ -8672,8 +8672,8 @@ static bool fix_semijoin_strategies_for_
           Opt_trace_object oto0(join->thd->opt_trace);
           Opt_trace_object oto1(join->thd->opt_trace,
                                 "reconsidering_access_paths_for_semijoin");
-          oto1.add("LooseScan", "strategy").
-            add(join->best_positions[idx].table->table->alias, "table");
+          oto1.add("strategy", "LooseScan").
+            add("table", join->best_positions[idx].table->table->alias);
           best_access_path(join, join->best_positions[idx].table,
                            rem_tables, idx, TRUE /* no jbuf */,
                            record_count, join->best_positions + idx,
@@ -9540,7 +9540,7 @@ static bool make_join_select(JOIN *join,
     Opt_trace_object oto0(join->thd->opt_trace);
     Opt_trace_object oto1(join->thd->opt_trace,
                           "attaching_conditions_to_tables");
-    oto1.add(cond, "original_condition");
+    oto1.add("original_condition", cond);
     Opt_trace_array ota(join->thd->opt_trace, "attached_conditions");
     for (uint i=join->const_tables ; i < join->tables ; i++)
     {
@@ -9830,8 +9830,8 @@ static bool make_join_select(JOIN *join,
         save_used_tables= 0;
       }
       Opt_trace_object oto2(thd->opt_trace);
-      oto2.add(tab->table->alias, "table").
-        add(tab->select_cond, "attached");
+      oto2.add("table", tab->table->alias).
+        add("attached", tab->select_cond);
     }
   }
   DBUG_RETURN(0);
@@ -13675,7 +13675,7 @@ void optimize_wo_join_buffering(JOIN *jo
   DBUG_ENTER("optimize_wo_join_buffering");
 
   Opt_trace_object oto(trace, "recompute_best_access_paths");
-  oto.add("join_buffering_not_possible", "cause");
+  oto.add("cause", "join_buffering_not_possible");
   Opt_trace_array ota(trace, "tables");
 
   if (first_tab > join->const_tables)
@@ -13701,7 +13701,7 @@ void optimize_wo_join_buffering(JOIN *jo
     {
       /* Find the best access method that would not use join buffering */
       Opt_trace_object oto1(trace);
-      oto1.add(rs->table->alias, "table");
+      oto1.add("table", rs->table->alias);
       best_access_path(join, rs, reopt_remaining_tables, i, 
                        i < no_jbuf_before, inner_fanout * outer_fanout,
                        &pos, &loose_scan_pos);
@@ -13899,7 +13899,7 @@ void advance_sj_state(JOIN *join, table_
         double reopt_cost, reopt_rec_count;
         /* We use the same FirstLetterUpcase as in EXPLAIN */
         Opt_trace_object oto(trace);
-        oto.add("FirstMatch", "strategy");
+        oto.add("strategy", "FirstMatch");
         optimize_wo_join_buffering(join, pos->first_firstmatch_table, idx,
                                    remaining_tables, FALSE, idx,
                                    &reopt_rec_count, &reopt_cost);
@@ -13917,11 +13917,11 @@ void advance_sj_state(JOIN *join, table_
           pos->sj_strategy= SJ_OPT_FIRST_MATCH;
           *current_read_time=    reopt_cost;
           *current_record_count= reopt_rec_count;
-          oto.add(*current_read_time, "cost").
-            add(*current_record_count, "records");
+          oto.add("cost", *current_read_time).
+            add("records", *current_record_count);
           handled_by_fm_or_ls=  pos->firstmatch_need_tables;
         }
-        oto.add((pos->sj_strategy == SJ_OPT_FIRST_MATCH), "chosen");
+        oto.add("chosen", (pos->sj_strategy == SJ_OPT_FIRST_MATCH));
       }
     }
   }
@@ -13969,7 +13969,7 @@ void advance_sj_state(JOIN *join, table_
       /* Got a complete LooseScan range. Calculate its cost */
       double reopt_cost, reopt_rec_count;
       Opt_trace_object oto(trace);
-      oto.add("LooseScan", "strategy");
+      oto.add("strategy", "LooseScan");
       /*
         The same problem as with FirstMatch - we need to save POSITIONs
         somewhere but reserving space for all cases would require too
@@ -13993,11 +13993,11 @@ void advance_sj_state(JOIN *join, table_
         pos->sj_strategy= SJ_OPT_LOOSE_SCAN;
         *current_read_time=    reopt_cost;
         *current_record_count= reopt_rec_count;
-        oto.add(*current_read_time, "cost").
-          add(*current_record_count, "records");
+        oto.add("cost", *current_read_time).
+          add("records", *current_record_count);
         handled_by_fm_or_ls= first->table->emb_sj_nest->sj_inner_tables;
       }
-      oto.add((pos->sj_strategy == SJ_OPT_LOOSE_SCAN), "chosen");
+      oto.add("chosen", (pos->sj_strategy == SJ_OPT_LOOSE_SCAN));
     }
   }
 
@@ -14046,8 +14046,8 @@ void advance_sj_state(JOIN *join, table_
       emb_sj_nest->nested_join->sj_depends_on |
       emb_sj_nest->nested_join->sj_corr_tables;
     pos->sjm_scan_last_inner= idx;
-    Opt_trace_object(trace).add("MaterializationScan", "strategy").
-      add("deferred", "choice");
+    Opt_trace_object(trace).add("strategy", "MaterializationScan").
+      add("choice", "deferred");
   }
   else if (sjm_strategy == SJ_OPT_MATERIALIZE_LOOKUP)
   {
@@ -14071,9 +14071,9 @@ void advance_sj_state(JOIN *join, table_
       prefix_rec_count * emb_sj_nest->nested_join->sjm.lookup_cost.total_cost();
 
     Opt_trace_object oto(trace);
-    oto.add("MaterializationLookup", "strategy").add(mat_read_time, "cost").
-      add(prefix_rec_count, "records").
-      add(pos->dups_producing_tables != 0, "duplicate_tables_left");
+    oto.add("strategy", "MaterializationLookup").add("cost", mat_read_time).
+      add("records", prefix_rec_count).
+      add("duplicate_tables_left", pos->dups_producing_tables != 0);
     if (mat_read_time < *current_read_time || pos->dups_producing_tables)
     {
       /*
@@ -14087,7 +14087,7 @@ void advance_sj_state(JOIN *join, table_
       *current_record_count= prefix_rec_count;
       pos->dups_producing_tables &= ~emb_sj_nest->sj_inner_tables;
     }
-    oto.add(pos->sj_strategy == SJ_OPT_MATERIALIZE_LOOKUP, "chosen");
+    oto.add("chosen", pos->sj_strategy == SJ_OPT_MATERIALIZE_LOOKUP);
   }
   
   /* 4.A SJM-Scan second phase check */
@@ -14103,7 +14103,7 @@ void advance_sj_state(JOIN *join, table_
     int first_tab= pos->sjm_scan_last_inner + 1 - table_count;
 
     Opt_trace_object oto(trace);
-    oto.add("MaterializationScan", "strategy");
+    oto.add("strategy", "MaterializationScan");
 
     /* Get the prefix cost */
     if (first_tab == (int)join->const_tables)
@@ -14132,13 +14132,13 @@ void advance_sj_state(JOIN *join, table_
     /* Need to re-run best-access-path as we prefix_rec_count has changed */
     {
       Opt_trace_object oto1(trace, "recompute_best_access_paths");
-      oto1.add("costs_of_prefix_changed", "cause");
+      oto1.add("cause", "costs_of_prefix_changed");
       Opt_trace_array ota1(trace, "tables");
 
       for (i= first_tab + table_count; i <= idx; i++)
       {
         Opt_trace_object oto2(trace);
-        oto2.add(join->positions[i].table->table->alias, "table");
+        oto2.add("table", join->positions[i].table->table->alias);
         best_access_path(join, join->positions[i].table, rem_tables, i, FALSE,
                          prefix_rec_count, &curpos, &dummy);
         prefix_rec_count *= curpos.records_read;
@@ -14153,8 +14153,8 @@ void advance_sj_state(JOIN *join, table_
       comparing cost without semi-join duplicate removal with cost with
       duplicate removal is not an apples-to-apples comparison.
     */
-    oto.add(prefix_cost, "cost").add(prefix_rec_count, "records").
-      add(pos->dups_producing_tables != 0, "duplicate_tables_left");
+    oto.add("cost", prefix_cost).add("records", prefix_rec_count).
+      add("duplicate_tables_left", pos->dups_producing_tables != 0);
     if (prefix_cost < *current_read_time || pos->dups_producing_tables)
     {
       pos->sj_strategy= SJ_OPT_MATERIALIZE_SCAN;
@@ -14162,7 +14162,7 @@ void advance_sj_state(JOIN *join, table_
       *current_record_count= prefix_rec_count;
       pos->dups_producing_tables &= ~mat_nest->sj_inner_tables;
     }
-    oto.add(pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN, "chosen");
+    oto.add("chosen", pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN);
   }
 
   /* 5. Duplicate Weedout strategy handler */
@@ -14263,9 +14263,9 @@ void advance_sj_state(JOIN *join, table_
         leave duplicate-producing tables not handled by any strategy.
       */
       Opt_trace_object oto(trace);
-      oto.add("DuplicatesWeedout", "strategy").add(dups_cost, "cost").
-        add(prefix_rec_count * sj_outer_fanout, "records").
-        add(pos->dups_producing_tables != 0, "duplicate_tables_left");
+      oto.add("strategy", "DuplicatesWeedout").add("cost", dups_cost).
+        add("records", prefix_rec_count * sj_outer_fanout).
+        add("duplicate_tables_left", pos->dups_producing_tables != 0);
       if (dups_cost < *current_read_time || pos->dups_producing_tables)
       {
         pos->sj_strategy= SJ_OPT_DUPS_WEEDOUT;
@@ -14273,7 +14273,7 @@ void advance_sj_state(JOIN *join, table_
         *current_record_count= prefix_rec_count * sj_outer_fanout;
         pos->dups_producing_tables &= ~dups_removed_fanout;
       }
-      oto.add(pos->sj_strategy == SJ_OPT_DUPS_WEEDOUT, "chosen");
+      oto.add("chosen", pos->sj_strategy == SJ_OPT_DUPS_WEEDOUT);
     }
   }
   DBUG_VOID_RETURN;
@@ -14415,7 +14415,7 @@ optimize_cond(JOIN *join, Item *conds, L
   {
     Opt_trace_object oto0(trace);
     Opt_trace_object oto1(trace, "condition_processing");
-    oto1.add(build_equalities ? "WHERE" : "HAVING", "condition");
+    oto1.add("condition", build_equalities ? "WHERE" : "HAVING");
     /* 
       Build all multiple equality predicates and eliminate equality
       predicates that can be inferred from these multiple equalities.
@@ -14424,12 +14424,12 @@ optimize_cond(JOIN *join, Item *conds, L
       predicate. Substitute a constant instead of this field if the
       multiple equality contains a constant.
     */
-    oto1.add(conds, "original_condition");
+    oto1.add("original_condition", conds);
     if (build_equalities)
     {
       conds= build_equal_items(join->thd, conds, NULL, join_list,
                                &join->cond_equal);
-      oto1.add(conds, "after_equality_propagation");
+      oto1.add("after_equality_propagation", conds);
     }
     /* change field = field to field = const for each found field = const */
     propagate_cond_constants(thd, (I_List<COND_CMP> *) 0, conds, conds);
@@ -14437,10 +14437,10 @@ optimize_cond(JOIN *join, Item *conds, L
       Remove all instances of item == item
       Remove all and-levels where CONST item != CONST item
     */
-    oto1.add(conds, "after_constant_propagation");
+    oto1.add("after_constant_propagation", conds);
     DBUG_EXECUTE("where",print_where(conds,"after const change", QT_ORDINARY););
     conds= remove_eq_conds(thd, conds, cond_value) ;
-    oto1.add(conds, "after_trivial_conditions_removal");
+    oto1.add("after_trivial_conditions_removal", conds);
   }
   DBUG_RETURN(conds);
 }

=== modified file 'sql/sql_test.cc'
--- a/sql/sql_test.cc	2010-09-05 16:08:07 +0000
+++ b/sql/sql_test.cc	2010-09-24 09:11:29 +0000
@@ -268,8 +268,8 @@ static void print_keyuse(Opt_trace_conte
   DBUG_UNLOCK_FILE;
   //key_part_map keypart_map; --?? there can be several?
   sprintf(buff2, "%s.%s= %s", keyuse->table->alias, fieldname, str.ptr());
-  Opt_trace_object(trace).add(buff2, "condition").
-    add(keyuse->null_rejecting, "null_rejecting");
+  Opt_trace_object(trace).add("condition", buff2).
+    add("null_rejecting", keyuse->null_rejecting);
 }
 
 

=== modified file 'unittest/gunit/opt_trace-t.cc'
--- a/unittest/gunit/opt_trace-t.cc	2010-09-23 20:15:10 +0000
+++ b/unittest/gunit/opt_trace-t.cc	2010-09-24 09:11:29 +0000
@@ -72,17 +72,17 @@ TEST(Trace_content_test, normal_usage)
       ota.add(200.4);
       {
         Opt_trace_object oto1(&trace);
-        oto1.add("one value", "one key").
-          add(100U, "another key");
+        oto1.add("one key", "one value").
+          add("another key", 100U);
       }
       Opt_trace_context *trace_ptr= &trace;
       OPT_TRACE(trace_ptr, add("one string element"));
       ota.add(true);
     }
-    oto.add(-1000LL, "yet another key");
+    oto.add("yet another key", -1000LL);
     {
       Opt_trace_array ota(&trace, "another array");
-      ota.add(1LL).add(2LL).add(3LL).add(4LL);
+      ota.add(1LL).add(2).add(3LL).add(4LL);
     }
   }
   trace.end();
@@ -132,13 +132,13 @@ TEST(Trace_content_test, tail)
       ota.add(200.4);
       {
         Opt_trace_object oto1(&trace);
-        oto1.add("one value", "one key").
-          add(100LL, "another key");
+        oto1.add("one key", "one value").
+          add("another key", 100LL);
       }
       ota.add("one string element");
       ota.add(true);
     }
-    oto.add(-1000LL, "yet another key");
+    oto.add("yet another key", -1000LL);
     {
       Opt_trace_array ota(&trace, "another array");
       ota.add(1LL).add(2LL).add(3LL).add(4LL);
@@ -197,7 +197,7 @@ TEST(Trace_content_test, buggy_object)
       ota.add("one string element");
       ota.add(true);
     }
-    oto.add(-1000LL, "yet another key");
+    oto.add("yet another key", -1000LL);
     {
       Opt_trace_array ota(&trace, "another array");
       ota.add(1LL).add(2LL).add(3LL).add(4LL);
@@ -244,10 +244,10 @@ TEST(Trace_content_test, buggy_array)
     {
       Opt_trace_array ota(&trace, "one array");
       Opt_trace_ooa::dbug_assert_on_syntax_error= false;
-      ota.add(200.4, "superfluous key"); // key, which is wrong
+      ota.add("superfluous key", 200.4); // key, which is wrong
       Opt_trace_ooa::dbug_assert_on_syntax_error= true;
     }
-    oto.add(-1000LL, "yet another key");
+    oto.add("yet another key", -1000LL);
     {
       Opt_trace_array ota(&trace, "another array");
       ota.add(1LL).add(2LL).add(3LL).add(4LL);
@@ -291,23 +291,23 @@ TEST(Trace_content_test, disable_I_S)
       ota.add(200.4);
       {
         Opt_trace_object oto1(&trace);
-        oto1.add("one value", "one key").
-          add(100LL, "another key");
+        oto1.add("one key", "one value").
+          add("another key", 100LL);
         Opt_trace_disable_I_S otd(&trace, true);
-        oto1.add(false, "a third key");
+        oto1.add("a third key", false);
         Opt_trace_object oto2(&trace, "a fourth key");
         Opt_trace_context *trace_ptr= &trace;
-        OPT_TRACE(trace_ptr, add(1LL, "key inside"));
+        OPT_TRACE(trace_ptr, add("key inside", 1LL));
         /* don't disable... but above layer is stronger */
         Opt_trace_disable_I_S otd2(&trace, false);
-        oto2.add(5LL, "another key inside");
+        oto2.add("another key inside", 5LL);
       }
       Opt_trace_context *trace_ptr= &trace;
       OPT_TRACE(trace_ptr, add("one string element"));
       ota.add(true);
     }
     Opt_trace_disable_I_S otd2(&trace, false); // don't disable
-    oto.add(-1000LL, "yet another key");
+    oto.add("yet another key", -1000LL);
     {
       Opt_trace_array ota(&trace, "another array");
       ota.add(1LL).add(2LL).add(3LL).add(4LL);
@@ -351,7 +351,7 @@ static void make_one_trace(Opt_trace_con
   ASSERT_EQ(false, trace.start(true, true, false, offset, limit, 0));
   {
     Opt_trace_object oto(&trace);
-    oto.add(0LL, name);
+    oto.add(name, 0LL);
   }
   trace.end();
 }
@@ -492,14 +492,14 @@ TEST(Trace_settings_test, max_mem_size2)
   /* make a "long" trace */
   {
     Opt_trace_object oto(&trace);
-    oto.add("make it long", "some key1");
+    oto.add("some key1", "make it long");
   }
   trace.end();
   /* A second similar trace */
   ASSERT_EQ(false, trace.start(true, false, false, -2, 2, 21));
   {
     Opt_trace_object oto(&trace);
-    oto.add("make it long", "some key2");
+    oto.add("some key2", "make it long");
   }
   trace.end();
   Opt_trace_iterator it(&trace);
@@ -523,7 +523,7 @@ TEST(Trace_settings_test, max_mem_size2)
   ASSERT_EQ(false, trace.start(true, false, false, -2, 2, 21));
   {
     Opt_trace_object oto(&trace);
-    oto.add("make it long", "some key3");
+    oto.add("some key3", "make it long");
   }
   trace.end();
   Opt_trace_iterator it2(&trace);


Attachment: [text/bzr-bundle] bzr/guilhem@mysql.com-20100924091129-jc2q6jo9psx978ym.bundle
Thread
bzr push into mysql-next-mr-bugfixing branch (guilhem:3211 to 3212) Guilhem Bichot24 Sep