List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:March 24 2011 1:34pm
Subject:bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch
(ole.john.aske:3455)
View as plain text  
#At file:///net/fimafeng09/export/home/tmp/oleja/mysql/mysql-5.1-telco-7.0-spj-scan-scan/ based on revid:ole.john.aske@stripped

 3455 Ole John Aske	2011-03-24
      SPJ: Cleanup of unintended diffs between SPJ and mainline-telco:
      
       - Removed lots of DBUG's not required anymore.
       - Some unintentional diffs caused by cherrypicking bugfixes to SPJ branch and then
         later backporting the same fix to telco
       - Some missinge / extra newlines.
      
      There shoule be no intentional functinal changes.

    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
      sql/opt_range.cc
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-03-23 14:07:43 +0000
+++ b/sql/ha_ndbcluster.cc	2011-03-24 13:34:51 +0000
@@ -34,7 +34,6 @@
 
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 #include "ha_ndbcluster.h"
-#include "ha_ndbcluster_push.h"
 #include <ndbapi/NdbApi.hpp>
 #include <util/Bitmask.hpp>
 #include <ndbapi/NdbIndexStat.hpp>
@@ -43,6 +42,7 @@
 #include <ndbapi/NdbQueryOperation.hpp>
 
 #include "ha_ndbcluster_binlog.h"
+#include "ha_ndbcluster_push.h"
 #include "ha_ndbcluster_cond.h"
 #include "ha_ndbcluster_tables.h"
 #include "ha_ndbcluster_connection.h"
@@ -277,6 +277,7 @@ static int ndbcluster_fill_files_table(h
                                        THD *thd, 
                                        TABLE_LIST *tables, 
                                        Item *cond);
+
 #if MYSQL_VERSION_ID >= 50501
 /**
    Used to fill in INFORMATION_SCHEMA* tables.
@@ -1704,7 +1705,6 @@ check_completed_operations(Thd_ndb *thd_
 void
 ha_ndbcluster::release_completed_operations(NdbTransaction *trans)
 {
-  DBUG_ENTER("ha_ndbcluster::release_completed_operations");
   /**
    * mysqld reads/write blobs fully,
    *   which means that it does not keep blobs
@@ -1715,7 +1715,6 @@ ha_ndbcluster::release_completed_operati
    */
   trans->releaseCompletedOperations();
   trans->releaseCompletedQueries();
-  DBUG_VOID_RETURN;
 }
 
 int execute_no_commit(Thd_ndb *thd_ndb, NdbTransaction *trans,
@@ -3681,6 +3680,7 @@ bool ha_ndbcluster::check_index_fields_i
   DBUG_RETURN(true);
 }
 
+
 /**
   Read one record from NDB using primary key.
 */
