Commit a6788bea authored by sasha@mysql.sashanet.com's avatar sasha@mysql.sashanet.com
Browse files

Merge work:/home/bk/mysql-4.0

into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
parents bd115b91 24f89c75
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O2"

base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"

base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static"
base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static \
 --with-client-ldflags=-all-static"
alpha_configs=""	# Not used yet
pentium_configs=""
sparc_configs=""
+46 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@

**********************************************************************/

#define MTEST_VERSION "1.8"
#define MTEST_VERSION "1.9"

#include <global.h>
#include <my_sys.h>
@@ -159,6 +159,8 @@ Q_SYNC_WITH_MASTER, Q_ERROR,
Q_SEND,             Q_REAP, 
Q_DIRTY_CLOSE,      Q_REPLACE,
Q_PING,             Q_EVAL,
Q_RPL_PROBE,        Q_ENABLE_RPL_PARSE,
Q_DISABLE_RPL_PARSE,
Q_UNKNOWN,                             /* Unknown command.   */
Q_COMMENT,                             /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
@@ -188,6 +190,8 @@ const char *command_names[] = {
  "send",             "reap", 
  "dirty_close",      "replace_result",
  "ping",             "eval",
  "rpl_probe",        "enable_rpl_parse",
  "disable_rpl_parse",
  0
};

@@ -645,6 +649,11 @@ int do_sync_with_master(struct st_query* q)
  char query_buf[FN_REFLEN+128];
  int offset = 0;
  char* p = q->first_argument;
  int rpl_parse;

  rpl_parse = mysql_rpl_parse_enabled(mysql);
  mysql_disable_rpl_parse(mysql);
  
  if(*p)
    offset = atoi(p);
  
@@ -662,6 +671,9 @@ int do_sync_with_master(struct st_query* q)
    die("Error on slave while syncing with master");
  mysql_free_result(res);

  if(rpl_parse)
    mysql_enable_rpl_parse(mysql);
  
  return 0;
}

@@ -670,6 +682,11 @@ int do_save_master_pos()
  MYSQL_RES* res;
  MYSQL_ROW row;
  MYSQL* mysql = &cur_con->mysql;
  int rpl_parse;

  rpl_parse = mysql_rpl_parse_enabled(mysql);
  mysql_disable_rpl_parse(mysql);
  
  if(mysql_query(mysql, "show master status"))
    die("At line %u: failed in show master status: %d: %s", start_lineno,
	mysql_errno(mysql), mysql_error(mysql));
@@ -682,6 +699,9 @@ int do_save_master_pos()
  master_pos.pos = strtoul(row[1], (char**) 0, 10); 
  mysql_free_result(res);
  
  if(rpl_parse)
    mysql_enable_rpl_parse(mysql);
      
  return 0;
}

@@ -705,6 +725,26 @@ int do_let(struct st_query* q)
  return var_set(var_name, var_name_end, var_val_start, p);
}

int do_rpl_probe(struct st_query* __attribute__((unused)) q)
{
  if(mysql_rpl_probe(&cur_con->mysql))
    die("Failed in mysql_rpl_probe(): %s", mysql_error(&cur_con->mysql));
  return 0;
}

int do_enable_rpl_parse(struct st_query* __attribute__((unused)) q)
{
  mysql_enable_rpl_parse(&cur_con->mysql);
  return 0;
}

int do_disable_rpl_parse(struct st_query* __attribute__((unused)) q)
{
  mysql_disable_rpl_parse(&cur_con->mysql);
  return 0;
}


int do_sleep(struct st_query* q)
{
  char* p=q->first_argument;
@@ -1830,6 +1870,9 @@ int main(int argc, char** argv)
      case Q_DISCONNECT:
      case Q_DIRTY_CLOSE:	
	close_connection(q); break;
      case Q_RPL_PROBE: do_rpl_probe(q); break;
      case Q_ENABLE_RPL_PARSE: do_enable_rpl_parse(q); break;
      case Q_DISABLE_RPL_PARSE: do_disable_rpl_parse(q); break;
      case Q_SOURCE: do_source(q); break;
      case Q_SLEEP: do_sleep(q); break;
      case Q_INC: do_inc(q); break;
+7 −0
Original line number Diff line number Diff line
@@ -54,3 +54,10 @@ extern const char *client_errors[]; /* Error messages */
#define CR_CANT_READ_CHARSET	2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION	2021
#define CR_PROBE_SLAVE_STATUS   2022
#define CR_PROBE_SLAVE_HOSTS    2023
#define CR_PROBE_SLAVE_CONNECT  2024
#define CR_PROBE_MASTER_CONNECT 2025


+35 −4
Original line number Diff line number Diff line
@@ -154,6 +154,14 @@ enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
		    MYSQL_STATUS_USE_RESULT};

