List:Internals« Previous MessageNext Message »
From:jwythe Date:December 6 2003 6:40pm
Subject:bk commit into 4.1 tree (jww:1.1657)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jww. When jww 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1657 03/12/06 10:28:12 jww@stripped +19 -0
  Merge

  support-files/mysql.server.sh
    1.34 03/12/06 06:58:20 jww@stripped +1 -1
    Merge

  scripts/make_binary_distribution.sh
    1.61 03/12/06 06:56:16 jww@stripped +1 -2
    Merge

  include/Makefile.am
    1.44 03/12/06 06:53:56 jww@stripped +2 -2
    Merge

  Docs/Makefile.am
    1.42 03/12/06 06:51:16 jww@stripped +4 -5
    Merge

  Makefile.am
    1.62 03/12/06 06:43:57 jww@stripped +4 -4
    Merge

  strings/Makefile.am
    1.36 03/12/05 05:00:50 jww@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.377 03/12/05 05:00:46 jww@stripped +0 -0
    Auto merged

  sql/Makefile.am
    1.91 03/12/05 05:00:26 jww@stripped +0 -0
    Auto merged

  scripts/mysql_install_db.sh
    1.53 03/12/05 05:00:22 jww@stripped +0 -0
    Auto merged

  scripts/Makefile.am
    1.37 03/12/05 05:00:18 jww@stripped +0 -0
    Auto merged

  mysys/Makefile.am
    1.49 03/12/05 05:00:17 jww@stripped +0 -0
    Auto merged

  myisam/ft_update.c
    1.30 03/12/05 05:00:15 jww@stripped +0 -0
    Auto merged

  myisam/Makefile.am
    1.26 03/12/05 05:00:14 jww@stripped +0 -0
    Auto merged

  libmysqld/Makefile.am
    1.39 03/12/05 05:00:13 jww@stripped +0 -0
    Auto merged

  libmysql_r/Makefile.am
    1.13 03/12/05 05:00:12 jww@stripped +0 -0
    Auto merged

  client/mysqlbinlog.cc
    1.81 03/12/05 05:00:10 jww@stripped +0 -0
    Auto merged

  configure.in
    1.251 03/12/05 05:00:06 jww@stripped +0 -0
    Auto merged

  BitKeeper/etc/logging_ok
    1.257 03/12/05 04:25:40 jww@stripped +0 -0
    auto-union

  BitKeeper/etc/ignore
    1.160 03/12/05 04:25:36 jww@stripped +1 -1
    auto-union

# 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:	jww
# Host:	skymaster.silksystems.com
# Root:	/u/src/mysql/mysql-4.1/RESYNC

--- 1.41/Docs/Makefile.am	Sat Sep 13 21:13:40 2003
+++ 1.42/Docs/Makefile.am	Sat Dec  6 06:51:16 2003
@@ -23,11 +23,11 @@
 
 build_sources =		$(targets) manual_toc.html include.texi
 EXTRA_DIST =		$(noinst_SCRIPTS) mysqld_error.txt \
-			reservedwords.texi 
+			reservedwords.texi internals.texi
 
 all:			$(targets) txt_files
 
-txt_files:		../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
+txt_files:		../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE \
 			../INSTALL-BINARY \
 			../support-files/MacOSX/ReadMe.txt
 
@@ -279,6 +279,10 @@
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
 	$(PERL) -w $(GT) $${d}mysql.info "Installing" "Tutorial" > $@
 
+../INSTALL-WIN-SOURCE:	mysql.info $(GT)
+	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
+	$(PERL) -w $(GT) $${d}mysql.info "Windows source build" "Post-installation" > $@
+
 # We put the description for the binary installation here so that
 # people who download source wont have to see it. It is moved up to
 # the toplevel by the script that makes the binary tar files.
@@ -289,10 +293,6 @@
 ../COPYING:		mysql.info $(GT)
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
 	$(PERL) -w $(GT) $${d}mysql.info "GPL license" "LGPL license" > $@
-
-../COPYING.LIB:		mysql.info $(GT)
-	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
-	$(PERL) -w $(GT) $${d}mysql.info "LGPL license" "Function Index" > $@
 
 ../support-files/MacOSX/ReadMe.txt:	mysql.info $(GT)
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\

--- 1.61/Makefile.am	Thu Oct 23 22:30:52 2003
+++ 1.62/Makefile.am	Sat Dec  6 06:43:57 2003
@@ -19,18 +19,17 @@
 AUTOMAKE_OPTIONS =	foreign
 
 # These are built from source in the Docs directory
-BUILT_SOURCES =		INSTALL-SOURCE README \
-			COPYING COPYING.LIB INSTALL-BINARY zlib
+BUILT_SOURCES =		INSTALL-SOURCE README COPYING INSTALL-BINARY zlib
 
 SUBDIRS =		. include @docs_dirs@ \
 			@readline_topdir@ sql-common \
 			@thread_dirs@ pstack \
 			@sql_server_dirs@ \
 			@sql_client_dirs@ \
-			scripts man tests \
+			scripts man tests SSL\
 			BUILD @netware_dir@ os2 @libmysqld_dirs@ \
 			@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
-
+			
 EXTRA_DIST = @extra_sql_client_dirs@ @extra_sql_server_dirs@ \
 	@extra_thread_dirs@ \
 	@extra_libmysqld_dirs@ @extra_tools_dirs@ \

--- 1.250/configure.in	Thu Oct 23 22:40:17 2003
+++ 1.251/configure.in	Fri Dec  5 05:00:06 2003
@@ -4,7 +4,7 @@
 AC_INIT(sql/mysqld.cc)
 AC_CANONICAL_SYSTEM
 # The Docs Makefile.am parses this line!
-AM_INIT_AUTOMAKE(mysql, 4.1.1-alpha)
+AM_INIT_AUTOMAKE(mysql, 4.1.2-alpha)
 AM_CONFIG_HEADER(config.h)
 
 # Handle prefix and suffix with in script files
@@ -763,7 +763,7 @@
  strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
  sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
  unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
- sys/ioctl.h)
+ sys/ioctl.h malloc.h sys/malloc.h)
 
 #--------------------------------------------------------------------
 # Check for system libraries. Adds the library to $LIBS
@@ -1900,7 +1900,7 @@
  pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
  pthread_attr_getstacksize \
  pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
- fchmod getpass getpassphrase initgroups mlockall)
+ fsync fdatasync fchmod getpass getpassphrase initgroups mlockall)
 
 CFLAGS="$ORG_CFLAGS"
 
@@ -3027,7 +3027,7 @@
  libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl
  libmysql/Makefile client/Makefile dnl
  pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
- sql-common/Makefile dnl
+ sql-common/Makefile SSL/Makefile dnl
  merge/Makefile dbug/Makefile scripts/Makefile dnl
  include/Makefile sql-bench/Makefile tools/Makefile dnl
  tests/Makefile Docs/Makefile support-files/Makefile dnl

--- 1.43/include/Makefile.am	Fri Jun 20 12:20:46 2003
+++ 1.44/include/Makefile.am	Sat Dec  6 06:53:56 2003
@@ -21,7 +21,8 @@
 		  	my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
 			errmsg.h my_global.h my_net.h my_alloc.h \
 			my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
-			sslopt-vars.h sslopt-case.h sql_common.h sql_state.h
+			sslopt-vars.h sslopt-case.h sql_common.h sql_state.h \
+			keycache.h
 
 noinst_HEADERS =	config-win.h config-os2.h config-netware.h \
 			nisam.h heap.h merge.h my_bitmap.h\

--- 1.25/myisam/Makefile.am	Thu Jun 19 22:10:23 2003
+++ 1.26/myisam/Makefile.am	Fri Dec  5 05:00:14 2003
@@ -47,7 +47,7 @@
 			mi_range.c mi_dbug.c mi_checksum.c mi_log.c \
 			mi_changed.c mi_static.c mi_delete_all.c \
 			mi_delete_table.c mi_rename.c  mi_check.c \
-			mi_preload.c \
+			mi_keycache.c mi_preload.c \
 			ft_parser.c ft_stopwords.c ft_static.c \
 			ft_update.c ft_boolean_search.c ft_nlq_search.c sort.c \
 			rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c

--- 1.29/myisam/ft_update.c	Fri Jun 13 22:49:52 2003
+++ 1.30/myisam/ft_update.c	Fri Dec  5 05:00:15 2003
@@ -21,13 +21,6 @@
 #include "ftdefs.h"
 #include <math.h>
 
