mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0 sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged
This commit is contained in:
		@@ -100,7 +100,6 @@ extern int NEAR my_errno;		/* Last error in mysys */
 | 
				
			|||||||
#define MY_RETURN_REAL_PATH	32	/* return full path for file */
 | 
					#define MY_RETURN_REAL_PATH	32	/* return full path for file */
 | 
				
			||||||
#define MY_SAFE_PATH		64	/* Return NULL if too long path */
 | 
					#define MY_SAFE_PATH		64	/* Return NULL if too long path */
 | 
				
			||||||
#define MY_RELATIVE_PATH	128	/* name is relative to 'dir' */
 | 
					#define MY_RELATIVE_PATH	128	/* name is relative to 'dir' */
 | 
				
			||||||
#define MY_QUOTE_SPACES        256     /* quote when the path has spaces */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* My seek flags */
 | 
						/* My seek flags */
 | 
				
			||||||
#define MY_SEEK_SET	0
 | 
					#define MY_SEEK_SET	0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3563,11 +3563,13 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
 | 
				
			|||||||
    share->state.rec_per_key_rows=info->state->records;
 | 
					    share->state.rec_per_key_rows=info->state->records;
 | 
				
			||||||
    share->state.changed&= ~STATE_NOT_ANALYZED;
 | 
					    share->state.changed&= ~STATE_NOT_ANALYZED;
 | 
				
			||||||
    if (info->state->records)
 | 
					    if (info->state->records)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      for (i=0; i<key_parts; i++)
 | 
					      for (i=0; i<key_parts; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i]))
 | 
					        if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i]))
 | 
				
			||||||
          share->state.changed|= STATE_NOT_ANALYZED;
 | 
					          share->state.changed|= STATE_NOT_ANALYZED;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC))
 | 
					  if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@
 | 
				
			|||||||
# We also check how the foreign_key_check variable is replicated
 | 
					# We also check how the foreign_key_check variable is replicated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source include/master-slave.inc;
 | 
					source include/master-slave.inc;
 | 
				
			||||||
 | 
					source include/have_innodb.inc
 | 
				
			||||||
connection master;
 | 
					connection master;
 | 
				
			||||||
drop table if exists t1;
 | 
					drop table if exists t1;
 | 
				
			||||||
