List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:August 25 2008 6:33pm
Subject:bzr commit into mysql-6.0-opt-subqueries branch (sergefp:2690)
View as plain text  
#At file:///home/psergey/dev/mysql-6.0-subq-r16/

 2690 Sergey Petrunia	2008-08-25
      * Fixed valgrind failure: call ha_index_or_rnd_end() before we delete the SJ-Materialization table
        (the requirement brought in by the merge) 
      * Fix wrong-query-results problem: reset all SJ_MATERIALIZE_INFO::is_materialized flags in JOIN::cleanup.
modified:
  sql/sql_select.cc
  sql/sql_select.h

per-file messages:
  sql/sql_select.cc
    * Fixed valgrind failure: call ha_index_or_rnd_end() before we delete the SJ-Materialization table
      (the requirement brought in by the merge) 
    * Fix wrong-query-results problem: reset all SJ_MATERIALIZE_INFO::is_materialized flags in JOIN::cleanup.
  sql/sql_select.h
    * Fixed valgrind failure: call ha_index_or_rnd_end() before we delete the SJ-Materialization table
      (the requirement brought in by the merge) 
    * Fix wrong-query-results problem: reset all SJ_MATERIALIZE_INFO::is_materialized flags in JOIN::cleanup.
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-08-21 21:51:40 +0000
+++ b/sql/sql_select.cc	2008-08-25 18:32:55 +0000
@@ -1320,9 +1320,16 @@ static void destroy_sj_tmp_tables(JOIN *
   TABLE *table;
   while ((table= it++))
   {
+    /* 
+      SJ-Materialization tables are initialized for sequential reading or
+      index lookup, DuplicateWeedout tables are not initialized (we only
+      write to them). Close whatever read we have open:
+    */
+    table->file->ha_index_or_rnd_end();
     free_tmp_table(join->thd, table);
   }
   join->sj_tmp_tables.empty();
+  join->sjm_info_list.empty();
 }
 
 
@@ -1347,6 +1354,13 @@ static int clear_sj_tmp_tables(JOIN *joi
     if ((res= table->file->ha_delete_all_rows()))
       return res;
   }
+
+  SJ_MATERIALIZE_INFO *sjm;
+  List_iterator<SJ_MATERIALIZE_INFO> it2(join->sjm_info_list);
+  while ((sjm= it2++))
+  {
+    sjm->materialized= FALSE;
+  }
   return 0;
 }
 
@@ -7719,7 +7733,7 @@ get_best_combination(JOIN *join, table_m
       continue;
     
     if (j->keys.is_clear_all() || !(keyuse= join->best_positions[tablenr].key) || 
-        (join->best_positions[0].sj_strategy == SJ_OPT_LOOSE_SCAN /* &&
+        (join->best_positions[tablenr].sj_strategy == SJ_OPT_LOOSE_SCAN /* &&
         psergey-todo TODO*/))
     {
       j->type=JT_ALL;
@@ -9219,6 +9233,7 @@ bool setup_sj_materialization(JOIN_TAB *
   sjm->table->file->extra(HA_EXTRA_WRITE_CACHE);
   sjm->table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
   tab->join->sj_tmp_tables.push_back(sjm->table);
+  tab->join->sjm_info_list.push_back(sjm);
   
   sjm->materialized= FALSE;
   if (!sjm->is_sj_scan)

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2008-08-21 15:19:35 +0000
+++ b/sql/sql_select.h	2008-08-25 18:32:55 +0000
@@ -649,6 +649,7 @@ public:
 
   /* Temporary tables used to weed-out semi-join duplicates */
   List<TABLE> sj_tmp_tables;
+  List<SJ_MATERIALIZE_INFO> sjm_info_list;
 
   /* 
     storage for caching buffers allocated during query execution. 

Thread
bzr commit into mysql-6.0-opt-subqueries branch (sergefp:2690)Sergey Petrunia25 Aug