1

Why does the Procedure/function created on the master replicates to slave even after enabling table filters using "replicate-do-table". This create a lot of problems in the production setup as it rewrites the function already in the slave with the one modified in master. I need to have two different functions in master and slave, only the table data needs to be replicated. Solution please

How to repeat: Create a table in master

Replicate the table to slave with replicate-do-table option

create a function on master

it rewrites the function which was already there in slave with the same name

0

Because in MySQL all fuynctions and procedures are stored in the mysql system database rather than in the database where they were defined. So unless you exclude the mysql database from replication, the functions and procedures you define will replicate downstream.

| improve this answer | |
  • Does that mean irrespective of any filters applied, the mysql schema will replicate? – DBAJJ Oct 7 at 5:43
  • No, you can exclude the mysql schema. Also note that row based and statement based replication work very differently in this context. With RBR filtering is based on the schema the rows are in. With SBR filtering is based in the current schema at statement execution time. – Gordan Bobic Oct 7 at 7:05
0

SUGGESTION

If you do not want a stored procedure to replicate to Slave, run this on the Master:

SET sql_log_bin = 0;
DROP PROCEDURE ...
CREATE PROCEDURE ...
SET sql_log_bin = 1;

This will create the stored procedure the Master but not record it in the Master's Binary Log. Since the procedure creation is not in the Binary Log, there is nothing to replicate.

GIVE IT A TRY !!!

| improve this answer | |
  • But the thing is I have 3 slaves, for other 2 slaves it need to be replicated and it should not get replicated to slave 3 alone, where I have enabled only one table replication – DBAJJ Oct 7 at 5:42
0

If it can be turned into a TRIGGER, then you could perhaps take advantage of triggers not being replicated by default.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.