create table t1(a int auto_increment, key(a));
 | 
					create table t1(a int auto_increment, key(a));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -111,15 +111,7 @@ my_string fn_format(my_string to, const char *name, const char *dir,
 | 
				
			|||||||
    strmov(buff,to);
 | 
					    strmov(buff,to);
 | 
				
			||||||
    (void) my_readlink(to, buff, MYF(0));
 | 
					    (void) my_readlink(to, buff, MYF(0));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if ( flag & MY_QUOTE_SPACES)
 | 
					  DBUG_RETURN(to);
 | 
				
			||||||
    if ( strchr(to, ' '))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      char tmp_buff[FN_REFLEN];
 | 
					 | 
				
			||||||
      tmp_buff[0]='"';
 | 
					 | 
				
			||||||
      strxmov(tmp_buff+1,to,"\"",NullS);
 | 
					 | 
				
			||||||
      strmov(to,tmp_buff);
 | 
					 | 
				
			||||||
    }  
 | 
					 | 
				
			||||||
  DBUG_RETURN (to);
 | 
					 | 
				
			||||||
} /* fn_format */
 | 
					} /* fn_format */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -593,8 +593,9 @@ err:
 | 
				
			|||||||
  UNLOCK_MUTEX;
 | 
					  UNLOCK_MUTEX;
 | 
				
			||||||
  if (error)
 | 
					  if (error)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    sql_print_error("Error in Log_event::read_log_event(): '%s', \
 | 
					    sql_print_error("\
 | 
				
			||||||
data_len=%d,event_type=%d",error,data_len,head[EVENT_TYPE_OFFSET]);
 | 
					Error in Log_event::read_log_event(): '%s', data_len: %d, event_type: %d",
 | 
				
			||||||
 | 
							    error,data_len,head[EVENT_TYPE_OFFSET]);
 | 
				
			||||||
    my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
 | 
					    my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
      The SQL slave thread will check if file->error<0 to know
 | 
					      The SQL slave thread will check if file->error<0 to know
 | 
				
			||||||
@@ -1433,8 +1434,8 @@ void Slave_log_event::print(FILE* file, bool short_form, char* last_db)
 | 
				
			|||||||
    return;
 | 
					    return;
 | 
				
			||||||
  print_header(file);
 | 
					  print_header(file);
 | 
				
			||||||
  fputc('\n', file);
 | 
					  fputc('\n', file);
 | 
				
			||||||
  fprintf(file, "Slave: master_host: '%s'  master_port: %d  \
 | 
					  fprintf(file, "\
 | 
				
			||||||
master_log: '%s'  master_pos: %s\n",
 | 
					Slave: master_host: '%s'  master_port: %d  master_log: '%s'  master_pos: %s\n",
 | 
				
			||||||
	  master_host, master_port, master_log, llstr(master_pos, llbuff));
 | 
						  master_host, master_port, master_log, llstr(master_pos, llbuff));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1755,7 +1756,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  int expected_error, actual_error= 0;
 | 
					  int expected_error, actual_error= 0;
 | 
				
			||||||
  init_sql_alloc(&thd->mem_root, 8192,0);
 | 
					  init_sql_alloc(&thd->mem_root, 8192,0);
 | 
				
			||||||
  thd->db = rewrite_db((char*)db);
 | 
					  thd->db= (char*) rewrite_db(db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*
 | 
					  /*
 | 
				
			||||||
    InnoDB internally stores the master log position it has processed so far;
 | 
					    InnoDB internally stores the master log position it has processed so far;
 | 
				
			||||||
@@ -1811,15 +1812,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
 | 
				
			|||||||
	  !ignored_error_code(expected_error))
 | 
						  !ignored_error_code(expected_error))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
	slave_print_error(rli, 0,
 | 
						slave_print_error(rli, 0,
 | 
				
			||||||
                          "Query '%s' did not get the same error as the query \
 | 
					                          "\
 | 
				
			||||||
got on master - got on master: '%s' (%d), got on slave: '%s' (%d) \
 | 
					Query '%s' caused different errors on master and slave. \
 | 
				
			||||||
(default database was '%s')",
 | 
					Error on master: '%s' (%d), Error on slave: '%s' (%d). \
 | 
				
			||||||
 | 
					Default database: '%s'",
 | 
				
			||||||
                          query,
 | 
					                          query,
 | 
				
			||||||
                          ER_SAFE(expected_error),
 | 
					                          ER_SAFE(expected_error),
 | 
				
			||||||
                          expected_error,
 | 
					                          expected_error,
 | 
				
			||||||
                          actual_error ? thd->net.last_error: "no error",
 | 
					                          actual_error ? thd->net.last_error: "no error",
 | 
				
			||||||
                          actual_error,
 | 
					                          actual_error,
 | 
				
			||||||
                          print_slave_db_safe((char*)db));
 | 
					                          print_slave_db_safe(db));
 | 
				
			||||||
	thd->query_error= 1;
 | 
						thd->query_error= 1;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      /*
 | 
					      /*
 | 
				
			||||||
@@ -1837,11 +1839,12 @@ got on master - got on master: '%s' (%d), got on slave: '%s' (%d) \
 | 
				
			|||||||
      */
 | 
					      */
 | 
				
			||||||
      else if (thd->query_error || thd->fatal_error)
 | 
					      else if (thd->query_error || thd->fatal_error)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        slave_print_error(rli,actual_error, "Error '%s' on query '%s' \
 | 
					        slave_print_error(rli,actual_error,
 | 
				
			||||||
(default database was '%s')",
 | 
								  "Error '%s' on query '%s'. Default database: '%s'",
 | 
				
			||||||
                          actual_error ? thd->net.last_error :
 | 
					                          (actual_error ? thd->net.last_error :
 | 
				
			||||||
                          "unexpected success or fatal error", query,
 | 
								   "unexpected success or fatal error"),
 | 
				
			||||||
                          print_slave_db_safe((char*)db)); 
 | 
								  query,
 | 
				
			||||||
 | 
					                          print_slave_db_safe(db));
 | 
				
			||||||
        thd->query_error= 1;
 | 
					        thd->query_error= 1;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
@@ -1896,7 +1899,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
 | 
				
			|||||||
			       bool use_rli_only_for_errors)
 | 
								       bool use_rli_only_for_errors)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  init_sql_alloc(&thd->mem_root, 8192,0);
 | 
					  init_sql_alloc(&thd->mem_root, 8192,0);
 | 
				
			||||||
  thd->db = rewrite_db((char*)db);
 | 
					  thd->db= (char*) rewrite_db(db);
 | 
				
			||||||
  DBUG_ASSERT(thd->query == 0);
 | 
					  DBUG_ASSERT(thd->query == 0);
 | 
				
			||||||
  thd->query = 0;				// Should not be needed
 | 
					  thd->query = 0;				// Should not be needed
 | 
				
			||||||
  thd->query_error = 0;
 | 
					  thd->query_error = 0;
 | 
				
			||||||