@@ -4465,7 +4465,6 @@ ha_ndbcluster::pk_unique_index_read_key(
   options.optionsPresent= 0;
   NdbOperation::GetValueSpec gets[2];
 
-  DBUG_ENTER("pk_unique_index_read_key");
   DBUG_ASSERT(m_thd_ndb->trans);
 
   if (idx != MAX_KEY)
@@ -4497,9 +4496,9 @@ ha_ndbcluster::pk_unique_index_read_key(
 
   if (uses_blob_value(table->read_set) &&
       get_blob_values(op, buf, table->read_set) != 0)
-    DBUG_RETURN(NULL);
+    return NULL;
 
-  DBUG_RETURN(op);
+  return op;
 }
 
 extern void sql_print_information(const char *format, ...);
@@ -4662,6 +4661,7 @@ int ha_ndbcluster::ordered_index_scan(co
   DBUG_ENTER("ha_ndbcluster::ordered_index_scan");
   DBUG_PRINT("enter", ("index: %u, sorted: %d, descending: %d read_set=0x%x",
              active_index, sorted, descending, table->read_set->bitmap[0]));
+  DBUG_PRINT("enter", ("Starting new ordered scan on %s", m_tabname));
 
   // Check that sorted seems to be initialised
   DBUG_ASSERT(sorted == 0 || sorted == 1);
@@ -6796,7 +6796,6 @@ int ha_ndbcluster::index_last(uchar *buf
   DBUG_RETURN(error);
 }
 
-
 int ha_ndbcluster::index_read_last(uchar * buf, const uchar * key, uint key_len)
 {
   DBUG_ENTER("ha_ndbcluster::index_read_last");
@@ -6854,14 +6853,11 @@ int ha_ndbcluster::read_range_first_to_b
   const KEY* key_info= table->key_info+active_index;
   int error; 
   DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf");
-  DBUG_PRINT("enter", ("type: %d, sorted: %d, descending: %d", type, sorted, desc));
+  DBUG_PRINT("info", ("desc: %d, sorted: %d", desc, sorted));
 
   if (unlikely((error= close_scan())))
     DBUG_RETURN(error);
 
-  if (m_active_cursor && (error= close_scan()))
-    DBUG_RETURN(error);
-
   if (m_use_partition_pruning)
   {
     DBUG_ASSERT(m_pushed_join_operation != PUSHED_ROOT);
@@ -6954,7 +6950,6 @@ int ha_ndbcluster::read_range_first(cons
                                       sorted, buf));
 }
 
-
 int ha_ndbcluster::read_range_next()
 {
   DBUG_ENTER("ha_ndbcluster::read_range_next");
@@ -6974,7 +6969,6 @@ int ha_ndbcluster::rnd_init(bool scan)
   DBUG_RETURN(0);
 }
 
-
 int ha_ndbcluster::close_scan()
 {
   /*
@@ -7028,7 +7022,6 @@ int ha_ndbcluster::close_scan()
   DBUG_RETURN(0);
 }
 
-
 int ha_ndbcluster::rnd_end()
 {
   DBUG_ENTER("rnd_end");
@@ -7523,9 +7516,9 @@ int ha_ndbcluster::reset()
   assert(m_is_bulk_delete == false);
   m_is_bulk_delete = false;
 
-  /* 
+  /*
     Setting pushed_code=NULL here is a temporary fix for bug #58553. This
-    should not be needed any longer if http://lists.mysql.com/commits/125336 
+    should not be needed any longer if http://lists.mysql.com/commits/125336
     is merged into this branch.
   */
   pushed_cond= NULL;
@@ -13884,8 +13877,8 @@ ha_ndbcluster::read_multi_range_first(KE
   */
 
   DBUG_ASSERT(cur_index_type != UNDEFINED_INDEX);
-  DBUG_ASSERT(m_multi_cursor == NULL);
-  DBUG_ASSERT(m_active_query == NULL);
+  DBUG_ASSERT(m_multi_cursor==NULL);
+  DBUG_ASSERT(m_active_query==NULL);
 
   const NdbOperation* lastOp= trans ? trans->getLastDefinedOperation() : 0;
   const NdbOperation::LockMode lm = get_ndb_lock_mode(m_lock.type);
@@ -14087,6 +14080,7 @@ ha_ndbcluster::read_multi_range_first(KE
           ERR_RETURN(trans->getNdbError());
         }
       }
+
       r->range_flag&= ~(uint)UNIQUE_RANGE;
       num_scan_ranges++;
     }

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-03-17 13:20:46 +0000
+++ b/sql/ha_ndbcluster.h	2011-03-24 13:34:51 +0000
@@ -363,6 +363,7 @@ class Thd_ndb 
 
   uint m_scan_count;
   uint m_pruned_scan_count;
+
   /** This is the number of sorted scans (via ordered indexes).*/
   uint m_sorted_scan_count;
 
@@ -498,7 +499,7 @@ class ha_ndbcluster: public handler
   int final_drop_index(TABLE *table_arg);
   void set_part_info(partition_info *part_info, bool early);
   ulong index_flags(uint idx, uint part, bool all_parts) const;
-  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
+  virtual const key_map *keys_to_use_for_scanning() { return &btree_keys; }
   bool primary_key_is_clustered();
   uint max_supported_record_length() const;
   uint max_supported_keys() const;
@@ -798,6 +799,7 @@ private:
   
   int primary_key_cmp(const uchar * old_row, const uchar * new_row);
   void print_results();
+
   virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                   ulonglong nb_desired_values,
                                   ulonglong *first_value,
@@ -852,7 +854,6 @@ private:
 
   Thd_ndb *m_thd_ndb;
   NdbScanOperation *m_active_cursor;
-
   const NdbDictionary::Table *m_table;
   /*
     Normal NdbRecord for accessing rows, with all fields including hidden

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2011-03-23 14:07:43 +0000
+++ b/sql/opt_range.cc	2011-03-24 13:34:51 +0000
@@ -10253,6 +10253,7 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *par
       quick->quick_prefix_select= get_quick_select(param, param_idx,
                                                    index_tree,
                                                    &quick->alloc);
+
 #ifndef MCP_BUG11764737
       if (!quick->quick_prefix_select)
       {

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-03-24 10:07:10 +0000
+++ b/sql/sql_select.cc	2011-03-24 13:34:51 +0000
@@ -1473,7 +1473,7 @@ JOIN::optimize()
         DBUG_RETURN(1);
       }
     }
-  
+    
     if (!(select_options & SELECT_BIG_RESULT) &&
         ((group_list &&
           (!simple_group ||
@@ -6881,6 +6881,7 @@ void rr_unlock_row(st_join_table *tab)
 }
 
 
+
 /**
   Pick the appropriate access method functions
 
@@ -6937,13 +6938,14 @@ make_join_readinfo(JOIN *join, ulonglong
   uint i;
   bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
   bool ordered_set= 0;
+  DBUG_ENTER("make_join_readinfo");
+
 #ifdef MCP_BUG11764737
   bool sorted= 1;
 #else
   /* First table sorted if ORDER or GROUP BY was specified */
   bool sorted= (join->order || join->group_list);
 #endif
-  DBUG_ENTER("make_join_readinfo");
 
   for (i=join->const_tables ; i < join->tables ; i++)
   {
@@ -7084,7 +7086,6 @@ make_join_readinfo(JOIN *join, ulonglong
       abort();					/* purecov: deadcode */
     }
   }
-
   join->join_tab[join->tables-1].next_select=0; /* Set by do_select */
   DBUG_VOID_RETURN;
 }
@@ -9510,7 +9511,7 @@ optimize_cond(JOIN *join, COND *conds, L
     DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY););
     conds= build_equal_items(join->thd, conds, NULL, join_list,
                              &join->cond_equal);
