List:Commits« Previous MessageNext Message »
From:Rohit Kalhans Date:April 16 2012 3:32pm
Subject:bzr push into mysql-trunk-wl5597 branch (rohit.kalhans:3672 to 3673)
View as plain text  
 3673 Rohit Kalhans	2012-04-16
      1- Addressing Svoj's comments regarding exposing a flag for 
         Search engines that donot synchronize result set. e.g. BLACKHOLE.
        -Modified sql/log_event.cc accordingly
      
      2- Made next_record_scan() readable by adding comment and slight refactoring. 

    modified:
      sql/handler.h
      sql/log_event.cc
      storage/blackhole/ha_blackhole.h
 3672 Rohit Kalhans	2012-04-10 [merge]
      fixing build failure on the  feature tree

    removed:
      mysql-test/suite/rpl/t/rpl_report_port-slave.opt
    modified:
      mysql-test/suite/rpl/r/rpl_master_pos_wait.result
      mysql-test/suite/rpl/r/rpl_report_port.result
      mysql-test/suite/rpl/t/rpl_master_pos_wait.test
      mysql-test/suite/rpl/t/rpl_report_port.test
      sql/log_event.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
=== modified file 'sql/handler.h'
--- a/sql/handler.h	2012-04-09 13:43:35 +0000
+++ b/sql/handler.h	2012-04-16 15:31:21 +0000
@@ -178,12 +178,6 @@ enum enum_alter_inplace_result {
 */
 #define HA_CAN_REPAIR                    (LL(1) << 37)
 
-/*
- Engine does not store actual rows. Used by replication slave to check if it is
- possible to retrieve rows from the table when deciding whether to do a full
- table scan, index scan or hash scan while applying a row event.
-*/
-#define HA_STORES_NO_ROWS                (LL(1) << 38)
 
 /*
   Set of all binlog flags. Currently only contain the capabilities
@@ -196,6 +190,14 @@ enum enum_alter_inplace_result {
 */
 #define HA_READ_BEFORE_WRITE_REMOVAL  (LL(1) << 38)
 
+/*
+  storage engine doesn't synchronize result set with expected table contents.
+  Used by replication slave to check if it is possible to retrieve rows from
+  the table when deciding whether to do a full table scan, index scan or hash
+  scan while applying a row event.
+ */
+#define HA_READ_OUT_OF_SYNC              (LL(1) << 39)
+
 /* bits in index_flags(index_number) for what you can do with index */
 #define HA_READ_NEXT            1       /* TODO really use this flag */
 #define HA_READ_PREV            2       /* supports ::index_prev */

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2012-04-10 08:52:15 +0000
+++ b/sql/log_event.cc	2012-04-16 15:31:21 +0000
@@ -9126,15 +9126,11 @@ Rows_log_event::decide_row_lookup_algori
 TABLE_OR_INDEX_HASH_SCAN:
 
   /*
-     NOTE: Blackhole engine cannot use HASH_SCAN, because
-           we cannot iterate over the rows in that engine.
-
-     TODO: remove this DB_TYPE_BLACKHOLE_DB dependency, perhaps
-           adding a flag to the engines flag stating that this
-           engine does not allow scanning.
+     NOTE: Engines like Blackhole cannot use HASH_SCAN, because
+           they do not syncronize reads .
    */
   if (!(slave_rows_search_algorithms_options & SLAVE_ROWS_HASH_SCAN) ||
-      (table->s->db_type()->db_type == DB_TYPE_BLACKHOLE_DB))
+      (table->file->ha_table_flags() & HA_READ_OUT_OF_SYNC))
     goto TABLE_OR_INDEX_FULL_SCAN;
 
   /* search for a key to see if we can narrow the lookup domain further. */
@@ -9447,16 +9443,20 @@ Rows_log_event::next_record_scan(bool fi
        */
       error= table->file->ha_index_next(table->record[0]);
       if(m_rows_lookup_algorithm == ROW_LOOKUP_HASH_SCAN)
-      {
-        if ((error))
+        /*
+          if we are out of rows for this particular key value
+          or we have jumped to the next key value, we reposition the
+          marker according to the next key value that we have in the
+          list.
+         */
+        if ((error) ||
+            (key_cmp(keyinfo->key_part, m_key, keyinfo->key_length) != 0))
         {
-          m_key= m_itr++;
-          first_read= true;
+          if ((m_key= m_itr++))
+            first_read= true;
+          else
+            error= HA_ERR_KEY_NOT_FOUND;
         }
-        else
-          if (key_cmp(keyinfo->key_part, m_key, keyinfo->key_length) != 0)
-            m_key= m_itr++;
-      }
     }
 
     if (first_read)

=== modified file 'storage/blackhole/ha_blackhole.h'
--- a/storage/blackhole/ha_blackhole.h	2012-04-09 13:43:35 +0000
+++ b/storage/blackhole/ha_blackhole.h	2012-04-16 15:31:21 +0000
@@ -54,7 +54,7 @@ public:
   {
     return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
            HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE |
-           HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_STORES_NO_ROWS |
+           HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_READ_OUT_OF_SYNC |
            HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED);
   }
   ulong index_flags(uint inx, uint part, bool all_parts) const

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5597 branch (rohit.kalhans:3672 to 3673) Rohit Kalhans20 Apr