@@ -1978,17 +1981,15 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
 | 
				
			|||||||
      if (mysql_load(thd, &ex, &tables, field_list, handle_dup, net != 0,
 | 
					      if (mysql_load(thd, &ex, &tables, field_list, handle_dup, net != 0,
 | 
				
			||||||
		     TL_WRITE))
 | 
							     TL_WRITE))
 | 
				
			||||||
	thd->query_error = 1;
 | 
						thd->query_error = 1;
 | 
				
			||||||
 | 
					      /* log_pos is the position of the LOAD event in the master log */
 | 
				
			||||||
      if (thd->cuted_fields)
 | 
					      if (thd->cuted_fields)
 | 
				
			||||||
	/* 
 | 
						sql_print_error("\
 | 
				
			||||||
	   log_pos is the position of the LOAD
 | 
					Slave: load data infile on table '%s' at log position %s in log \
 | 
				
			||||||
	   event in the master log
 | 
					'%s' produced %ld warning(s). Default database: '%s'",
 | 
				
			||||||
	*/
 | 
					                        (char*) table_name,
 | 
				
			||||||
	sql_print_error("Slave: load data infile at position %s in log \
 | 
					 | 
				
			||||||
'%s' produced %d warning(s) (loaded table was '%s', database was '%s')",
 | 
					 | 
				
			||||||
                        llstr(log_pos,llbuff), RPL_LOG_NAME, 
 | 
					                        llstr(log_pos,llbuff), RPL_LOG_NAME, 
 | 
				
			||||||
			thd->cuted_fields,
 | 
								(ulong) thd->cuted_fields,
 | 
				
			||||||
                        (char*)table_name,
 | 
					                        print_slave_db_safe(db));
 | 
				
			||||||
                        print_slave_db_safe((char*)db));
 | 
					 | 
				
			||||||
      if (net)
 | 
					      if (net)
 | 
				
			||||||
        net->pkt_nr= thd->net.pkt_nr;
 | 
					        net->pkt_nr= thd->net.pkt_nr;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -2019,10 +2020,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
 | 
				
			|||||||
      sql_errno=ER_UNKNOWN_ERROR;
 | 
					      sql_errno=ER_UNKNOWN_ERROR;
 | 
				
			||||||
      err=ER(sql_errno);       
 | 
					      err=ER(sql_errno);       
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    slave_print_error(rli,sql_errno,
 | 
					    slave_print_error(rli,sql_errno,"\
 | 
				
			||||||
		      "Error '%s' running load data infile \
 | 
					Error '%s' running lOAD DATA INFILE on table '%s'. Default database: '%s'",
 | 
				
			||||||
(loaded table was '%s', database was '%s')",
 | 
							      err, (char*)table_name, print_slave_db_safe(db));
 | 
				
			||||||
		      err, (char*)table_name, print_slave_db_safe((char*)db));
 | 
					 | 
				
			||||||
    free_root(&thd->mem_root,0);
 | 
					    free_root(&thd->mem_root,0);
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -2030,10 +2030,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
 | 
				
			|||||||
	    
 | 
						    
 | 
				
			||||||
  if (thd->fatal_error)
 | 
					  if (thd->fatal_error)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    slave_print_error(rli,ER_UNKNOWN_ERROR,
 | 
					    slave_print_error(rli,ER_UNKNOWN_ERROR, "\
 | 
				
			||||||
"Fatal error running \
 | 
					Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
 | 
				
			||||||
LOAD DATA INFILE (loaded table was '%s', database was '%s')",
 | 
							      (char*)table_name, print_slave_db_safe(db));
 | 
				
			||||||
                    (char*)table_name, print_slave_db_safe((char*)db));
 | 
					 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2339,13 +2338,15 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
 | 
				
			|||||||
      What we want instead is add the filename to the current error message.
 | 
					      What we want instead is add the filename to the current error message.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME));
 | 
					    char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME));
 | 
				
			||||||
    if (!tmp)
 | 
					    if (tmp)
 | 
				
			||||||
      goto err;
 | 
					    {
 | 
				
			||||||
    slave_print_error(rli,rli->last_slave_errno, /* ok to re-use the error code */
 | 
					      slave_print_error(rli,
 | 
				
			||||||
                      "%s. Failed executing load from '%s'", 
 | 
								rli->last_slave_errno, /* ok to re-use error code */
 | 
				
			||||||
                      tmp, fname);
 | 
								"%s. Failed executing load from '%s'", 
 | 
				
			||||||
    my_free(tmp,MYF(0));
 | 
								tmp, fname);
 | 
				
			||||||
    thd->options = save_options;
 | 
					      my_free(tmp,MYF(0));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    thd->options= save_options;
 | 
				
			||||||
    goto err;
 | 
					    goto err;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  thd->options = save_options;
 | 
					  thd->options = save_options;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,8 +30,8 @@
 | 
				
			|||||||
#include <thr_alarm.h>
 | 
					#include <thr_alarm.h>
 | 
				
			||||||
#include <mysql_embed.h>
 | 
					#include <mysql_embed.h>
 | 
				
			||||||
#include <mysql_com.h>
 | 
					#include <mysql_com.h>
 | 
				
			||||||
#include <violite.h>
 | 
					 | 
				
			||||||
#include <my_sys.h>
 | 
					#include <my_sys.h>
 | 
				
			||||||
 | 
					#include <violite.h>
 | 
				
			||||||
#include <mysys_err.h>
 | 
					#include <mysys_err.h>
 | 
				
			||||||
#include <m_string.h>
 | 
					#include <m_string.h>
 | 
				
			||||||
#include <m_ctype.h>
 | 
					#include <m_ctype.h>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2506,6 +2506,19 @@ int mysql_service(void *p)
 | 
				
			|||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Quote string if it contains space, else copy */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char *add_quoted_string(char *to, const char *from, char *to_end)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  uint length= (uint) (to_end-to);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!strchr(from, ' '))
 | 
				
			||||||
 | 
					    return strnmov(to, from, length);
 | 
				
			||||||
 | 
					  return strxnmov(to, length, "\"", from, "\"", NullS);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
  Handle basic handling of services, like installation and removal
 | 
					  Handle basic handling of services, like installation and removal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2515,25 +2528,41 @@ int mysql_service(void *p)
 | 
				
			|||||||
    servicename		Internal name of service
 | 
					    servicename		Internal name of service
 | 
				
			||||||
    displayname		Display name of service (in taskbar ?)
 | 
					    displayname		Display name of service (in taskbar ?)
 | 
				
			||||||
    file_path		Path to this program
 | 
					    file_path		Path to this program
 | 
				
			||||||
 | 
					    startup_option	Startup option to mysqld
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  RETURN VALUES
 | 
					  RETURN VALUES
 | 
				
			||||||
    0		option handled
 | 
					    0		option handled
 | 
				
			||||||
    1		Could not handle option
 | 
					    1		Could not handle option
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool default_service_handling(char **argv,
 | 
					static bool
 | 
				
			||||||
			      const char *servicename,
 | 
					default_service_handling(char **argv,
 | 
				
			||||||
			      const char *displayname,
 | 
								 const char *servicename,
 | 
				
			||||||
			      const char *file_path)
 | 
								 const char *displayname,
 | 
				
			||||||
 | 
								 const char *file_path,
 | 
				
			||||||
 | 
								 const char *extra_opt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  char path_and_service[FN_REFLEN+FN_REFLEN+32], *pos, *end;
 | 
				
			||||||
 | 
					  end= path_and_service + sizeof(path_and_service)-1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* We have to quote filename if it contains spaces */
 | 
				
			||||||
 | 
					  pos= add_quoted_string(path_and_service, file_path, end);
 | 
				
			||||||
 | 
					  if (*extra_opt)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    /* Add (possible quoted) option after file_path */
 | 
				
			||||||
 | 
					    *pos++= ' ';
 | 
				
			||||||
 | 
					    pos= add_quoted_string(pos, extra_opt, end);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  *pos= 0;					// Ensure end null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Service.got_service_option(argv, "install"))
 | 
					  if (Service.got_service_option(argv, "install"))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    Service.Install(1, servicename, displayname, file_path);
 | 
					    Service.Install(1, servicename, displayname, path_and_service);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (Service.got_service_option(argv, "install-manual"))
 | 
					  if (Service.got_service_option(argv, "install-manual"))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    Service.Install(0, servicename, displayname, file_path);
 | 
					    Service.Install(0, servicename, displayname, path_and_service);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (Service.got_service_option(argv, "remove"))
 | 
					  if (Service.got_service_option(argv, "remove"))
 | 
				
			||||||
@@ -2560,12 +2589,11 @@ int main(int argc, char **argv)
 | 
				
			|||||||
    char file_path[FN_REFLEN];
 | 
					    char file_path[FN_REFLEN];
 | 
				
			||||||
    my_path(file_path, argv[0], "");		      /* Find name in path */
 | 
					    my_path(file_path, argv[0], "");		      /* Find name in path */
 | 
				
			||||||
    fn_format(file_path,argv[0],file_path,"",MY_REPLACE_DIR+
 | 
					    fn_format(file_path,argv[0],file_path,"",MY_REPLACE_DIR+
 | 
				
			||||||
              MY_UNPACK_FILENAME+MY_RESOLVE_SYMLINKS+MY_QUOTE_SPACES);
 | 
					              MY_UNPACK_FILENAME | MY_RESOLVE_SYMLINKS);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (argc == 2)
 | 
					    if (argc == 2)
 | 
				
			||||||
    {	
 | 
					    {	
 | 
				
			||||||
      if (!default_service_handling(argv,MYSQL_SERVICENAME, MYSQL_SERVICENAME,
 | 
					      if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME,
 | 
				
			||||||
				   file_path))
 | 
									   file_path, ""))
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
      if (Service.IsService(argv[1]))
 | 
					      if (Service.IsService(argv[1]))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@@ -2578,12 +2606,8 @@ int main(int argc, char **argv)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (argc == 3) /* install or remove any optional service */
 | 
					    else if (argc == 3) /* install or remove any optional service */
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      /* Add service name after filename */
 | 
					      if (!default_service_handling(argv, argv[2], argv[2], file_path,
 | 
				
			||||||
      uint length=strlen(file_path);
 | 
									    argv[2]))
 | 
				
			||||||
      *strxnmov(file_path + length, sizeof(file_path)-length-2, " ",
 | 
					 | 
				
			||||||
		argv[2], NullS)= '\0';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!default_service_handling(argv, argv[2], argv[2], file_path))
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
      if (Service.IsService(argv[2]))
 | 
					      if (Service.IsService(argv[2]))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@@ -2605,12 +2629,8 @@ int main(int argc, char **argv)
 | 
				
			|||||||
	Install an optional service with optional config file
 | 
						Install an optional service with optional config file
 | 
				
			||||||
	mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini
 | 
						mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini
 | 
				
			||||||
      */
 | 
					      */
 | 
				
			||||||
      uint length=strlen(file_path);
 | 
					      if (!default_service_handling(argv, argv[2], argv[2], file_path,
 | 
				
			||||||
      char tmp_path[FN_REFLEN];
 | 
									    argv[3]))
 | 
				
			||||||
      fn_format(tmp_path,argv[3],tmp_path,"",MY_QUOTE_SPACES);
 | 
					 | 
				
			||||||
      *strxnmov(file_path + length, sizeof(file_path)-length-2, " ",
 | 
					 | 
				
			||||||
                tmp_path, " ", argv[2], NullS)= '\0';
 | 
					 | 
				
			||||||
      if (!default_service_handling(argv, argv[2], argv[2], file_path))
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME))
 | 
					    else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME))
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										38
									
								
								sql/slave.cc
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								sql/slave.cc
									
									
									
									
									
								
							@@ -828,6 +828,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli)
 | 
				
			|||||||
  return rli->abort_slave || abort_loop || thd->killed;
 | 
					  return rli->abort_slave || abort_loop || thd->killed;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
  Writes an error message to rli->last_slave_error and rli->last_slave_errno
 | 
					  Writes an error message to rli->last_slave_error and rli->last_slave_errno
 | 
				
			||||||
  (which will be displayed by SHOW SLAVE STATUS), and prints it to stderr.
 | 
					  (which will be displayed by SHOW SLAVE STATUS), and prints it to stderr.
 | 
				
			||||||
