dbTalk Databases Forums  

Stored procedure work badly with binlog

mailing.database.myodbc mailing.database.myodbc


Discuss Stored procedure work badly with binlog in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AESYS S.p.A. [Enzo Arlati]
 
Posts: n/a

Default Stored procedure work badly with binlog - 01-10-2006 , 09:26 AM







I found a problem using stored procedure and bin-log enabled.

Suppose I stored procedure like this:
==================================================
DELIMITER $$;

DROP PROCEDURE IF EXISTS `pmv_manager`.`pAggiornaStatusNotificaPMV`$$

CREATE PROCEDURE `pAggiornaStatusNotificaPMV`( ipAddrPMV varchar(16),
ipAddrST varchar(16), ipAddrSNMP varchar(16))
BEGIN
declare ifound int default -1;
-- ----------------------------------------------------------
select ipAddrPMV, ipAddrST, ipAddrSNMP;

-- ----------------------------------------------------------

select count(ip_addr_pmv) into ifound from status_notifica_pmv
where ip_addr_pmv = ipAddrPMV;
if( ifound = 0 ) then
insert into status_notifica_pmv ( ip_addr_pmv, ip_addr_srv_st,
ip_addr_srv_snmp, dt_mod )
values( ipAddrPMV, ipAddrST , ipAddrSNMP,
current_timestamp );
else
update status_notifica_pmv
set ip_addr_srv_st = ipAddrST,
ip_addr_srv_snmp = ipAddrSNMP,
dt_mod = current_timestamp
where ip_addr_pmv = ipAddrPMV;
end if;
END$$

DELIMITER ;$$

==================================================
where tablke status_notifica_pmv are defined as:
==================================================

CREATE TABLE `status_notifica_pmv`

`ip_addr_pmv` varchar(16) NOT NULL,
`ip_addr_srv_st` varchar(16) default NULL,
`ip_addr_srv_snmp` varchar(16) default NULL,
`dt_mod` timestamp NULL default NULL,
PRIMARY KEY (`ip_addr_pmv`),
CONSTRAINT `status_notifica_pmv_ibfk_1` FOREIGN KEY
(`ip_addr_pmv`) REFERENCES `lista_pmv` (`IPAddress`) ON DELETE CASCADE ON
UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1


==================================================
if I call the procedure the task is performed as expected
it create a new record or modify it if present with the right value
==================================================
call pAggiornaStatusNotificaPMV( '192.168.200.222', '192.168.200.218',
'192.168.200.218' );

-> ipAddrPMV ipAddrST ipAddrSNMP
--------------- --------------- ---------------
192.168.200.222 192.168.200.218 192.168.200.218

==================================================
but if I look inside the binlog file I found corrupted data
==================================================

pmv_manager_log_bin.000001 1864 Query 1 644
use `pmv_manager`; update status_notifica_pmv
set ip_addr_srv_st = NAME_CONST('ipAddrST',4QQDQ$_ <<<<
WRONG DATA <<<<


==================================================
==================================================

Maybe I wrong something or should be a bug ?



Enzo Arlati
enzo.arlati (AT) aesys (DOT) it




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Gleb Paharenko
 
Posts: n/a

Default Re: Stored procedure work badly with binlog - 01-11-2006 , 02:46 PM






Hello.

This is a bug:
http://bugs.mysql.com/bug.php?id=16378


AESYS S.p.A. [Enzo Arlati] wrote:
Quote:
I found a problem using stored procedure and bin-log enabled.

Suppose I stored procedure like this:
==================================================
DELIMITER $$;

DROP PROCEDURE IF EXISTS `pmv_manager`.`pAggiornaStatusNotificaPMV`$$

CREATE PROCEDURE `pAggiornaStatusNotificaPMV`( ipAddrPMV varchar(16),
ipAddrST varchar(16), ipAddrSNMP varchar(16))
BEGIN
declare ifound int default -1;
-- ----------------------------------------------------------
select ipAddrPMV, ipAddrST, ipAddrSNMP;

-- ----------------------------------------------------------

select count(ip_addr_pmv) into ifound from status_notifica_pmv
where ip_addr_pmv = ipAddrPMV;
if( ifound = 0 ) then
insert into status_notifica_pmv ( ip_addr_pmv, ip_addr_srv_st,
ip_addr_srv_snmp, dt_mod )
values( ipAddrPMV, ipAddrST , ipAddrSNMP,
current_timestamp );
else
update status_notifica_pmv
set ip_addr_srv_st = ipAddrST,
ip_addr_srv_snmp = ipAddrSNMP,
dt_mod = current_timestamp
where ip_addr_pmv = ipAddrPMV;
end if;
END$$

DELIMITER ;$$

==================================================
where tablke status_notifica_pmv are defined as:
==================================================

CREATE TABLE `status_notifica_pmv`

`ip_addr_pmv` varchar(16) NOT NULL,
`ip_addr_srv_st` varchar(16) default NULL,
`ip_addr_srv_snmp` varchar(16) default NULL,
`dt_mod` timestamp NULL default NULL,
PRIMARY KEY (`ip_addr_pmv`),
CONSTRAINT `status_notifica_pmv_ibfk_1` FOREIGN KEY
(`ip_addr_pmv`) REFERENCES `lista_pmv` (`IPAddress`) ON DELETE CASCADE ON
UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1


==================================================
if I call the procedure the task is performed as expected
it create a new record or modify it if present with the right value
==================================================
call pAggiornaStatusNotificaPMV( '192.168.200.222', '192.168.200.218',
'192.168.200.218' );

-> ipAddrPMV ipAddrST ipAddrSNMP
--------------- --------------- ---------------
192.168.200.222 192.168.200.218 192.168.200.218

==================================================
but if I look inside the binlog file I found corrupted data
==================================================

pmv_manager_log_bin.000001 1864 Query 1 644
use `pmv_manager`; update status_notifica_pmv
set ip_addr_srv_st = NAME_CONST('ipAddrST',4оQДоQDсQ$ъ_
WRONG DATA


==================================================
==================================================

Maybe I wrong something or should be a bug ?



Enzo Arlati
enzo.arlati (AT) aesys (DOT) it





--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko (AT) ensita (DOT) net
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.