=== added file 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.result'
--- Percona-Server/mysql-test/suite/federated/federated_bug_68354.result	1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/federated/federated_bug_68354.result	2013-06-25 17:38:27 +0000
@@ -0,0 +1,80 @@
+CREATE DATABASE federated;
+CREATE DATABASE federated;
+SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
+SET @@GLOBAL.CONCURRENT_INSERT= 0;
+SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
+SET @@GLOBAL.CONCURRENT_INSERT= 0;
+DROP TABLE IF EXISTS federated.t1;
+Warnings:
+Note	1051	Unknown table 't1'
+CREATE TABLE federated.t1 (
+`id` int(20) NOT NULL,
+`dummy` int(20) DEFAULT NULL,
+PRIMARY KEY (`id`))
+ENGINE="MyISAM"
+  DEFAULT CHARSET=latin1;
+INSERT INTO federated.t1 (`id`) VALUES
+(1001), (1002), (1003), (1004), (1005),
+(1006), (1007), (1008), (1009), (1010);
+CREATE TABLE federated.t1 (
+`id` int(20) NOT NULL,
+`dummy` int(20) DEFAULT NULL,
+PRIMARY KEY (`id`))
+ENGINE="FEDERATED"
+  DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+CREATE TABLE federated.t2 (
+`id` int(20) NOT NULL,
+`dummy` int(20) NOT NULL,
+PRIMARY KEY (`id`))
+ENGINE="MyISAM"
+  DEFAULT CHARSET=latin1;
+INSERT INTO federated.t2 (`id`, `dummy`) VALUES (1005, 5);
+SELECT * FROM federated.t1;
+id	dummy
+1001	NULL
+1002	NULL
+1003	NULL
+1004	NULL
+1005	NULL
+1006	NULL
+1007	NULL
+1008	NULL
+1009	NULL
+1010	NULL
+UPDATE federated.t1 ft1 INNER JOIN federated.t2 ft2 ON ft1.id = ft2.id SET ft1.dummy = ft2.dummy WHERE ft1.dummy IS NULL;
+SELECT * FROM federated.t1;
+id	dummy
+1001	NULL
+1002	NULL
+1003	NULL
+1004	NULL
+1005	5
+1006	NULL
+1007	NULL
+1008	NULL
+1009	NULL
+1010	NULL
+DELETE FROM federated.t1 WHERE id = 1005;
+SELECT * FROM federated.t1 WHERE id = 1005;
+id	dummy
+SELECT * FROM federated.t1;
+id	dummy
+1001	NULL
+1002	NULL
+1003	NULL
+1004	NULL
+1006	NULL
+1007	NULL
+1008	NULL
+1009	NULL
+1010	NULL
+DROP TABLE federated.t2;
+DROP TABLE federated.t1;
+DROP TABLE federated.t1;
+SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
+SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE federated;

