diff --git a/mysql-test/extra/rpl_tests/rpl_partition.test b/mysql-test/extra/rpl_tests/rpl_partition.test
new file mode 100644
index 00000000000..8f2956bf1ef
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_partition.test
@@ -0,0 +1,262 @@
+############################################################
+# Author: MATZ                                             #
+# Date: 2006-03-22                                         #
+# Purpose: See if replication of partition tables work     #
+############################################################
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_query_log
+
+--echo --- Start test 2 partition RANGE testing --
+
+# Create table that is partitioned by range on year i.e. year(t) and
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+# Note that the storage engine should not be explicit: the default
+# storage engine is used on master and slave.
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY RANGE (YEAR(t)) 
+                (PARTITION p0 VALUES LESS THAN (1901), 
+                 PARTITION p1 VALUES LESS THAN (1946),  
+                 PARTITION p2 VALUES LESS THAN (1966), 
+                 PARTITION p3 VALUES LESS THAN (1986), 
+                 PARTITION p4 VALUES LESS THAN (2005), 
+                 PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave --
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+--enable_query_log
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 2 partition RANGE testing ---
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 3 partition LIST testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned  #
+# by list on id i.e. (2,4). Pretend that we     #
+# missed one and alter to add. Then  replicate  #
+# basice operations such at insert, update      #
+# delete between 2 different storage engines    #
+# Alter table and ensure table is handled       #
+# Correctly on the slave                        #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY LIST(id) 
+                (PARTITION p0 VALUES IN (2, 4), 
+                 PARTITION p1 VALUES IN (42, 142));
+
+--echo --- Test 3 Alter to add partition ---
+
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 3 partition LIST testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 4 partition HASH testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned  #
+# by hash on year i.e. YEAR(t). Then replicate  #
+# basice operations such at insert, update      #
+# delete between 2 different storage engines    #
+# Alter table and ensure table is handled       #
+# Correctly on the slave                        #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY HASH( YEAR(t) ) 
+                 PARTITIONS 4; 
+
+--echo --- show that tables have been created correctly ---
+
+SHOW CREATE TABLE t1;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 4 partition HASH testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 5 partition by key testing ---
+--echo --- Create Table Section ---
+
+#################################################
+# Requirment: Create table that is partitioned  #
+# by key on id with 4 parts.    Then replicate  #
+# basice operations such at insert, update      #
+# delete between 2 different storage engines    #
+# Alter table and ensure table is handled       #
+# Correctly on the slave                        #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE,PRIMARY KEY(id))
+                 PARTITION BY KEY() 
+                 PARTITIONS 4;
+
+--echo --- Show that tables on master are ndbcluster tables ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show that tables on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still right type ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 5 key partition testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/mysql-test/r/rpl_row_basic_8partition.result b/mysql-test/r/rpl_row_basic_8partition.result
new file mode 100644
index 00000000000..3316e42b869
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_8partition.result
@@ -0,0 +1,652 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+SET BINLOG_FORMAT=ROW;
+**** Partition RANGE testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+y YEAR, t DATE)
+PARTITION BY RANGE (YEAR(t)) 
+(PARTITION p0 VALUES LESS THAN (1901), 
+PARTITION p1 VALUES LESS THAN (1946),  
+PARTITION p2 VALUES LESS THAN (1966), 
+PARTITION p3 VALUES LESS THAN (1986), 
+PARTITION p4 VALUES LESS THAN (2005), 
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+--- On slave --
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition LIST testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+y YEAR, t DATE)
+PARTITION BY LIST(id) 
+(PARTITION p0 VALUES IN (2, 4), 
+PARTITION p1 VALUES IN (42, 142),
+PARTITION p2 VALUES IN (412));
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition HASH testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+y YEAR, t DATE)
+PARTITION BY HASH( YEAR(t) ) 
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition by KEY ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+y YEAR, t DATE,PRIMARY KEY(id))
+PARTITION BY KEY() 
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned DEFAULT NULL,
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` varchar(255) DEFAULT NULL,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` mediumint(9) NOT NULL,
+  `b1` bit(8) DEFAULT NULL,
+  `vc` text,
+  `bc` char(255) DEFAULT NULL,
+  `d` decimal(10,4) DEFAULT '0.0000',
+  `f` float DEFAULT '0',
+  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+  `y` year(4) DEFAULT NULL,
+  `t` date DEFAULT NULL,
+  PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
+"--- Insert into t1 --" as "";
+--- Select from t1 on master --- 
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id	hex(b1)	vc	bc	d	f	total	y	t
+2	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
+4	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
+42	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
+142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
+412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master --- 
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id	hex(b1)	vc	bc	d	f	total	y	t
+412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 --- 
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test
new file mode 100644
index 00000000000..0e2518817fa
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_8partition.test
@@ -0,0 +1,204 @@
+############################################################
+# Author: MATZ                                             #
+# Date: 2006-03-22                                         #
+# Purpose: See if replication of partition tables work     #
+# Most of this test is copied from the rpl_xxx2yyy tests,  #
+# but here we just test some simple basic replication of   #
+# partition tables with same engine (MyISAM) in both ends. #
+############################################################
+
+--source include/master-slave.inc
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+SET BINLOG_FORMAT=ROW;
+
+--echo **** Partition RANGE testing ****
+
+# Create table that is partitioned by range on year i.e. year(t) and
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+# Note that the storage engine should not be explicit: the default
+# storage engine is used on master and slave.
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY RANGE (YEAR(t)) 
+                (PARTITION p0 VALUES LESS THAN (1901), 
+                 PARTITION p1 VALUES LESS THAN (1946),  
+                 PARTITION p2 VALUES LESS THAN (1966), 
+                 PARTITION p3 VALUES LESS THAN (1986), 
+                 PARTITION p4 VALUES LESS THAN (2005), 
+                 PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave --
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition LIST testing ****
+
+# Create table that is partitioned by list on id i.e. (2,4). Pretend
+# that we missed one and alter to add. Then replicate basice
+# operations such at insert, update delete between 2 different storage
+# engines Alter table and ensure table is handled Correctly on the
+# slave.
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY LIST(id) 
+                (PARTITION p0 VALUES IN (2, 4), 
+                 PARTITION p1 VALUES IN (42, 142),
+                 PARTITION p2 VALUES IN (412));
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition HASH testing ****
+
+# Create table that is partitioned by hash on year i.e. YEAR(t). Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE)
+                 PARTITION BY HASH( YEAR(t) ) 
+                 PARTITIONS 4; 
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+# This part does not work
+--echo **** Partition by KEY ****
+
+# Create table that is partitioned by key on id with 4 parts.  Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
+                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
+                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
+                 y YEAR, t DATE,PRIMARY KEY(id))
+                 PARTITION BY KEY() 
+                 PARTITIONS 4;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/sql/handler.cc b/sql/handler.cc
index 80f2f4c0161..808dd0841c5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3309,6 +3309,13 @@ int handler::ha_write_row(byte *buf)
 int handler::ha_update_row(const byte *old_data, byte *new_data)
 {
   int error;
+
+  /*
+    Some storage engines require that the new record is in record[0]
+    (and the old record is in record[1]).
+   */
+  DBUG_ASSERT(new_data == table->record[0]);
+
   if (unlikely(error= update_row(old_data, new_data)))
     return error;
 #ifdef HAVE_ROW_BASED_REPLICATION
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d7ad9501ffd..8a39b1fc4eb 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6402,7 +6402,7 @@ static int find_and_fetch_row(TABLE *table, byte *key)
       table->record[0] if the engine allows it.  We first compute a
       row reference using the position() member function (it will be
       stored in table->file->ref) and the use rnd_pos() to position
-      the "cursor" at the correct row.
+      the "cursor" (i.e., record[0] in this case) at the correct row.
     */
     table->file->position(table->record[0]);
     DBUG_RETURN(table->file->rnd_pos(table->record[0], table->file->ref));
@@ -6425,9 +6425,9 @@ static int find_and_fetch_row(TABLE *table, byte *key)
     my_ptrdiff_t const pos=
       table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
     table->record[1][pos]= 0xFF;
-    if ((error= table->file->index_read_idx(table->record[1], 0, key,
-                                            table->key_info->key_length,
-                                            HA_READ_KEY_EXACT)))
+    if ((error= table->file->index_read(table->record[1], key,
+                                        table->key_info->key_length,
+                                        HA_READ_KEY_EXACT)))
     {
       table->file->print_error(error, MYF(0));
       DBUG_RETURN(error);
@@ -6797,19 +6797,25 @@ int Update_rows_log_event::do_exec_row(TABLE *table)
     return error;
 
   /*
-    This is only a precaution to make sure that the call to
-    ha_update_row is using record[1].
+    We have to ensure that the new record (i.e., the after image) is
+    in record[0] and the old record (i.e., the before image) is in
+    record[1].  This since some storage engines require this (for
+    example, the partition engine).
 
-    If this is not needed/required, then we could use m_after_image in
-    that call instead.
+    Since find_and_fetch_row() puts the fetched record (i.e., the old
+    record) in record[0], we have to move it out of the way and into
+    record[1]. After that, we can put the new record (i.e., the after
+    image) into record[0].
   */
-  bmove_align(table->record[1], m_after_image,(size_t) table->s->reclength);
+  bmove_align(table->record[1], table->record[0], table->s->reclength);
+  bmove_align(table->record[0], m_after_image, table->s->reclength);
 
   /*
-    Now we should have the right row to update.  The record that has
-    been fetched is guaranteed to be in record[0], so we use that.
+    Now we should have the right row to update.  The old row (the one
+    we're looking for) has to be in record[1] and the new row has to
+    be in record[0] for all storage engines to work correctly.
   */
-  error= table->file->ha_update_row(table->record[0], table->record[1]);
+  error= table->file->ha_update_row(table->record[1], table->record[0]);
 
   return error;
 }