-    DBUG_EXECUTE("where",print_where(conds,"after equal_items",QT_ORDINARY););
+    DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
 
     /* change field = field to field = const for each found field = const */
     propagate_cond_constants(thd, (I_List<COND_CMP> *) 0, conds, conds);
@@ -11459,12 +11460,8 @@ do_select(JOIN *join,List<Item> *fields,
   {
     DBUG_ASSERT(join->tables);
     error= sub_select(join,join_tab,0);
-    DBUG_PRINT("info", ("do_select, got %d from sub_select", error));
     if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS)
-    {
-      DBUG_PRINT("info", (" -> start sub_select with 'end' flag"));
       error= sub_select(join,join_tab,1);
-    }
     if (error == NESTED_LOOP_QUERY_LIMIT)
       error= NESTED_LOOP_OK;                    /* select_limit used */
   }
@@ -11521,30 +11518,29 @@ enum_nested_loop_state
 sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
 {
   enum_nested_loop_state rc;
-  DBUG_ENTER("sub_select_cache");
 
   if (end_of_records)
   {
     rc= flush_cached_records(join,join_tab,FALSE);
     if (rc == NESTED_LOOP_OK || rc == NESTED_LOOP_NO_MORE_ROWS)
       rc= sub_select(join,join_tab,end_of_records);
-    DBUG_RETURN(rc);
+    return rc;
   }
   if (join->thd->killed)		// If aborted by user
   {
     join->thd->send_kill_message();
-    DBUG_RETURN(NESTED_LOOP_KILLED);                   /* purecov: inspected */
+    return NESTED_LOOP_KILLED;                   /* purecov: inspected */
   }
   if (join_tab->use_quick != 2 || test_if_quick_select(join_tab) <= 0)
   {
     if (!store_record_in_cache(&join_tab->cache))
-      DBUG_RETURN(NESTED_LOOP_OK);                     // There is more room in cache
-    DBUG_RETURN(flush_cached_records(join,join_tab,FALSE));
+      return NESTED_LOOP_OK;                     // There is more room in cache
+    return flush_cached_records(join,join_tab,FALSE);
   }
   rc= flush_cached_records(join, join_tab, TRUE);
   if (rc == NESTED_LOOP_OK || rc == NESTED_LOOP_NO_MORE_ROWS)
     rc= sub_select(join, join_tab, end_of_records);
-  DBUG_RETURN(rc);
+  return rc;
 }
 
 /**
@@ -11670,14 +11666,9 @@ sub_select_cache(JOIN *join,JOIN_TAB *jo
 enum_nested_loop_state
 sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
 {
-  DBUG_ENTER("sub_select");
   join_tab->table->null_row=0;
   if (end_of_records)
-  {
-    DBUG_PRINT("info", ("end_of_records"));
-    enum_nested_loop_state rc= (*join_tab->next_select)(join,join_tab+1,end_of_records);
-    DBUG_RETURN(rc);
-  }
+    return (*join_tab->next_select)(join,join_tab+1,end_of_records);
 
   int error;
   enum_nested_loop_state rc;
@@ -11685,7 +11676,6 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
 
   if (join->resume_nested_loop)
   {
-    DBUG_PRINT("info", ("resume_nested_loop"));
     /* If not the last table, plunge down the nested loop */
     if (join_tab < join->join_tab + join->tables - 1)
       rc= (*join_tab->next_select)(join, join_tab + 1, 0);
