Bug #20938 MySQL cluster : stored procedures are not sent on nodes in the cluster
Submitted: 10 Jul 2006 12:45 Modified: 14 Jul 2006 13:07
Reporter: Peningault Olivier Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.0.21 OS:Linux (Linux)
Assigned to: CPU Architecture:Any
Tags: mysql cluster stored procedures

[10 Jul 2006 12:45] Peningault Olivier
Description:
When we create a stored procedure on a node, and all data used by this procedure is on cluster tables, the procedure is not avaliable on all nodes of the cluster, only on the node where it has been created.

How to repeat:
1- create a database named toto on every node
2- add this data :
use toto;

create table c (
        id int,
        toto varchar(10)
) engine=ndbcluster;
insert into c values (1,"toto");

delimiter //
create procedure proc (OUT paraml INT)
BEGIN
        select count(*) from c;
END;
//

delimiter ;

3- on the node you put the data :
mysql> call proc(@a);
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0,00 sec)

Query OK, 0 rows affected (0,00 sec)

mysql>

4- on another node of the cluster :
mysql> call proc(@a);
ERROR 1305 (42000): PROCEDURE toto.proc does not exist
mysql>

Suggested fix:
Verify if all tables used in the stored procedure are on ndb tables, in this case the procedure should be replicated everywhere. Or give at least an update to the standard syntax to force the creation of the procedure on every node.
[12 Jul 2006 15:56] Peningault Olivier
Change category to mysql server -> cluster
[12 Jul 2006 16:03] Peningault Olivier
change severity
[14 Jul 2006 13:07] Jonathan Miller
Hi,

Stored Procs are stored in the mysql database. The mysql database is not replicated to other mysqlds that are part of the cluster. For this reason, you would need to add the stored procedures to each mysqld that you wanted to have them.

Thanks,