@@ -842,7 +843,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  RETURN VALUES
 | 
					  RETURN VALUES
 | 
				
			||||||
    void
 | 
					    void
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...)
 | 
					void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -853,11 +854,11 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...)
 | 
				
			|||||||
  rli->last_slave_errno = err_code;
 | 
					  rli->last_slave_errno = err_code;
 | 
				
			||||||
  /* If the error string ends with '.', do not add a ',' it would be ugly */
 | 
					  /* If the error string ends with '.', do not add a ',' it would be ugly */
 | 
				
			||||||
  if (rli->last_slave_error[0] && 
 | 
					  if (rli->last_slave_error[0] && 
 | 
				
			||||||
      (rli->last_slave_error[strlen(rli->last_slave_error)-1] == '.'))
 | 
					      (*(strend(rli->last_slave_error)-1) == '.'))
 | 
				
			||||||
    sql_print_error("Slave: %s Error_code=%d", rli->last_slave_error,
 | 
					    sql_print_error("Slave: %s Error_code: %d", rli->last_slave_error,
 | 
				
			||||||
                    err_code);
 | 
					                    err_code);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    sql_print_error("Slave: %s, error_code=%d", rli->last_slave_error,
 | 
					    sql_print_error("Slave: %s, Error_code: %d", rli->last_slave_error,
 | 
				
			||||||
                    err_code);
 | 
					                    err_code);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -872,7 +873,7 @@ void skip_load_data_infile(NET* net)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char* rewrite_db(char* db)
 | 
					const char *rewrite_db(const char* db)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (replicate_rewrite_db.is_empty() || !db)
 | 
					  if (replicate_rewrite_db.is_empty() || !db)
 | 
				
			||||||
    return db;
 | 
					    return db;
 | 
				
			||||||