-/**************************************************************
-   This is to make ft-code to ignore keyseg.length at all     *
-   and to index the whole VARCHAR/BLOB instead...             */
-#undef set_if_smaller
-#define set_if_smaller(A,B)                          /* no op */
-/**************************************************************/
-
 void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
 			     FT_SEG_ITERATOR *ftsi)
 {
@@ -88,7 +81,6 @@
   {
     ftsi->len=uint2korr(ftsi->pos);
     ftsi->pos+=2;				 /* Skip VARCHAR length */
-    set_if_smaller(ftsi->len,ftsi->seg->length);
     DBUG_RETURN(1);
   }
   if (ftsi->seg->flag & HA_BLOB_PART)
@@ -96,7 +88,6 @@
     ftsi->len=_mi_calc_blob_length(ftsi->seg->bit_start,ftsi->pos);
     memcpy_fixed((char*) &ftsi->pos, ftsi->pos+ftsi->seg->bit_start,
 		 sizeof(char*));
-    set_if_smaller(ftsi->len,ftsi->seg->length);
     DBUG_RETURN(1);
   }
   ftsi->len=ftsi->seg->length;
@@ -106,7 +97,8 @@
 
 /* parses a document i.e. calls ft_parse for every keyseg */
 
-uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
+uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr,
+                  const byte *record, my_bool with_alloc)
 {
   FT_SEG_ITERATOR ftsi;
   DBUG_ENTER("_mi_ft_parse");
@@ -117,21 +109,19 @@
   while (_mi_ft_segiterator(&ftsi))
   {
     if (ftsi.pos)
-      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len))
+      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc))
         DBUG_RETURN(1);
   }
   DBUG_RETURN(0);
 }
 
-FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr,
-			     byte *keybuf __attribute__((unused)),
-			     const byte *record)
+FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record)
 {
   TREE ptree;
   DBUG_ENTER("_mi_ft_parserecord");
 
   bzero((char*) &ptree, sizeof(ptree));
-  if (_mi_ft_parse(&ptree, info, keynr, record))
+  if (_mi_ft_parse(&ptree, info, keynr, record,0))
     DBUG_RETURN(NULL);
 
   DBUG_RETURN(ft_linearize(&ptree));
@@ -208,9 +198,9 @@
   int cmp, cmp2;
   DBUG_ENTER("_mi_ft_update");
 
-  if (!(old_word=oldlist=_mi_ft_parserecord(info, keynr, keybuf, oldrec)))
+  if (!(old_word=oldlist=_mi_ft_parserecord(info, keynr, oldrec)))
     goto err0;
-  if (!(new_word=newlist=_mi_ft_parserecord(info, keynr, keybuf, newrec)))
+  if (!(new_word=newlist=_mi_ft_parserecord(info, keynr, newrec)))
     goto err1;
 
   error=0;
@@ -258,7 +248,7 @@
   FT_WORD *wlist;
   DBUG_ENTER("_mi_ft_add");
 
-  if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
+  if ((wlist=_mi_ft_parserecord(info, keynr, record)))
   {
     error=_mi_ft_store(info,keynr,keybuf,wlist,pos);
     my_free((char*) wlist,MYF(0));
@@ -277,7 +267,7 @@
   DBUG_ENTER("_mi_ft_del");
   DBUG_PRINT("enter",("keynr: %d",keynr));
 
-  if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
+  if ((wlist=_mi_ft_parserecord(info, keynr, record)))
   {
     error=_mi_ft_erase(info,keynr,keybuf,wlist,pos);
     my_free((char*) wlist,MYF(0));
@@ -289,7 +279,7 @@
 uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
 		  my_off_t filepos)
 {
-  byte buf[HA_FT_MAXLEN+16];
+  byte buf[HA_FT_MAXBYTELEN+16];
   DBUG_ENTER("_ft_make_key");
 
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
@@ -305,3 +295,53 @@
   memcpy(buf+HA_FT_WLEN+2,wptr->pos,wptr->len);
   DBUG_RETURN(_mi_make_key(info,keynr,(uchar*) keybuf,buf,filepos));
 }
+
+/*
+  convert key value to ft2
+*/
+uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key)
+{
+  my_off_t root;
+  DYNAMIC_ARRAY *da=info->ft1_to_ft2;
+  MI_KEYDEF *keyinfo=&info->s->ft2_keyinfo;
+  uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
+  uint length, key_length;
+  DBUG_ENTER("_mi_ft_convert_to_ft2");
+
+  /* we'll generate one pageful at once, and insert the rest one-by-one */
+  /* calculating the length of this page ...*/
+  length=(keyinfo->block_length-2) / keyinfo->keylength;
+  set_if_smaller(length, da->elements);
+  length=length * keyinfo->keylength;
+
+  get_key_full_length_rdonly(key_length, key);
+  while (_mi_ck_delete(info, keynr, key, key_length) == 0)
+    /* nothing to do here.
+       _mi_ck_delete() will populate info->ft1_to_ft2 with deleted keys
+     */;
+
+  /* creating pageful of keys */
+  mi_putint(info->buff,length+2,0);
+  memcpy(info->buff+2, key_ptr, length);
+  info->buff_used=info->page_changed=1;           /* info->buff is used */
+  if ((root= _mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR ||
+      _mi_write_keypage(info,keyinfo,root,DFLT_INIT_HITS,info->buff))
+    DBUG_RETURN(-1);
+
+  /* inserting the rest of key values */
+  end= (uchar*) dynamic_array_ptr(da, da->elements);
+  for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength)
+    if(_mi_ck_real_write_btree(info, keyinfo, key_ptr, 0, &root, SEARCH_SAME))
+      DBUG_RETURN(-1);
+
+  /* now, writing the word key entry */
+  ft_intXstore(key+key_length, - (int) da->elements);
+  _mi_dpointer(info, key+key_length+HA_FT_WLEN, root);
+
+  DBUG_RETURN(_mi_ck_real_write_btree(info,
+                                     info->s->keyinfo+keynr,
+                                     key, 0,
+                                     &info->s->state.key_root[keynr],
+                                     SEARCH_SAME));
+}
+

--- 1.48/mysys/Makefile.am	Thu Oct 23 03:34:15 2003
+++ 1.49/mysys/Makefile.am	Fri Dec  5 05:00:17 2003
@@ -29,7 +29,7 @@
 			mf_path.c mf_loadpath.c\
 			my_open.c my_create.c my_dup.c my_seek.c my_read.c \
 			my_pread.c my_write.c \
-			mf_keycache.c my_crc32.c \
+			mf_keycache.c mf_keycaches.c my_crc32.c \
 			mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
 			mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
 			my_malloc.c my_realloc.c my_once.c mulalloc.c \
@@ -39,7 +39,7 @@
 			mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
 			my_symlink.c my_symlink2.c \
 			mf_pack.c mf_unixpath.c mf_strip.c \
-			mf_soundex.c mf_wcomp.c mf_wfile.c \
+			mf_wcomp.c mf_wfile.c \
 			mf_qsort.c mf_qsort2.c mf_sort.c \
 			ptr_cmp.c mf_radix.c queues.c \
 			tree.c list.c hash.c array.c string.c typelib.c \
@@ -47,7 +47,7 @@
 			my_delete.c my_rename.c my_redel.c my_tempnam.c \
 			my_chsize.c my_lread.c my_lwrite.c my_clock.c \
 			my_quick.c my_lockmem.c my_static.c \
-			my_getopt.c my_mkdir.c \
+			my_sync.c my_getopt.c my_mkdir.c \
 			default.c my_compress.c checksum.c raid.cc \
 			my_net.c my_semaphore.c my_port.c my_sleep.c \
 			charset.c charset-def.c my_bitmap.c my_bit.c md5.c \

--- 1.36/scripts/Makefile.am	Thu Oct 23 22:47:51 2003
+++ 1.37/scripts/Makefile.am	Fri Dec  5 05:00:18 2003
@@ -149,6 +149,7 @@
 	  -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
 	  -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
 	  -e 's!@''LIBS''@!@LIBS@!' \
+	  -e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
 	  -e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
 	  -e 's!@''openssl_libs''@!@openssl_libs@!' \
 	  -e 's!@''VERSION''@!@VERSION@!' \

--- 1.60/scripts/make_binary_distribution.sh	Sat Sep 13 21:20:03 2003
+++ 1.61/scripts/make_binary_distribution.sh	Sat Dec  6 06:56:16 2003
@@ -108,7 +108,7 @@
   fi
 done
 
-for i in COPYING COPYING.LIB README INSTALL-BINARY \
+for i in COPYING README INSTALL-BINARY \
          MySQLEULA.txt LICENSE.doc README.NW 
 do
   if [ -f $i ]

--- 1.52/scripts/mysql_install_db.sh	Thu Oct 23 03:34:18 2003
+++ 1.53/scripts/mysql_install_db.sh	Fri Dec  5 05:00:22 2003
@@ -182,7 +182,7 @@
   fi
 fi
 
-if test "$ip_only" ="1"
+if test "$ip_only" = "1"
 then
   ip=`echo "$resolved" | awk '/ /{print $6}'`
   hostname=$ip

--- 1.90/sql/Makefile.am	Sun Oct 26 21:44:24 2003
+++ 1.91/sql/Makefile.am	Fri Dec  5 05:00:26 2003
@@ -47,7 +47,7 @@
 noinst_HEADERS =	item.h item_func.h item_sum.h item_cmpfunc.h \
 			item_strfunc.h item_timefunc.h item_uniq.h \
 			item_create.h item_subselect.h item_row.h \
-			mysql_priv.h item_geofunc.h \
+			mysql_priv.h item_geofunc.h sql_bitmap.h \
 			procedure.h sql_class.h sql_lex.h sql_list.h \
 			sql_manager.h sql_map.h sql_string.h unireg.h \
 			field.h handler.h \
@@ -64,7 +64,7 @@
 			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
 			thr_malloc.cc item_create.cc item_subselect.cc \
 			item_row.cc item_geofunc.cc \
-			field.cc key.cc sql_class.cc sql_list.cc \
+			field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
 			net_serv.cc protocol.cc sql_state.c \
 			lock.cc my_lock.c \
 			sql_string.cc sql_manager.cc sql_map.cc \

--- 1.80/client/mysqlbinlog.cc	Thu Oct 23 22:44:03 2003
+++ 1.81/client/mysqlbinlog.cc	Fri Dec  5 05:00:10 2003
@@ -35,6 +35,7 @@
 ulong bytes_sent = 0L, bytes_received = 0L;
 ulong mysqld_net_retry_count = 10L;
 uint test_flags = 0; 
+static uint opt_protocol= 0;
 
 static FILE *result_file;
 
@@ -53,7 +54,7 @@
 static int port = MYSQL_PORT;
 static const char* sock= 0;
 static const char* user = 0;
-static const char* pass = "";
+static char* pass = 0;
 static ulonglong position = 0;
 static short binlog_flags = 0; 
 static MYSQL* mysql = NULL;
@@ -227,13 +228,17 @@
   {"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
    0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p', "Password to connect to remote server.",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Use port to connect to the remote server.",
    (gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
    0, 0, 0},
   {"position", 'j', "Start reading the binlog at position N.",
    (gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
    0, 0},
+  {"protocol", OPT_MYSQL_PROTOCOL,
+   "The protocol of connection (tcp,socket,pipe,memory).",
+   0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
   {"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
@@ -267,6 +272,11 @@
   va_end(args);
 }
 
+static void cleanup()
+{
+  my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
+}
+
 static void die(const char* fmt, ...)
 {
   va_list args;
@@ -275,12 +285,13 @@
   vfprintf(stderr, fmt, args);
   fprintf(stderr, "\n");
   va_end(args);
+  cleanup();
   exit(1);
 }
 
 static void print_version()
 {
-  printf("%s Ver 2.4 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+  printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
 }
 
 
@@ -334,6 +345,7 @@
 get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
 	       char *argument)
 {
+  bool tty_password=0;
   switch (optid) {
 #ifndef DBUG_OFF
   case '#':
@@ -344,7 +356,17 @@
     one_database = 1;
     break;
   case 'p':
-    pass = my_strdup(argument, MYF(0));
+    if (argument)
+    {
+      my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
+      char *start=argument;
+      pass= my_strdup(argument,MYF(MY_FAE));
+      while (*argument) *argument++= 'x';		/* Destroy argument */
+      if (*start)
+        start[1]=0;				/* Cut length of argument */
+    }
+    else
+      tty_password=1;
     break;
   case 'r':
     if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
@@ -353,6 +375,17 @@
   case 'R':
     remote_opt= 1;
     break;
+  case OPT_MYSQL_PROTOCOL:
+  {
+    if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) ==
+	~(ulong) 0)
+    {
+      fprintf(stderr, "Unknown option to protocol: %s\n", argument);
+      exit(1);
+    }
+    break;
+  }
+  break;
   case 'V':
     print_version();
     exit(0);
@@ -360,6 +393,9 @@
     usage();
     exit(0);
   }
+  if (tty_password)
+    pass= get_tty_password(NullS);
+
   return 0;
 }
 
@@ -379,9 +415,11 @@
 static MYSQL* safe_connect()
 {
   MYSQL *local_mysql = mysql_init(NULL);
-  if(!local_mysql)
+  if (!local_mysql)
     die("Failed on mysql_init");
 
+  if (opt_protocol)
+    mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
   if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
     die("failed on connect: %s", mysql_error(local_mysql));
 
@@ -708,6 +746,7 @@
     my_fclose(result_file, MYF(0));
   if (remote_opt)
     mysql_close(mysql);
+  cleanup();
   free_defaults(defaults_argv);
   my_end(0);
   return 0;

--- 1.376/sql/mysqld.cc	Mon Nov  3 16:09:51 2003
+++ 1.377/sql/mysqld.cc	Fri Dec  5 05:00:46 2003
@@ -307,8 +307,6 @@
 ulong my_bind_addr;			/* the address we bind to */
 volatile ulong cached_thread_count= 0;
 
-ulonglong keybuff_size;
-
 double log_10[32];			/* 10 potences */
 
 time_t start_time;
@@ -320,10 +318,7 @@
      language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
      max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
 
-const char *opt_datetime_formats[3];
-const char *opt_datetime_format_names[3]= {"date_format",
-					   "time_format",
-					   "datetime_format"};
+const char *opt_date_time_formats[3];
 
 char *language_ptr, *default_collation_name, *default_character_set_name;
 char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
@@ -337,6 +332,14 @@
 const char *in_left_expr_name= "<left expr>";
 /* name of additional condition */
 const char *in_additional_cond= "<IN COND>";
+/* classes for comparation parsing/processing */
+Eq_creator eq_creator;
+Ne_creator ne_creator;
+Gt_creator gt_creator;
+Lt_creator lt_creator;
+Ge_creator ge_creator;
+Le_creator le_creator;
+
 
 FILE *bootstrap_file;
 
@@ -351,8 +354,8 @@
 struct system_variables max_system_variables;
 
 MY_TMPDIR mysql_tmpdir_list;
-DATE_FORMAT dayord;
 MY_BITMAP temp_pool;
+KEY_CACHE *sql_key_cache;
 
 CHARSET_INFO *system_charset_info, *files_charset_info ;
 CHARSET_INFO *national_charset_info, *table_alias_charset;
@@ -906,15 +909,18 @@
     udf_free();
 #endif
   (void) ha_panic(HA_PANIC_CLOSE);	/* close all tables and logs */
-  end_key_cache();
-  delete_elements(&key_caches, free_key_cache);
+  delete_elements(&key_caches, (void (*)(const char*, gptr)) free_key_cache);
+  multi_keycache_free();
   end_thr_alarm(1);			/* Free allocated memory */
 #ifdef USE_RAID
   end_raid();
 #endif
-  g_datetime_frm(DATE_FORMAT_TYPE).clean();
-  g_datetime_frm(TIME_FORMAT_TYPE).clean();
-  g_datetime_frm(DATETIME_FORMAT_TYPE).clean();
+  my_free((char*) global_system_variables.date_format,
+	  MYF(MY_ALLOW_ZERO_PTR));
+  my_free((char*) global_system_variables.time_format,
+	  MYF(MY_ALLOW_ZERO_PTR));
+  my_free((char*) global_system_variables.datetime_format,
+	  MYF(MY_ALLOW_ZERO_PTR));
   if (defaults_argv)
     free_defaults(defaults_argv);
   free_tmpdir(&mysql_tmpdir_list);
@@ -1558,14 +1564,15 @@
 We will try our best to scrape up some info that will hopefully help diagnose\n\
 the problem, but since we have already crashed, something is definitely wrong\n\
 and this may fail.\n\n");
-  fprintf(stderr, "key_buffer_size=%lu\n", (ulong) keybuff_size);
+  fprintf(stderr, "key_buffer_size=%lu\n", 
+          (ulong) sql_key_cache->key_cache_mem_size);
   fprintf(stderr, "read_buffer_size=%ld\n", global_system_variables.read_buff_size);
   fprintf(stderr, "max_used_connections=%ld\n", max_used_connections);
   fprintf(stderr, "max_connections=%ld\n", max_connections);
   fprintf(stderr, "threads_connected=%d\n", thread_count);
   fprintf(stderr, "It is possible that mysqld could use up to \n\
 key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K\n\
-bytes of memory\n", ((ulong) keybuff_size +
+bytes of memory\n", ((ulong) sql_key_cache->key_cache_mem_size +
 		     (global_system_variables.read_buff_size +
 		      global_system_variables.sortbuff_size) *
 		     max_connections)/ 1024);
@@ -1881,7 +1888,7 @@
   if ((thd= current_thd))
   {
     /*
-      thd->lex.current_select equel to zero if lex structure is not inited
+      thd->lex.current_select == 0 if lex structure is not inited
       (not query command (COM_QUERY))
     */
     if (thd->lex.current_select &&
@@ -1975,7 +1982,7 @@
 #endif
 
 
-const char *load_default_groups[]= { "mysqld","server",MYSQL_BASE_VERSION,0 };
+const char *load_default_groups[]= { "mysqld","server",MYSQL_BASE_VERSION,0,0};
 
 bool open_log(MYSQL_LOG *log, const char *hostname,
 	      const char *opt_name, const char *extension,
@@ -2010,33 +2017,45 @@
 }
 
 
-int init_global_datetime_format(datetime_format_types format_type, bool is_alloc)
+/*
+  Initialize one of the global date/time format variables
+
+  SYNOPSIS
+    init_global_datetime_format()
+    format_type		What kind of format should be supported
+    var_ptr		Pointer to variable that should be updated
+  
+  NOTES
+    The default value is taken from either opt_date_time_formats[] or
+    the ISO format (ANSI SQL)
+
+  RETURN
+    0 ok
+    1 error
+*/
+
+bool init_global_datetime_format(timestamp_type format_type,
+				 DATE_TIME_FORMAT **var_ptr)
 {
-  const char *format_str= opt_datetime_formats[format_type];
-  uint format_length= 0;
-  DATETIME_FORMAT *tmp_format= &g_datetime_frm(format_type).datetime_format;
+  /* Get command line option */
+  const char *str= opt_date_time_formats[format_type];
 
-  if (format_str)
+  if (!str)					// No specified format
   {
-    format_str= opt_datetime_formats[format_type];
-    format_length= strlen(format_str);
+    str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
+				  format_type);
+    /*
+      Set the "command line" option to point to the generated string so
+      that we can set global formats back to default
+    */
+    opt_date_time_formats[format_type]= str;
   }
-  else
+  if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
   {
-    format_str= datetime_formats[format_type][ISO_FORMAT];
-    format_length= strlen(datetime_formats[format_type][ISO_FORMAT]);
-    opt_datetime_formats[format_type]= format_str;
-  }
-  if (make_format(tmp_format, format_type, format_str,
-		  format_length, is_alloc))
-  {
-    g_datetime_frm(format_type).name= opt_datetime_format_names[format_type];
-    g_datetime_frm(format_type).name_length=
-      strlen(opt_datetime_format_names[format_type]);
-    g_datetime_frm(format_type).format_type= format_type;
-    return 0;
+    fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
+    return 1;
   }
-  return 1;
+  return 0;
 }
 
 
@@ -2050,6 +2069,8 @@
 
   max_system_variables.pseudo_thread_id= (ulong)~0;
   start_time=time((time_t*) 0);
+  if (init_thread_environment())
+    return 1;
   mysql_init_variables();
 
 #ifdef OS2
@@ -2093,8 +2114,6 @@
   load_defaults(conf_file_name, groups, &argc, &argv);
   defaults_argv=argv;
   get_options(argc,argv);
-  if (init_thread_environment())
-    return 1;
   if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
     strcat(server_version,"-log");
   DBUG_PRINT("info",("%s  Ver %s for %s on %s\n",my_progname,
@@ -2151,19 +2170,14 @@
     }
     default_charset_info= default_collation;
   }
-  global_system_variables.collation_server= default_charset_info;
-  global_system_variables.collation_database= default_charset_info;
-  global_system_variables.collation_connection= default_charset_info;
+  /* Set collactions that depends on the default collation */
+  global_system_variables.collation_server=	 default_charset_info;
+  global_system_variables.collation_database=	 default_charset_info;
+  global_system_variables.collation_connection=  default_charset_info;
   global_system_variables.character_set_results= default_charset_info;
-  global_system_variables.character_set_client= default_charset_info;
-  global_system_variables.collation_connection= default_charset_info;
+  global_system_variables.character_set_client=  default_charset_info;
 
-  if (init_global_datetime_format(DATE_FORMAT_TYPE, 1) ||
-      init_global_datetime_format(TIME_FORMAT_TYPE, 1) ||
-      init_global_datetime_format(DATETIME_FORMAT_TYPE, 1))
-    return 1;
-
-  if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
+  if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
     return 1;
   return 0;
 }
@@ -2309,7 +2323,11 @@
   }
   if (opt_myisam_log)
     (void) mi_log(1);
-  ha_key_cache();
+
+  /* call ha_init_key_cache() on all key caches to init them */
+  process_key_caches(&ha_init_key_cache);
+  /* We must set dflt_key_cache in case we are using ISAM tables */
+  dflt_key_cache= sql_key_cache;
 
 #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
   if (locked_in_memory && !geteuid())
@@ -2712,7 +2730,7 @@
 			 const char *extra_opt)
 {
   char path_and_service[FN_REFLEN+FN_REFLEN+32], *pos, *end;
-  end= path_and_service + sizeof(path_and_service)-1;
+  end= path_and_service + sizeof(path_and_service)-3;
 
   /* We have to quote filename if it contains spaces */
   pos= add_quoted_string(path_and_service, file_path, end);
@@ -2722,7 +2740,9 @@
     *pos++= ' ';
     pos= add_quoted_string(pos, extra_opt, end);
   }
-  *pos= 0;					// Ensure end null
+  /* We must have servicename last */
+  *pos++= ' ';
+  strmake(pos, servicename, (uint) (end+2 - pos));
 
   if (Service.got_service_option(argv, "install"))
   {
@@ -2765,10 +2785,16 @@
       if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME,
 				   file_path, ""))
 	return 0;
