List:Commits« Previous MessageNext Message »
From:monty Date:August 1 2007 9:59pm
Subject:bk commit into 5.1 tree (monty:1.2557) BUG#30127
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of monty. When monty 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-08-01 22:59:05+03:00, monty@stripped +24 -0
  Fixes Bug#30127: --debug-info no longer prints memory usage in mysql
  Fixed compiler warnings, errors and link errors
  Fixed new bug on Solaris with gethrtime()
  Added --debug-check option to all mysql clients to print errors and memory leaks
  Added --debug-info to all clients. This now works as --debug-check but also prints
memory and cpu usage

  BUILD/compile-solaris-sparc-debug@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +1 -1
    Remove old cpu options

  client/client_priv.h@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +2 -2
    Added OPT_DBUG_CHECK

  client/mysql.cc@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +16 -7
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysql_upgrade.c@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +23 -10
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqladmin.cc@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +17 -6
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqlbinlog.cc@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +16 -7
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqlcheck.c@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +15 -6
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqldump.c@stripped, 2007-08-01 22:58:59+03:00, monty@stripped +16 -7
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqlimport.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +14 -6
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqlshow.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +15 -5
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqlslap.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +15 -7
    --debug-info now prints memory usage 
    Added --debug-check

  client/mysqltest.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +15 -4
    --debug-info now prints memory usage 
    Added --debug-check

  include/my_sys.h@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +2 -2
    Added extra option to TERMINATE to not print statistics

  libmysql/libmysql.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +1 -1
    Fixed compiler warning

  mysql-test/mysql-test-run.pl@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +6 -6
    --debug-info -> --debug-check to not print memory usage

  mysys/my_getsystime.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +40 -28
    Moved fast time calculation to my_micro_time_and_time()
    Fixed bug in previous push related to HAVE_GETHRTIME

  mysys/my_init.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +8 -3
    Print not freed memory in my_end() if MY_CHECK_ERROR is given

  mysys/my_static.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +0 -2
    Cleanup

  mysys/safemalloc.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +10 -8
    Added extra option to TERMINATE to not print statistics

  sql/item_xmlfunc.cc@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +2 -2
    Fixed compiler warning

  sql/sql_test.cc@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +1 -1
    Fixed TERMINATE() call

  unittest/mysys/base64-t.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +2 -0
    Fixed link error

  unittest/mysys/bitmap-t.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +5 -4
    Fixed link error

  unittest/mysys/my_atomic-t.c@stripped, 2007-08-01 22:59:00+03:00, monty@stripped +2 -1
    Fixed link error

diff -Nrup a/BUILD/compile-solaris-sparc-debug b/BUILD/compile-solaris-sparc-debug
--- a/BUILD/compile-solaris-sparc-debug	2007-02-23 13:13:46 +02:00
+++ b/BUILD/compile-solaris-sparc-debug	2007-08-01 22:58:59 +03:00
@@ -6,6 +6,6 @@ make -k clean || true
 path=`dirname $0`
 . "$path/autorun.sh"
  
-CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts
-Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused  -O3
-fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit
-Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat
-Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder
-Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti 
-O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure
--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex
--enable-thread-safe-client --with-debug
+CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts
-Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused  -O3
-fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch
-Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare
-Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy
-Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti  -O3
-fno-omit-frame-pointer" ./configure --prefix=/usr/local/mysql --enable-assembler
--with-extra-charsets=complex --enable-thread-safe-client --with-debug
 
 make -j 4
diff -Nrup a/client/client_priv.h b/client/client_priv.h
--- a/client/client_priv.h	2007-04-19 05:47:49 +03:00
+++ b/client/client_priv.h	2007-08-01 22:58:59 +03:00
@@ -75,6 +75,6 @@ enum options_client
   OPT_SLAP_POST_QUERY,
   OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
   OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
-  OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG,
-  OPT_MAX_CLIENT_OPTION
+  OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
+  OPT_WRITE_BINLOG, OPT_MAX_CLIENT_OPTION
 };
diff -Nrup a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc	2007-07-11 12:40:24 +03:00
+++ b/client/mysql.cc	2007-08-01 22:58:59 +03:00
@@ -43,7 +43,7 @@
 #include <locale.h>
 #endif
 
-const char *VER= "14.13";
+const char *VER= "14.14";
 
 /* Don't try to make a nice table if the data is too big */
 #define MAX_COLUMN_LENGTH	     1024
@@ -129,7 +129,7 @@ enum enum_info_type { INFO_INFO,INFO_ERR
 typedef enum enum_info_type INFO_TYPE;
 
 static MYSQL mysql;			/* The connection */
-static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
+static my_bool ignore_errors=0,wait_flag=0,quick=0,
                connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
 	       opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
 	       opt_compress=0, using_opt_local_infile=0,
@@ -139,9 +139,11 @@ static my_bool info_flag=0,ignore_errors
 	       default_charset_used= 0, opt_secure_auth= 0,
                default_pager_set= 0, opt_sigint_ignore= 0,
                show_warnings= 0, executing_query= 0, interrupted_query= 0;
+static my_bool debug_info_flag, debug_check_flag;
 static my_bool column_types_flag;
 static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
+static uint my_end_arg;
 static char * opt_mysql_unix_port=0;
 static int connect_flag=CLIENT_INTERACTIVE;
 static char *current_host,*current_db,*current_user=0,*opt_password=0,
@@ -541,7 +543,7 @@ sig_handler mysql_end(int sig)
   my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
   mysql_server_end();
   free_defaults(defaults_argv);
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
   exit(status.exit_status);
 }
 
@@ -611,8 +613,11 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"database", 'D', "Database to use.", (uchar**) &current_db,
    (uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
@@ -927,7 +932,7 @@ get_one_option(int optid, const struct m
     break;
   case '#':
     DBUG_PUSH(argument ? argument : default_dbug_option);
-    info_flag= 1;
+    debug_info_flag= 1;
     break;
   case 's':
     if (argument == disabled_my_option)
@@ -1021,6 +1026,10 @@ static int get_options(int argc, char **
   }
   if (tty_password)
     opt_password= get_tty_password(NullS);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return(0);
 }
 
@@ -3288,7 +3297,7 @@ sql_real_connect(char *host,char *databa
   }
   connected=1;
 #ifndef EMBEDDED_LIBRARY
-  mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens
+  mysql.reconnect= debug_info_flag; // We want to know if this happens
 #else
   mysql.reconnect= 1;
 #endif
diff -Nrup a/client/mysql_upgrade.c b/client/mysql_upgrade.c
--- a/client/mysql_upgrade.c	2007-05-10 12:59:20 +03:00
+++ b/client/mysql_upgrade.c	2007-08-01 22:58:59 +03:00
@@ -17,6 +17,8 @@
 #include <sslopt-vars.h>
 #include "../scripts/mysql_fix_privilege_tables_sql.c"
 
+#define VER "1.1"
+
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
@@ -32,7 +34,8 @@
 static char mysql_path[FN_REFLEN];
 static char mysqlcheck_path[FN_REFLEN];
 
-static my_bool opt_force, opt_verbose;
+static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag;
+static uint my_end_arg= 0;
 static char *opt_user= (char*)"root";
 
 static DYNAMIC_STRING ds_args;
@@ -56,6 +59,11 @@ static struct my_option my_long_options[
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"basedir", 'b', "Not used by mysql_upgrade. Only for backward compatibilty",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"character-sets-dir", OPT_CHARSETS_DIR,
+   "Directory where character sets are.", 0,
+   0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
+   (uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
   {"datadir", 'd',
    "Not used by mysql_upgrade. Only for backward compatibilty",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -66,14 +74,14 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar* *) & default_dbug_option,
    (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory where character sets are.", 0,
-   0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
-   (uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
   {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
    "has already been executed for the current version of MySQL.",
    (uchar**)&opt_force, (uchar**)&opt_force, 0,
@@ -138,7 +146,7 @@ static void die(const char *fmt, ...)
   va_end(args);
 
   free_used_memory();
-  my_end(MY_CHECK_ERROR);
+  my_end(my_end_arg);
   exit(1);
 }
 
@@ -200,8 +208,9 @@ get_one_option(int optid, const struct m
   switch (optid) {
 
   case '?':
-    printf("MySQL utility for upgrading database to MySQL version %s\n",
-           MYSQL_SERVER_VERSION);
+    printf("%s  Ver %s Distrib %s, for %s (%s)\n",
+           my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+    puts("MySQL utility for upgrading databases to new MySQL versions\n");
     my_print_help(my_long_options);
     exit(0);
     break;
@@ -732,6 +741,10 @@ int main(int argc, char **argv)
 
   if (handle_options(&argc, &argv, my_long_options, get_one_option))
     die(NULL);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (tty_password)
   {
@@ -780,7 +793,7 @@ int main(int argc, char **argv)
   create_mysql_upgrade_info_file();
 
   free_used_memory();
-  my_end(MY_CHECK_ERROR);
+  my_end(my_end_arg);
   exit(0);
 }
 
diff -Nrup a/client/mysqladmin.cc b/client/mysqladmin.cc
--- a/client/mysqladmin.cc	2007-05-10 12:59:20 +03:00
+++ b/client/mysqladmin.cc	2007-08-01 22:58:59 +03:00
@@ -40,9 +40,10 @@ ulonglong last_values[MAX_MYSQL_VAR];
 static int interval=0;
 static my_bool option_force=0,interrupted=0,new_line=0,
                opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
-               tty_password= 0, info_flag= 0, opt_nobeep;
-static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
-            opt_count_iterations= 0;
+               tty_password= 0, opt_nobeep;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
+static uint opt_count_iterations= 0, my_end_arg;
 static ulong opt_connect_timeout, opt_shutdown_timeout;
 static char * unix_port=0;
 #ifdef LATER_HAVE_NDBCLUSTER_DB
@@ -134,10 +135,16 @@ static struct my_option my_long_options[
    "Number of iterations to make. This works with -i (--sleep) only.",
    (uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef DBUG_OFF
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f',
    "Don't ask for confirmation on drop database; with multiple commands, continue even if
an error occurs.",
    (uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -315,6 +322,10 @@ int main(int argc,char *argv[])
     free_defaults(save_argv);
     exit(ho_error);
   }
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (argc == 0)
   {
@@ -413,7 +424,7 @@ int main(int argc,char *argv[])
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(save_argv);
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
   exit(error ? 1 : 0);
   return 0;
 }
diff -Nrup a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
--- a/client/mysqlbinlog.cc	2007-06-01 10:43:50 +03:00
+++ b/client/mysqlbinlog.cc	2007-08-01 22:58:59 +03:00
@@ -65,11 +65,13 @@ static bool one_database=0, to_last_remo
 static bool opt_hexdump= 0;
 static bool opt_base64_output= 0;
 static const char* database= 0;
-static my_bool force_opt= 0, short_form= 0, remote_opt= 0, info_flag;
+static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
+static my_bool debug_info_flag, debug_check_flag;
 static my_bool force_if_open_opt= 1;
 static ulonglong offset = 0;
 static const char* host = 0;
 static int port= 0;
+static uint my_end_arg;
 static const char* sock= 0;
 static const char* user = 0;
 static char* pass = 0;
@@ -727,8 +729,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
     "enabled --to-last-log and are sending the output to the same MySQL server. "
     "This way you could avoid an endless loop. You would also like to use it "
@@ -860,7 +866,7 @@ static void die(const char* fmt, ...)
   va_end(args);
   cleanup();
   /* We cannot free DBUG, it is used in global destructors after exit(). */
-  my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
+  my_end(my_end_arg | MY_DONT_FREE_DBUG);
   exit(1);
 }
 
@@ -868,7 +874,7 @@ static void die(const char* fmt, ...)
 
 static void print_version()
 {
-  printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+  printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
   NETWARE_SET_SCREEN_MODE(1);
 }
 
@@ -984,7 +990,10 @@ static int parse_args(int *argc, char***
   load_defaults("my",load_default_groups,argc,argv);
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
-
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return 0;
 }
 
@@ -1597,7 +1606,7 @@ int main(int argc, char** argv)
   my_free_open_file_info();
   load_processor.destroy();
   /* We cannot free DBUG, it is used in global destructors after exit(). */
-  my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
+  my_end(my_end_arg | MY_DONT_FREE_DBUG);
 
   if (file_not_closed_error)
   {
diff -Nrup a/client/mysqlcheck.c b/client/mysqlcheck.c
--- a/client/mysqlcheck.c	2007-05-10 12:59:20 +03:00
+++ b/client/mysqlcheck.c	2007-08-01 22:58:59 +03:00
@@ -15,7 +15,7 @@
 
 /* By Jani Tolonen, 2001-04-20, MySQL Development Team */
 
-#define CHECK_VERSION "2.4.5"
+#define CHECK_VERSION "2.5.0"
 
 #include "client_priv.h"
 #include <m_ctype.h>
@@ -33,10 +33,11 @@ static my_bool opt_alldbs = 0, opt_check
                opt_compress = 0, opt_databases = 0, opt_fast = 0,
                opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
                opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
-               tty_password= 0, opt_frm= 0, info_flag= 0, 
+               tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0,
                opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
                opt_write_binlog= 1;
 static uint verbose = 0, opt_mysql_port=0;
+static int my_end_arg;
 static char * opt_mysql_unix_port = 0;
 static char *opt_password = 0, *current_user = 0, 
 	    *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
@@ -96,8 +97,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", (uchar**) &default_charset,
    (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -375,6 +380,10 @@ static int get_options(int *argc, char *
   }
   if (tty_password)
     opt_password = get_tty_password(NullS);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return(0);
 } /* get_options */
 
@@ -762,7 +771,7 @@ int main(int argc, char **argv)
   */
   if (get_options(&argc, &argv))
   {
-    my_end(info_flag ? MY_CHECK_ERROR : 0);
+    my_end(my_end_arg);
     exit(EX_USAGE);
   }
   if (dbConnect(current_host, current_user, opt_password))
@@ -804,6 +813,6 @@ int main(int argc, char **argv)
 #ifdef HAVE_SMEM
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
   return(first_error!=0);
 } /* main */
diff -Nrup a/client/mysqldump.c b/client/mysqldump.c
--- a/client/mysqldump.c	2007-07-19 18:01:07 +03:00
+++ b/client/mysqldump.c	2007-08-01 22:58:59 +03:00
@@ -36,7 +36,7 @@
 ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
 */
 
-#define DUMP_VERSION "10.12"
+#define DUMP_VERSION "10.13"
 
 #include <my_global.h>
 #include <my_sys.h>
@@ -100,9 +100,9 @@ static my_bool  verbose= 0, opt_no_creat
                 opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
                 opt_events= 0,
                 opt_alltspcs=0, opt_notspcs= 0;
+static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
 static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static MYSQL mysql_connection,*mysql=0;
-static my_bool insert_pat_inited= 0, info_flag;
 static DYNAMIC_STRING insert_pat;
 static char  *opt_password=0,*current_user=0,
              *current_host=0,*path=0,*fields_terminated=0,
@@ -116,7 +116,8 @@ static char compatible_mode_normal_str[2
 static ulong opt_compatible_mode= 0;
 #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
-static uint     opt_mysql_port= 0, opt_master_data;
+static uint opt_mysql_port= 0, opt_master_data;
+static uint my_end_arg;
 static char * opt_mysql_unix_port=0;
 static int   first_error=0;
 static DYNAMIC_STRING extended_row;
@@ -242,8 +243,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", (uchar**) &default_charset,
    (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -724,7 +729,7 @@ get_one_option(int optid, const struct m
     break;
   case '#':
     DBUG_PUSH(argument ? argument : default_dbug_option);
-    info_flag= 1;
+    debug_info_flag= 1;
     break;
 #include <sslopt-case.h>
   case 'V': print_version(); exit(0);
@@ -858,6 +863,10 @@ static int get_options(int *argc, char *
 
   *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
   *mysql_params->p_net_buffer_length= opt_net_buffer_length;
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (opt_delayed)
     opt_lock=0;                         /* Can't have lock with delayed */
@@ -1262,7 +1271,7 @@ static void free_resources()
     dynstr_free(&insert_pat);
   if (defaults_argv)
     free_defaults(defaults_argv);
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
 }
 
 
diff -Nrup a/client/mysqlimport.c b/client/mysqlimport.c
--- a/client/mysqlimport.c	2007-05-10 12:59:20 +03:00
+++ b/client/mysqlimport.c	2007-08-01 22:59:00 +03:00
@@ -24,7 +24,7 @@
 **			   *			   *
 **			   *************************
 */
-#define IMPORT_VERSION "3.6"
+#define IMPORT_VERSION "3.7"
 
 #include "client_priv.h"
 #include "mysql_version.h"
@@ -49,8 +49,8 @@ static char *add_load_option(char *ptr,c
 static my_bool	verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
 		replace=0,silent=0,ignore=0,opt_compress=0,
                 opt_low_priority= 0, tty_password= 0;
-static my_bool info_flag= 0;
-static uint opt_use_threads=0, opt_local_file=0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0;
 static char	*opt_password=0, *current_user=0,
 		*current_host=0, *current_db=0, *fields_terminated=0,
 		*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
@@ -87,8 +87,12 @@ static struct my_option my_long_options[
    0, 0, 0},
   {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
    GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
    (uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-terminated-by", OPT_FTB,
@@ -254,6 +258,10 @@ static int get_options(int *argc, char *
 
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (enclosed && opt_enclosed)
   {
@@ -659,6 +667,6 @@ int main(int argc, char **argv)
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(argv_to_free);
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
   return(exitcode);
 }
diff -Nrup a/client/mysqlshow.c b/client/mysqlshow.c
--- a/client/mysqlshow.c	2007-05-10 12:59:20 +03:00
+++ b/client/mysqlshow.c	2007-08-01 22:59:00 +03:00
@@ -15,7 +15,7 @@
 
 /* Show databases, tables or columns */
 
-#define SHOW_VERSION "9.6"
+#define SHOW_VERSION "9.10"
 
 #include "client_priv.h"
 #include <my_sys.h>
@@ -28,7 +28,9 @@
 
 static char * host=0, *opt_password=0, *user=0;
 static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
-static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
+static my_bool tty_password= 0, opt_table_type= 0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint my_end_arg= 0;
 static uint opt_verbose=0;
 static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
 
@@ -150,7 +152,7 @@ int main(int argc, char **argv)
 #ifdef HAVE_SMEM
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
-  my_end(info_flag ? MY_CHECK_ERROR : 0);
+  my_end(my_end_arg);
   exit(error ? 1 : 0);
   return 0;				/* No compiler warnings */
 }
@@ -176,8 +178,12 @@ static struct my_option my_long_options[
    0, 0, 0},
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**)
&info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
@@ -326,6 +332,10 @@ get_options(int *argc,char ***argv)
     */
     opt_verbose= 2;
   }
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return;
 }
 
diff -Nrup a/client/mysqlslap.c b/client/mysqlslap.c
--- a/client/mysqlslap.c	2007-06-02 07:33:16 +03:00
+++ b/client/mysqlslap.c	2007-08-01 22:59:00 +03:00
@@ -69,7 +69,7 @@ TODO:
 
 */
 
-#define SHOW_VERSION "0.9"
+#define SLAP_VERSION "1.0"
 
 #define HUGE_STRING_LENGTH 8196
 #define RAND_STRING_SIZE 126
@@ -128,10 +128,8 @@ const char *delimiter= "\n";
 
 const char *create_schema_string= "mysqlslap";
 
-static my_bool opt_preserve;
-
+static my_bool opt_preserve= 0, debug_info_flag= 0, debug_check_flag= 0;
 static my_bool opt_only_print= FALSE;
-
 static my_bool opt_compress= FALSE, tty_password= FALSE,
                opt_silent= FALSE,
                auto_generate_sql_autoincrement= FALSE,
@@ -144,13 +142,14 @@ static unsigned long connect_flags= CLIE
 static int verbose, delimiter_length;
 const char *num_int_cols_opt;
 const char *num_char_cols_opt;
+
 /* Yes, we do set defaults here */
 static unsigned int num_int_cols= 1;
 static unsigned int num_char_cols= 1;
 static unsigned int num_int_cols_index= 0; 
 static unsigned int num_char_cols_index= 0;
-
 static unsigned int iterations;
+static uint my_end_arg= 0;
 static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
 static ulonglong actual_queries= 0;
 static ulonglong auto_actual_queries;
@@ -403,7 +402,7 @@ int main(int argc, char **argv)
     my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(defaults_argv);
-  my_end(0);
+  my_end(my_end_arg);
 
   return 0;
 }
@@ -546,6 +545,11 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
     (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
     OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"delimiter", 'F',
     "Delimiter to use in SQL statements supplied in file or command line.",
     (uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
@@ -636,7 +640,7 @@ static struct my_option my_long_options[
 
 static void print_version(void)
 {
-  printf("%s  Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION,
+  printf("%s  Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION,
          MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
 }
 
@@ -1090,6 +1094,10 @@ get_options(int *argc,char ***argv)
   DBUG_ENTER("get_options");
   if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (!user)
     user= (char *)"root";
diff -Nrup a/client/mysqltest.c b/client/mysqltest.c
--- a/client/mysqltest.c	2007-07-23 20:39:46 +03:00
+++ b/client/mysqltest.c	2007-08-01 22:59:00 +03:00
@@ -31,7 +31,7 @@
   Holyfoot
 */
 
-#define MTEST_VERSION "3.2"
+#define MTEST_VERSION "3.3"
 
 #include "client_priv.h"
 #include <mysql_version.h>
@@ -80,6 +80,7 @@ const char *opt_include= 0, *opt_charset
 static int opt_port= 0;
 static int opt_max_connect_retries;
 static my_bool opt_compress= 0, silent= 0, verbose= 0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
 static my_bool tty_password= 0;
 static my_bool opt_mark_progress= 0;
 static my_bool ps_protocol= 0, ps_protocol_enabled= 0;
@@ -100,6 +101,7 @@ static const char *load_default_groups[]
 static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
 
 static uint start_lineno= 0; /* Start line of current command */
+static uint my_end_arg= 0;
 
 static char delimiter[MAX_DELIMITER_LENGTH]= ";";
 static uint delimiter_length= 1;
@@ -807,12 +809,11 @@ void free_used_memory()
 static void cleanup_and_exit(int exit_code)
 {
   free_used_memory();
-  my_end(MY_CHECK_ERROR);
+  my_end(my_end_arg | MY_CHECK_ERROR);
 
   if (!silent)
   {
-    switch (exit_code)
-    {
+    switch (exit_code) {
     case 1:
       printf("not ok\n");
       break;
@@ -4482,6 +4483,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
@@ -4724,6 +4731,10 @@ int parse_args(int argc, char **argv)
     opt_db= *argv;
   if (tty_password)
     opt_pass= get_tty_password(NullS);          /* purify tested */
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   return 0;
 }
diff -Nrup a/include/my_sys.h b/include/my_sys.h
--- a/include/my_sys.h	2007-07-30 11:33:41 +03:00
+++ b/include/my_sys.h	2007-08-01 22:59:00 +03:00
@@ -150,7 +150,7 @@ extern ulonglong sf_malloc_mem_limit;
 #else
 #define my_checkmalloc()
 #undef TERMINATE
-#define TERMINATE(A) {}
+#define TERMINATE(A,B) {}
 #define QUICK_SAFEMALLOC
 #define NORMAL_SAFEMALLOC
 extern void *my_malloc(size_t Size,myf MyFlags);
@@ -618,7 +618,7 @@ extern int nt_share_delete(const char *n
 #endif
 
 #ifndef TERMINATE
-extern void TERMINATE(FILE *file);
+extern void TERMINATE(FILE *file, uint flag);
 #endif
 extern void init_glob_errs(void);
 extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
diff -Nrup a/libmysql/libmysql.c b/libmysql/libmysql.c
--- a/libmysql/libmysql.c	2007-07-21 13:36:28 +03:00
+++ b/libmysql/libmysql.c	2007-08-01 22:59:00 +03:00
@@ -215,7 +215,7 @@ void STDCALL mysql_server_end()
 }
 
 static MYSQL_PARAMETERS mysql_internal_parameters=
-{&max_allowed_packet, &net_buffer_length};
+{&max_allowed_packet, &net_buffer_length, 0};
 
 MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void)
 {
diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-06-29 15:18:18 +03:00
+++ b/mysql-test/mysql-test-run.pl	2007-08-01 22:59:00 +03:00
@@ -1655,7 +1655,7 @@ sub generate_cmdline_mysqldump ($) {
   my($mysqld) = @_;
   return
     mtr_native_path($exe_mysqldump) .
-      " --no-defaults -uroot --debug-info " .
+      " --no-defaults -uroot --debug-check " .
       "--port=$mysqld->{'port'} " .
       "--socket=$mysqld->{'path_sock'} --password=";
 }
@@ -1908,7 +1908,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlcheck=
     mtr_native_path($exe_mysqlcheck) .
-    " --no-defaults --debug-info -uroot " .
+    " --no-defaults --debug-check -uroot " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1960,7 +1960,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlimport=
     mtr_native_path($exe_mysqlimport) .
-    " -uroot --debug-info " .
+    " -uroot --debug-check " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1977,7 +1977,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlshow=
     mtr_native_path($exe_mysqlshow) .
-    " -uroot --debug-info " .
+    " -uroot --debug-check " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1993,7 +1993,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlbinlog=
     mtr_native_path($exe_mysqlbinlog) .
-      " --no-defaults --disable-force-if-open --debug-info";
+      " --no-defaults --disable-force-if-open --debug-check";
   if ( !$opt_extern && $mysql_version_id >= 50000 )
   {
     $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@@ -2011,7 +2011,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysql=
     mtr_native_path($exe_mysql) .
-    " --no-defaults --debug-info --host=localhost  --user=root --password= " .
+    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} ".
     "--character-sets-dir=$path_charsetsdir";
diff -Nrup a/mysys/my_getsystime.c b/mysys/my_getsystime.c
--- a/mysys/my_getsystime.c	2007-07-30 11:33:42 +03:00
+++ b/mysys/my_getsystime.c	2007-08-01 22:59:00 +03:00
@@ -17,11 +17,13 @@
 /* thus to get the current time we should use the system function
    with the highest possible resolution */
 
+#include "mysys_priv.h"
+#include "my_static.h"
+
 #ifdef __NETWARE__
 #include <nks/time.h>
 #endif
 
-#include "mysys_priv.h"
 ulonglong my_getsystime()
 {
 #ifdef HAVE_CLOCK_GETTIME
@@ -30,7 +32,6 @@ ulonglong my_getsystime()
   return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
 #elif defined(__WIN__)
   LARGE_INTEGER t_cnt;
-  struct timeval tv;
   if (query_performance_frequency)
   {
     QueryPerformanceCounter(&t_cnt);
@@ -38,8 +39,7 @@ ulonglong my_getsystime()
             t_cnt.QuadPart % query_performance_frequency * 10000000/
             query_performance_frequency+query_performance_offset);
   }
-  gettimeofday(&tv,NULL);
-  return (ulonglong)tv.tv_sec*10000000+(ulonglong)tv.tv_usec*10;
+  return 0;
 #elif defined(__NETWARE__)
   NXTime_t tm;
   NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm);
@@ -62,26 +62,13 @@ ulonglong my_getsystime()
 
 */
 
-#define DELTA_FOR_SECONDS LL(500000000)  /* Half a second */
-
 time_t my_time(myf flags __attribute__((unused)))
 {
+  time_t t;
 #ifdef HAVE_GETHRTIME
-  static hrtime_t prev_gethrtime= 0;
-  static time_t cur_time= 0;
-
-  hrtime_t cur_gethrtime;
-  pthread_mutex_lock(&THR_LOCK_time);
-  cur_gethrtime= gethrtime();
-  if ((prev_gethrtime - cur_gethrtime) > DELTA_FOR_SECONDS)
-  {
-    cur_time= time(0);
-    prev_gethrtime= cur_gethrtime;
-  }
-  pthread_mutex_unlock(&THR_LOCK_time);
-  return cur_time;
+  (void) my_micro_time_and_time(&t);
+  return t;
 #else
-  time_t t;
   /* The following loop is here beacuse time() may fail on some systems */
   while ((t= time(0)) == (time_t) -1)
   {
@@ -120,11 +107,12 @@ ulonglong my_micro_time()
 #if defined(__WIN__)
   if (query_performance_frequency)
   {
-    QueryPerformanceCounter(&newtime);
+    QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
     newtime/= (query_performance_frequency * 1000000);
   }
   else
-    newtime= (GetTickCount() * 1000; /* GetTickCount only returns milliseconds */
+    newtime= (GetTickCount() * 1000); /* GetTickCount only returns milliseconds */
+  return newtime;
 #elif defined(HAVE_GETHRTIME)
   return gethrtime()/1000;
 #else
@@ -133,13 +121,13 @@ ulonglong my_micro_time()
   while (gettimeofday(&t, NULL) != 0)
   {}
   newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
-#endif  /* defined(__WIN__) */
   return newtime;
+#endif  /* defined(__WIN__) */
 }
 
 
 /*
-  Return time in seconds and timer in microseconds
+  Return time in seconds and timer in microseconds (not different start!)
 
   SYNOPSIS
     my_micro_time_and_time()
@@ -152,24 +140,48 @@ ulonglong my_micro_time()
     to measure the time of a query (for the slow query log)
 
   IMPLEMENTATION
-    Same as my_micro_time()
+    Value of time is as in time() call.
+    Value of microtime is same as my_micro_time(), which may be totally unrealated
+    to time()
 
   RETURN
     Value in microseconds from some undefined point in time
 */
 
+#define DELTA_FOR_SECONDS LL(500000000)  /* Half a second */
+
 ulonglong my_micro_time_and_time(time_t *time_arg)
 {
   ulonglong newtime;
 #if defined(__WIN__)
   if (query_performance_frequency)
   {
-    QueryPerformanceCounter((LARGE_INTEGER *) &newtime);
+    QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
     newtime/= (query_performance_frequency * 1000000);
   }
   else
-    newtime= (GetTickCount() * 1000; /* GetTickCount only returns milliseconds */
+    newtime= (GetTickCount() * 1000); /* GetTickCount only returns milliseconds */
   (void) time(time_arg);
+  return newtime;
+#elif defined(HAVE_GETHRTIME)
+  /*
+    Solaris has a very slow time() call. We optimize this by using the very fast
+    gethrtime() call and only calling time() every 1/2 second
+  */
+  static hrtime_t prev_gethrtime= 0;
+  static time_t cur_time= 0;
+  hrtime_t cur_gethrtime;
+
+  pthread_mutex_lock(&THR_LOCK_time);
+  cur_gethrtime= gethrtime();
+  if ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS)
+  {
+    cur_time= time(0);
+    prev_gethrtime= cur_gethrtime;
+  }
+  *time_arg= cur_time;
+  pthread_mutex_unlock(&THR_LOCK_time);
+  return cur_gethrtime/1000;
 #else
   struct timeval t;
   /* The following loop is here because gettimeofday may fail on some systems */
@@ -177,8 +189,8 @@ ulonglong my_micro_time_and_time(time_t 
   {}
   *time_arg= t.tv_sec;
   newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
-#endif  /* defined(__WIN__) */
   return newtime;
+#endif  /* defined(__WIN__) */
 }
 
 
diff -Nrup a/mysys/my_init.c b/mysys/my_init.c
--- a/mysys/my_init.c	2007-07-30 11:33:42 +03:00
+++ b/mysys/my_init.c	2007-08-01 22:59:00 +03:00
@@ -130,8 +130,9 @@ void my_end(int infoflag)
   */
   FILE *info_file= DBUG_FILE;
   my_bool print_info= (info_file != stderr);
-  /* We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
-     operational, so we cannot use DBUG_RETURN.
+  /*
+    We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
+    operational, so we cannot use DBUG_RETURN.
   */
   DBUG_PRINT("info",("Shutting down"));
   if (!info_file)
@@ -185,7 +186,7 @@ Voluntary context switches %ld, Involunt
     fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
 #endif
 #if defined(SAFEMALLOC)
-    TERMINATE(stderr);		/* Give statistic on screen */
+    TERMINATE(stderr, 1);		/* Give statistic on screen */
 #elif defined(__WIN__) && defined(_MSC_VER)
    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
@@ -196,6 +197,10 @@ Voluntary context switches %ld, Involunt
    _CrtCheckMemory();
    _CrtDumpMemoryLeaks();
 #endif
+  }
+  else if (infoflag & MY_CHECK_ERROR)
+  {
+    TERMINATE(stderr, 0);		/* Print memory leaks on screen */
   }
 
   if (!(infoflag & MY_DONT_FREE_DBUG))
diff -Nrup a/mysys/my_static.c b/mysys/my_static.c
--- a/mysys/my_static.c	2007-07-30 11:33:42 +03:00
+++ b/mysys/my_static.c	2007-08-01 22:59:00 +03:00
@@ -18,11 +18,9 @@
   a shared library
 */
 
-#if !defined(stdin)
 #include "mysys_priv.h"
 #include "my_static.h"
 #include "my_alarm.h"
-#endif
 
 my_bool timed_mutexes= 0;
 
diff -Nrup a/mysys/safemalloc.c b/mysys/safemalloc.c
--- a/mysys/safemalloc.c	2007-05-10 12:59:26 +03:00
+++ b/mysys/safemalloc.c	2007-08-01 22:59:00 +03:00
@@ -51,7 +51,7 @@
 				(equivalent to realloc())
 	FREE( pPtr )		Free memory allocated by NEW
 				(equivalent to free())
-	TERMINATE(file)		End system, report errors and stats on file
+	TERMINATE(file,flag)	End system, report errors and stats on file
   I personally use two more functions, but have not included them here:
 	char *STRSAVE( sPtr )	Save a copy of the string in dynamic memory
 	char *RENEW( pPtr, uSize )
@@ -352,12 +352,15 @@ static int check_ptr(const char *where, 
 
 
 /*
-  TERMINATE(FILE *file)
-    Report on all the memory pieces that have not been
-    free'ed as well as the statistics.
+  Report on all the memory pieces that have not been free'ed
+
+  SYNOPSIS
+    TERMINATE()
+    file   Write output to this file
+    flag   If <> 0, also write statistics 
  */
 
-void TERMINATE(FILE *file)
+void TERMINATE(FILE *file, uint flag)
 {
   struct st_irem *irem;
   DBUG_ENTER("TERMINATE");
@@ -373,8 +376,7 @@ void TERMINATE(FILE *file)
   {
     if (file)
     {
-      fprintf(file, "Warning: Not freed memory segments: %u\n",
-	      sf_malloc_count);
+      fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
       (void) fflush(file);
     }
     DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
@@ -414,7 +416,7 @@ void TERMINATE(FILE *file)
     }
   }
   /* Report the memory usage statistics */
-  if (file)
+  if (file && flag)
   {
     fprintf(file, "Maximum memory usage: %ld bytes (%ldk)\n",
 	    sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
diff -Nrup a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
--- a/sql/item_xmlfunc.cc	2007-07-30 11:33:43 +03:00
+++ b/sql/item_xmlfunc.cc	2007-08-01 22:59:00 +03:00
@@ -2767,9 +2767,9 @@ String *Item_xml_str_func::parse_xml(Str
   if ((rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length())) != MY_XML_OK)
   {
     char buf[128];
-    my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %u: %s",
+    my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %lu: %s",
                 my_xml_error_lineno(&p) + 1,
-                my_xml_error_pos(&p) + 1,
+                (ulong) my_xml_error_pos(&p) + 1,
                 my_xml_error_string(&p));
     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                         ER_WRONG_VALUE,
diff -Nrup a/sql/sql_test.cc b/sql/sql_test.cc
--- a/sql/sql_test.cc	2007-06-01 10:43:55 +03:00
+++ b/sql/sql_test.cc	2007-08-01 22:59:00 +03:00
@@ -509,7 +509,7 @@ Next alarm time: %lu\n",
   fflush(stdout);
   my_checkmalloc();
   fprintf(stdout,"\nBegin safemalloc memory dump:\n"); // tag needed for test suite
-  TERMINATE(stdout);				// Write malloc information
+  TERMINATE(stdout, 1);				// Write malloc information
   fprintf(stdout,"\nEnd safemalloc memory dump.\n");  
 
 #ifdef HAVE_MALLINFO
diff -Nrup a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c
--- a/unittest/mysys/base64-t.c	2007-02-21 19:16:36 +02:00
+++ b/unittest/mysys/base64-t.c	2007-08-01 22:59:00 +03:00
@@ -14,6 +14,7 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
 
 #include <my_global.h>
+#include <my_sys.h>
 #include <base64.h>
 #include <tap.h>
 #include <string.h>
@@ -26,6 +27,7 @@ main(void)
 {
   int i, cmp;
   size_t j, k, l, dst_len, needed_length;
+  MY_INIT("base64-t");
 
   plan(BASE64_LOOP_COUNT * BASE64_ROWS);
 
diff -Nrup a/unittest/mysys/bitmap-t.c b/unittest/mysys/bitmap-t.c
--- a/unittest/mysys/bitmap-t.c	2006-12-23 21:33:31 +02:00
+++ b/unittest/mysys/bitmap-t.c	2007-08-01 22:59:00 +03:00
@@ -18,12 +18,11 @@
    library.
 */
 
-#include <tap.h>
-
 #include <my_global.h>
+#include <my_sys.h>
 #include <my_bitmap.h>
-
-#include <string.h>
+#include <tap.h>
+#include <m_string.h>
 
 uint get_rand_bit(uint bitsize)
 {
@@ -379,6 +378,8 @@ int main()
   int i;
   int const min_size = 1;
   int const max_size = 1024;
+  MY_INIT("bitmap-t");
+
   plan(max_size - min_size);
   for (i= min_size; i < max_size; i++)
     ok(do_test(i) == 0, "bitmap size %d", i);
diff -Nrup a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c
--- a/unittest/mysys/my_atomic-t.c	2007-03-16 20:43:57 +02:00
+++ b/unittest/mysys/my_atomic-t.c	2007-08-01 22:59:00 +03:00
@@ -14,9 +14,9 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <my_global.h>
-#include <tap.h>
 #include <my_sys.h>
 #include <my_atomic.h>
+#include <tap.h>
 
 int32 a32,b32,c32;
 my_atomic_rwlock_t rwl;
@@ -160,6 +160,7 @@ err:
 int main()
 {
   int err;
+  MY_INIT("my_atomic-t.c");
 
   diag("N CPUs: %d", my_getncpus());
   err= my_atomic_initialize();
Thread
bk commit into 5.1 tree (monty:1.2557) BUG#30127monty1 Aug