[Commits] Rev 2882: Added ha_write_tmp_row() for slightly faster write_row for internal temp tables. in http://bazaar.launchpad.net/~maria-captains/maria/5.3/

serg at askmonty.org serg at askmonty.org
Thu Jan 13 21:27:12 EET 2011


At http://bazaar.launchpad.net/~maria-captains/maria/5.3/

------------------------------------------------------------
revno: 2882
revision-id: sergii at pisem.net-20110113192708-u4wqf3j4d12k6iv0
parent: sergii at pisem.net-20110113192003-jw50qo0ck24cke62
committer: Sergei Golubchik <sergii at pisem.net>
branch nick: 5.3-monty
timestamp: Thu 2011-01-13 20:27:08 +0100
message:
  Added ha_write_tmp_row() for slightly faster write_row for internal temp tables.
-------------- next part --------------
=== modified file 'sql/handler.h'
--- a/sql/handler.h	2010-12-13 17:01:32 +0000
+++ b/sql/handler.h	2011-01-13 19:27:08 +0000
@@ -2415,6 +2415,7 @@ class handler :public Sql_alloc
   /* XXX to be removed, see ha_partition::partition_ht() */
   virtual handlerton *partition_ht() const
   { return ht; }
+  inline int ha_write_tmp_row(uchar *buf);
 };
 
 #include "multi_range_read.h"

=== modified file 'sql/opt_subselect.cc'
--- a/sql/opt_subselect.cc	2011-01-13 19:18:38 +0000
+++ b/sql/opt_subselect.cc	2011-01-13 19:27:08 +0000
@@ -2910,7 +2910,7 @@ int do_sj_dups_weedout(THD *thd, SJ_TMP_
     }
   }
 
-  error= sjtbl->tmp_table->file->ha_write_row(sjtbl->tmp_table->record[0]);
+  error= sjtbl->tmp_table->file->ha_write_tmp_row(sjtbl->tmp_table->record[0]);
   if (error)
   {
     /* create_internal_tmp_table_from_heap will generate error if needed */

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-12-27 22:22:05 +0000
+++ b/sql/sql_class.h	2011-01-13 19:27:08 +0000
@@ -3639,5 +3639,10 @@ inline int handler::ha_read_first_row(uc
   return error;
 }
 
+inline int handler::ha_write_tmp_row(uchar *buf)
+{
+  increment_statistics(&SSV::ha_write_count);
+  return write_row(buf);
+}
 
 #endif /* MYSQL_SERVER */

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-01-13 19:19:29 +0000
+++ b/sql/sql_select.cc	2011-01-13 19:27:08 +0000
@@ -7485,7 +7485,7 @@ end_sj_materialize(JOIN *join, JOIN_TAB 
     fill_record(thd, table->field, sjm->sjm_table_cols, TRUE, FALSE);
     if (thd->is_error())
       DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
-    if ((error= table->file->ha_write_row(table->record[0])))
+    if ((error= table->file->ha_write_tmp_row(table->record[0])))
     {
       /* create_myisam_from_heap will generate error if needed */
       if (table->file->is_fatal_error(error, HA_CHECK_DUP) &&
@@ -12749,7 +12749,7 @@ create_internal_tmp_table_from_heap2(THD
   */
   while (!table->file->ha_rnd_next(new_table.record[1]))
   {
-    write_err= new_table.file->ha_write_row(new_table.record[1]);
+    write_err= new_table.file->ha_write_tmp_row(new_table.record[1]);
     DBUG_EXECUTE_IF("raise_error", write_err= HA_ERR_FOUND_DUPP_KEY ;);
     if (write_err)
       goto err;
@@ -12757,7 +12757,7 @@ create_internal_tmp_table_from_heap2(THD
   if (!new_table.no_rows && new_table.file->ha_end_bulk_insert())
     goto err;
   /* copy row that filled HEAP table */
-  if ((write_err=new_table.file->ha_write_row(table->record[0])))
+  if ((write_err=new_table.file->ha_write_tmp_row(table->record[0])))
   {
     if (new_table.file->is_fatal_error(write_err, HA_CHECK_DUP) ||
         !ignore_last_dupp_key_error)
@@ -14634,7 +14634,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab
     {
       int error;
       join->found_records++;
-      if ((error= table->file->ha_write_row(table->record[0])))
+      if ((error= table->file->ha_write_tmp_row(table->record[0])))
       {
         if (!table->file->is_fatal_error(error, HA_CHECK_DUP))
           goto end;
@@ -14723,7 +14723,7 @@ end_update(JOIN *join, JOIN_TAB *join_ta
   init_tmptable_sum_functions(join->sum_funcs);
   if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
     DBUG_RETURN(NESTED_LOOP_ERROR);           /* purecov: inspected */
-  if ((error= table->file->ha_write_row(table->record[0])))
+  if ((error= table->file->ha_write_tmp_row(table->record[0])))
   {
     if (create_internal_tmp_table_from_heap(join->thd, table,
                                             join->tmp_table_param.start_recinfo,
@@ -14766,7 +14766,7 @@ end_unique_update(JOIN *join, JOIN_TAB *
   if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
     DBUG_RETURN(NESTED_LOOP_ERROR);           /* purecov: inspected */
 
-  if (!(error= table->file->ha_write_row(table->record[0])))
+  if (!(error= table->file->ha_write_tmp_row(table->record[0])))
     join->send_records++;                       // New group
   else
   {
@@ -14826,7 +14826,7 @@ end_write_group(JOIN *join, JOIN_TAB *jo
                        join->sum_funcs_end[send_group_parts]);
         if (!join->having || join->having->val_int())
         {
-          int error= table->file->ha_write_row(table->record[0]);
+          int error= table->file->ha_write_tmp_row(table->record[0]);
           if (error && 
               create_internal_tmp_table_from_heap(join->thd, table,
                                                   join->tmp_table_param.start_recinfo,
@@ -18501,7 +18501,7 @@ int JOIN::rollup_write_data(uint idx, TA
           item->save_in_result_field(1);
       }
       copy_sum_funcs(sum_funcs_end[i+1], sum_funcs_end[i]);
-      if ((write_error= table_arg->file->ha_write_row(table_arg->record[0])))
+      if ((write_error= table_arg->file->ha_write_tmp_row(table_arg->record[0])))
       {
         if (create_internal_tmp_table_from_heap(thd, table_arg, 
                                                 tmp_table_param.start_recinfo,



More information about the commits mailing list