List:Commits« Previous MessageNext Message »
From:msvensson Date:November 26 2007 6:03pm
Subject:bk commit into 6.0 tree (msvensson:1.2655) BUG#31952
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-26 19:03:23+01:00, msvensson@stripped +4 -0
  Bug#31952 Remove undocumented mysql_rpl_* functions.
   - Functions removed + variables in st_mysql and st_mysql_options renamed
     to "unusedn".
   - Code updated to work without those functions and variables 

  include/mysql.h@stripped, 2007-11-26 19:03:21+01:00, msvensson@stripped +6 -84
    - Remove "enum mysql_rpl_type"
    - Remove variables used for mysql_rpl_* from 
       "struct st_mysql_options" and "struct st_mysql"
    - Remove function prototypes for
        mysql_enable_rpl_parse, mysql_disable_rpl_parse, mysql_rpl_parse_enabled,
        mysql_enable_reads_from_master, mysql_disable_reads_from_master,
        mysql_reads_from_master_enabled, mysql_rpl_query_type, mysql_rpl_probe,
        mysql_set_master and mysql_add_slave
    - Remove duplicate define of mysql_reload

  libmysql/libmysql.c@stripped, 2007-11-26 19:03:21+01:00, msvensson@stripped +7 -384
    - Remove exported functions
       mysql_master_query, mysql_master_send_query,
       mysql_slave_query, mysql_slave_send_query, 
       mysql_enable_rpl_parse, mysql_disable_rpl_parse, mysql_rpl_parse_enabled,
       mysq_enable_reads_from_master, mysql_disable_reads_from_master,
        mysql_reads_from_master_enabled,
       mysql_rpl_probe, mysql_rpl_query_type, mysql_set_master, mysql_add_slave 
    - Remove helper functions
       spawn_init, expand_error, get_master, get_slaves_from_master,
    - Update code to work without mysql->last_used_con

  sql-common/client.c@stripped, 2007-11-26 19:03:21+01:00, msvensson@stripped +10 -104
    - Remove the possibility for libmysql to read "replication-probe",
      "enable-reads-from-master" and "repl-parse-query" from my.cnf
    - Renumber values in switch after removal of the above from list of
      values to read
    - Update code to work without mysql->last_used_con, mysql->option.rpl*,
       mysql->master, mysql->last_used_slave, mysql->next_slave and any other
       variable removed from st_mysql and st_mysql_options
    - Remove all code scheduled marked with TO_BE_DELETED 

  storage/federated/ha_federated.cc@stripped, 2007-11-26 19:03:21+01:00, msvensson@stripped +1 -1
    - Read insert_id directly from mysql, there is no such thing as last_used_con.
      Preferrably all code accessing specific variable in MYSQL should use the accessor functions.  

diff -Nrup a/include/mysql.h b/include/mysql.h
--- a/include/mysql.h	2007-08-03 16:54:34 +02:00
+++ b/include/mysql.h	2007-11-26 19:03:21 +01:00
@@ -186,24 +186,10 @@ struct st_mysql_options {
   unsigned long max_allowed_packet;
   my_bool use_ssl;				/* if to use SSL or not */
   my_bool compress,named_pipe;
- /*
-   On connect, find out the replication role of the server, and
-   establish connections to all the peers
- */
-  my_bool rpl_probe;
- /*
-   Each call to mysql_real_query() will parse it to tell if it is a read
-   or a write, and direct it to the slave or the master
- */
-  my_bool rpl_parse;
- /*
-   If set, never read from a master, only from slave, when doing
-   a read that is replication-aware
- */
-  my_bool no_master_reads;
-#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
-  my_bool separate_thread;
-#endif
+  my_bool unused1;
+  my_bool unused2;
+  my_bool unused3;
+  my_bool unused4;
   enum mysql_option methods_to_use;
   char *client_ip;
   /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
@@ -230,15 +216,6 @@ enum mysql_protocol_type 
   MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
   MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
 };
-/*
-  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 character_set
 {
@@ -283,21 +260,8 @@ typedef struct st_mysql
 
   /* session-wide random string */
   char	        scramble[SCRAMBLE_LENGTH+1];
-
- /*
-   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()
- */
-  my_bool rpl_pivot;
-  /*
-    Pointers to the master, and the next slave connections, points to
-    itself if lone connection.
-  */
-  struct st_mysql* master, *next_slave;
-
-  struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
- /* needed for send/read/store/use result to work correctly with replication */
-  struct st_mysql* last_used_con;
+  my_bool unused1;
+  void *unused2, *unused3, *unused4, *unused5;
 
   LIST  *stmts;                     /* list of all statements */
   const struct st_mysql_methods *methods;