@@ -889,13 +890,14 @@ char* rewrite_db(char* db)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
  From other comments and tests in code, it looks like
 | 
					  From other comments and tests in code, it looks like
 | 
				
			||||||
  sometimes Query_log_event and Load_log_event can have db==0
 | 
					  sometimes Query_log_event and Load_log_event can have db == 0
 | 
				
			||||||
  (see rewrite_db() above for example)
 | 
					  (see rewrite_db() above for example)
 | 
				
			||||||
  (cases where this happens are unclear; it may be when the master is 3.23).
 | 
					  (cases where this happens are unclear; it may be when the master is 3.23).
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
char* print_slave_db_safe(char* db)
 | 
					
 | 
				
			||||||
 | 
					const char *print_slave_db_safe(const char* db)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return (db ? rewrite_db(db) : (char*) "");
 | 
					  return (db ? rewrite_db(db) : "");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -1303,8 +1305,8 @@ file '%s', errno %d)", fname, my_errno);
 | 
				
			|||||||
    if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
 | 
					    if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
 | 
				
			||||||
		      MYF(MY_WME))) 
 | 
							      MYF(MY_WME))) 
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      sql_print_error("Failed to create a cache on relay log info file (\
 | 
					      sql_print_error("Failed to create a cache on relay log info file '%s'",
 | 
				
			||||||
file '%s')", fname);
 | 
							      fname);
 | 
				
			||||||
      msg= current_thd->net.last_error;
 | 
					      msg= current_thd->net.last_error;
 | 
				
			||||||
      goto err;
 | 
					      goto err;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1313,8 +1315,7 @@ file '%s')", fname);
 | 
				
			|||||||
    if (init_relay_log_pos(rli,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */,
 | 
					    if (init_relay_log_pos(rli,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */,
 | 
				
			||||||
			   &msg))
 | 
								   &msg))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      sql_print_error("Failed to open the relay log (relay_log_name='FIRST', \
 | 
					      sql_print_error("Failed to open the relay log 'FIRST' (relay_log_pos 4");
 | 
				
			||||||
relay_log_pos=4)");
 | 
					 | 
				
			||||||
      goto err;
 | 
					      goto err;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    rli->master_log_name[0]= 0;
 | 
					    rli->master_log_name[0]= 0;
 | 
				
			||||||