=== renamed file 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.result' => 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.result.moved'
=== added file 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.test'
--- Percona-Server/mysql-test/suite/federated/federated_bug_68354.test	1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/federated/federated_bug_68354.test	2013-06-25 17:38:27 +0000
@@ -0,0 +1,79 @@
+# Bug 1182572 68354: Server crashes on update/join FEDERATED + local table when 
+# only 1 local row.
+#
+# When updating a federated table with UPDATE ... JOIN, the server consistently
+# crashes with Signal 11 when only 1 row exists in the local table involved in
+# the join and that 1 row can be joined with a row in the federated table.
+#
+
+--source suite/federated/include/federated.inc
+
+connection default;
+
+# Disable concurrent inserts to avoid test failures when reading
+# data from concurrent connections (insert might return before
+# the data is actually in the table).
+SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
+SET @@GLOBAL.CONCURRENT_INSERT= 0;
+
+connection slave;
+SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
+SET @@GLOBAL.CONCURRENT_INSERT= 0;
+DROP TABLE IF EXISTS federated.t1;
+CREATE TABLE federated.t1 (
+    `id` int(20) NOT NULL,
+    `dummy` int(20) DEFAULT NULL,
+    PRIMARY KEY (`id`))
+  ENGINE="MyISAM"
+  DEFAULT CHARSET=latin1;
+
+INSERT INTO federated.t1 (`id`) VALUES
+    (1001), (1002), (1003), (1004), (1005),
+    (1006), (1007), (1008), (1009), (1010);
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+    `id` int(20) NOT NULL,
+    `dummy` int(20) DEFAULT NULL,
+    PRIMARY KEY (`id`))
+  ENGINE="FEDERATED"
+  DEFAULT CHARSET=latin1
+  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+
+CREATE TABLE federated.t2 (
+    `id` int(20) NOT NULL,
+    `dummy` int(20) NOT NULL,
+    PRIMARY KEY (`id`))
+  ENGINE="MyISAM"
+  DEFAULT CHARSET=latin1;
+
+INSERT INTO federated.t2 (`id`, `dummy`) VALUES (1005, 5);
+
+SELECT * FROM federated.t1;
+
+# master would crash here before bug fix
+UPDATE federated.t1 ft1 INNER JOIN federated.t2 ft2 ON ft1.id = ft2.id SET ft1.dummy = ft2.dummy WHERE ft1.dummy IS NULL;
+
+# sanity test to make sure correct rows are being returned and server doesn't
+# also crash during DELETE
+SELECT * FROM federated.t1;
+DELETE FROM federated.t1 WHERE id = 1005;
+SELECT * FROM federated.t1 WHERE id = 1005;
+
+SELECT * FROM federated.t1;
+
+DROP TABLE federated.t2;
+DROP TABLE federated.t1;
+
+connection slave;
+DROP TABLE federated.t1;
+
+connection default;
+
+SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
+connection slave;
+SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
+
+connection default;
+--source suite/federated/include/federated_cleanup.inc

=== renamed file 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.test' => 'Percona-Server/mysql-test/suite/federated/federated_bug_68354.test.moved'
=== modified file 'Percona-Server/storage/federated/ha_federated.cc'
--- Percona-Server/storage/federated/ha_federated.cc	2013-06-18 18:39:22 +0000
+++ Percona-Server/storage/federated/ha_federated.cc	2013-06-25 17:38:27 +0000
@@ -2329,6 +2329,7 @@
 
   DBUG_ENTER("ha_federated::index_read");
 
+<<<<<<< TREE
   if ((retval= index_read_idx_with_result_set(buf, active_index, key,
                                              key_len, find_flag,
                                              &mysql_result)))
@@ -2336,6 +2337,15 @@
 
   set_last_result(mysql_result);
   DBUG_RETURN(0);
+=======
+  if ((retval= index_read_idx_with_result_set(buf, active_index, key,
+                                              key_len, find_flag,
+                                              &mysql_result)))
+    DBUG_RETURN(retval);
+
+  set_last_result(mysql_result);
+  DBUG_RETURN(0);
+>>>>>>> MERGE-SOURCE
 }
 
 
@@ -2505,10 +2515,17 @@
     retval= HA_ERR_END_OF_FILE;
     goto error;
   }
+<<<<<<< TREE
 
   set_last_result(mysql_result);
   
   DBUG_RETURN(read_next(table->record[0], mysql_result));
+=======
+
+  set_last_result(mysql_result);
+
+  DBUG_RETURN(read_next(table->record[0], mysql_result));
+>>>>>>> MERGE-SOURCE
 
 error:
   table->status= STATUS_NOT_FOUND;
@@ -2714,8 +2731,12 @@
   /* Store data cursor position. */
   memcpy_fixed(ref + sizeof(MYSQL_RES *), &current_position,
                sizeof(MYSQL_ROW_OFFSET));
+<<<<<<< TREE
 
   position_called= true;
+=======
+  position_called= true;
+>>>>>>> MERGE-SOURCE
   DBUG_VOID_RETURN;
 }
 