@@ -11713,21 +11703,13 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
     join->thd->row_count= 0;
 
     error= (*join_tab->read_first_record)(join_tab);
-    DBUG_PRINT("info", ("read_first_record returned: %d", error));
-
     rc= evaluate_join_record(join, join_tab, error);
-    DBUG_PRINT("info", ("first evaluate_join_record returned: %d", rc));
   }
 
   while (rc == NESTED_LOOP_OK)
   {
-    DBUG_PRINT("info", ("next 'read_record'"));
     error= info->read_record(info);
-    DBUG_PRINT("info", ("'read_record' returned:%d", error));
-
-    DBUG_PRINT("info", ("next 'evaluate_join_record'"));
     rc= evaluate_join_record(join, join_tab, error);
-    DBUG_PRINT("info", ("next evaluate_join_record returned: %d", rc));
   }
 
   if (rc == NESTED_LOOP_NO_MORE_ROWS &&
@@ -11736,10 +11718,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
 
   if (rc == NESTED_LOOP_NO_MORE_ROWS)
     rc= NESTED_LOOP_OK;
-
-  DBUG_PRINT("info", ("sub_select returns:%d", rc));
-//return rc;
-  DBUG_RETURN(rc);
+  return rc;
 }
 
 
@@ -11780,10 +11759,8 @@ evaluate_join_record(JOIN *join, JOIN_TA
       return NESTED_LOOP_ERROR;
   }
 
-  enum enum_nested_loop_state rc= NESTED_LOOP_OK;
   if (!select_cond || select_cond_result)
   {
-    DBUG_PRINT("info", ("  Condition passed"));
     /*
       There is no select condition or the attached pushed down
       condition is true => a match is found.
@@ -11856,7 +11833,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
               not to the last table of the current nest level.
             */
             join->return_tab= tab;
-            return rc;
+            return NESTED_LOOP_OK;
           }
         }
       }
@@ -11871,16 +11848,6 @@ evaluate_join_record(JOIN *join, JOIN_TA
     }
 
     /*
-     Setting NESTED_LOOP_NO_MORE_ROWS (if not_exists_optimize) 
-     also implies a 'not found' condition. However we could not
-     set this inside the  loop above as it would prematurely
-     have terminated the 'first_unmatched' / 'first_unmatched->found'
-     calculations above.
-    */
-    if (rc == NESTED_LOOP_NO_MORE_ROWS)
-      found= false;
-
-    /*
       It was not just a return to lower loop level when one
       of the newly activated predicates is evaluated as false
       (See above join->return_tab= tab).
@@ -11892,7 +11859,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
 
     if (found)
     {
-      DBUG_PRINT("info", ("  found match"));
+      enum enum_nested_loop_state rc;
       /* A match from join_tab is found for the current partial join. */
       rc= (*join_tab->next_select)(join, join_tab+1, 0);
       if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