@@ -1330,15 +1331,16 @@ relay_log_pos=4)");
 | 
				
			|||||||
      int error=0;
 | 
					      int error=0;
 | 
				
			||||||
      if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
 | 
					      if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        sql_print_error("Failed to open the existing relay log info file (\
 | 
					        sql_print_error("\
 | 
				
			||||||
file '%s', errno %d)", fname, my_errno);
 | 
					Failed to open the existing relay log info file '%s' (errno %d)",
 | 
				
			||||||
 | 
								fname, my_errno);
 | 
				
			||||||
        error= 1;
 | 
					        error= 1;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else if (init_io_cache(&rli->info_file, info_fd,
 | 
					      else if (init_io_cache(&rli->info_file, info_fd,
 | 
				
			||||||
                             IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME)))
 | 
					                             IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME)))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        sql_print_error("Failed to create a cache on relay log info file (\
 | 
					        sql_print_error("Failed to create a cache on relay log info file '%s'",
 | 
				
			||||||
file '%s')", fname);
 | 
								fname);
 | 
				
			||||||
        error= 1;
 | 
					        error= 1;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (error)
 | 
					      if (error)
 | 
				
			||||||
@@ -1377,8 +1379,8 @@ file '%s')", fname);
 | 
				
			|||||||
			   &msg))
 | 
								   &msg))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      char llbuf[22];
 | 
					      char llbuf[22];
 | 
				
			||||||
      sql_print_error("Failed to open the relay log (relay_log_name='%s', \
 | 
					      sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)",
 | 
				
			||||||