@@ -452,16 +416,6 @@ int		STDCALL mysql_real_query(MYSQL *mys
 MYSQL_RES *     STDCALL mysql_store_result(MYSQL *mysql);
 MYSQL_RES *     STDCALL mysql_use_result(MYSQL *mysql);
 
-/* perform query on master */
-my_bool		STDCALL mysql_master_query(MYSQL *mysql, const char *q,
-					   unsigned long length);
-my_bool		STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
-						unsigned long length);
-/* perform query on slave */  
-my_bool		STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
-					  unsigned long length);
-my_bool		STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
-					       unsigned long length);
 void        STDCALL mysql_get_character_set_info(MYSQL *mysql,
                            MY_CHARSET_INFO *charset);
 
@@ -483,37 +437,6 @@ mysql_set_local_infile_handler(MYSQL *my
 void
 mysql_set_local_infile_default(MYSQL *mysql);
 
-
-/*
-  enable/disable parsing of all queries to decide if they go on master or
-  slave
-*/
-void            STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
-void            STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
-/* get the value of the parse flag */  
-int             STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
-
-/*  enable/disable reads from master */
-void            STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
-void            STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
-/* get the value of the master read flag */  
-my_bool		STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
-
-enum mysql_rpl_type     STDCALL mysql_rpl_query_type(const char* q, int len);  
-
-/* discover the master and its slaves */  
-my_bool		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_shutdown(MYSQL *mysql,
                                        enum mysql_enum_shutdown_level
                                        shutdown_level);
@@ -850,7 +773,6 @@ MYSQL *		STDCALL mysql_connect(MYSQL *my
 				      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);
-#define	 mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
 #endif
 #define HAVE_MYSQL_REAL_CONNECT
 
diff -Nrup a/libmysql/libmysql.c b/libmysql/libmysql.c
--- a/libmysql/libmysql.c	2007-10-25 09:39:52 +02:00
+++ b/libmysql/libmysql.c	2007-11-26 19:03:21 +01:00
@@ -251,16 +251,6 @@ void STDCALL mysql_thread_end()
 #endif
 }
 
-/*
-  Let the user specify that we don't want SIGPIPE;  This doesn't however work
-  with threaded applications as we can have multiple read in progress.
-*/
-static MYSQL* spawn_init(MYSQL* parent, const char* host,
-			 unsigned int port,
-			 const char* user,
-			 const char* passwd);
-
-
 
 /*
   Expand wildcard to a sql string
@@ -322,7 +312,7 @@ mysql_debug(const char *debug __attribut
 
 
 /**************************************************************************
-  Close the server connection if we get a SIGPIPE
+  Ignore SIGPIPE handler
    ARGSUSED
 **************************************************************************/
 
@@ -335,305 +325,6 @@ my_pipe_sig_handler(int sig __attribute_
 #endif
 }
 