@@ -11912,7 +11879,6 @@ evaluate_join_record(JOIN *join, JOIN_TA
   }
   else
   {
-    DBUG_PRINT("info", ("  not a match"));
     /*
       The condition pushed down to the table join_tab rejects all rows
       with the beginning coinciding with the current partial join.
@@ -11921,7 +11887,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
     join->thd->row_count++;
     join_tab->read_record.unlock_row(join_tab);
   }
-  return rc;
+  return NESTED_LOOP_OK;
 }
 
 
@@ -12209,26 +12175,23 @@ join_read_system(JOIN_TAB *tab)
 {
   TABLE *table= tab->table;
   int error;
-  DBUG_ENTER("join_read_system");
-
   if (table->status & STATUS_GARBAGE)		// If first read
   {
     if ((error=table->file->read_first_row(table->record[0],
 					   table->s->primary_key)))
     {
       if (error != HA_ERR_END_OF_FILE)
-	DBUG_RETURN(report_error(table, error));
+	return report_error(table, error);
       mark_as_null_row(tab->table);
       empty_record(table);			// Make empty record
-      DBUG_RETURN(-1);
+      return -1;
     }
     store_record(table,record[1]);
   }
   else if (!table->status)			// Only happens with left join
     restore_record(table,record[1]);			// restore old record
   table->null_row=0;
-  int rc = table->status ? -1 : 0;
-  DBUG_RETURN(rc);
+  return table->status ? -1 : 0;
 }
 
 
@@ -12250,7 +12213,6 @@ join_read_const(JOIN_TAB *tab)
 {
   int error;
   TABLE *table= tab->table;
-  DBUG_ENTER("join_read_const");
   if (table->status & STATUS_GARBAGE)		// If first read
   {
     table->status= 0;
@@ -12269,8 +12231,8 @@ join_read_const(JOIN_TAB *tab)
       mark_as_null_row(tab->table);
       empty_record(table);
       if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
-	DBUG_RETURN(report_error(table, error));
-      DBUG_RETURN(-1);
+	return report_error(table, error);
+      return -1;
     }
     store_record(table,record[1]);
   }
@@ -12280,8 +12242,7 @@ join_read_const(JOIN_TAB *tab)
     restore_record(table,record[1]);			// restore old record
   }
   table->null_row=0;
-  int rc = table->status ? -1 : 0;
-  DBUG_RETURN(rc);
+  return table->status ? -1 : 0;
 }
 
 
@@ -12290,7 +12251,6 @@ join_read_key(JOIN_TAB *tab)
 {
   int error;
   TABLE *table= tab->table;
-  DBUG_ENTER("join_read_key");
 
   if (!table->file->inited)
   {
@@ -12307,7 +12267,7 @@ join_read_key(JOIN_TAB *tab)
     if (tab->ref.key_err)
     {
       table->status=STATUS_NOT_FOUND;
-      DBUG_RETURN(-1);
+      return -1;
     }
     /*
       Moving away from the current record. Unlock the row
@@ -12323,7 +12283,7 @@ join_read_key(JOIN_TAB *tab)
                                       make_prev_keypart_map(tab->ref.key_parts),
                                       HA_READ_KEY_EXACT);
     if (error && error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
-      DBUG_RETURN(report_error(table, error));
+      return report_error(table, error);
 
     if (! error)
     {
@@ -12337,8 +12297,7 @@ join_read_key(JOIN_TAB *tab)
     tab->ref.use_count++;
   }
   table->null_row=0;
-  int rc = table->status ? -1 : 0;
-  DBUG_RETURN(rc);
+  return table->status ? -1 : 0;
 }
 
 
@@ -12571,10 +12530,9 @@ join_read_prev_same(READ_RECORD *info)
 static int
 join_init_quick_read_record(JOIN_TAB *tab)
 {
-  DBUG_ENTER("join_init_quick_read_record");
   if (test_if_quick_select(tab) == -1)
-    DBUG_RETURN(-1);					/* No possible records */
-  DBUG_RETURN(join_init_read_record(tab));
+    return -1;					/* No possible records */
+  return join_init_read_record(tab);
 }
 
 
@@ -12600,12 +12558,11 @@ test_if_quick_select(JOIN_TAB *tab)
 static int
 join_init_read_record(JOIN_TAB *tab)
 {
-  DBUG_ENTER("join_init_read_record");
   if (tab->select && tab->select->quick && tab->select->quick->reset())
-    DBUG_RETURN(1);
+    return 1;
   init_read_record(&tab->read_record, tab->join->thd, tab->table,
 		   tab->select,1,1, FALSE);
-  DBUG_RETURN((*tab->read_record.read_record)(&tab->read_record));
+  return (*tab->read_record.read_record)(&tab->read_record);
 }
 
 
@@ -14250,7 +14207,6 @@ check_reverse_order:                  
 	  DBUG_RETURN(0);		// Reverse sort not supported
 	}
 	select->quick=tmp;
-	DBUG_ASSERT(select->quick->sorted);
       }
     }
     else if (tab->type != JT_NEXT && tab->type != JT_REF_OR_NULL &&
@@ -14268,7 +14224,6 @@ check_reverse_order:                  
   }
   else if (select && select->quick)
     select->quick->sorted= 1;
-
   DBUG_RETURN(1);
 }
 
@@ -17281,7 +17236,8 @@ static void select_describe(JOIN *join, 
 	  else if (tab->select->cond)
           {
             const COND *pushed_cond= tab->table->file->pushed_cond;
-            if (pushed_cond && thd->variables.engine_condition_pushdown)
+
+            if (thd->variables.engine_condition_pushdown && pushed_cond)
             {
               extra.append(STRING_WITH_LEN("; Using where with pushed "
                                            "condition"));

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2011-01-17 12:08:49 +0000
+++ b/sql/sql_select.h	2011-03-24 13:34:51 +0000
@@ -222,7 +222,6 @@ typedef struct st_join_table {
   TABLE_REF	ref;
   JOIN_CACHE	cache;
   JOIN		*join;
-
   /** Bitmap of nested joins this table is part of */
   nested_join_map embedding_map;
 


Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20110324133451-hht94khek4xuwcah.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3455) Ole John Aske24 Mar