/* there are three types of queries - the ones that have to go to
     the master, the ones that go to a slave, and the adminstrative
     type which must happen on the pivot connectioin
*/
enum mysql_rpl_type { MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE,
			      MYSQL_RPL_ADMIN };
  

typedef struct st_mysql {
  NET		net;			/* Communication parameters */
  gptr		connector_fd;		/* ConnectorFd for SSL */
@@ -183,7 +191,15 @@ typedef struct st_mysql {
  struct st_mysql* master, *next_slave;
  
  struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
  my_bool is_slave; /* will be false for a lone connection */
  struct st_mysql* last_used_con; /* needed for send/read/store/use
				      result to work
				      correctly with replication
				   */
  my_bool rpl_pivot; /* set if this is the original connection,
			not a master or a slave we have added though
			mysql_rpl_probe() or mysql_set_master()/
			mysql_add_slave()
		     */
} MYSQL;


@@ -261,9 +277,13 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
/* perform query on master */
int		STDCALL mysql_master_query(MYSQL *mysql, const char *q,
					unsigned int length);
int		STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
					unsigned int length);
/* perform query on slave */  
int		STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
					unsigned int length);
int		STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
					unsigned int length);

/* enable/disable parsing of all queries to decide
   if they go on master or slave */
@@ -278,11 +298,22 @@ void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */  
int             STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);

int             STDCALL mysql_query_goes_to_master(const char* q, int len);  
enum mysql_rpl_type     STDCALL mysql_rpl_query_type(const char* q, int len);  

/* discover the master and its slaves */  
int             STDCALL mysql_rpl_probe(MYSQL* mysql);
  
/* set the master, close/free the old one, if it is not a pivot */
int             STDCALL mysql_set_master(MYSQL* mysql, const char* host,
					   unsigned int port,
					   const char* user,
					   const char* passwd);
int             STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
					   unsigned int port,
					   const char* user,
					   const char* passwd);
  
  
int		STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int		STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
int		STDCALL mysql_shutdown(MYSQL *mysql);
+14 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
   MA 02111-1307, USA */

/* Error messages for MySQL clients */
/* error messages for the demon is in share/language/errmsg.sys */
/* error messages for the daemon is in share/language/errmsg.sys */

#include <global.h>
#include <my_sys.h>
@@ -47,6 +47,10 @@ const char *client_errors[]=
  "Can't initialize character set %-.64s (path: %-.64s)",
  "Got packet bigger than 'max_allowed_packet'",
  "Embedded server",
  "Error on SHOW SLAVE STATUS: %-.64s",
  "Error on SHOW SLAVE HOSTS: %-.64s",
  "Error connecting to slave: %-.64s",
  "Error connecting to master: %-.64s"
};

/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
@@ -76,6 +80,10 @@ const char *client_errors[]=
  "No pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)",
  "Obteve pacote maior do que 'max_allowed_packet'",
  "Embedded server"
  "Error on SHOW SLAVE STATUS: %-.64s",
  "Error on SHOW SLAVE HOSTS: %-.64s",
  "Error connecting to slave: %-.64s",
  "Error connecting to master: %-.64s"
};

#else /* ENGLISH */
@@ -102,7 +110,11 @@ const char *client_errors[]=
  "Can't set state of named pipe to host: %-.64s  pipe: %-.32s (%lu)",
  "Can't initialize character set %-.64s (path: %-.64s)",
  "Got packet bigger than 'max_allowed_packet'",
  "Embedded server"
  "Embedded server",
  "Error on SHOW SLAVE STATUS:",
  "Error on SHOW SLAVE HOSTS:",
  "Error connecting to slave:",
  "Error connecting to master:"
};
#endif

Loading