-/* perform query on master */
-my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
-				   unsigned long length)
-{
-  DBUG_ENTER("mysql_master_query");
-  if (mysql_master_send_query(mysql, q, length))
-    DBUG_RETURN(1);
-  DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
-}
-
-my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
-					unsigned long length)
-{
-  MYSQL *master = mysql->master;
-  DBUG_ENTER("mysql_master_send_query");
-  if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
-    DBUG_RETURN(1);
-  master->reconnect= 1;
-  mysql->last_used_con = master;
-  DBUG_RETURN(simple_command(master, COM_QUERY, (const uchar*) q, length, 1));
-}
-
-
-/* perform query on slave */
-my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
-				  unsigned long length)
-{
-  DBUG_ENTER("mysql_slave_query");
-  if (mysql_slave_send_query(mysql, q, length))
-    DBUG_RETURN(1);
-  DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
-}
-
-
-my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
-				   unsigned long length)
-{
-  MYSQL* last_used_slave, *slave_to_use = 0;
-  DBUG_ENTER("mysql_slave_send_query");
-
-  if ((last_used_slave = mysql->last_used_slave))
-    slave_to_use = last_used_slave->next_slave;
-  else
-    slave_to_use = mysql->next_slave;
-  /*
-    Next_slave is always safe to use - we have a circular list of slaves
-    if there are no slaves, mysql->next_slave == mysql
-  */
-  mysql->last_used_con = mysql->last_used_slave = slave_to_use;
-  if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
-						    0,0,0,0))
-    DBUG_RETURN(1);
-  slave_to_use->reconnect= 1;
-  DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, (const uchar*) q,
-                             length, 1));
-}
-
-
-/* enable/disable parsing of all queries to decide
-   if they go on master or slave */
-void STDCALL mysql_enable_rpl_parse(MYSQL* mysql)
-{
-  mysql->options.rpl_parse = 1;
-}
-
-void STDCALL mysql_disable_rpl_parse(MYSQL* mysql)
-{
-  mysql->options.rpl_parse = 0;
-}
-
-/* get the value of the parse flag */
-int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql)
-{
-  return mysql->options.rpl_parse;
-}
-
-/*  enable/disable reads from master */
-void STDCALL mysql_enable_reads_from_master(MYSQL* mysql)
-{
-  mysql->options.no_master_reads = 0;
-}
-
-void STDCALL mysql_disable_reads_from_master(MYSQL* mysql)
-{
-  mysql->options.no_master_reads = 1;
-}
-
-/* get the value of the master read flag */
-my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql)
-{
-  return !(mysql->options.no_master_reads);
-}
-
-
-/*
-  We may get an error while doing replication internals.
-  In this case, we add a special explanation to the original
-  error
-*/
-
-static void expand_error(MYSQL* mysql, int error)
-{
-  char tmp[MYSQL_ERRMSG_SIZE];
-  char *p;
-  uint err_length;
-  strmake(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE-1);
-  p = strmake(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE-1);
-  err_length= (uint) (p - mysql->net.last_error);
-  strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length);
-  mysql->net.last_errno = error;
-}
-
-/*
-  This function assumes we have just called SHOW SLAVE STATUS and have
-  read the given result and row
-*/
-
-static my_bool get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
-{
-  MYSQL* master;
-  DBUG_ENTER("get_master");
-  if (mysql_num_fields(res) < 3)
-    DBUG_RETURN(1); /* safety */
-
-  /* use the same username and password as the original connection */
-  if (!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0)))
-    DBUG_RETURN(1);
-  mysql->master = master;
-  DBUG_RETURN(0);
-}
-
-
-/*
-  Assuming we already know that mysql points to a master connection,
-  retrieve all the slaves
-*/
-
-static my_bool get_slaves_from_master(MYSQL* mysql)
-{
-  MYSQL_RES* res = 0;
-  MYSQL_ROW row;
-  my_bool error = 1;
-  int has_auth_info;
-  int port_ind;
-  DBUG_ENTER("get_slaves_from_master");
-
-  if (!mysql->net.vio && !mysql_real_connect(mysql,0,0,0,0,0,0,0))
-  {
-    expand_error(mysql, CR_PROBE_MASTER_CONNECT);
-    DBUG_RETURN(1);
-  }
-  mysql->reconnect= 1;
-
-  if (mysql_query(mysql, "SHOW SLAVE HOSTS") ||
-      !(res = mysql_store_result(mysql)))
-  {
-    expand_error(mysql, CR_PROBE_SLAVE_HOSTS);
-    DBUG_RETURN(1);
-  }
-
-  switch (mysql_num_fields(res)) {
-  case 5:
-    has_auth_info = 0;
-    port_ind=2;
-    break;
-  case 7:
-    has_auth_info = 1;
-    port_ind=4;
-    break;
-  default:
-    goto err;
-  }
-
-  while ((row = mysql_fetch_row(res)))
-  {
-    MYSQL* slave;
-    const char* tmp_user, *tmp_pass;
-
-    if (has_auth_info)
-    {
-      tmp_user = row[2];
-      tmp_pass = row[3];
-    }
-    else
-    {
-      tmp_user = mysql->user;
-      tmp_pass = mysql->passwd;
-    }
-
-    if (!(slave = spawn_init(mysql, row[1], atoi(row[port_ind]),
-			     tmp_user, tmp_pass)))
-      goto err;
-
-    /* Now add slave into the circular linked list */
-    slave->next_slave = mysql->next_slave;
-    mysql->next_slave = slave;
-  }
-  error = 0;
-err:
-  if (res)
-    mysql_free_result(res);
-  DBUG_RETURN(error);
-}
-
-
-my_bool STDCALL mysql_rpl_probe(MYSQL* mysql)
-{
-  MYSQL_RES *res= 0;
-  MYSQL_ROW row;
-  my_bool error= 1;
-  DBUG_ENTER("mysql_rpl_probe");
-
-  /*
-    First determine the replication role of the server we connected to
-    the most reliable way to do this is to run SHOW SLAVE STATUS and see
-    if we have a non-empty master host. This is still not fool-proof -
-    it is not a sin to have a master that has a dormant slave thread with
-    a non-empty master host. However, it is more reliable to check
-    for empty master than whether the slave thread is actually running
-  */
-  if (mysql_query(mysql, "SHOW SLAVE STATUS") ||
-      !(res = mysql_store_result(mysql)))
-  {
-    expand_error(mysql, CR_PROBE_SLAVE_STATUS);
-    DBUG_RETURN(1);
-  }
-
-  row= mysql_fetch_row(res);
-  /*
-    Check master host for emptiness/NULL
-    For MySQL 4.0 it's enough to check for row[0]
-  */
-  if (row && row[0] && *(row[0]))
-  {
-    /* this is a slave, ask it for the master */
-    if (get_master(mysql, res, row) || get_slaves_from_master(mysql))
-      goto err;
-  }
-  else
-  {
-    mysql->master = mysql;
-    if (get_slaves_from_master(mysql))
-      goto err;
-  }
-
-  error = 0;
-err:
-  if (res)
-    mysql_free_result(res);
-  DBUG_RETURN(error);
-}
-
-
-/*
-  Make a not so fool-proof decision on where the query should go, to
-  the master or the slave. Ideally the user should always make this
-  decision himself with mysql_master_query() or mysql_slave_query().
-  However, to be able to more easily port the old code, we support the
-  option of an educated guess - this should work for most applications,
-  however, it may make the wrong decision in some particular cases. If
-  that happens, the user would have to change the code to call
-  mysql_master_query() or mysql_slave_query() explicitly in the place
-  where we have made the wrong decision
-*/
-
-enum mysql_rpl_type
-STDCALL mysql_rpl_query_type(const char* q, int len)
-{
-  const char *q_end= q + len;
-  for (; q < q_end; ++q)
-  {
-    char c;
-    if (my_isalpha(&my_charset_latin1, (c= *q)))
-    {
-      switch (my_tolower(&my_charset_latin1,c)) {
-      case 'i':  /* insert */
-      case 'u':  /* update or unlock tables */
-      case 'l':  /* lock tables or load data infile */
-      case 'd':  /* drop or delete */
-      case 'a':  /* alter */
-	return MYSQL_RPL_MASTER;
-      case 'c':  /* create or check */
-	return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN :
-	  MYSQL_RPL_MASTER;
-      case 's': /* select or show */
-	return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN :
-	  MYSQL_RPL_SLAVE;
-      case 'f': /* flush */
-      case 'r': /* repair */
-      case 'g': /* grant */
-	return MYSQL_RPL_ADMIN;
-      default:
-	return MYSQL_RPL_SLAVE;
-      }
-    }
-  }
-  return MYSQL_RPL_MASTER;		/* By default, send to master */
-}
-
 
 /**************************************************************************
   Connect to sql server
@@ -1099,68 +790,6 @@ mysql_query(MYSQL *mysql, const char *qu
 }
 
 
-static MYSQL* spawn_init(MYSQL* parent, const char* host,
-			 unsigned int port, const char* user,
-			 const char* passwd)
-{
-  MYSQL* child;
-  DBUG_ENTER("spawn_init");
-  if (!(child= mysql_init(0)))
-    DBUG_RETURN(0);
-
-  child->options.user= my_strdup((user) ? user :
-				 (parent->user ? parent->user :
-				  parent->options.user), MYF(0));
-  child->options.password= my_strdup((passwd) ? passwd :
-				     (parent->passwd ?
-				      parent->passwd :
-				      parent->options.password), MYF(0));
-  child->options.port= port;
-  child->options.host= my_strdup((host) ? host :
-				 (parent->host ?
-				  parent->host :
-				  parent->options.host), MYF(0));
-  if (parent->db)
-    child->options.db= my_strdup(parent->db, MYF(0));
-  else if (parent->options.db)
-    child->options.db= my_strdup(parent->options.db, MYF(0));
-
-  /*
-    rpl_pivot is set to 1 in mysql_init();  Reset it as we are not doing
-    replication here
-  */
-  child->rpl_pivot= 0;
-  DBUG_RETURN(child);
-}
-
-
-int
-STDCALL mysql_set_master(MYSQL* mysql, const char* host,
-			 unsigned int port, const char* user,
-			 const char* passwd)
-{
-  if (mysql->master != mysql && !mysql->master->rpl_pivot)
-    mysql_close(mysql->master);
-  if (!(mysql->master = spawn_init(mysql, host, port, user, passwd)))
-    return 1;
-  return 0;
-}
-
-
-int
-STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
-			unsigned int port,
-			const char* user,
-			const char* passwd)
-{
-  MYSQL* slave;
-  if (!(slave = spawn_init(mysql, host, port, user, passwd)))
-    return 1;
-  slave->next_slave = mysql->next_slave;
-  mysql->next_slave = slave;
-  return 0;
-}
-
 /**************************************************************************
   Return next field of the query results
 **************************************************************************/
