List:Internals« Previous MessageNext Message »
From:sasha Date:October 13 2001 3:28pm
Subject:bk commit into 4.0 tree
View as plain text  
Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-10-13 09:28:35-06:00, sasha@stripped
  64-bit portability fixes in network I/O
  use $MAX_TABLES mysqltest variable to make join test portable
  make test now works with the manager on IA64 Linux

  client/mysqltest.c
    1.66 01/10/13 09:28:34 sasha@stripped +3 -0
    added MAX_TABLES variable

  libmysql/libmysql.c
    1.77 01/10/13 09:28:34 sasha@stripped +5 -4
    portability fixes for 64-bit systems

  mysql-test/mysql-test-run.sh
    1.114 01/10/13 09:28:34 sasha@stripped +2 -2
    fixed bug - wrong values of -display in xterm in gdb mode

  mysql-test/r/join.result
    1.8 01/10/13 09:28:34 sasha@stripped +1 -1
    make test work on both 32-bit and 64-bit systems

  mysql-test/t/join.test
    1.6 01/10/13 09:28:34 sasha@stripped +1 -1
    make test work on both 32-bit and 64-bit systems

  sql/mini_client.cc
    1.32 01/10/13 09:28:34 sasha@stripped +10 -9
    64-bit portability fixes

  sql/mini_client.h
    1.9 01/10/13 09:28:34 sasha@stripped +1 -1
    64-bit portability fixes

  sql/slave.cc
    1.132 01/10/13 09:28:34 sasha@stripped +3 -3
    64-bit portability fixes

  tools/mysqlmanager.c
    1.21 01/10/13 09:28:34 sasha@stripped +54 -33
    64-bit portability fixes

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	sasha
# Host:	mysql.sashanet.com
# Root:	/home/sasha/src/bk/mysql-4.0

--- 1.76/libmysql/libmysql.c	Tue Oct  9 17:50:27 2001
+++ 1.77/libmysql/libmysql.c	Sat Oct 13 09:28:34 2001
@@ -905,7 +905,8 @@
 static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
 			     uint fields)
 {
-  uint	field,pkt_len;
+  uint	field;
+  ulong pkt_len;
   ulong len;
   uchar *cp;
   char	*to;
@@ -991,7 +992,7 @@
   ulong pkt_len,len;
   uchar *pos,*prev_pos;
 
-  if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
+  if ((pkt_len=net_safe_read(mysql)) == packet_error)
     return -1;
   if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
     return 1;				/* End of data */
@@ -1453,7 +1454,7 @@
   my_socket	sock;
   uint32	ip_addr;
   struct	sockaddr_in sock_addr;
-  uint		pkt_length;
+  ulong		pkt_length;
   NET		*net= &mysql->net;
 #ifdef __WIN__
   HANDLE	hPipe=INVALID_HANDLE_VALUE;
@@ -2135,7 +2136,7 @@
   uchar *pos;
   ulong field_count;
   MYSQL_DATA *fields;
-  uint length;
+  ulong length;
   DBUG_ENTER("mysql_read_query_result");
 
   /* read from the connection which we actually used, which

--- 1.113/mysql-test/mysql-test-run.sh	Fri Oct 12 09:37:24 2001
+++ 1.114/mysql-test/mysql-test-run.sh	Sat Oct 13 09:28:34 2001
@@ -674,8 +674,8 @@
     elif [ x$DO_GDB = x1 ]
     then
       $ECHO "set args $master_args" > $GDB_MASTER_INIT
-      manager_launch master $XTERM -display :0 -title "Master" -e gdb -x \
-       $GDB_MASTER_INIT $MYSQLD 
+      manager_launch master $XTERM -display $DISPLAY \
+      -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD 
     else	    
       manager_launch master $MYSQLD $master_args  
     fi  

--- 1.31/sql/mini_client.cc	Sat Sep 29 20:46:19 2001
+++ 1.32/sql/mini_client.cc	Sat Oct 13 09:28:34 2001
@@ -351,11 +351,11 @@
 ** or packet is an error message
 *****************************************************************************/
 
-uint STDCALL
+ulong STDCALL
 mc_net_safe_read(MYSQL *mysql)
 {
   NET *net= &mysql->net;
-  uint len=0;
+  ulong len=0;
 
   if (net->vio != 0)
     len=my_net_read(net);
@@ -514,7 +514,7 @@
   my_socket	sock;
   ulong		ip_addr;
   struct	sockaddr_in sock_addr;
-  uint		pkt_length;
+  ulong		pkt_length;
   NET		*net= &mysql->net;
   thr_alarm_t   alarmed;
   ALARM alarm_buff;
@@ -921,8 +921,8 @@
       DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
       for (;;)
       {
-	uint pkt_len;
-	if ((pkt_len=(uint) mc_net_safe_read(result->handle)) == packet_error)
+	ulong pkt_len;
+	if ((pkt_len=mc_net_safe_read(result->handle)) == packet_error)
 	  break;
 	if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
 	  break;				/* End of data */
@@ -999,7 +999,7 @@
   uchar *pos;
   ulong field_count;
   MYSQL_DATA *fields;
-  uint length;
+  ulong length;
   DBUG_ENTER("mc_mysql_read_query_result");
 
   if ((length = mc_net_safe_read(mysql)) == packet_error)
@@ -1174,7 +1174,8 @@
 static MYSQL_DATA *mc_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
 			     uint fields)
 {
-  uint	field,pkt_len;
+  uint	field;
+  ulong pkt_len;
   ulong len;
   uchar *cp;
   char	*to;
@@ -1183,7 +1184,7 @@
   NET *net = &mysql->net;
   DBUG_ENTER("mc_read_rows");
 
-  if ((pkt_len=(uint) mc_net_safe_read(mysql)) == packet_error)
+  if ((pkt_len=mc_net_safe_read(mysql)) == packet_error)
     DBUG_RETURN(0);
   if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
 				       MYF(MY_WME | MY_ZEROFILL))))
@@ -1260,7 +1261,7 @@
   ulong pkt_len,len;
   uchar *pos,*prev_pos;
 
-  if ((pkt_len=(uint) mc_net_safe_read(mysql)) == packet_error)
+  if ((pkt_len=mc_net_safe_read(mysql)) == packet_error)
     return -1;
   if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
     return 1;				/* End of data */

--- 1.8/sql/mini_client.h	Mon May 28 19:18:22 2001
+++ 1.9/sql/mini_client.h	Sat Oct 13 09:28:34 2001
@@ -35,7 +35,7 @@
 void STDCALL
 mc_mysql_debug(const char *debug);
 
-uint STDCALL
+ulong STDCALL
 mc_net_safe_read(MYSQL *mysql);
 
 char * STDCALL mc_mysql_error(MYSQL *mysql);

--- 1.131/sql/slave.cc	Thu Oct 11 13:54:05 2001
+++ 1.132/sql/slave.cc	Sat Oct 13 09:28:34 2001
@@ -335,7 +335,7 @@
 static int create_table_from_dump(THD* thd, NET* net, const char* db,
 				  const char* table_name)
 {
-  uint packet_len = my_net_read(net); // read create table statement
+  ulong packet_len = my_net_read(net); // read create table statement
   Vio* save_vio;
   HA_CHECK_OPT check_opt;
   TABLE_LIST tables;
@@ -870,7 +870,7 @@
 
 static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
 {
-  uint len = packet_error;
+  ulong len = packet_error;
   // for convinience lets think we start by
   // being in the interrupted state :-)
   int read_errno = EINTR;
@@ -890,7 +890,7 @@
   }
   if (abort_loop || abort_slave)
     return packet_error;
-  if (len == packet_error || (int) len < 1)
+  if (len == packet_error || (long) len < 1)
   {
     sql_print_error("Error reading packet from server: %s (read_errno %d,\
 server_errno=%d)",

--- 1.7/mysql-test/r/join.result	Wed Oct 10 18:59:44 2001
+++ 1.8/mysql-test/r/join.result	Sat Oct 13 09:28:34 2001
@@ -89,7 +89,7 @@
 1
 2
 select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join !
 t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
-Too many tables. MySQL can only use 31 tables in a join
+Too many tables. MySQL can only use $MAX_TABLES tables in a join
 drop table t1;
 CREATE TABLE t1 (
 a int(11) NOT NULL,

--- 1.5/mysql-test/t/join.test	Wed Oct 10 18:59:42 2001
+++ 1.6/mysql-test/t/join.test	Sat Oct 13 09:28:34 2001
@@ -1,7 +1,7 @@
 #
 # This failed for lia Perminov
 #
-
+eval_result; # because MAX_TABLES is different on 64-bit system
 drop table if exists t1,t2;
 create table t1 (id int primary key);
 create table t2 (id int);

--- 1.65/client/mysqltest.c	Thu Oct 11 13:54:04 2001
+++ 1.66/client/mysqltest.c	Sat Oct 13 09:28:34 2001
@@ -2158,12 +2158,15 @@
 
 static void init_var_hash()
 {
+  VAR* v;
   if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0)))
     die("Variable hash initialization failed");
   var_from_env("MASTER_MYPORT", "9306");
   var_from_env("SLAVE_MYPORT", "9307");
   var_from_env("MYSQL_TEST_DIR", "/tmp");
   var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
+  v=var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "63",0);
+  hash_insert(&var_hash, (byte*)v);
 }
 
 

--- 1.20/tools/mysqlmanager.c	Fri Oct 12 09:37:24 2001
+++ 1.21/tools/mysqlmanager.c	Sat Oct 13 09:28:34 2001
@@ -291,9 +291,9 @@
 static void print_time(FILE* fp);
 static void clean_up();
 static struct manager_cmd* lookup_cmd(char* s,int len);
-static void client_msg(NET* net,int err_code,const char* fmt,...);
-static void client_msg_pre(NET* net,int err_code,const char* fmt,...);
-static void client_msg_raw(NET* net,int err_code,int pre,const char* fmt,
+static int client_msg(NET* net,int err_code,const char* fmt,...);
+static int client_msg_pre(NET* net,int err_code,const char* fmt,...);
+static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt,
 			    va_list args);
 static int authenticate(struct manager_thd* thd);
 static char* read_line(struct manager_thd* thd); /* returns pointer to end of
@@ -307,6 +307,27 @@
 void print_stacktrace();
 #endif
 
+static void log_msg(const char* fmt, int msg_type, va_list args);
+
+/* No 'inline' here becasue functions with ... can't do that portable */
+#define LOG_MSG_FUNC(type,TYPE) static void type  \
+ (const char* fmt,...) { \
+  va_list args; \
+  va_start(args,fmt); \
+  log_msg(fmt,TYPE,args);\
+ }
+
+LOG_MSG_FUNC(log_err,LOG_ERR)
+LOG_MSG_FUNC(log_warn,LOG_WARN)
+LOG_MSG_FUNC(log_info,LOG_INFO)
+
+#ifndef DBUG_OFF
+LOG_MSG_FUNC(log_debug,LOG_DEBUG)
+#else
+void log_debug(const char* __attribute__((unused)) fmt,...) {}
+#endif
+
+
 static void handle_segfault(int sig)
 {
   if (in_segfault)
@@ -369,11 +390,13 @@
   struct manager_cmd* cmd;
   for (;p<buf_end && !isspace(*p);p++)
     *p=tolower(*p);
+  log_info("Command '%s'", buf);
   if (!(cmd=lookup_cmd(buf,(int)(p-buf))))
   {
-    client_msg(&thd->net,MANAGER_CLIENT_ERR,
-	       "Unrecognized command, type help to see list of supported\
- commands");
+    if(client_msg(&thd->net,MANAGER_CLIENT_ERR,
+	       "Unrecognized command '%s', type help to see list of supported\
+ commands", buf))
+      thd->fatal=1;
     return 1;
   }
   for (;p<buf_end && isspace(*p);p++);
@@ -1025,24 +1048,6 @@
   pthread_mutex_unlock(&lock_log);
 }
 
