Bug #27378 update becomes delete on slave

 - quick workaround, better patch is needed later
 - test case
parent b327e23c
......@@ -65,6 +65,41 @@ nid nom prenom
4 CCP DDD
5 EEE FFF
DROP table t1;
CREATE TABLE `t1` (
`prid` int(10) unsigned NOT NULL,
`id_type` enum('IMSI','SIP') NOT NULL,
`fkimssub` varchar(50) NOT NULL,
`user_id` varchar(20) DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ptg_nbr` varchar(20) DEFAULT NULL,
`old_tmsi` int(10) unsigned DEFAULT NULL,
`new_tmsi` int(10) unsigned DEFAULT NULL,
`dev_capability` int(10) unsigned DEFAULT NULL,
`dev_oid` bigint(20) unsigned DEFAULT NULL,
`lac_cell_id` bigint(20) unsigned DEFAULT NULL,
`ms_classmark1` int(10) unsigned DEFAULT NULL,
`cipher_key` int(10) unsigned DEFAULT NULL,
`priid_master` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`prid`),
UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
Warnings:
Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL);
select count(*) from t1;
count(*)
12
select count(*) from t1;
count(*)
12
update t1 set dev_oid=dev_oid+1;
select count(*) from t1;
count(*)
12
select count(*) from t1;
count(*)
12
DROP table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
......
......@@ -79,6 +79,49 @@ select * from t1 order by nid;
--connection master
DROP table t1;
#
# Bug #27378 update becomes delete on slave
#
--connection master
CREATE TABLE `t1` (
`prid` int(10) unsigned NOT NULL,
`id_type` enum('IMSI','SIP') NOT NULL,
`fkimssub` varchar(50) NOT NULL,
`user_id` varchar(20) DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ptg_nbr` varchar(20) DEFAULT NULL,
`old_tmsi` int(10) unsigned DEFAULT NULL,
`new_tmsi` int(10) unsigned DEFAULT NULL,
`dev_capability` int(10) unsigned DEFAULT NULL,
`dev_oid` bigint(20) unsigned DEFAULT NULL,
`lac_cell_id` bigint(20) unsigned DEFAULT NULL,
`ms_classmark1` int(10) unsigned DEFAULT NULL,
`cipher_key` int(10) unsigned DEFAULT NULL,
`priid_master` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`prid`),
UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL);
select count(*) from t1;
--sync_slave_with_master
--connection slave
select count(*) from t1;
--connection master
update t1 set dev_oid=dev_oid+1;
select count(*) from t1;
--sync_slave_with_master
--connection slave
select count(*) from t1;
--connection master
DROP table t1;
##################################################################
#
# Check that retries are made on the slave on some temporary errors
......
......@@ -3873,7 +3873,8 @@ int ha_ndbcluster::extra(enum ha_extra_function operation)
break;
case HA_EXTRA_WRITE_CAN_REPLACE:
DBUG_PRINT("info", ("HA_EXTRA_WRITE_CAN_REPLACE"));
if (!m_has_unique_index)
if (!m_has_unique_index ||
current_thd->slave_thread) /* always set if slave, quick fix for bug 27378 */
{
DBUG_PRINT("info", ("Turning ON use of write instead of insert"));
m_use_write= TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment