summaryrefslogtreecommitdiff
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-09-04 19:26:30 +0300
committerMichael Widenius <monty@askmonty.org>2012-09-04 19:26:30 +0300
commit513923868545338c00390f35f63b92efd55f50bb (patch)
tree580f41a16d8d9b3d0b378c608f265cfdfca84658 /sql/sql_udf.cc
parentbc644de9a9d1126fbcbc67e90fe24cfa24147092 (diff)
downloadmariadb-git-513923868545338c00390f35f63b92efd55f50bb.tar.gz
Switch automaticly to statement based replication for statements that can't generate row based events. This is needed to avoid getting
updates to system, statistics and admin tables logged to binary log. - Removed special code used to temporarily change to statement based replication. - Changed to a faster and smaller interface for temporarily switching to statement based replication. sql/event_db_repository.cc: Change to new interface to not use row based replication for system table changes. sql/events.cc: Change to new interface to not use row based replication for system table changes. sql/sp.cc: Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command()) sql/sql_acl.cc: Change to new interface to not use row based replication for system table changes. Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command()) sql/sql_class.h: Added new interface for temporarily switching to statement based replication. sql/sql_parse.cc: Mark commands that needs original replication mode with CF_FORCE_ORIGINAL_BINLOG_FORMAT. Switch automaticly to statement based replication for statements that can't generate row based events (and can't change replication mode) sql/sql_udf.cc: Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command())
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc47
1 files changed, 3 insertions, 44 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 169e0d9e418..9069d876609 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -428,7 +428,6 @@ int mysql_create_function(THD *thd,udf_func *udf)
TABLE *table;
TABLE_LIST tables;
udf_func *u_d;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_create_function");
if (!initialized)
@@ -459,13 +458,6 @@ int mysql_create_function(THD *thd,udf_func *udf)
DBUG_RETURN(1);
}
- /*
- Turn off row binlogging of this statement and use statement-based
- so that all supporting tables are updated for CREATE FUNCTION command.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
mysql_rwlock_wrlock(&THR_LOCK_udf);
if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
{
@@ -533,27 +525,14 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* Binlog the create function. */
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
- }
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
DBUG_RETURN(0);
err:
if (new_dl)
dlclose(dl);
mysql_rwlock_unlock(&THR_LOCK_udf);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
}
@@ -565,7 +544,6 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
udf_func *udf;
char *exact_name_str;
uint exact_name_len;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_drop_function");
if (!initialized)
@@ -577,13 +555,6 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_RETURN(1);
}
- /*
- Turn off row binlogging of this statement and use statement-based
- so that all supporting tables are updated for DROP FUNCTION command.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
mysql_rwlock_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str,
(uint) udf_name->length)))
@@ -623,24 +594,12 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
while binlogging, to avoid binlog inconsistency.
*/
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
- }
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
DBUG_RETURN(0);
+
err:
mysql_rwlock_unlock(&THR_LOCK_udf);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
}