List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:March 3 2011 9:36am
Subject:Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779
View as plain text  
Sven Sandberg wrote:
> On 03/03/2011 03:06 AM, He Zhenxing wrote:
> > Sven Sandberg wrote:
> >> Hi Zhenxing,
> >>
> >> Thanks for this work. This patch is easy to understand and does only the
> >> minimal amount of changes in order to get the interface right. This is
> >> very good.
> >>
> >> I have six comments inline, (1)-(6). This is just some details.
> >>
> >> Also, it seems that we disagree on what the purposes of the three
> >> interfaces are. I think the purposes should be:
> >>
> >> Binlog interface:
> >>    - record changes made on this server
> >>
> >
> > My understanding of Binlog interface also including reapply the binlog
> > events, which could be used for replication and backup or maybe some
> > other purposes.
> >
> > I'm also OK with the idea to separate the reapply as a component itself,
> > but I do not think it belongs to slave. By this way, we can also allow
> > user to implement their own replication (master and slave) without
> > having to also implement their own reapply mechanism.
> >
> >> Master interface:
> >>    - copy changes made on this server to another server
> >>
> >
> > Agree
> >
> >> Slave interface:
> >>    - copy changes made on another server to this server
> >
> > Agree
> >
> >>    - execute changes that were copied
> >>
> >
> > IMO, slave is just one user of the Binlog reapply interface to do this
> > job.
> 
> Actually I think this is a very good idea. Shall we create a fourth 
> component? We will then have:
> 
> Store
> Send
> Receive
> Reapply
> 
> Perhaps with other names, perhaps prefixed by rpl.
> 
> Sounds good?
> 
> The only problem is commands like SHOW SLAVE STATUS and CHANGE MASTER, 
> which are as much part of Receive (IO thread) as of Reapply (SQL 
> thread). Where should those be?
> 

Yes, that would be ideal, this was my original goal to achieve when
designing the interfaces. but I think should make this as the next goal
because this would introduce more refactoring of the code.

And I think SHOW SLAVE STATUS and CHANGE MASTER should still belong to
the Slave component, which will use the Receive and Reapply component.