-/* No 'inline' here becasue functions with ... can't do that portable */
-#define LOG_MSG_FUNC(type,TYPE) static void type  \
- (const char* fmt,...) { \
-  va_list args; \
-  va_start(args,fmt); \
-  log_msg(fmt,TYPE,args);\
- }
-
-LOG_MSG_FUNC(log_err,LOG_ERR)
-LOG_MSG_FUNC(log_warn,LOG_WARN)
-LOG_MSG_FUNC(log_info,LOG_INFO)
-
-#ifndef DBUG_OFF
-LOG_MSG_FUNC(log_debug,LOG_DEBUG)
-#else
-void log_debug(const char* __attribute__((unused)) fmt,...) {}
-#endif
-
 static pthread_handler_decl(process_launcher_messages,
 			    __attribute__((unused)) arg)
 {
@@ -1121,7 +1126,7 @@
   return 0;					/* Don't get cc warning */
 }
 
-static void client_msg_raw(NET* net, int err_code, int pre, const char* fmt,
+static int client_msg_raw(NET* net, int err_code, int pre, const char* fmt,
 			   va_list args)
 {
   char buf[MAX_CLIENT_MSG_LEN],*p,*buf_end;
@@ -1136,29 +1141,36 @@
     p=buf_end - 2;
   *p++='\r';
   *p++='\n';
+  
   if (my_net_write(net,buf,(uint)(p-buf)) || net_flush(net))
-    log_err("Failed writing to client: errno=%d",net->last_errno);
+  {
+    p[-2]=0;
+    log_err("Failed writing '%s' to client: errno=%d",buf,errno);
+    net_end(net);
+    return 1;
+  }
+  return 0;
 }
 
-static void client_msg(NET* net, int err_code, const char* fmt, ...)
+static int client_msg(NET* net, int err_code, const char* fmt, ...)
 {
   va_list args;
   va_start(args,fmt);
-  client_msg_raw(net,err_code,0,fmt,args);
+  return client_msg_raw(net,err_code,0,fmt,args);
 }
 
-static void client_msg_pre(NET* net, int err_code, const char* fmt, ...)
+static int client_msg_pre(NET* net, int err_code, const char* fmt, ...)
 {
   va_list args;
   va_start(args,fmt);
-  client_msg_raw(net,err_code,1,fmt,args);
+  return client_msg_raw(net,err_code,1,fmt,args);
 }
 
 static char* read_line(struct manager_thd* thd)
 {
-  uint len;
+  int len;
   char* p, *buf_end;
-  if ((len=my_net_read(&thd->net)) == packet_error)
+  if ((len=my_net_read(&thd->net)) == (int)packet_error || !len)
     {
       log_err("Error reading command from client (Error: %d)",
 	      errno);
@@ -1212,6 +1224,12 @@
 
 static void manager_thd_free(struct manager_thd* thd)
 {
+  NET* net=&thd->net;
+  if (net->vio)
+  {
+    vio_delete(net->vio);
+    net->vio=0;
+  }
   net_end(&thd->net);
 }
 
@@ -1379,15 +1397,18 @@
       vio_close(vio);
       continue;
     }
-    
     if (authenticate(thd))
     {
       client_msg(&thd->net,MANAGER_ACCESS, "Access denied");
       manager_thd_free(thd);
+      log_info("Client failed to authenticate");
       continue;
     }
     if (shutdown_requested)
+    {
+      manager_thd_free(thd);
       break;
+    }
     if (one_thread)
     {
       process_connection((void*)thd);
Thread
bk commit into 4.0 treesasha13 Oct
  • Re: Seriously Disruptive DBA Jonathan G. Lampe24 Aug