summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <Li-Bing.Song@sun.com>2010-10-23 20:55:44 +0800
committerunknown <Li-Bing.Song@sun.com>2010-10-23 20:55:44 +0800
commit06c49d571be82ca927b9c37d96ab8353bd87359d (patch)
tree52454198340d0d06bc8448adc13f37f9a977b9c8 /sql/sql_class.cc
parent6646fecc1420fce3b2d2425aa07170370a7671bf (diff)
downloadmariadb-git-06c49d571be82ca927b9c37d96ab8353bd87359d.tar.gz
Bug#27606 GRANT statement should be replicated with DEFINER information
"Grantor" columns' data is lost when replicating mysql.tables_priv. Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE statements executing on it. In this patch, current user is put in query log event for all GRANT and REVOKE statement, SQL thread uses the user in query log event as grantor. mysql-test/suite/rpl/r/rpl_do_grant.result: Add test for this bug. mysql-test/suite/rpl/t/rpl_do_grant.test: Add test for this bug. sql/log_event.cc: Refactoring THD::current_user_used and related functions. current_user_used is used to judge if current user should be binlogged in query log event. So it is better to call it m_binlog_invoker. The related functions are renamed too. sql/sql_class.cc: Refactoring THD::current_user_used and related functions. current_user_used is used to judge if current user should be binlogged in query log event. So it is better to call it m_binlog_invoker. The related functions are renamed too. sql/sql_class.h: Refactoring THD::current_user_used and related functions. current_user_used is used to judge if current user should be binlogged in query log event. So it is better to call it m_binlog_invoker. The related functions are renamed too. sql/sql_parse.cc: Call binlog_invoker() for GRANT and REVOKE statements.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 44bb6d51c6c..a61ce7bfd14 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -738,7 +738,7 @@ THD::THD()
thr_lock_owner_init(&main_lock_id, &lock_info);
m_internal_handler= NULL;
- current_user_used= FALSE;
+ m_binlog_invoker= FALSE;
memset(&invoker_user, 0, sizeof(invoker_user));
memset(&invoker_host, 0, sizeof(invoker_host));
}
@@ -1247,7 +1247,7 @@ void THD::cleanup_after_query()
where= THD::DEFAULT_WHERE;
/* reset table map for multi-table update */
table_map_for_update= 0;
- clean_current_user_used();
+ m_binlog_invoker= FALSE;
}
@@ -3281,7 +3281,7 @@ void THD::set_query(char *query_arg, uint32 query_length_arg)
void THD::get_definer(LEX_USER *definer)
{
- set_current_user_used();
+ binlog_invoker();
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
if (slave_thread && has_invoker())
{