Description:
When I run in the SP listed below the slave stops with:
Last_Errno: 121
Last_Error: Error in Write_rows event: error during transaction execution on table mysql.proc
But the SP actually is in the slave mysql.proc:
mysql> select * from mysql.proc\G
*************************** 1. row ***************************
db: TPCB
name: ExTrans
type: PROCEDURE
specific_name: ExTrans
language: SQL
sql_data_access: CONTAINS_SQL
is_deterministic: NO
security_type: DEFINER
param_list: IN acct INT, IN brch INT, IN tell INT, IN amt DECIMAL(10,2)
returns:
body: BEGIN DECLARE bal DECIMAL(10,2) DEFAULT 0.0; DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; START TRANSACTION; SELECT account.balance INTO bal FROM TPCB.account WHERE aid = acct; SELECT teller.balance INTO tbal FROM TPCB.teller WHERE tid = tell; SELECT branch.balance INTO bbal FROM TPCB.branch WHERE bid = brch; SET bal = bal + amt; SET bbal = bbal + amt; SET tbal = tbal + amt; UPDATE TPCB.account SET balance = bal, filler = 'account updated' WHERE aid = acct; UPDATE TPCB.branch SET balance = bbal, filler = 'branch updated' WHERE bid = brch; UPDATE TPCB.teller SET balance = tbal, filler = 'teller updated' WHERE tid = tell; COMMIT; END
definer: root@localhost
created: 2005-11-02 03:15:33
modified: 2005-11-02 03:20:15
sql_mode:
comment:
1 row in set (0.00 sec)
Slave error log:
051102 3:05:33 [ERROR] Slave: Error in Write_rows event: row application failed, Error_code: 121051102 3:05:33 [ERROR] Slave: Error in Write_rows event: error during transaction execution on table mysql.proc, Error_code: 121
051102 3:05:33 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master1.000001' position 1539
051102 3:11:19 [Note] Slave I/O thread killed while reading event
051102 3:11:19 [Note] Slave I/O thread exiting, read up to log 'master1.000001', position 361801
var]$ /home/ndbdev/jmiller/builds/bin/perror --ndb 121
OS error code 121: No message slogan found (please report a bug if you get this error code): Unknown: Unknown
MySQL error code 121: Duplicate key on write or update
var]$ /home/ndbdev/jmiller/builds/bin/perror 121
OS error code 121: Remote I/O error
MySQL error code 121: Duplicate key on write or update
How to repeat:
mysql> CREATE TABLE account (aid INT, bid INT, balance DECIMAL(8,2), filler CHAR(80), PRIMARY KEY (aid))ENGINE=ndb;
Query OK, 0 rows affected (0.63 sec)
mysql> CREATE TABLE branch (bid INT, balance DECIMAL(8,2), filler CHAR(80), PRIMARY KEY (bid))ENGINE=ndb;
Query OK, 0 rows affected (0.65 sec)
mysql> CREATE TABLE teller (tid INT, bid INT, balance DECIMAL(8,2), filler CHAR(80), PRIMARY KEY (tid))ENGINE=ndb;
Query OK, 0 rows affected (0.64 sec)
mysql> CREATE TABLE history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, tid INT, bid INT, filler CHAR(80),PRIMARY KEY (id))ENGINE=ndb;
Query OK, 0 rows affected (0.66 sec)
mysql> delimiter ||;
mysql> CREATE PROCEDURE TPCB.ExTrans(IN acct INT, IN brch INT, IN tell INT, IN amt DECIMAL(10,2)) -> BEGIN -> DECLARE bal DECIMAL(10,2) DEFAULT 0.0; -> DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; -> DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; -> -> START TRANSACTION; -> SELECT account.balance INTO bal FROM TPCB.account WHERE aid = acct;
-> SELECT teller.balance INTO tbal FROM TPCB.teller WHERE tid = tell;
-> SELECT branch.balance INTO bbal FROM TPCB.branch WHERE bid = brch;
->
-> SET bal = bal + amt;
-> SET bbal = bbal + amt;
-> SET tbal = tbal + amt;
->
-> UPDATE TPCB.account SET balance = bal, filler = 'account updated' WHERE aid = acct;
-> UPDATE TPCB.branch SET balance = bbal, filler = 'branch updated' WHERE bid = brch;
-> UPDATE TPCB.teller SET balance = tbal, filler = 'teller updated' WHERE tid = tell;
-> COMMIT;
-> END||;
Query OK, 0 rows affected (0.00 sec)