relay_log_pos=%s)", rli->relay_log_name, llstr(rli->relay_log_pos, llbuf));
 | 
							      rli->relay_log_name, llstr(rli->relay_log_pos, llbuf));
 | 
				
			||||||
      goto err;
 | 
					      goto err;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -382,8 +382,8 @@ int add_table_rule(HASH* h, const char* table_spec);
 | 
				
			|||||||
int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
 | 
					int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
 | 
				
			||||||
void init_table_rule_hash(HASH* h, bool* h_inited);
 | 
					void init_table_rule_hash(HASH* h, bool* h_inited);
 | 
				
			||||||
void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited);
 | 
					void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited);
 | 
				
			||||||
char* rewrite_db(char* db);
 | 
					const char *rewrite_db(const char* db);
 | 
				
			||||||
char* print_slave_db_safe(char* db);
 | 
					const char *print_slave_db_safe(const char* db);
 | 
				
			||||||
int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
 | 
					int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
 | 
				
			||||||
void skip_load_data_infile(NET* net);
 | 
					void skip_load_data_infile(NET* net);
 | 
				
			||||||
void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
 | 
					void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1242,13 +1242,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    /* 
 | 
					    /* 
 | 
				
			||||||
       The tables must be marked "updating" so that tables_ok() takes them into
 | 
					       The tables must be marked "updating" so that tables_ok() takes them into
 | 
				
			||||||
       account in tests.
 | 
					       account in tests.  It's ok to leave 'updating' set after tables_ok.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    tables.updating=1;
 | 
					    tables.updating= 1;
 | 
				
			||||||
    /* Thanks to bzero, tables.next==0 */
 | 
					    /* Thanks to bzero, tables.next==0 */
 | 
				
			||||||
    if (!tables_ok(0, &tables))
 | 
					    if (!tables_ok(0, &tables))
 | 
				
			||||||
      DBUG_RETURN(0);
 | 
					      DBUG_RETURN(0);
 | 
				
			||||||
    tables.updating=0;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2138,10 +2137,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
 | 
				
			|||||||
       The tables must be marked "updating" so that tables_ok() takes them into
 | 
					       The tables must be marked "updating" so that tables_ok() takes them into
 | 
				
			||||||
       account in tests.
 | 
					       account in tests.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    tables[0].updating=tables[1].updating=tables[2].updating=1;
 | 
					    tables[0].updating= tables[1].updating= tables[2].updating= 1;
 | 
				
			||||||
    if (!tables_ok(0, tables))
 | 
					    if (!tables_ok(0, tables))
 | 
				
			||||||
      DBUG_RETURN(0);
 | 
					      DBUG_RETURN(0);
 | 
				
			||||||
    tables[0].updating=tables[1].updating=tables[2].updating=0;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2319,10 +2317,9 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
 | 
				
			|||||||
       The tables must be marked "updating" so that tables_ok() takes them into
 | 
					       The tables must be marked "updating" so that tables_ok() takes them into
 | 
				
			||||||
       account in tests.
 | 
					       account in tests.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    tables[0].updating=tables[1].updating=1;
 | 
					    tables[0].updating= tables[1].updating= 1;
 | 
				
			||||||
    if (!tables_ok(0, tables))
 | 
					    if (!tables_ok(0, tables))
 | 
				
			||||||
      DBUG_RETURN(0);
 | 
					      DBUG_RETURN(0);
 | 
				
			||||||
    tables[0].updating=tables[1].updating=0;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_OPENSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <my_sys.h>
 | 
					 | 
				
			||||||
#include <mysql_com.h>
 | 
					#include <mysql_com.h>
 | 
				
			||||||
 | 
					#include <my_sys.h>
 | 
				
			||||||
#include <violite.h>
 | 
					#include <violite.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user