-      if (Service.IsService(argv[1]))
+      if (Service.IsService(argv[1]))        /* Start an optional service */
       {
-        /* start an optional service */
-        load_default_groups[0]= argv[1];
+	/*
+	  Only add the service name to the groups read from the config file
+	  if it's not "MySQL". (The default service name should be 'mysqld'
+	  but we started a bad tradition by calling it MySQL from the start
+	  and we are now stuck with it.
+	*/
+	if (my_strcasecmp(system_charset_info, argv[1],"mysql"))
+	  load_default_groups[3]= argv[1];
         start_mode= 1;
         Service.Init(argv[1], mysql_service);
         return 0;
@@ -2776,8 +2802,7 @@
     }
     else if (argc == 3) /* install or remove any optional service */
     {
-      if (!default_service_handling(argv, argv[2], argv[2], file_path,
-				    argv[2]))
+      if (!default_service_handling(argv, argv[2], argv[2], file_path, ""))
 	return 0;
       if (Service.IsService(argv[2]))
       {
@@ -2789,6 +2814,8 @@
 	opt_argc= 2;				// Skip service-name
 	opt_argv=argv;
 	start_mode= 1;
+	if (my_strcasecmp(system_charset_info, argv[2],"mysql"))
+	  load_default_groups[3]= argv[2];
 	Service.Init(argv[2], mysql_service);
 	return 0;
       }
@@ -3295,35 +3322,22 @@
 #ifdef HAVE_SMEM
 pthread_handler_decl(handle_connections_shared_memory,arg)
 {
-/*
-  event_connect_request is event object for start connection actions
-  event_connect_answer is event object for confirm, that server put data
-  handle_connect_file_map is file-mapping object, use for create shared memory
-  handle_connect_map is pointer on shared memory
-  handle_map is pointer on shared memory for client
-  event_server_wrote,
-  event_server_read,
-  event_client_wrote,
-  event_client_read are events for transfer data between server and client
-  handle_file_map is file-mapping object, use for create shared memory
-*/
-  HANDLE handle_connect_file_map = NULL;
-  char  *handle_connect_map = NULL;
-  HANDLE event_connect_request = NULL;
-  HANDLE event_connect_answer = NULL;
-  ulong smem_buffer_length = shared_memory_buffer_length + 4;
-  ulong connect_number = 1;
+  /* file-mapping object, use for create shared memory */
+  HANDLE handle_connect_file_map= 0;
+  char  *handle_connect_map= 0;  		// pointer on shared memory
+  HANDLE event_connect_request= 0;		// for start connection actions
+  HANDLE event_connect_answer= 0;
+  ulong smem_buffer_length= shared_memory_buffer_length + 4;
+  ulong connect_number= 1;
   my_bool error_allow;
-  THD *thd;
   char tmp[63];
   char *suffix_pos;
   char connect_number_char[22], *p;
-
+  const char *errmsg= 0;
   my_thread_init();
   DBUG_ENTER("handle_connections_shared_memorys");
   DBUG_PRINT("general",("Waiting for allocated shared memory."));
 
-
   /*
     The name of event and file-mapping events create agree next rule:
       shared_memory_base_name+unique_part
@@ -3331,166 +3345,165 @@
       shared_memory_base_name is unique value for each server
       unique_part is unique value for each object (events and file-mapping)
   */
-  suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS);
+  suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
   strmov(suffix_pos, "CONNECT_REQUEST");
-  if ((event_connect_request = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+  if ((event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
   {
-    sql_perror("Can't create shared memory service ! The request event don't create.");
+    errmsg= "Could not create request event";
     goto error;
   }
   strmov(suffix_pos, "CONNECT_ANSWER");
-  if ((event_connect_answer = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+  if ((event_connect_answer= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
   {
-    sql_perror("Can't create shared memory service ! The answer event don't create.");
+    errmsg="Could not create answer event";
     goto error;
   }
   strmov(suffix_pos, "CONNECT_DATA");
-  if ((handle_connect_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,
-                                 0,sizeof(connect_number),tmp)) == 0)
+  if ((handle_connect_file_map= CreateFileMapping(INVALID_HANDLE_VALUE,0,
+						   PAGE_READWRITE,
+						   0,sizeof(connect_number),
+						   tmp)) == 0)
   {
-    sql_perror("Can't create shared memory service ! File mapping don't create.");
+    errmsg= "Could not create file mapping";
     goto error;
   }
-  if ((handle_connect_map = (char *)MapViewOfFile(handle_connect_file_map,FILE_MAP_WRITE,0,0,
-                            sizeof(DWORD))) == 0)
+  if ((handle_connect_map= (char *)MapViewOfFile(handle_connect_file_map,
+						  FILE_MAP_WRITE,0,0,
+						  sizeof(DWORD))) == 0)
   {
-    sql_perror("Can't create shared memory service ! Map of memory don't create.");
+    errmsg= "Could not create shared memory service";
     goto error;
   }
 
-
   while (!abort_loop)
   {
-/*
- Wait a request from client
-*/
+    /* Wait a request from client */
     WaitForSingleObject(event_connect_request,INFINITE);
-    error_allow = FALSE;
 
-    HANDLE handle_client_file_map = NULL;
-    char  *handle_client_map = NULL;
-    HANDLE event_client_wrote = NULL;
-    HANDLE event_client_read = NULL;
-    HANDLE event_server_wrote = NULL;
-    HANDLE event_server_read = NULL;
+    HANDLE handle_client_file_map= 0;
+    char  *handle_client_map= 0;
+    HANDLE event_client_wrote= 0;
+    HANDLE event_client_read= 0;    // for transfer data server <-> client
+    HANDLE event_server_wrote= 0;
+    HANDLE event_server_read= 0;
+    THD *thd= 0;
 
-    p = int2str(connect_number, connect_number_char, 10);
-/*
-  The name of event and file-mapping events create agree next rule:
-    shared_memory_base_name+unique_part+number_of_connection
-  Where:
-    shared_memory_base_name is uniquel value for each server
-    unique_part is unique value for each object (events and file-mapping)
-    number_of_connection is number of connection between server and client
-*/
-    suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char,"_",NullS);
+    p= int2str(connect_number, connect_number_char, 10);
+    /*
+      The name of event and file-mapping events create agree next rule:
+        shared_memory_base_name+unique_part+number_of_connection
+        Where:
+	  shared_memory_base_name is uniquel value for each server
+	  unique_part is unique value for each object (events and file-mapping)
+	  number_of_connection is connection-number between server and client
+    */
+    suffix_pos= strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
+			 "_",NullS);
     strmov(suffix_pos, "DATA");
-    if ((handle_client_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,
-                                  PAGE_READWRITE,0,smem_buffer_length,tmp)) == 0)
+    if ((handle_client_file_map= CreateFileMapping(INVALID_HANDLE_VALUE,0,
+						    PAGE_READWRITE,0,
+						    smem_buffer_length,
+						    tmp)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! File mapping don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create file mapping";
       goto errorconn;
     }
-    if ((handle_client_map = (char*)MapViewOfFile(handle_client_file_map,FILE_MAP_WRITE,0,0,smem_buffer_length)) == 0)
+    if ((handle_client_map= (char*)MapViewOfFile(handle_client_file_map,
+						  FILE_MAP_WRITE,0,0,
+						  smem_buffer_length)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! Map of memory don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create memory map";
       goto errorconn;
     }
-
     strmov(suffix_pos, "CLIENT_WROTE");
-    if ((event_client_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+    if ((event_client_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! CW event don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create client write event";
       goto errorconn;
     }
-
     strmov(suffix_pos, "CLIENT_READ");
-    if ((event_client_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+    if ((event_client_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! CR event don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create client read event";
       goto errorconn;
     }
-
     strmov(suffix_pos, "SERVER_READ");
-    if ((event_server_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+    if ((event_server_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! SR event don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create server read event";
       goto errorconn;
     }
-
     strmov(suffix_pos, "SERVER_WROTE");
-    if ((event_server_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0)
+    if ((event_server_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
     {
-      sql_perror("Can't create connection with client in shared memory service ! SW event don't create.");
-      error_allow = TRUE;
+      errmsg= "Could not create server write event";
       goto errorconn;
     }
-
-    if (abort_loop) break;
-    if ( !(thd = new THD))
-    {
-      error_allow = TRUE;
+    if (abort_loop)
       goto errorconn;
-    }
-
-/*
-Send number of connection to client
-*/
+    if (!(thd= new THD))
+      goto errorconn;
+    /* Send number of connection to client */
     int4store(handle_connect_map, connect_number);
-
-/*
-  Send number of connection to client
-*/
     if (!SetEvent(event_connect_answer))
     {
-      sql_perror("Can't create connection with client in shared memory service ! Can't send answer event.");
-      error_allow = TRUE;
+      errmsg= "Could not send answer event";
       goto errorconn;
     }
-
-/*
-  Set event that client should receive data
-*/
+    /* Set event that client should receive data */
     if (!SetEvent(event_client_read))
     {
-      sql_perror("Can't create connection with client in shared memory service ! Can't set client to read's mode.");
-      error_allow = TRUE;
+      errmsg= "Could not set client to read mode";
       goto errorconn;
     }
-    if (!(thd->net.vio = vio_new_win32shared_memory(&thd->net,handle_client_file_map,handle_client_map,event_client_wrote,
-                         event_client_read,event_server_wrote,event_server_read)) ||
-                          my_net_init(&thd->net, thd->net.vio))
+    if (!(thd->net.vio= vio_new_win32shared_memory(&thd->net,
+						   handle_client_file_map,
+						   handle_client_map,
+						   event_client_wrote,
+						   event_client_read,
+						   event_server_wrote,
+						   event_server_read)) ||
+	my_net_init(&thd->net, thd->net.vio))
     {
       close_connection(thd, ER_OUT_OF_RESOURCES, 1);
-      delete thd;
-      error_allow = TRUE;
+      errmsg= 0;
+      goto errorconn;
     }
-    /* host name is unknown */
+    thd->host= my_strdup(my_localhost,MYF(0)); /* Host is unknown */
+    create_new_thread(thd);
+    connect_number++;
+    continue;
+
 errorconn:
-    if (error_allow)
+    /* Could not form connection;  Free used handlers/memort and retry */
+    if (errmsg)
     {
-      if (!handle_client_map) UnmapViewOfFile(handle_client_map);
-      if (!handle_client_file_map) CloseHandle(handle_client_file_map);
-      if (!event_server_wrote) CloseHandle(event_server_wrote);
-      if (!event_server_read) CloseHandle(event_server_read);
-      if (!event_client_wrote) CloseHandle(event_client_wrote);
-      if (!event_client_read) CloseHandle(event_client_read);
-      continue;
-    }
-    thd->host = my_strdup(my_localhost,MYF(0)); /* Host is unknown */
-    create_new_thread(thd);
-    uint4korr(connect_number++);
+      char buff[180];
+      strxmov(buff, "Can't create shared memory connection: ", errmsg, ".",
+	      NullS);
+      sql_perror(buff);
+    }
+    if (handle_client_file_map) CloseHandle(handle_client_file_map);
+    if (handle_client_map)	UnmapViewOfFile(handle_client_map);
+    if (event_server_wrote)	CloseHandle(event_server_wrote);
+    if (event_server_read)	CloseHandle(event_server_read);
+    if (event_client_wrote)	CloseHandle(event_client_wrote);
+    if (event_client_read)	CloseHandle(event_client_read);
+    delete thd;
   }
+
+  /* End shared memory handling */
 error:
-  if (!handle_connect_map) UnmapViewOfFile(handle_connect_map);
-  if (!handle_connect_file_map) CloseHandle(handle_connect_file_map);
-  if (!event_connect_answer) CloseHandle(event_connect_answer);
-  if (!event_connect_request) CloseHandle(event_connect_request);
+  if (errmsg)
+  {
+    char buff[180];
+    strxmov(buff, "Can't create shared memory service: ", errmsg, ".", NullS);
+    sql_perror(buff);
+  }
+  if (handle_connect_map)	UnmapViewOfFile(handle_connect_map);
+  if (handle_connect_file_map)	CloseHandle(handle_connect_file_map);
+  if (event_connect_answer)	CloseHandle(event_connect_answer);
+  if (event_connect_request)	CloseHandle(event_connect_request);
 
   decrement_handler_count();
   DBUG_RETURN(0);
@@ -3573,9 +3586,11 @@
   OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT,
   OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE,
   OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN,
-  OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_FT_STOPWORD_FILE,
+  OPT_FT_MAX_WORD_LEN, OPT_FT_QUERY_EXPANSION_LIMIT, OPT_FT_STOPWORD_FILE,
   OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
-  OPT_KEY_BUFFER_SIZE, OPT_LONG_QUERY_TIME,
+  OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
+  OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
+  OPT_LONG_QUERY_TIME,
   OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
   OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
   OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
@@ -3584,7 +3599,7 @@
   OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
   OPT_MAX_LENGTH_FOR_SORT_DATA,
   OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
-  OPT_MAX_ERROR_COUNT, OPT_MAX_PREP_STMT,
+  OPT_MAX_ERROR_COUNT,
   OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
   OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
   OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
@@ -4210,15 +4225,15 @@
   { "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
     "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
     (gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
-    REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0},
+    REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0},
   { "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
     "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
     (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
-    REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0},
-  { "ft_max_word_len_for_sort", OPT_FT_MAX_WORD_LEN_FOR_SORT,
-    "The maximum length of the word for repair_by_sorting. Longer words are included the slow way. The lower this value, the more words will be put in one sort bucket.",
-    (gptr*) &ft_max_word_len_for_sort, (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG,
-    REQUIRED_ARG, 20, 4, HA_FT_MAXLEN, 0, 1, 0},
+    REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0},
+  { "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT,
+    "Number of best matches to use for query expansion",
+    (gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG,
+    REQUIRED_ARG, 20, 0, 1000, 0, 1, 0},
   { "ft_stopword_file", OPT_FT_STOPWORD_FILE,
     "Use stopwords from this file instead of built-in list.",
     (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
@@ -4288,10 +4303,29 @@
    IO_SIZE, 0},
   {"key_buffer_size", OPT_KEY_BUFFER_SIZE,
    "The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
-   (gptr*) &keybuff_size, (gptr*) &keybuff_size, 0,
-   (enum get_opt_var_type) (GET_ULL | GET_ASK_ADDR),
+   (gptr*) &dflt_key_cache_var.param_buff_size,
+   (gptr*) 0,
+   0, (enum get_opt_var_type) (GET_ULL | GET_ASK_ADDR),
    REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD,
    IO_SIZE, 0},
+  {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
+   "The default size of key cache blocks",
+   (gptr*) &dflt_key_cache_var.param_block_size,
+   (gptr*) 0,
+   0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
+   KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0},
+  {"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
+   "The minimum percentage of warm blocks in key cache",
+   (gptr*) &dflt_key_cache_var.param_division_limit,
+   (gptr*) 0,
+   0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
+   1, 100, 0, 1, 0},
+  {"key_cache_division_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
+   "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
+   (gptr*) &dflt_key_cache_var.param_age_threshold,
+   (gptr*) 0,
+   0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, 
+   300, 100, ~0L, 0, 100, 0},
   {"long_query_time", OPT_LONG_QUERY_TIME,
    "Log all queries that have taken more than long_query_time seconds to execute to file.",
    (gptr*) &global_system_variables.long_query_time,
@@ -4354,11 +4388,6 @@
     (gptr*) &global_system_variables.max_length_for_sort_data,
     (gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
     REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
-  {"max_prepared_statements", OPT_MAX_PREP_STMT,
-   "Max number of prepared_statements for a thread.",
-   (gptr*) &global_system_variables.max_prep_stmt_count,
-   (gptr*) &max_system_variables.max_prep_stmt_count, 0, GET_ULONG,
-   REQUIRED_ARG, DEFAULT_PREP_STMT_COUNT, 0, ~0L, 0, 1, 0},
   {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
    "If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 expected, the minimum value for this variable is 4096.",
    (gptr*) &max_relay_log_size, (gptr*) &max_relay_log_size, 0, GET_ULONG,
@@ -4574,7 +4603,7 @@
    (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
    REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
   {"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
-   "Logs will be rotated after expire-log-days days. ",
+   "Logs will be rotated after expire-log-days days ",
    (gptr*) &expire_logs_days,
    (gptr*) &expire_logs_days, 0, GET_ULONG,
    REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
@@ -4584,23 +4613,24 @@
     (gptr*) &max_system_variables.default_week_format,
     0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0},
   { "date-format", OPT_DATE_FORMAT,
-    "The DATE format.",
-    (gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE],
-    (gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE],
+    "The DATE format (For future).",
+    (gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
+    (gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "datetime-format", OPT_DATETIME_FORMAT,
-    "The DATETIME/TIMESTAMP format.",
-    (gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE],
-    (gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE],
+    "The DATETIME/TIMESTAMP format (for future).",
+    (gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
+    (gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "time-format", OPT_TIME_FORMAT,
-    "The TIME format.",
-    (gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE],
-    (gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE],
+    "The TIME format (for future).",
+    (gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
+    (gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
+
 struct show_var_st status_vars[]= {
   {"Aborted_clients",          (char*) &aborted_threads,        SHOW_LONG},
   {"Aborted_connects",         (char*) &aborted_connects,       SHOW_LONG},
@@ -4709,13 +4739,19 @@
   {"Handler_rollback",         (char*) &ha_rollback_count,      SHOW_LONG},
   {"Handler_update",           (char*) &ha_update_count,        SHOW_LONG},
   {"Handler_write",            (char*) &ha_write_count,         SHOW_LONG},
-  {"Key_blocks_used",          (char*) &my_blocks_used,        SHOW_LONG_CONST},
-  {"Key_read_requests",        (char*) &my_cache_r_requests,   SHOW_LONG},
-  {"Key_reads",                (char*) &my_cache_read,         SHOW_LONG},
-  {"Key_write_requests",       (char*) &my_cache_w_requests,   SHOW_LONG},
-  {"Key_writes",               (char*) &my_cache_write,        SHOW_LONG},
+  {"Key_blocks_not_flushed",   (char*) &dflt_key_cache_var.global_blocks_changed,
+   SHOW_KEY_CACHE_LONG},
+  {"Key_blocks_used",          (char*) &dflt_key_cache_var.global_blocks_used,
+   SHOW_KEY_CACHE_LONG},
+  {"Key_read_requests",        (char*) &dflt_key_cache_var.global_cache_r_requests,
+   SHOW_KEY_CACHE_LONG},
+  {"Key_reads",                (char*) &dflt_key_cache_var.global_cache_read,
+   SHOW_KEY_CACHE_LONG},
+  {"Key_write_requests",       (char*) &dflt_key_cache_var.global_cache_w_requests,
+   SHOW_KEY_CACHE_LONG},
+  {"Key_writes",               (char*) &dflt_key_cache_var.global_cache_write,
+   SHOW_KEY_CACHE_LONG},
   {"Max_used_connections",     (char*) &max_used_connections,  SHOW_LONG},
-  {"Not_flushed_key_blocks",   (char*) &my_blocks_changed,     SHOW_LONG_CONST},
   {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use,    SHOW_LONG_CONST},
   {"Open_tables",              (char*) 0,                       SHOW_OPENTABLES},
   {"Open_files",               (char*) &my_file_opened,         SHOW_LONG_CONST},
@@ -4786,8 +4822,8 @@
 
 static void print_version(void)
 {
-  printf("%s  Ver %s for %s on %s\n",my_progname,
-	 server_version,SYSTEM_TYPE,MACHINE_TYPE);
+  printf("%s  Ver %s for %s on %s (%s)\n",my_progname,
+	 server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
 }
 
 static void use_help(void)
@@ -4906,6 +4942,8 @@
   national_charset_info= &my_charset_utf8_general_ci;
   table_alias_charset= &my_charset_bin;
 
+  opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
+
   /* Things with default values that are not zero */
   delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
   opt_specialflag= SPECIAL_ENGLISH;
@@ -4927,7 +4965,9 @@
   threads.empty();
   thread_cache.empty();
   key_caches.empty();
-  if (!get_or_create_key_cache("default", 7))
+  multi_keycache_init();
+  if (!(sql_key_cache= get_or_create_key_cache(default_key_cache_base.str,
+					       default_key_cache_base.length)))
     exit(1);
 
   /* Initialize structures that is used when processing options */
@@ -4962,11 +5002,6 @@
 
 
   /* Set default values for some option variables */
-  global_system_variables.collation_server= default_charset_info;
-  global_system_variables.collation_database= default_charset_info;
-  global_system_variables.collation_connection= default_charset_info;
-  global_system_variables.character_set_results= default_charset_info;
-  global_system_variables.character_set_client= default_charset_info;
   global_system_variables.table_type=   DB_TYPE_MYISAM;
   global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
   global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
@@ -4975,10 +5010,6 @@
   max_system_variables.max_join_size=   (ulonglong) HA_POS_ERROR;
   global_system_variables.old_passwords= 0;
 
-  init_global_datetime_format(DATE_FORMAT_TYPE, 0);
-  init_global_datetime_format(TIME_FORMAT_TYPE, 0);
-  init_global_datetime_format(DATETIME_FORMAT_TYPE, 0);
-
   /* Variables that depends on compile options */
 #ifndef DBUG_OFF
   default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
@@ -5026,9 +5057,9 @@
   have_crypt=SHOW_OPTION_NO;
 #endif
 #ifdef HAVE_COMPRESS
-  SHOW_COMP_OPTION have_compress= SHOW_OPTION_YES;
+  have_compress= SHOW_OPTION_YES;
 #else
-  SHOW_COMP_OPTION have_compress= SHOW_OPTION_NO;
+  have_compress= SHOW_OPTION_NO;
 #endif
 #ifdef HAVE_LIBWRAP
   libwrapName= NullS;
@@ -5369,13 +5400,12 @@
     break;
   case OPT_TABLE_TYPE:
   {
-    int type;
-    if ((type=find_type(argument, &ha_table_typelib, 2)) <= 0)
+    if ((enum db_type)((global_system_variables.table_type= 
+    	  ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
     {
       fprintf(stderr,"Unknown table type: %s\n",argument);
       exit(1);
     }
-    global_system_variables.table_type= type-1;
     break;
   }
   case OPT_SERVER_ID:
@@ -5553,21 +5583,28 @@
 mysql_getopt_value(const char *keyname, uint key_length,
 		   const struct my_option *option)
 {
-  if (!key_length)
-  {
-    keyname= "default";
-    key_length= 7;
-  }
   switch (option->id) {
   case OPT_KEY_BUFFER_SIZE:
+  case OPT_KEY_CACHE_BLOCK_SIZE:
+  case OPT_KEY_CACHE_DIVISION_LIMIT:
+  case OPT_KEY_CACHE_AGE_THRESHOLD:
   {
     KEY_CACHE *key_cache;
     if (!(key_cache= get_or_create_key_cache(keyname, key_length)))
       exit(1);
-    return (gptr*) &key_cache->size;
+    switch (option->id) {
+    case OPT_KEY_BUFFER_SIZE:
+      return (gptr*) &key_cache->param_buff_size;
+    case OPT_KEY_CACHE_BLOCK_SIZE:
+      return (gptr*) &key_cache->param_block_size;
+    case OPT_KEY_CACHE_DIVISION_LIMIT:
+      return (gptr*) &key_cache->param_division_limit;
+    case OPT_KEY_CACHE_AGE_THRESHOLD:
+      return (gptr*) &key_cache->param_age_threshold;
+    }
   }
   }
-  return option->value;
+ return option->value;
 }
 
 
@@ -5580,7 +5617,7 @@
     exit(ho_error);
   if (argc > 0)
   {
-    fprintf(stderr, "%s: Too many arguments.\nUse --help to get a list of available options\n", my_progname);
+    fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
     exit(ho_error);
   }
 
@@ -5631,16 +5668,18 @@
   table_alias_charset= (lower_case_table_names ?
 			files_charset_info :
 			&my_charset_bin);
-  /* QQ To be deleted when we have key cache variables in a struct */
-  {
-    NAMED_LIST *not_used;
-    keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7,
-					     &not_used))->size);
-  }
   if (opt_short_log_format)
     opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
   if (opt_log_queries_not_using_indexes)
     opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES;
+
+  if (init_global_datetime_format(TIMESTAMP_DATE,
+				  &global_system_variables.date_format) ||
+      init_global_datetime_format(TIMESTAMP_TIME,
+				  &global_system_variables.time_format) ||
+      init_global_datetime_format(TIMESTAMP_DATETIME,
+				  &global_system_variables.datetime_format))
+    exit(1);
 }
 
 
@@ -5742,62 +5781,79 @@
 */
 
 #ifdef SET_RLIMIT_NOFILE
+
+#ifndef RLIM_INFINITY
+#define RLIM_INFINITY ((uint) 0xffffffff)
+#endif
+
 static uint set_maximum_open_files(uint max_file_limit)
 {
   struct rlimit rlimit;
-  ulong old_cur;
+  uint old_cur;
+  DBUG_ENTER("set_maximum_open_files");
+  DBUG_PRINT("enter",("files: %u", max_file_limit));
 
   if (!getrlimit(RLIMIT_NOFILE,&rlimit))
   {
-    old_cur=rlimit.rlim_cur;
-    if (rlimit.rlim_cur >= max_file_limit)	// Nothing to do
-      return rlimit.rlim_cur;			/* purecov: inspected */
-    rlimit.rlim_cur=rlimit.rlim_max=max_file_limit;
+    old_cur= (uint) rlimit.rlim_cur;
+    DBUG_PRINT("info", ("rlim_cur: %u  rlim_max: %u",
+			(uint) rlimit.rlim_cur,
+			(uint) rlimit.rlim_max));
+    if (rlimit.rlim_cur >= max_file_limit ||
+	rlimit.rlim_cur == RLIM_INFINITY)
+      DBUG_RETURN(rlimit.rlim_cur);		/* purecov: inspected */
+    rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
     if (setrlimit(RLIMIT_NOFILE,&rlimit))
     {
       if (global_system_variables.log_warnings)
-	sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)",
+	sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %u (request: %u)",
 			old_cur, max_file_limit); /* purecov: inspected */
-      max_file_limit=old_cur;
+      max_file_limit= old_cur;
     }
     else
     {
+      rlimit.rlim_cur= 0;			// Safety if next call fails
       (void) getrlimit(RLIMIT_NOFILE,&rlimit);
-      if ((uint) rlimit.rlim_cur != max_file_limit &&
+      DBUG_PRINT("info", ("rlim_cur: %u", (uint) rlimit.rlim_cur));
+      if ((uint) rlimit.rlim_cur < max_file_limit &&
 	  global_system_variables.log_warnings)
-	sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)",
-			(ulong) rlimit.rlim_cur,
+	sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %u (request: %u)",
+			(uint) rlimit.rlim_cur,
 			max_file_limit); /* purecov: inspected */
-      max_file_limit=rlimit.rlim_cur;
+      max_file_limit= (uint) rlimit.rlim_cur;
     }
   }
-  return max_file_limit;
+  DBUG_PRINT("exit",("max_file_limit: %u", max_file_limit));
+  DBUG_RETURN(max_file_limit);
 }
 #endif
 
+
 #ifdef OS2
 static uint set_maximum_open_files(uint max_file_limit)
 {
-   LONG     cbReqCount;
-   ULONG    cbCurMaxFH, cbCurMaxFH0;
-   APIRET   ulrc;
-
-   // get current limit
-   cbReqCount = 0;
-   DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH0);
-
-   // set new limit
-   cbReqCount = max_file_limit - cbCurMaxFH0;
-   ulrc = DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH);
-   if (ulrc) {
-      sql_print_error("Warning: DosSetRelMaxFH couldn't increase number of open files to more than %d",
-         cbCurMaxFH0);
-      cbCurMaxFH = cbCurMaxFH0;
-   }
+  LONG     cbReqCount;
+  ULONG    cbCurMaxFH, cbCurMaxFH0;
+  APIRET   ulrc;
+  DBUG_ENTER("set_maximum_open_files");
+
+  // get current limit
+  cbReqCount = 0;
+  DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH0);
+
+  // set new limit
+  cbReqCount = max_file_limit - cbCurMaxFH0;
+  ulrc = DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH);
+  if (ulrc) {
+    sql_print_error("Warning: DosSetRelMaxFH couldn't increase number of open files to more than %d",
+		    cbCurMaxFH0);
+    cbCurMaxFH = cbCurMaxFH0;
+  }
 
-   return cbCurMaxFH;
+  DBUG_RETURN(cbCurMaxFH);
 }
 #endif
+
 
 /*
   Return a bitfield from a string of substrings separated by ','

--- 1.35/strings/Makefile.am	Wed Jun 11 09:14:40 2003
+++ 1.36/strings/Makefile.am	Fri Dec  5 05:00:50 2003
@@ -21,20 +21,20 @@
 
 # Exact one of ASSEMBLER_X
 if ASSEMBLER_x86
-ASRCS		= strings-x86.s longlong2str-x86.s
+ASRCS		= strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
 CSRCS		= bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
 else
 if ASSEMBLER_sparc32
 # These file MUST all be on the same line!! Otherwise automake
 # generats a very broken makefile
 ASRCS		= bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
-CSRCS		= strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
+CSRCS		= strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
 else
 #no assembler
 ASRCS		=
 # These file MUST all be on the same line!! Otherwise automake
 # generats a very broken makefile
-CSRCS		= strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
+CSRCS		= strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
 endif
 endif
 
@@ -47,6 +47,7 @@
                         ctype-ucs2.c ctype-tis620.c ctype-ujis.c \
                         xml.c strto.c strings-x86.s \
 			longlong2str.c longlong2str-x86.s \
+			my_strtoll10.c my_strtoll10-x86.s \
 			strxmov.c bmove_upp.c strappend.c strcont.c strend.c \
 			strfill.c strcend.c is_prefix.c strstr.c strinstr.c \
 			strmake.c strnmov.c strmov.c strnlen.c \

--- 1.33/support-files/mysql.server.sh	Sat Oct 25 00:17:55 2003
+++ 1.34/support-files/mysql.server.sh	Sat Dec  6 06:58:20 2003
@@ -109,19 +109,6 @@
 fi
 
 #
-# Set pid file if not given
-#
-if test -z "$pid_file"
-then
-  pid_file=$datadir/@PROGRAM_PREFIX@`@HOSTNAME@`@PROGRAM_SUFFIX@.pid
-else
-  case "$pid_file" in
-    /* ) ;;
-    * )  pid_file="$datadir/$pid_file" ;;
-  esac
-fi
-
-#
 # Test if someone changed datadir;  In this case we should also read the
 # default arguments from this directory
 #
@@ -133,6 +120,19 @@
 fi
 
 parse_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
+
+#
+# Set pid file if not given
+#
+if test -z "$pid_file"
+then
+  pid_file=$datadir/@PROGRAM_PREFIX@`@HOSTNAME@`@PROGRAM_SUFFIX@.pid
+else
+  case "$pid_file" in
+    /* ) ;;
+    * )  pid_file="$datadir/$pid_file" ;;
+  esac
+fi
 
 # Safeguard (relative paths, core dumps..)
 cd $basedir

--- 1.256/BitKeeper/etc/logging_ok	Thu Oct 23 03:01:44 2003
+++ 1.257/BitKeeper/etc/logging_ok	Fri Dec  5 04:25:40 2003
@@ -8,6 +8,7 @@
 administrador@stripped
 ahlentz@stripped
 akishkin@stripped
+antony@stripped
 arjen@stripped
 arjen@stripped
 arjen@stripped
@@ -50,6 +51,7 @@
 jani@stripped
 jani@stripped
 jani@stripped
+jani@stripped
 jcole@stripped
 jcole@stripped
 jcole@stripped
@@ -78,6 +80,7 @@
 monty@mashka.(none)
 monty@stripped
 monty@stripped
+monty@stripped
 monty@narttu.
 monty@stripped
 monty@rescue.
@@ -102,6 +105,7 @@
 peter@stripped
 peterg@stripped
 pgulutzan@stripped
+ram@deer.(none)
 ram@stripped
 ram@stripped
 ram@stripped
@@ -112,12 +116,14 @@
 salle@banica.(none)
 salle@geopard.(none)
 salle@stripped
+salle@stripped
 sasha@stripped
 serg@stripped
 serg@stripped
 serg@stripped
 serg@stripped
 serg@stripped
+sergefp@stripped
 sinisa@stripped
 tfr@stripped
 tfr@stripped

--- 1.38/libmysqld/Makefile.am	Thu Oct 23 03:34:10 2003
+++ 1.39/libmysqld/Makefile.am	Fri Dec  5 05:00:13 2003
@@ -38,7 +38,7 @@
 
 noinst_HEADERS =	embedded_priv.h
 
-sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
+sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
 	ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \
 	ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
 	hostname.cc init.cc password.c \
@@ -92,10 +92,10 @@
 		  ar x $$file; \
 		  for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
 		  ar q ../libmysqld_int2.a *.o ; \
-		  rm *.o ; \
+		  rm -f *.o ; \
 		done
 		mv libmysqld_int2.a libmysqld.a
-		rm tmp/*
+		rm -f tmp/*
 		$(RANLIB) libmysqld.a
 
 ## XXX: any time the client interface changes, we'll need to bump

--- 1.159/BitKeeper/etc/ignore	Thu Oct 23 03:01:39 2003
+++ 1.160/BitKeeper/etc/ignore	Fri Dec  5 04:25:36 2003
@@ -74,6 +74,7 @@
 Docs/tex.fmt
 Docs/texi2dvi.out
 INSTALL-SOURCE
+INSTALL-WIN-SOURCE
 Logs/*
 MIRRORS
 Makefile
@@ -420,6 +421,7 @@
 libmysqld/sql_update.cc
 libmysqld/sql_yacc.cc
 libmysqld/stacktrace.c
+libmysqld/strfunc.cc
 libmysqld/table.cc
 libmysqld/thr_malloc.cc
 libmysqld/time.cc
@@ -593,6 +595,7 @@
 sql/sql_yacc.h
 sql/sql_yacc.output
 sql/sql_yacc.yy.orig
+sql/udf_example.so
 sql_error.cc
 sql_prepare.cc
 stamp-h

--- 1.12/libmysql_r/Makefile.am	Fri May  9 13:17:41 2003
+++ 1.13/libmysql_r/Makefile.am	Fri Dec  5 05:00:12 2003
@@ -19,7 +19,7 @@
 
 target = libmysqlclient_r.la
 target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
-## LIBS = @LIBS@
+LIBS = @LIBS@ @openssl_libs@
 
 INCLUDES =	@MT_INCLUDES@ -I../include -I$(top_srcdir)/include $(openssl_includes)
 
Thread
bk commit into 4.1 tree (jww:1.1657)jwythe6 Dec