[Commits] 3c5ce8a: Make testsuite to pass

Sergei Petrunia psergey at askmonty.org
Fri Nov 21 20:44:06 EET 2014


revision-id: 3c5ce8a0a32a74cd8e0ddc81bcfacf7c85f0d90a
parent(s): 305dd8e5fba804d8006d34ca7cb05bec5a3b45e6
committer: Sergei Petrunia
branch nick: 10.1-explain-json-r4
timestamp: 2014-11-21 21:44:06 +0300
message:

Make testsuite to pass

- Drop all tables in explain_json.test
- Tabular form should print ref='' when type='fulltext' (another peculiarity
  of the traditional EXPLAIN format)
- String_list::append_str should allocate memory for \0, too
- Some temporary code for EXPLAIN JSON and join buffering.

---
 mysql-test/r/explain_json.result |    2 +-
 mysql-test/t/explain_json.test   |    2 +-
 sql/sql_explain.cc               |   15 +++++++++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result
index 2b2a4bf..7621332 100644
--- a/mysql-test/r/explain_json.result
+++ b/mysql-test/r/explain_json.result
@@ -174,5 +174,5 @@ EXPLAIN
     }
   }
 }
-drop table t1;
+drop table t1,t2;
 drop table t0;
diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test
index 887ef66..0b7bfb0 100644
--- a/mysql-test/t/explain_json.test
+++ b/mysql-test/t/explain_json.test
@@ -38,5 +38,5 @@ explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
 
 explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
 
-drop table t1;
+drop table t1,t2;
 drop table t0;
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index a468d16..e8bc907 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -721,7 +721,15 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
   /* `ref` */
   StringBuffer<64> ref_list_buf;
   if (ref_list.is_empty())
-    item_list.push_back(item_null);
+  {
+    if (type == JT_FT)
+    {
+      /* Traditionally, EXPLAIN lines with type=fulltext have ref='' */
+      push_str(&item_list, "");
+    }
+    else
+      item_list.push_back(item_null);
+  }
   else
     push_string_list(&item_list, ref_list, &ref_list_buf);
  
@@ -819,7 +827,7 @@ bool String_list::append_str(MEM_ROOT *mem_root, const char *str)
 {
   size_t len= strlen(str);
   char *cp;
-  if (!(cp = (char*)alloc_root(mem_root, len)))
+  if (!(cp = (char*)alloc_root(mem_root, len+1)))
     return 1;
   memcpy(cp, str, len+1);
   push_back(cp);
@@ -880,6 +888,9 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
     case ET_USING:
       // index merge: case ET_USING 
       break;
+    case ET_USING_JOIN_BUFFER: 
+      // TODO TODO 
+      break;
     default:
       DBUG_ASSERT(0);
   }


More information about the commits mailing list