> /Sven
> 
> >
> >> If this is the distinction between the interfaces, then I think
> >> execute_binlog_statement should be part of the slave interface, because
> >> that's the only interface where we execute things. I think we can regard
> >> replication slave and mysqlbinlog as two different ways to re-execute
> >> things, and the BINLOG statement is part of the machinery for mysqlbinlog.
> >>
> >> What do you think?
> >>
> >> /Sven
> >>
> >>
> >> He Zhenxing wrote:
> >>> #At file:///home/hezx/work/mysql/bzr/w5779/trunk/ based on
> revid:tor.didriksen@stripped
> >>>
> >>>   3710 He Zhenxing	2011-03-02
> >>>        WL#5779 Replication slave interface
> >>>
> >>>        In this worklog, we define an interface for the replication
> slave. We only create
> >>>        a class that groups together the functions that the core server
> needs in order to
> >>>        execute slave-related commands.
> >>>
> >>>      added:
> >>>        sql/rpl.h
> >>>      modified:
> >>>        sql/mysqld.cc
> >>>        sql/mysqld.h
> >>>        sql/rpl_slave.cc
> >>>        sql/rpl_slave.h
> >>>        sql/sql_parse.cc
> >>>        sql/sql_reload.cc
> >>> === modified file 'sql/mysqld.cc'
> >>> --- a/sql/mysqld.cc	2011-02-22 02:58:40 +0000
> >>> +++ b/sql/mysqld.cc	2011-03-02 07:14:10 +0000
> >>> @@ -53,7 +53,6 @@
> >>>   #include<m_ctype.h>
> >>>   #include<my_dir.h>
> >>>   #include<my_bit.h>
> >>> -#include "rpl_slave.h"
> >>>   #include "rpl_master.h"
> >>>   #include "rpl_mi.h"
> >>>   #include "rpl_filter.h"
> >>> @@ -1121,7 +1120,7 @@ static void close_connections(void)
> >>>     Events::deinit();
> >>>
> >>>     sql_print_information("Shutting down slave threads");
> >>> -  end_slave();
> >>> +  rpl_slave.end();
> >>>
> >>>     if (thread_count)
> >>>       sleep(2);					// Give threads time to die
> >>> @@ -4785,14 +4784,9 @@ int mysqld_main(int argc, char **argv)
> >>>     binlog_unsafe_map_init();
> >>>     /*
> >>>       init_slave() must be called after the thread keys are created.
> >>> -    Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and
> other
> >>> -    places) assume that active_mi != 0, so let's fail if it's 0 (out
> of
> >>> -    memory); a message has already been printed.
> >>>     */
> >>> -  if (init_slave()&&  !active_mi)
> >>> -  {
> >>> +  if (rpl_slave.init())
> >>>       unireg_abort(1);
> >>> -  }
> >>>
> >>>   #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
> >>>     initialize_performance_schema_acl(opt_bootstrap);
> >>>
> >>> === modified file 'sql/mysqld.h'
> >>> --- a/sql/mysqld.h	2011-02-18 11:39:05 +0000
> >>> +++ b/sql/mysqld.h	2011-03-02 07:14:10 +0000
> >>> @@ -154,6 +154,7 @@ extern char pidfile_name[FN_REFLEN], sys
> >>>   extern char default_logfile_name[FN_REFLEN];
> >>>   extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
> >>>   /*Move UUID_LENGTH from item_strfunc.h*/
> >>> +#define HAVE_SERVER_UUID 1
> >>
> >> (1) I think you can just define the symbol:
> >>
> >> #define HAVE_SERVER_UUID
> >>
> >>>   #define UUID_LENGTH (8+1+4+1+4+1+4+1+12)
> >>>   extern char server_uuid[UUID_LENGTH+1];
> >>>   extern const char *server_uuid_ptr;
> >>>
> >>> === added file 'sql/rpl.h'
> >>> --- a/sql/rpl.h	1970-01-01 00:00:00 +0000
> >>> +++ b/sql/rpl.h	2011-03-02 07:14:10 +0000
> >>> @@ -0,0 +1,37 @@
> >>> +#ifndef RPL_H_INCLUDED
> >>> +/* Copyright (c) 2011, Oracle and/or its affiliates. All rights
> reserved.
> >>> +
> >>> +   This program is free software; you can redistribute it and/or
> modify
> >>> +   it under the terms of the GNU General Public License as published
> by
> >>> +   the Free Software Foundation; version 2 of the License.
> >>> +
> >>> +   This program is distributed in the hope that it will be useful,
> >>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>> +   GNU General Public License for more details.
> >>> +
> >>> +   You should have received a copy of the GNU General Public License
> >>> +   along with this program; if not, write to the Free Software
> Foundation,
> >>> +   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
> >>> +
> >>> +#define RPL_H_INCLUDED
> >>> +
> >>> +#ifdef HAVE_REPLICATION
> >>> +
> >>> +class Rpl_slave {
> >>> +public:
> >>> +  int init();
> >>> +  void end();
> >>> +  int change_master(THD* thd);
> >>> +  int start_slave(THD* thd);
> >>> +  int stop_slave(THD* thd);
> >>> +  int reset_slave(THD* thd);
> >>> +  int show_slave_status(THD* thd);
> >>> +  int flush_relay_log(THD* thd);
> >>> +  int show_relay_log_events(THD* thd);
> >>> +};
> >>> +
> >>> +extern Rpl_slave rpl_slave;
> >>> +
> >>> +#endif /*HAVE_REPLICATION */
> >>> +#endif /* RPL_H_INCLUDED */
> >>>
> >>> === modified file 'sql/rpl_slave.cc'
> >>> --- a/sql/rpl_slave.cc	2011-02-14 16:07:38 +0000
> >>> +++ b/sql/rpl_slave.cc	2011-03-02 07:14:10 +0000
> >>> @@ -158,7 +158,9 @@ static int connect_to_master(THD* thd, M
> >>>   static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC
> thread_killed,
> >>>                         void* thread_killed_arg);
> >>>   static int get_master_version_and_clock(MYSQL* mysql, Master_info*
> mi);
> >>> +#if HAVE_SERVER_UUID
> >>
> >> (2) This will only complie if HAVE_SERVER_UUID has been defined. Please,
> >> use this instead:
> >>
> >> #ifdef HAVE_SERVER_UUID
> >>
> >> It's more standard.
> >>
> >>>   static int get_master_uuid(MYSQL *mysql, Master_info *mi);
> >>> +#endif
> >>>   int io_thread_init_commands(MYSQL *mysql, Master_info *mi);
> >>>   static Log_event* next_event(Relay_log_info* rli);
> >>>   static int queue_event(Master_info* mi,const char* buf,ulong
> event_len);
> >>> @@ -1154,6 +1156,7 @@ bool is_network_error(uint errorno)
> >>>     return FALSE;
> >>>   }
> >>>
> >>> +#if HAVE_SERVER_UUID
> >>>   /**
> >>>     Set user variables after connecting to the master.
> >>>
> >>> @@ -1279,6 +1282,7 @@ static int get_master_uuid(MYSQL *mysql,
> >>>       mysql_free_result(master_res);
> >>>     return ret;
> >>>   }
> >>> +#endif /* HAVE_SERVER_UUID */
> >>>
> >>>   /*
> >>>     Note that we rely on the master's version (3.23, 4.0.14 etc) instead
> of
> >>> @@ -2057,7 +2061,9 @@ bool show_master_info(THD* thd, Master_i
> >>>                                                FN_REFLEN));
> >>>     field_list.push_back(new Item_return_int("Master_Server_Id",
> sizeof(ulong),
> >>>                                              MYSQL_TYPE_LONG));
> >>> +#if HAVE_SERVER_UUID
> >>>     field_list.push_back(new Item_empty_string("Master_UUID",
> UUID_LENGTH));
> >>> +#endif
> >>>     field_list.push_back(new Item_empty_string("Master_Info_File",
> >>>                                                2 * FN_REFLEN));
> >>>     field_list.push_back(new Item_return_int("SQL_Delay", 10,
> MYSQL_TYPE_LONG));
> >>> @@ -2219,7 +2225,9 @@ bool show_master_info(THD* thd, Master_i
> >>>       }
> >>>       // Master_Server_id
> >>>       protocol->store((uint32) mi->master_id);
> >>> +#if HAVE_SERVER_UUID
> >>>       protocol->store(mi->master_uuid,&my_charset_bin);
> >>> +#endif
> >>>       // Master_Info_File
> >>>      
> protocol->store(mi->get_description_info(),&my_charset_bin);
> >>>       // SQL_Delay
> >>> @@ -3256,10 +3264,12 @@ connected:
> >>>     thd->slave_net =&mysql->net;
> >>>     thd_proc_info(thd, "Checking master version");
> >>>     ret= get_master_version_and_clock(mysql, mi);
> >>> +#if HAVE_SERVER_UUID
> >>>     if (!ret)
> >>>       ret= get_master_uuid(mysql, mi);
> >>>     if (!ret)
> >>>       io_thread_init_commands(mysql, mi);
> >>> +#endif
> >>>
> >>>     if (ret == 1)
> >>>       /* Fatal error */
> >>> @@ -5568,8 +5578,6 @@ int start_slave(THD* thd , Master_info*
> >>>     int thread_mask;
> >>>     DBUG_ENTER("start_slave");
> >>>
> >>> -  if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0))
> >>> -    DBUG_RETURN(1);
> >>>     lock_slave_threads(mi);  // this allows us to cleanly read
> slave_running
> >>>     // Get a mask of _stopped_ threads
> >>>     init_thread_mask(&thread_mask,mi,1 /* inverse */);
> >>> @@ -5706,8 +5714,6 @@ int stop_slave(THD* thd, Master_info* mi
> >>>     if (!thd)
> >>>       thd = current_thd;
> >>>
> >>> -  if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0))
> >>> -    DBUG_RETURN(1);
> >>>     thd_proc_info(thd, "Killing slave");
> >>>     int thread_mask;
> >>>     lock_slave_threads(mi);
> >>> @@ -5886,7 +5892,9 @@ bool change_master(THD* thd, Master_info
> >>>     if ((lex_mi->host&&  strcmp(lex_mi->host,
> mi->host)) ||
> >>>         (lex_mi->port&&  lex_mi->port != mi->port))
> >>>     {
> >>> +#if HAVE_SERVER_UUID
> >>>       mi->master_uuid[0]= 0;
> >>> +#endif
> >>>       mi->master_id= 0;
> >>>     }
> >>>
> >>> @@ -6117,6 +6125,135 @@ err:
> >>>     DBUG_RETURN(ret);
> >>>   }
> >>>
> >>> +int Rpl_slave::change_master(THD* thd)
> >>> +{
> >>> +  int res= 0;
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  res = ::change_master(thd,active_mi);
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return res;
> >>> +}
> >>> +
> >>> +int Rpl_slave::start_slave(THD*thd)
> >>> +{
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  ::start_slave(thd,active_mi,1 /* net report*/);
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return 0;
> >>> +}
> >>> +
> >>> +int Rpl_slave::stop_slave(THD* thd)
> >>> +{
> >>> +  /*
> >>> +    If the client thread has locked tables, a deadlock is possible.
> >>> +    Assume that
> >>> +    - the client thread does LOCK TABLE t READ.
> >>> +    - then the master updates t.
> >>> +    - then the SQL slave thread wants to update t,
> >>> +      so it waits for the client thread because t is locked by it.
> >>> +    - then the client thread does SLAVE STOP.
> >>> +      SLAVE STOP waits for the SQL slave thread to terminate its
> >>> +      update t, which waits for the client thread because t is locked
> by it.
> >>> +    To prevent that, refuse SLAVE STOP if the
> >>> +    client thread has locked tables
> >>
> >> (3) SLAVE STOP is old syntax. Since you are moving this comment, would
> >> you mind replacing it by STOP SLAVE?
> >>
> >>> +  */
> >>> +  if (thd->locked_tables_mode ||
> >>> +      thd->in_active_multi_stmt_transaction() ||
> thd->global_read_lock.is_acquired())
> >>> +  {
> >>> +    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
> >>> +               ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
> >>> +    return 1;
> >>> +  }
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  int res= ::stop_slave(thd,active_mi,1/* net report*/);
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return res;
> >>> +}
> >>> +
> >>> +int Rpl_slave::show_slave_status(THD* thd)
> >>> +{
> >>> +  int res= 0;
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  if (active_mi != NULL)
> >>> +  {
> >>> +    res = show_master_info(thd, active_mi);
> >>> +  }
> >>> +  else
> >>> +  {
> >>> +    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
> >>> +                 WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
> >>> +    my_ok(thd);
> >>> +  }
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return res;
> >>> +}
> >>> +
> >>> +int Rpl_slave::flush_relay_log(THD* thd)
> >>> +{
> >>> +  int res= 0;
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  rotate_relay_log(active_mi);
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return res;
> >>> +}
> >>> +
> >>> +int Rpl_slave::reset_slave(THD* thd)
> >>> +{
> >>> +  int res= 0;
> >>> +  mysql_mutex_lock(&LOCK_active_mi);
> >>> +  res= ::reset_slave(thd, active_mi);
> >>> +  mysql_mutex_unlock(&LOCK_active_mi);
> >>> +  return res;
> >>> +}
> >>> +
> >>> +/**
> >>> +  Execute a SHOW RELAYLOG EVENTS statement.
> >>> +
> >>> +  @param thd Pointer to THD object for the client thread executing the
> >>> +  statement.
> >>> +
> >>> +  @retval FALSE success
> >>> +  @retval TRUE failure
> >>> +*/
> >>> +int Rpl_slave::show_relay_log_events(THD* thd)
> >>> +{
> >>> +  Protocol *protocol= thd->protocol;
> >>> +  List<Item>  field_list;
> >>> +  DBUG_ENTER("mysql_show_relaylog_events");
> >>> +
> >>> +  DBUG_ASSERT(thd->lex->sql_command ==
> SQLCOM_SHOW_RELAYLOG_EVENTS);
> >>> +
> >>> +  Log_event::init_show_field_list(&field_list);
> >>> +  if (protocol->send_result_set_metadata(&field_list,
> >>> +                            Protocol::SEND_NUM_ROWS |
> Protocol::SEND_EOF))
> >>> +    DBUG_RETURN(TRUE);
> >>> +
> >>> +  if (!active_mi)
> >>> +    DBUG_RETURN(TRUE);
> >>> +
> >>> + 
> DBUG_RETURN(show_binlog_events(thd,&active_mi->rli->relay_log));
> >>> +}
> >>
> >> (4) This is copied from rpl_rli.cc. I think we should then remove
> >> show_relaylog_events from rpl_rli.cc. Also:
> >>
> >> - please replace
> >>       DBUG_ENTER("mysql_show_relaylog_events");
> >>     by
> >>       DBUG_ENTER("mysql_show_relay_log_events");
> >>
> >> - please remove the assertion (it doesn't check anything useful, and we
> >>     don't assert that the SQLCOM is matching for any other commands
> >>
> >>> +
> >>> +int Rpl_slave::init()
> >>> +{
> >>> +  /*
> >>> +    init_slave() must be called after the thread keys are created.
> >>> +    Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and
> other
> >>> +    places) assume that active_mi != 0, so let's fail if it's 0 (out
> of
> >>> +    memory); a message has already been printed.
> >>> +  */
> >>> +  if (init_slave()&&  !active_mi)
> >>> +    return 1;
> >>> +  return 0;
> >>> +}
> >>> +
> >>> +void Rpl_slave::end()
> >>> +{
> >>> +  end_slave();
> >>> +}
> >>> +
> >>> +Rpl_slave rpl_slave;
> >>> +
> >>>   /**
> >>>     @} (end of group Replication)
> >>>   */
> >>>
> >>> === modified file 'sql/rpl_slave.h'
> >>> --- a/sql/rpl_slave.h	2011-02-16 17:13:30 +0000
> >>> +++ b/sql/rpl_slave.h	2011-03-02 07:14:10 +0000
> >>> @@ -48,6 +48,7 @@
> >>>   #include "my_list.h"
> >>>   #include "rpl_filter.h"
> >>>   #include "rpl_tblmap.h"
> >>> +#include "rpl.h"
> >>
> >> (5) Please, don't include header files from header files. Better to
> >> include them directly in each .cc file that needs them.
> >>
> >> (When WL#5675 is done, I think core should not include anything else
> >> than rpl.h)
> >>
> >>>
> >>>   #define SLAVE_NET_TIMEOUT  3600
> >>>
> >>> @@ -125,7 +126,6 @@ extern bool use_slave_mask;
> >>>   extern char *slave_load_tmpdir;
> >>>   extern char *master_info_file, *relay_log_info_file;
> >>>   extern char *opt_relay_logname, *opt_relaylog_index_name;
> >>> -extern char *opt_binlog_index_name;
> >>
> >> (6) Why was opt_binlog_index_name removed?
> >>
> >>>   extern my_bool opt_skip_slave_start, opt_reckless_slave;
> >>>   extern my_bool opt_log_slave_updates;
> >>>   extern char *opt_slave_skip_errors;
> >>>
> >>> === modified file 'sql/sql_parse.cc'
> >>> --- a/sql/sql_parse.cc	2011-02-21 11:34:14 +0000
> >>> +++ b/sql/sql_parse.cc	2011-03-02 07:14:10 +0000
> >>> @@ -2199,7 +2199,7 @@ case SQLCOM_PREPARE:
> >>>     {
> >>>       if (check_global_access(thd, REPL_SLAVE_ACL))
> >>>         goto error;
> >>> -    res = mysql_show_relaylog_events(thd);
> >>> +    res = rpl_slave.show_relay_log_events(thd);
> >>>       break;
> >>>     }
> >>>     case SQLCOM_SHOW_BINLOG_EVENTS:
> >>> @@ -2238,9 +2238,7 @@ case SQLCOM_PREPARE:
> >>>     {
> >>>       if (check_global_access(thd, SUPER_ACL))
> >>>         goto error;
> >>> -    mysql_mutex_lock(&LOCK_active_mi);
> >>> -    res = change_master(thd,active_mi);
> >>> -    mysql_mutex_unlock(&LOCK_active_mi);
> >>> +    res = rpl_slave.change_master(thd);
> >>>       break;
> >>>     }
> >>>     case SQLCOM_SHOW_SLAVE_STAT:
> >>> @@ -2248,18 +2246,7 @@ case SQLCOM_PREPARE:
> >>>       /* Accept one of two privileges */
> >>>       if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
> >>>         goto error;
> >>> -    mysql_mutex_lock(&LOCK_active_mi);
> >>> -    if (active_mi != NULL)
> >>> -    {
> >>> -      res = show_master_info(thd, active_mi);
> >>> -    }
> >>> -    else
> >>> -    {
> >>> -      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
> >>> -                   WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
> >>> -      my_ok(thd);
> >>> -    }
> >>> -    mysql_mutex_unlock(&LOCK_active_mi);
> >>> +    res = rpl_slave.show_slave_status(thd);
> >>>       break;
> >>>     }
> >>>     case SQLCOM_SHOW_MASTER_STAT:
> >>> @@ -2548,36 +2535,18 @@ end_with_restore_list:
> >>>   #ifdef HAVE_REPLICATION
> >>>     case SQLCOM_SLAVE_START:
> >>>     {
> >>> -    mysql_mutex_lock(&LOCK_active_mi);
> >>> -    start_slave(thd,active_mi,1 /* net report*/);
> >>> -    mysql_mutex_unlock(&LOCK_active_mi);
> >>> +    if (check_global_access(thd, SUPER_ACL))
> >>> +      goto error;
> >>> +    if (rpl_slave.start_slave(thd))
> >>> +      goto error;
> >>>       break;
> >>>     }
> >>>     case SQLCOM_SLAVE_STOP:
> >>> -  /*
> >>> -    If the client thread has locked tables, a deadlock is possible.
> >>> -    Assume that
> >>> -    - the client thread does LOCK TABLE t READ.
> >>> -    - then the master updates t.
> >>> -    - then the SQL slave thread wants to update t,
> >>> -      so it waits for the client thread because t is locked by it.
> >>> -    - then the client thread does SLAVE STOP.
> >>> -      SLAVE STOP waits for the SQL slave thread to terminate its
> >>> -      update t, which waits for the client thread because t is locked
> by it.
> >>> -    To prevent that, refuse SLAVE STOP if the
> >>> -    client thread has locked tables
> >>> -  */
> >>> -  if (thd->locked_tables_mode ||
> >>> -      thd->in_active_multi_stmt_transaction() ||
> thd->global_read_lock.is_acquired())
> >>> -  {
> >>> -    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
> >>> -               ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
> >>> -    goto error;
> >>> -  }
> >>>     {
> >>> -    mysql_mutex_lock(&LOCK_active_mi);
> >>> -    stop_slave(thd,active_mi,1/* net report*/);
> >>> -    mysql_mutex_unlock(&LOCK_active_mi);
> >>> +    if (check_global_access(thd, SUPER_ACL))
> >>> +      goto error;
> >>> +    if (rpl_slave.stop_slave(thd))
> >>> +      goto error;
> >>>       break;
> >>>     }
> >>>   #endif /* HAVE_REPLICATION */
> >>>
> >>> === modified file 'sql/sql_reload.cc'
> >>> --- a/sql/sql_reload.cc	2010-12-10 16:55:50 +0000
> >>> +++ b/sql/sql_reload.cc	2011-03-02 07:14:10 +0000
> >>> @@ -149,10 +149,8 @@ bool reload_acl_and_cache(THD *thd, unsi
> >>>     if (options&  REFRESH_RELAY_LOG)
> >>>     {
> >>>   #ifdef HAVE_REPLICATION
> >>> -    mysql_mutex_lock(&LOCK_active_mi);
> >>> -    if (rotate_relay_log(active_mi))
> >>> +    if (rpl_slave.flush_relay_log(thd))
> >>>         *write_to_binlog= -1;
> >>> -    mysql_mutex_unlock(&LOCK_active_mi);
> >>>   #endif
> >>>     }
> >>>   #ifdef HAVE_QUERY_CACHE
> >>> @@ -275,10 +273,8 @@ bool reload_acl_and_cache(THD *thd, unsi
> >>>    if (options&  REFRESH_SLAVE)
> >>>    {
> >>>      tmp_write_to_binlog= 0;
> >>> -   mysql_mutex_lock(&LOCK_active_mi);
> >>> -   if (reset_slave(thd, active_mi))
> >>> +   if (rpl_slave.reset_slave(thd))
> >>>        result=1;
> >>> -   mysql_mutex_unlock(&LOCK_active_mi);
> >>>    }
> >>>   #endif
> >>>    if (options&  REFRESH_USER_RESOURCES)
> >>>
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------
> >>>
> >>>
> >
> 
> 


Thread
bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing2 Mar
  • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779Sven Sandberg2 Mar
    • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779Sven Sandberg2 Mar
      • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing3 Mar
    • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing3 Mar
      • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779Sven Sandberg3 Mar
        • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing3 Mar
          • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779Sven Sandberg3 Mar
            • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing3 Mar
              • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779Sven Sandberg3 Mar
                • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing4 Mar
    • Re: bzr commit into mysql-trunk branch (hezx:3710) WL#5779He Zhenxing3 Mar