List:Commits« Previous MessageNext Message »
From:msvensson Date:March 6 2006 10:46am
Subject:bk commit into 5.1 tree (msvensson:1.2171)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2171 06/03/06 11:46:33 msvensson@stripped +3 -0
  Merge devsrv-b.mysql.com:/space/magnus/bug17377/my50-bug17377
  into  devsrv-b.mysql.com:/space/magnus/bug17377/my51-bug17377

  sql/ha_federated.h
    1.27 06/03/06 11:46:27 msvensson@stripped +0 -0
    Auto merged

  sql/ha_federated.cc
    1.53 06/03/06 11:46:27 msvensson@stripped +0 -0
    Auto merged

  mysql-test/t/federated.test
    1.23 06/03/06 11:46:27 msvensson@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	devsrv-b.mysql.com
# Root:	/space/magnus/bug17377/my51-bug17377/RESYNC

--- 1.22/mysql-test/t/federated.test	2006-02-08 11:11:36 +01:00
+++ 1.23/mysql-test/t/federated.test	2006-03-06 11:46:27 +01:00
@@ -1257,4 +1257,59 @@
 SELECT LAST_INSERT_ID();
 SELECT * FROM federated.t1;
 
+#
+# Bug#17377 Federated Engine returns wrong Data, always the rows
+#           with the highest ID
+#
+
+connection slave;
+
+--disable_warnings
+DROP TABLE IF EXISTS federated.bug_17377_table;
+--enable_warnings
+
+CREATE TABLE federated.bug_17377_table (
+`fld_cid` bigint(20) NOT NULL auto_increment,
+`fld_name` varchar(255) NOT NULL default '',
+`fld_parentid` bigint(20) NOT NULL default '0',
+`fld_delt` int(1) NOT NULL default '0',
+PRIMARY KEY (`fld_cid`),
+KEY `fld_parentid` (`fld_parentid`),
+KEY `fld_delt` (`fld_delt`),
+KEY `fld_cid` (`fld_cid`)
+) ENGINE=MyISAM;
+
+# Insert some test-data
+insert into federated.bug_17377_table( fld_name )
+values
+("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel");
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.t1;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+`fld_cid` bigint(20) NOT NULL auto_increment,
+`fld_name` varchar(255) NOT NULL default '',
+`fld_parentid` bigint(20) NOT NULL default '0',
+`fld_delt` int(1) NOT NULL default '0',
+PRIMARY KEY (`fld_cid`),
+KEY `fld_parentid` (`fld_parentid`),
+KEY `fld_delt` (`fld_delt`),
+KEY `fld_cid` (`fld_cid`)
+) ENGINE=FEDERATED
+CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/bug_17377_table';
+
+select * from federated.t1 where fld_parentid=0 and fld_delt=0
+order by fld_name;
+
+select * from federated.t1 where fld_parentid=0 and fld_delt=0;
+
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.bug_17377_table;
+
+
 source include/federated_cleanup.inc;

--- 1.52/sql/ha_federated.cc	2006-02-07 22:33:23 +01:00
+++ 1.53/sql/ha_federated.cc	2006-03-06 11:46:27 +01:00
@@ -756,7 +756,7 @@
 
 ha_federated::ha_federated(TABLE_SHARE *table_arg)
   :handler(&federated_hton, table_arg),
-  mysql(0), stored_result(0), scan_flag(0),
+  mysql(0), stored_result(0),
   ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0)
 {
   trx_next= 0;
@@ -2236,7 +2236,7 @@
     containing the correct record, hence update the wrong row!
 
   */
-  scan_flag= scan;
+
   if (scan)
   {
     DBUG_PRINT("info", ("share->select_query %s", share->select_query));
@@ -2360,24 +2360,13 @@
 int ha_federated::rnd_pos(byte *buf, byte *pos)
 {
   DBUG_ENTER("ha_federated::rnd_pos");
-  /*
-    we do not need to do any of this if there has been a scan performed
-    already, or if this is an update and index_read_idx already has a result
-    set in which to build it's update query from
-  */
-  if (scan_flag)
-  {
-    int retval;
-    statistic_increment(table->in_use->status_var.ha_read_rnd_count,
-                        &LOCK_status);
-    memcpy_fixed(&current_position, pos, sizeof(MYSQL_ROW_OFFSET));  // pos
-    /* is not aligned */
-    stored_result->current_row= 0;
-    stored_result->data_cursor= current_position;
-    retval= rnd_next(buf);
-    DBUG_RETURN(retval);
-  }
-  DBUG_RETURN(0);
+
+  statistic_increment(table->in_use->status_var.ha_read_rnd_count,
+                      &LOCK_status);
+  memcpy_fixed(&current_position, pos, sizeof(MYSQL_ROW_OFFSET));
+  stored_result->current_row= 0;
+  stored_result->data_cursor= current_position;
+  DBUG_RETURN(rnd_next(buf));
 }
 
 

--- 1.26/sql/ha_federated.h	2006-02-07 22:33:23 +01:00
+++ 1.27/sql/ha_federated.h	2006-03-06 11:46:27 +01:00
@@ -153,7 +153,6 @@
   FEDERATED_SHARE *share;    /* Shared lock info */
   MYSQL *mysql; /* MySQL connection */
   MYSQL_RES *stored_result;
-  bool scan_flag;
   uint ref_length;
   uint fetch_num; // stores the fetch num
   MYSQL_ROW_OFFSET current_position;  // Current position used by ::position()
Thread
bk commit into 5.1 tree (msvensson:1.2171)msvensson6 Mar