@@ -1491,17 +1120,17 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_t
 
 unsigned int STDCALL mysql_field_count(MYSQL *mysql)
 {
-  return mysql->last_used_con->field_count;
+  return mysql->field_count;
 }
 
 my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
 {
-  return mysql->last_used_con->affected_rows;
+  return mysql->affected_rows;
 }
 
 my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
 {
-  return mysql->last_used_con->insert_id;
+  return mysql->insert_id;
 }
 
 const char *STDCALL mysql_sqlstate(MYSQL *mysql)
@@ -1937,7 +1566,6 @@ my_bool cli_read_prepare_result(MYSQL *m
   MYSQL_DATA *fields_data;
   DBUG_ENTER("cli_read_prepare_result");
 
-  mysql= mysql->last_used_con;
   if ((packet_length= cli_safe_read(mysql)) == packet_error)
     DBUG_RETURN(1);
   mysql->warning_count= 0;
@@ -2174,7 +1802,7 @@ static unsigned int alloc_stmt_fields(MY
 {
   MYSQL_FIELD *fields, *field, *end;
   MEM_ROOT *alloc= &stmt->mem_root;
-  MYSQL *mysql= stmt->mysql->last_used_con;
+  MYSQL *mysql= stmt->mysql;
 
   stmt->field_count= mysql->field_count;
 
@@ -2541,7 +2169,6 @@ static my_bool execute(MYSQL_STMT *stmt,
   DBUG_ENTER("execute");
   DBUG_DUMP("packet", (uchar *) packet, length);
 
-  mysql->last_used_con= mysql;
   int4store(buff, stmt->stmt_id);		/* Send stmt id to server */
   buff[4]= (char) stmt->flags;
   int4store(buff+5, 1);                         /* iteration count */
@@ -4738,7 +4365,6 @@ int cli_read_binary_rows(MYSQL_STMT *stm
   }
 
   net = &mysql->net;
-  mysql= mysql->last_used_con;
 
   while ((pkt_len= cli_safe_read(mysql)) != packet_error)
   {
@@ -4829,8 +4455,6 @@ int STDCALL mysql_stmt_store_result(MYSQ
   MYSQL_DATA *result= &stmt->result;
   DBUG_ENTER("mysql_stmt_store_result");
 
-  mysql= mysql->last_used_con;
-
   if (!stmt->field_count)
     DBUG_RETURN(0);
 
@@ -5227,8 +4851,7 @@ my_bool STDCALL mysql_more_results(MYSQL
   my_bool res;
   DBUG_ENTER("mysql_more_results");
 
-  res= ((mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) ?
-	1: 0);
+  res= ((mysql->server_status & SERVER_MORE_RESULTS_EXISTS) ? 1: 0);
   DBUG_PRINT("exit",("More results exists ? %d", res));
   DBUG_RETURN(res);
 }
@@ -5254,7 +4877,7 @@ int STDCALL mysql_next_result(MYSQL *mys
   strmov(mysql->net.sqlstate, not_error_sqlstate);
   mysql->affected_rows= ~(my_ulonglong) 0;
 
-  if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
+  if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
     DBUG_RETURN((*mysql->methods->next_result)(mysql));
 
   DBUG_RETURN(-1);				/* No more results */
diff -Nrup a/sql-common/client.c b/sql-common/client.c
--- a/sql-common/client.c	2007-08-13 15:11:14 +02:00
+++ b/sql-common/client.c	2007-11-26 19:03:21 +01:00
@@ -939,7 +939,6 @@ static const char *default_options[]=
   "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
   "character-sets-dir", "default-character-set", "interactive-timeout",
   "connect-timeout", "local-infile", "disable-local-infile",
-  "replication-probe", "enable-reads-from-master", "repl-parse-query",
   "ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name",
   "multi-results", "multi-statements", "multi-queries", "secure-auth",
   "report-data-truncation",
@@ -1112,24 +1111,11 @@ void mysql_read_default_options(struct s
 	case 22:
 	  options->client_flag&= ~CLIENT_LOCAL_FILES;
           break;
-	case 23:  /* replication probe */
-#ifndef TO_BE_DELETED
-	  options->rpl_probe= 1;
-#endif
-	  break;
-	case 24: /* enable-reads-from-master */
-	  options->no_master_reads= 0;
-	  break;
-	case 25: /* repl-parse-query */
-#ifndef TO_BE_DELETED
-	  options->rpl_parse= 1;
-#endif
-	  break;
-	case 27:
+	case 24: /* max-allowed-packet */
           if (opt_arg)
 	    options->max_allowed_packet= atoi(opt_arg);
 	  break;
-        case 28:		/* protocol */
+        case 25: /* protocol */
           if ((options->protocol= find_type(opt_arg,
 					    &sql_protocol_typelib,0)) <= 0)
           {
@@ -1137,24 +1123,24 @@ void mysql_read_default_options(struct s
             exit(1);
           }
           break;
-        case 29:		/* shared_memory_base_name */
+        case 26: /* shared_memory_base_name */
 #ifdef HAVE_SMEM
           if (options->shared_memory_base_name != def_shared_memory_base_name)
             my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
           options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME));
 #endif
           break;
-	case 30:
+	case 27: /* multi-results */
 	  options->client_flag|= CLIENT_MULTI_RESULTS;
 	  break;
-	case 31:
-	case 32:
+	case 28: /* multi-statements */
+	case 29: /* multi-queries */
 	  options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
 	  break;
-        case 33: /* secure-auth */
+        case 30: /* secure-auth */
           options->secure_auth= TRUE;
           break;
-        case 34: /* report-data-truncation */
+        case 31: /* report-data-truncation */
           options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;
           break;
 	default:
@@ -1478,16 +1464,8 @@ mysql_init(MYSQL *mysql)
   else
     bzero((char*) (mysql), sizeof(*(mysql)));
   mysql->options.connect_timeout= CONNECT_TIMEOUT;
-  mysql->last_used_con= mysql->next_slave= mysql->master = mysql;
   mysql->charset=default_client_charset_info;
   strmov(mysql->net.sqlstate, not_error_sqlstate);
-  /*
-    By default, we are a replication pivot. The caller must reset it
-    after we return if this is not the case.
-  */
-#ifndef TO_BE_DELETED
-  mysql->rpl_pivot = 1;
-#endif
 
   /*
     Only enable LOAD DATA INFILE by default if configured with
@@ -2397,11 +2375,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
     mysql->reconnect=reconnect;
   }
 
-#ifndef TO_BE_DELETED
-  if (mysql->options.rpl_probe && mysql_rpl_probe(mysql))
-    goto error;
-#endif
-
   DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql));
   reset_sigpipe(mysql);
   DBUG_RETURN(mysql);
@@ -2421,28 +2394,6 @@ error:
 }
 
 
-/* needed when we move MYSQL structure to a different address */
-
-#ifndef TO_BE_DELETED
-static void mysql_fix_pointers(MYSQL* mysql, MYSQL* old_mysql)
-{
-  MYSQL *tmp, *tmp_prev;
-  if (mysql->master == old_mysql)
-    mysql->master= mysql;
-  if (mysql->last_used_con == old_mysql)
-    mysql->last_used_con= mysql;
-  if (mysql->last_used_slave == old_mysql)
-    mysql->last_used_slave= mysql;
-  for (tmp_prev = mysql, tmp = mysql->next_slave;
-       tmp != old_mysql;tmp = tmp->next_slave)
-  {
-    tmp_prev= tmp;
-  }
-  tmp_prev->next_slave= mysql;
-}
-#endif
-
-
 my_bool mysql_reconnect(MYSQL *mysql)
 {
   MYSQL tmp_mysql;
@@ -2461,8 +2412,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
   mysql_init(&tmp_mysql);
   tmp_mysql.options= mysql->options;
   tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0;
-  tmp_mysql.rpl_pivot= mysql->rpl_pivot;
-  
+
   if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
 			  mysql->db, mysql->port, mysql->unix_socket,
 			  mysql->client_flag | CLIENT_REMEMBER_OPTIONS))
@@ -2514,7 +2464,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
   mysql->free_me=0;
   mysql_close(mysql);
   *mysql=tmp_mysql;
-  mysql_fix_pointers(mysql, &tmp_mysql); /* adjust connection pointers */
   net_clear(&mysql->net, 1);
   mysql->affected_rows= ~(my_ulonglong) 0;
   DBUG_RETURN(0);
@@ -2652,23 +2601,6 @@ void STDCALL mysql_close(MYSQL *mysql)
     mysql_close_free_options(mysql);
     mysql_close_free(mysql);
     mysql_detach_stmt_list(&mysql->stmts, "mysql_close");
-#ifndef TO_BE_DELETED
-    /* free/close slave list */
-    if (mysql->rpl_pivot)
-    {
-      MYSQL* tmp;
-      for (tmp = mysql->next_slave; tmp != mysql; )
-      {
-	/* trick to avoid following freed pointer */
-	MYSQL* tmp1 = tmp->next_slave;
-	mysql_close(tmp);
-	tmp = tmp1;
-      }
-      mysql->rpl_pivot=0;
-    }
-#endif
-    if (mysql != mysql->master)
-      mysql_close(mysql->master);
 #ifndef MYSQL_SERVER
     if (mysql->thd)
       (*mysql->methods->free_embedded_thd)(mysql);
@@ -2688,12 +2620,6 @@ static my_bool cli_read_query_result(MYS
   ulong length;
   DBUG_ENTER("cli_read_query_result");
 
-  /*
-    Read from the connection which we actually used, which
-    could differ from the original connection if we have slaves
-  */
-  mysql = mysql->last_used_con;
-
   if ((length = cli_safe_read(mysql)) == packet_error)
     DBUG_RETURN(1);
   free_old_query(mysql);		/* Free old result */
@@ -2760,23 +2686,6 @@ int STDCALL
 mysql_send_query(MYSQL* mysql, const char* query, ulong length)
 {
   DBUG_ENTER("mysql_send_query");
-  DBUG_PRINT("enter",("rpl_parse: %d  rpl_pivot: %d",
-		      mysql->options.rpl_parse, mysql->rpl_pivot));
-#ifndef TO_BE_DELETED
-  if (mysql->options.rpl_parse && mysql->rpl_pivot)
-  {
-    switch (mysql_rpl_query_type(query, length)) {
-    case MYSQL_RPL_MASTER:
-      DBUG_RETURN(mysql_master_send_query(mysql, query, length));
-    case MYSQL_RPL_SLAVE:
-      DBUG_RETURN(mysql_slave_send_query(mysql, query, length));
-    case MYSQL_RPL_ADMIN:
-      break;					/* fall through */
-    }
-  }
-  mysql->last_used_con = mysql;
-#endif
-
   DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
 }
 
@@ -2803,8 +2712,7 @@ MYSQL_RES * STDCALL mysql_store_result(M
 {
   MYSQL_RES *result;
   DBUG_ENTER("mysql_store_result");
-  /* read from the actually used connection */
-  mysql = mysql->last_used_con;
+
   if (!mysql->fields)
     DBUG_RETURN(0);
   if (mysql->status != MYSQL_STATUS_GET_RESULT)
@@ -2858,8 +2766,6 @@ static MYSQL_RES * cli_use_result(MYSQL 
 {
   MYSQL_RES *result;
   DBUG_ENTER("cli_use_result");
-
-  mysql = mysql->last_used_con;
 
   if (!mysql->fields)
     DBUG_RETURN(0);
diff -Nrup a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
--- a/storage/federated/ha_federated.cc	2007-10-23 11:29:00 +02:00
+++ b/storage/federated/ha_federated.cc	2007-11-26 19:03:21 +01:00
@@ -2821,7 +2821,7 @@ int ha_federated::info(uint flag)
   }
 
   if (flag & HA_STATUS_AUTO)
-    stats.auto_increment_value= mysql->last_used_con->insert_id;
+    stats.auto_increment_value= mysql->insert_id;
 
   mysql_free_result(result);
 
Thread
bk commit into 6.0 tree (msvensson:1.2655) BUG#31952msvensson26 Nov