List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:February 2 2006 8:27pm
Subject:bk commit into 5.1 tree (konstantin:1.2129)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja 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
  1.2129 06/02/02 23:27:06 konstantin@stripped +52 -0
  Merge mysql.com:/home/kostja/mysql/tmp_merge
  into  mysql.com:/home/kostja/mysql/mysql-5.1-merge

  tests/mysql_client_test.c
    1.170 06/02/02 23:26:53 konstantin@stripped +1 -4
    Manual merge.

  sql/share/errmsg.txt
    1.79 06/02/02 23:25:37 konstantin@stripped +0 -0
    SCCS merged

  sql/ha_archive.cc
    1.77 06/02/02 23:22:05 konstantin@stripped +3 -6
    Manual merge.

  mysql-test/t/information_schema.test
    1.69 06/02/02 23:21:36 konstantin@stripped +4 -0
    Manual merge.

  mysql-test/r/information_schema.result
    1.107 06/02/02 23:21:04 konstantin@stripped +0 -0
    SCCS merged

  zlib/Makefile.am
    1.8 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/tools/ndb_size.pl
    1.6 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/main.cpp
    1.48 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.hpp
    1.18 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.cpp
    1.58 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.41 06/02/02 23:20:22 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.90 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.59 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.59 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Configuration.hpp
    1.18 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.44 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/main.cpp
    1.57 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/util/SocketServer.cpp
    1.19 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.33 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/SysLogHandler.cpp
    1.6 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/Logger.cpp
    1.14 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/LogHandler.cpp
    1.13 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/FileLogHandler.cpp
    1.11 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/include/mgmcommon/ConfigRetriever.hpp
    1.19 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/include/mgmapi/mgmapi.h
    1.49 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/include/logger/Logger.hpp
    1.8 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/include/logger/LogHandler.hpp
    1.8 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  storage/myisam/ft_update.c
    1.41 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  sql/table.h
    1.128 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  sql/table.cc
    1.206 06/02/02 23:20:21 konstantin@stripped +0 -0
    Auto merged

  sql/sql_yacc.yy
    1.450 06/02/02 23:20:20 konstantin@stripped +0 -0
    Auto merged

  sql/sql_show.cc
    1.299 06/02/02 23:20:19 konstantin@stripped +0 -0
    Auto merged

  sql/sql_select.cc
    1.385 06/02/02 23:20:19 konstantin@stripped +0 -0
    Auto merged

  sql/sql_prepare.cc
    1.160 06/02/02 23:20:18 konstantin@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.178 06/02/02 23:20:18 konstantin@stripped +0 -0
    Auto merged

  sql/sp_head.h
    1.78 06/02/02 23:20:18 konstantin@stripped +0 -0
    Auto merged

  sql/sp_head.cc
    1.199 06/02/02 23:20:18 konstantin@stripped +0 -0
    Auto merged

  sql/protocol.cc
    1.113 06/02/02 23:20:18 konstantin@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.529 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  sql/item_func.cc
    1.273 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  sql/field.cc
    1.299 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/sp.test
    1.173 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/sp-error.test
    1.102 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/rpl_sp.test
    1.15 06/02/02 23:20:17 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/tools/ndb_size.pl
    1.2.3.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/tools/ndb_size.pl -> storage/ndb/tools/ndb_size.pl

  storage/ndb/src/mgmsrv/main.cpp
    1.41.6.3 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/main.cpp -> storage/ndb/src/mgmsrv/main.cpp

  storage/ndb/src/common/logger/SysLogHandler.cpp
    1.4.1.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/logger/SysLogHandler.cpp -> storage/ndb/src/common/logger/SysLogHandler.cpp

  storage/ndb/src/common/logger/Logger.cpp
    1.10.4.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/logger/Logger.cpp -> storage/ndb/src/common/logger/Logger.cpp

  storage/ndb/src/common/logger/LogHandler.cpp
    1.8.4.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/logger/LogHandler.cpp -> storage/ndb/src/common/logger/LogHandler.cpp

  storage/ndb/src/common/logger/FileLogHandler.cpp
    1.9.1.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/logger/FileLogHandler.cpp -> storage/ndb/src/common/logger/FileLogHandler.cpp

  storage/ndb/include/mgmcommon/ConfigRetriever.hpp
    1.16.2.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/include/mgmcommon/ConfigRetriever.hpp -> storage/ndb/include/mgmcommon/ConfigRetriever.hpp

  storage/ndb/include/mgmapi/mgmapi.h
    1.42.5.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/include/mgmapi/mgmapi.h -> storage/ndb/include/mgmapi/mgmapi.h

  storage/ndb/include/logger/Logger.hpp
    1.6.1.2 06/02/02 23:20:16 konstantin@stripped +0 -0
    Merge rename: ndb/include/logger/Logger.hpp -> storage/ndb/include/logger/Logger.hpp

  mysql-test/r/type_float.result
    1.44 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/sp.result
    1.184 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/sp-error.result
    1.101 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/rpl_sp.result
    1.18 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  mysql-test/ndb/ndbcluster.sh
    1.49 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  libmysql/libmysql.c
    1.233 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  configure.in
    1.336 06/02/02 23:20:16 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.hpp
    1.13.3.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.hpp -> storage/ndb/src/mgmsrv/Services.hpp

  storage/ndb/src/mgmsrv/Services.cpp
    1.45.13.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.cpp -> storage/ndb/src/mgmsrv/Services.cpp

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.30.9.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.hpp -> storage/ndb/src/mgmsrv/MgmtSrvr.hpp

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.73.17.3 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.49.7.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp -> storage/ndb/src/mgmclient/CommandInterpreter.cpp

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.44.14.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/mgmapi/mgmapi.cpp -> storage/ndb/src/mgmapi/mgmapi.cpp

  storage/ndb/src/kernel/vm/Configuration.hpp
    1.15.2.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/kernel/vm/Configuration.hpp -> storage/ndb/src/kernel/vm/Configuration.hpp

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.39.2.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/kernel/vm/Configuration.cpp -> storage/ndb/src/kernel/vm/Configuration.cpp

  storage/ndb/src/kernel/main.cpp
    1.48.9.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/kernel/main.cpp -> storage/ndb/src/kernel/main.cpp

  storage/ndb/src/common/util/SocketServer.cpp
    1.15.3.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/util/SocketServer.cpp -> storage/ndb/src/common/util/SocketServer.cpp

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.24.8.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/src/common/mgmcommon/ConfigRetriever.cpp -> storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp

  storage/ndb/include/logger/LogHandler.hpp
    1.6.1.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: ndb/include/logger/LogHandler.hpp -> storage/ndb/include/logger/LogHandler.hpp

  storage/myisam/ft_update.c
    1.37.1.2 06/02/02 23:20:15 konstantin@stripped +0 -0
    Merge rename: myisam/ft_update.c -> storage/myisam/ft_update.c

  BitKeeper/etc/ignore
    1.225 06/02/02 23:19:51 konstantin@stripped +1 -142
    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:	konstantin
# Host:	oak.local
# Root:	/home/kostja/mysql/mysql-5.1-merge/RESYNC

--- 1.335/configure.in	2006-02-01 15:33:31 +03:00
+++ 1.336/configure.in	2006-02-02 23:20:16 +03:00
@@ -13,7 +13,8 @@
 PROTOCOL_VERSION=10
 DOT_FRM_VERSION=6
 # See the libtool docs for information on how to do shared lib versions.
-SHARED_LIB_VERSION=15:0:0
+SHARED_LIB_MAJOR_VERSION=15
+SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
 
 # Set all version vars based on $VERSION. How do we do this more elegant ?
 # Remember that regexps needs to quote [ and ] since this is run through m4
@@ -60,6 +61,7 @@
 AC_SUBST(DOT_FRM_VERSION)
 AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
                    [Version of .frm files])
+AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 AC_SUBST(SHARED_LIB_VERSION)
 AC_SUBST(AVAILABLE_LANGUAGES)
 
@@ -338,6 +340,13 @@
 fi
 
 MYSQL_PROG_AR
+
+# libmysqlclient versioning when linked with GNU ld.
+if $LD --version 2>/dev/null|grep -q GNU; then
+  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver"
+  AC_CONFIG_FILES(libmysql/libmysql.ver)
+fi
+AC_SUBST(LD_VERSION_SCRIPT)
 
 # Avoid bug in fcntl on some versions of linux
 AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")

--- 1.232/libmysql/libmysql.c	2006-01-18 15:14:58 +03:00
+++ 1.233/libmysql/libmysql.c	2006-02-02 23:20:16 +03:00
@@ -2722,13 +2722,13 @@
     /* Send row request to the server */
     int4store(buff, stmt->stmt_id);
     int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
-    if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
-                             NullS, 0, 1))
+    if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
+                                            buff, sizeof(buff), NullS, 0, 1))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       return 1;
     }
-    if (cli_read_binary_rows(stmt))
+    if ((*mysql->methods->read_rows_from_cursor)(stmt))
       return 1;
     stmt->server_status= mysql->server_status;
 
@@ -5101,9 +5101,9 @@
   DBUG_ENTER("mysql_autocommit");
   DBUG_PRINT("enter", ("mode : %d", auto_mode));
 
-  if (auto_mode) /* set to true */
-    DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=1", 16));
-  DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=0", 16));
+  DBUG_RETURN((my_bool) mysql_real_query(mysql, auto_mode ?
+                                         "set autocommit=1":"set autocommit=0",
+                                         16));
 }
 
 

--- 1.37.1.1/myisam/ft_update.c	2006-01-23 19:06:00 +03:00
+++ 1.41/storage/myisam/ft_update.c	2006-02-02 23:20:21 +03:00
@@ -96,18 +96,22 @@
 /* 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, my_bool with_alloc)
+                  const byte *record, my_bool with_alloc,
+                  MYSQL_FTPARSER_PARAM *param)
 {
   FT_SEG_ITERATOR ftsi;
+  struct st_mysql_ftparser *parser;
   DBUG_ENTER("_mi_ft_parse");
 
   _mi_ft_segiterator_init(info, keynr, record, &ftsi);
 
   ft_parse_init(parsed, info->s->keyinfo[keynr].seg->charset);
+  parser= info->s->keyinfo[keynr].parser;
   while (_mi_ft_segiterator(&ftsi))
   {
     if (ftsi.pos)
-      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc))
+      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc, parser,
+                   param))
         DBUG_RETURN(1);
   }
   DBUG_RETURN(0);
@@ -116,10 +120,12 @@
 FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record)
 {
   TREE ptree;
+  MYSQL_FTPARSER_PARAM *param;
   DBUG_ENTER("_mi_ft_parserecord");
-
+  if (! (param= ftparser_call_initializer(info, keynr)))
+    DBUG_RETURN(NULL);
   bzero((char*) &ptree, sizeof(ptree));
-  if (_mi_ft_parse(&ptree, info, keynr, record,0))
+  if (_mi_ft_parse(&ptree, info, keynr, record, 0, param))
     DBUG_RETURN(NULL);
 
   DBUG_RETURN(ft_linearize(&ptree));

--- 1.298/sql/field.cc	2006-02-02 16:54:34 +03:00
+++ 1.299/sql/field.cc	2006-02-02 23:20:17 +03:00
@@ -5877,7 +5877,7 @@
                                                     field_length/
                                                     field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr,from,copy_length);
+  memmove(ptr, from, copy_length);
 
   /* Append spaces if the string was shorter than the field. */
   if (copy_length < field_length)
@@ -6293,7 +6293,7 @@
 						    field_length/
 						    field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr + length_bytes, from, copy_length);
+  memmove(ptr + length_bytes, from, copy_length);
   if (length_bytes == 1)
     *ptr= (uchar) copy_length;
   else

--- 1.272/sql/item_func.cc	2006-02-02 16:56:12 +03:00
+++ 1.273/sql/item_func.cc	2006-02-02 23:20:17 +03:00
@@ -431,12 +431,19 @@
 
 void Item_func::fix_num_length_and_dec()
 {
-  decimals= 0;
+  uint fl_length= 0;
+  decimals=0;
   for (uint i=0 ; i < arg_count ; i++)
   {
-    set_if_bigger(decimals, args[i]->decimals);
+    set_if_bigger(decimals,args[i]->decimals);
+    set_if_bigger(fl_length, args[i]->max_length);
+  }
+  max_length=float_length(decimals);
+  if (fl_length > max_length)
+  {
+    decimals= NOT_FIXED_DEC;
+    max_length= float_length(NOT_FIXED_DEC);
   }
-  max_length= float_length(decimals);
 }
 
 

--- 1.528/sql/mysqld.cc	2006-02-02 17:19:02 +03:00
+++ 1.529/sql/mysqld.cc	2006-02-02 23:20:17 +03:00
@@ -5120,7 +5120,7 @@
    "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).",
    (gptr*) &innobase_flush_log_at_trx_commit,
    (gptr*) &innobase_flush_log_at_trx_commit,
-   0, GET_UINT, OPT_ARG,  1, 0, 2, 0, 0, 0},
+   0, GET_ULONG, OPT_ARG,  1, 0, 2, 0, 0, 0},
   {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
    "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
    (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,

--- 1.112/sql/protocol.cc	2006-01-04 13:18:54 +03:00
+++ 1.113/sql/protocol.cc	2006-02-02 23:20:18 +03:00
@@ -601,9 +601,23 @@
       else
       {
         /* With conversion */
+        uint max_char_len;
         int2store(pos, thd_charset->number);
-        uint char_len= field.length / item->collation.collation->mbmaxlen;
-        int4store(pos+2, char_len * thd_charset->mbmaxlen);
+        /*
+          For TEXT/BLOB columns, field_length describes the maximum data
+          length in bytes. There is no limit to the number of characters
+          that a TEXT column can store, as long as the data fits into
+          the designated space.
+          For the rest of textual columns, field_length is evaluated as
+          char_count * mbmaxlen, where character count is taken from the
+          definition of the column. In other words, the maximum number
+          of characters here is limited by the column definition.
+        */
+        max_char_len= (field.type >= (int) MYSQL_TYPE_TINY_BLOB &&
+                      field.type <= (int) MYSQL_TYPE_BLOB) ?
+                      field.length / item->collation.collation->mbminlen :
+                      field.length / item->collation.collation->mbmaxlen;
+        int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
       }
       pos[6]= field.type;
       int2store(pos+7,field.flags);

--- 1.177/sql/sql_acl.cc	2006-02-02 16:48:05 +03:00
+++ 1.178/sql/sql_acl.cc	2006-02-02 23:20:18 +03:00
@@ -1001,7 +1001,7 @@
       {
 	if (compare_hostname(&acl_db->host, host, ip))
 	{
-	  if (!acl_db->db || (db && !strcmp(acl_db->db, db)))
+	  if (!acl_db->db || (db && !wild_compare(db, acl_db->db, 0)))
 	  {
 	    sctx->db_access= acl_db->access;
 	    break;

--- 1.384/sql/sql_select.cc	2006-02-02 11:59:19 +03:00
+++ 1.385/sql/sql_select.cc	2006-02-02 23:20:19 +03:00
@@ -9117,7 +9117,7 @@
 
     field++;
   }
-  *field= NULL;                                 /* mark the end of the list */
+  *field= NULL;                             /* mark the end of the list */
   share->blob_field[blob_count]= 0;            /* mark the end of the list */
   share->blob_fields= blob_count;
 
@@ -11659,6 +11659,12 @@
 	goto err;
     }
   }
+
+  /* Fill schema tables with data before filesort if it's necessary */
+  if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
+      get_schema_tables_result(join))
+    goto err;
+
   if (table->s->tmp_table)
     table->file->info(HA_STATUS_VARIABLE);	// Get record count
   table->sort.found_records=filesort(thd, table,sortorder, length,

--- 1.298/sql/sql_show.cc	2006-02-02 16:48:06 +03:00
+++ 1.299/sql/sql_show.cc	2006-02-02 23:20:19 +03:00
@@ -4550,7 +4550,16 @@
     TABLE_LIST *table_list= tab->table->pos_in_table_list;
     if (table_list->schema_table && thd->fill_derived_tables())
     {
-      if (&lex->unit != lex->current_select->master_unit()) // is subselect
+      bool is_subselect= (&lex->unit != lex->current_select->master_unit());
+      /*
+        The schema table is already processed and 
+        the statement is not a subselect.
+        So we don't need to handle this table again.
+      */
+      if (table_list->is_schema_table_processed && !is_subselect)
+        continue;
+
+      if (is_subselect) // is subselect
       {
         table_list->table->file->extra(HA_EXTRA_RESET_STATE);
         table_list->table->file->delete_all_rows();
@@ -4563,6 +4572,7 @@
       if (table_list->schema_table->fill_table(thd, table_list,
                                                tab->select_cond))
         result= 1;
+      table_list->is_schema_table_processed= TRUE;
     }
   }
   thd->no_warnings_for_error= 0;

--- 1.449/sql/sql_yacc.yy	2006-02-02 12:03:05 +03:00
+++ 1.450/sql/sql_yacc.yy	2006-02-02 23:20:20 +03:00
@@ -1642,11 +1642,26 @@
 sp_name:
 	  ident '.' ident
 	  {
+            if (!$1.str || check_db_name($1.str))
+            {
+	      my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
+	      YYABORT;
+	    }
+	    if (check_routine_name($3))
+            {
+	      my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
+	      YYABORT;
+	    }
 	    $$= new sp_name($1, $3);
 	    $$->init_qname(YYTHD);
 	  }
 	| ident
 	  {
+	    if (check_routine_name($1))
+            {
+	      my_error(ER_SP_WRONG_NAME, MYF(0), $1.str);
+	      YYABORT;
+	    }
 	    $$= sp_name_current_db_new(YYTHD, $1);
 	  }
 	;

--- 1.127/sql/table.h	2006-02-01 16:47:04 +03:00
+++ 1.128/sql/table.h	2006-02-02 23:20:21 +03:00
@@ -560,6 +560,7 @@
   st_select_lex_unit *derived;		/* SELECT_LEX_UNIT of derived table */
   ST_SCHEMA_TABLE *schema_table;        /* Information_schema table */
   st_select_lex	*schema_select_lex;
+  bool is_schema_table_processed;
   /*
     True when the view field translation table is used to convert
     schema table fields for backwards compatibility with SHOW command.

--- 1.78/sql/share/errmsg.txt	2006-02-02 11:59:20 +03:00
+++ 1.79/sql/share/errmsg.txt	2006-02-02 23:25:37 +03:00
@@ -5798,3 +5798,5 @@
         eng "You can't write-lock a log table. Only read access is possible."
 ER_CANT_READ_LOCK_LOG_TABLE
         eng "You can't use usual read lock with log tables. Try READ LOCAL instead."
+ER_SP_WRONG_NAME 42000
+	eng "Incorrect routine name '%-.64s'"

--- 1.76/sql/ha_archive.cc	2006-01-30 15:09:02 +03:00
+++ 1.77/sql/ha_archive.cc	2006-02-02 23:22:05 +03:00
@@ -139,6 +139,10 @@
 
 /* Static declarations for handerton */
 static handler *archive_create_handler(TABLE_SHARE *table);
+/*
+  Number of rows that will force a bulk insert.
+*/
+#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2
 
 
 /* dummy handlerton - only to have something to return from archive_db_init */
@@ -1302,7 +1306,8 @@
 void ha_archive::start_bulk_insert(ha_rows rows)
 {
   DBUG_ENTER("ha_archive::start_bulk_insert");
-  bulk_insert= TRUE;
+  if (!rows || rows >= ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT)
+    bulk_insert= TRUE;
   DBUG_VOID_RETURN;
 }
 

--- 1.17/mysql-test/r/rpl_sp.result	2006-01-12 18:45:07 +03:00
+++ 1.18/mysql-test/r/rpl_sp.result	2006-02-02 23:20:16 +03:00
@@ -401,5 +401,18 @@
 select * from t1;
 a
 1
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(col VARCHAR(10));
+CREATE PROCEDURE p1(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg);
+CALL p1('test');
+SELECT * FROM t1;
+col
+test
+SELECT * FROM t1;
+col
+test
+DROP PROCEDURE p1;
 drop table t1;
 reset master;

--- 1.14/mysql-test/t/rpl_sp.test	2006-01-12 19:05:03 +03:00
+++ 1.15/mysql-test/t/rpl_sp.test	2006-02-02 23:20:17 +03:00
@@ -403,6 +403,42 @@
 connection slave;
 select * from t1;
 
+#
+# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
+# Log for 5.0.18"
+#
+
+# Prepare environment.
+
+connection master;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Test case.
+
+CREATE TABLE t1(col VARCHAR(10));
+
+CREATE PROCEDURE p1(arg VARCHAR(10))
+  INSERT INTO t1 VALUES(arg);
+
+CALL p1('test');
+
+SELECT * FROM t1;
+
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+
+# Cleanup.
+
+connection master;
+
+DROP PROCEDURE p1;
+
 # cleanup
 connection master;
 drop table t1;

--- 1.106/mysql-test/r/information_schema.result	2006-02-01 16:52:27 +03:00
+++ 1.107/mysql-test/r/information_schema.result	2006-02-02 23:21:04 +03:00
@@ -1126,6 +1126,19 @@
 DROP VIEW v1;
 DROP FUNCTION func1;
 DROP FUNCTION func2;
+create database mysqltest;
+create table mysqltest.t1(a int);
+select table_schema from information_schema.tables where table_schema='mysqltest';
+table_schema
+drop database mysqltest;
+select column_type, group_concat(table_schema, '.', table_name), count(*) as num
+from information_schema.columns where
+table_schema='information_schema' and
+(column_type = 'varchar(7)' or column_type = 'varchar(20)')
+group by column_type order by num;
+column_type	group_concat(table_schema, '.', table_name)	num
+varchar(20)	information_schema.COLUMNS	1
+varchar(7)	information_schema.ROUTINES,information_schema.VIEWS	2
 select * from information_schema.engines WHERE ENGINE="MyISAM";
 ENGINE	SUPPORT	COMMENT	TRANSACTIONS	XA	SAVEPOINTS
 MyISAM	ENABLED	Default engine as of MySQL 3.23 with great performance	NO	NO	NO

--- 1.68/mysql-test/t/information_schema.test	2006-01-19 05:56:00 +03:00
+++ 1.69/mysql-test/t/information_schema.test	2006-02-02 23:21:36 +03:00
@@ -794,6 +794,29 @@
 DROP VIEW v1;
 DROP FUNCTION func1;
 DROP FUNCTION func2;
+
+#
+# Bug #15851 Unlistable directories yield no info from information_schema
+#
+create database mysqltest;
+create table mysqltest.t1(a int);
+--exec chmod -r $MYSQL_TEST_DIR/var/master-data/mysqltest
+select table_schema from information_schema.tables where table_schema='mysqltest';
+--exec chmod +r $MYSQL_TEST_DIR/var/master-data/mysqltest
+drop database mysqltest;
+
+#
+# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
+#
+select column_type, group_concat(table_schema, '.', table_name), count(*) as num
+from information_schema.columns where
+table_schema='information_schema' and
+(column_type = 'varchar(7)' or column_type = 'varchar(20)')
+group by column_type order by num;
+
+#
+# End of 5.0 tests.
+#
 # Show engines
 #
 

--- 1.7/zlib/Makefile.am	2005-12-18 20:02:38 +03:00
+++ 1.8/zlib/Makefile.am	2006-02-02 23:20:22 +03:00
@@ -16,6 +16,8 @@
 
 # Process this file with automake to create Makefile.in
 
+INCLUDES=		-I$(top_builddir)/include -I$(top_srcdir)/include
+
 pkglib_LTLIBRARIES=libz.la
 
 libz_la_LDFLAGS= -version-info 3:3:2

--- 1.42.5.1/ndb/include/mgmapi/mgmapi.h	2006-01-16 16:13:13 +03:00
+++ 1.49/storage/ndb/include/mgmapi/mgmapi.h	2006-02-02 23:20:21 +03:00
@@ -171,7 +171,6 @@
     = NODE_TYPE_MGM
 #endif
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
-    ,NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP  /** A replication node */
     ,NDB_MGM_NODE_TYPE_MIN     = 0          /** Min valid value*/
     ,NDB_MGM_NODE_TYPE_MAX     = 3          /** Max valid value*/
 #endif

--- 1.24.8.1/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-01-16 16:13:13 +03:00
+++ 1.33/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-02-02 23:20:21 +03:00
@@ -63,7 +63,10 @@
 
   if (ndb_mgm_set_connectstring(m_handle, _connect_string))
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     DBUG_VOID_RETURN;
   }
   resetError();
@@ -150,7 +153,10 @@
   ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
   if(conf == 0)
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     return 0;
   }
   return conf;
@@ -359,7 +365,10 @@
       no_retries--;
       NdbSleep_SecSleep(retry_delay_in_seconds);
     }
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
   } else
     setError(CR_ERROR, "management server handle not initialized");    
   return 0;

--- 1.39.2.1/ndb/src/kernel/vm/Configuration.cpp	2006-01-16 16:13:13 +03:00
+++ 1.44/storage/ndb/src/kernel/vm/Configuration.cpp	2006-02-02 23:20:21 +03:00
@@ -592,13 +592,9 @@
     case NODE_TYPE_API:
       noOfAPINodes++; // No of API processes
       break;
-    case NODE_TYPE_REP:
-      break;
     case NODE_TYPE_MGM:
       noOfMGMNodes++; // No of MGM processes
       break;
-    case NODE_TYPE_EXT_REP:
-      break;
     default:
       BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
       ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
@@ -663,14 +659,14 @@
      */
     // Can keep 65536 pages (= 0.5 GByte)
     cfg.put(CFG_ACC_DIR_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
     
     cfg.put(CFG_ACC_DIR_ARRAY,
 	    (noOfIndexPages >> 8) + 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     /*-----------------------------------------------------------------------*/
     // The extra operation records added are used by the scan and node 
@@ -686,14 +682,11 @@
     
     cfg.put(CFG_ACC_OVERFLOW_RECS,
 	    noOfIndexPages + 
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_PAGE8, 
 	    noOfIndexPages + 32);
     
-    cfg.put(CFG_ACC_ROOT_FRAG, 
-	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
-    
     cfg.put(CFG_ACC_TABLE, noOfAccTables);
     
     cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
@@ -776,7 +769,7 @@
      * Tup Size Alt values
      */
     cfg.put(CFG_TUP_FRAG, 
-	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_OP_RECS, 
 	    noOfLocalOperations + 50);
@@ -785,14 +778,14 @@
 	    noOfDataPages);
     
     cfg.put(CFG_TUP_PAGE_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_TABLE, 
 	    noOfMetaTables);
     
     cfg.put(CFG_TUP_TABLE_DESC, 
-	    2 * 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
-	    2 * 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
+	    6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
+	    10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
     
     cfg.put(CFG_TUP_STORED_PROC,
 	    noOfLocalScanRecords);
@@ -806,7 +799,7 @@
 	    noOfMetaTables /*noOfOrderedIndexes*/);
     
     cfg.put(CFG_TUX_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
     
     cfg.put(CFG_TUX_ATTRIBUTE, 
 	    noOfOrderedIndexes * 4);

--- 1.44.14.1/ndb/src/mgmapi/mgmapi.cpp	2006-01-16 16:13:13 +03:00
+++ 1.59/storage/ndb/src/mgmapi/mgmapi.cpp	2006-02-02 23:20:21 +03:00
@@ -184,7 +184,7 @@
     handle->cfg.~LocalConfig();
     new (&(handle->cfg)) LocalConfig;
     handle->cfg.init(0, 0); /* reset the LocalConfig */
-    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, mgmsrv ? mgmsrv : "");
     DBUG_RETURN(-1);
   }
   handle->cfg_i= -1;

--- 1.49.7.1/ndb/src/mgmclient/CommandInterpreter.cpp	2006-01-16 16:13:13 +03:00
+++ 1.59/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2006-02-02 23:20:21 +03:00
@@ -16,14 +16,7 @@
 
 #include <ndb_global.h>
 #include <my_sys.h>
-
-//#define HAVE_GLOBAL_REPLICATION
-
 #include <Vector.hpp>
-#ifdef  HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
 #include <mgmapi.h>
 
 class MgmtSrvr;
@@ -158,11 +151,6 @@
   int m_verbose;
   int try_reconnect;
   int m_error;
-#ifdef HAVE_GLOBAL_REPLICATION  
-  NdbRepHandle m_repserver;
-  const char *rep_host;
-  bool rep_connected;
-#endif
   struct NdbThread* m_event_thread;
 };
 
@@ -220,10 +208,6 @@
 #include <NdbMem.h>
 #include <EventLogger.hpp>
 #include <signaldata/SetLogLevelOrd.hpp>
-#include <signaldata/GrepImpl.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-
-#endif // HAVE_GLOBAL_REPLICATION
 #include "MgmtErrorReporter.hpp"
 #include <Parser.hpp>
 #include <SocketServer.hpp>
@@ -251,9 +235,6 @@
 "---------------------------------------------------------------------------\n"
 "HELP                                   Print help text\n"
 "HELP SHOW                              Help for SHOW command\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"HELP REPLICATION                       Help for global replication\n"
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
 "HELP DEBUG                             Help for debug compiled version\n"
 #endif
@@ -277,9 +258,6 @@
 "EXIT SINGLE USER MODE                  Exit single user mode\n"
 "<id> STATUS                            Print status\n"
 "<id> CLUSTERLOG {<category>=<level>}+  Set log level for cluster log\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"REP CONNECT <host:port>                Connect to REP server on host:port\n"
-#endif
 "PURGE STALE SESSIONS                   Reset reserved nodeid's in the mgmt server\n"
 "CONNECT [<connectstring>]              Connect to management server (reconnect if already connected)\n"
 "QUIT                                   Quit management client\n"
@@ -297,39 +275,6 @@
 #endif
 ;
 
-#ifdef HAVE_GLOBAL_REPLICATION
-static const char* helpTextRep =
-"---------------------------------------------------------------------------\n"
-" NDB Cluster -- Management Client -- Help for Global Replication\n"
-"---------------------------------------------------------------------------\n"
-"Commands should be executed on the standby NDB Cluster\n"
-"These features are in an experimental release state.\n"
-"\n"
-"Simple Commands:\n"
-"REP START              Start Global Replication\n" 
-"REP START REQUESTOR    Start Global Replication Requestor\n" 
-"REP STATUS             Show Global Replication status\n" 
-"REP STOP               Stop Global Replication\n"
-"REP STOP REQUESTOR     Stop Global Replication Requestor\n"
-"\n" 
-"Advanced Commands:\n"
-"REP START <protocol>   Starts protocol\n"
-"REP STOP <protocol>    Stops protocol\n"
-"<protocol> = TRANSFER | APPLY | DELETE\n"
-"\n"
-#ifdef VM_TRACE // DEBUG ONLY
-"Debugging commands:\n"
-"REP DELETE             Removes epochs stored in primary and standy systems\n"
-"REP DROP <tableid>     Drop a table in SS identified by table id\n"
-"REP SLOWSTOP           Stop Replication (Tries to synchonize with primary)\n" 
-"REP FASTSTOP           Stop Replication (Stops in consistent state)\n" 
-"<component> = SUBSCRIPTION\n"
-"              METALOG | METASCAN | DATALOG | DATASCAN\n"
-"              REQUESTOR | TRANSFER | APPLY | DELETE\n"
-#endif
-;
-#endif // HAVE_GLOBAL_REPLICATION
-
 #ifdef VM_TRACE // DEBUG ONLY
 static const char* helpTextDebug =
 "---------------------------------------------------------------------------\n"
@@ -401,11 +346,6 @@
   m_connected= false;
   m_event_thread= 0;
   try_reconnect = 0;
-#ifdef HAVE_GLOBAL_REPLICATION
-  rep_host = NULL;
-  m_repserver = NULL;
-  rep_connected = false;
-#endif
 }
 
 /*
@@ -698,13 +638,6 @@
     executePurge(allAfterFirstToken);
     DBUG_RETURN(true);
   } 
-#ifdef HAVE_GLOBAL_REPLICATION
-  else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
-	  strcasecmp(firstToken, "REP") == 0) {
-    executeRep(allAfterFirstToken);
-    DBUG_RETURN(true);
-  }
-#endif // HAVE_GLOBAL_REPLICATION
   else if(strcasecmp(firstToken, "ENTER") == 0 &&
 	  allAfterFirstToken != NULL &&
 	  strncasecmp(allAfterFirstToken, "SINGLE USER MODE ", 
@@ -967,11 +900,6 @@
     ndbout << endl;
   } else if (strcasecmp(parameters, "SHOW") == 0) {
     ndbout << helpTextShow;
-#ifdef HAVE_GLOBAL_REPLICATION
-  } else if (strcasecmp(parameters, "REPLICATION") == 0 ||
-	     strcasecmp(parameters, "REP") == 0) {
-    ndbout << helpTextRep;
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
   } else if (strcasecmp(parameters, "DEBUG") == 0) {
     ndbout << helpTextDebug;
@@ -1216,8 +1144,6 @@
       case NDB_MGM_NODE_TYPE_UNKNOWN:
         ndbout << "Error: Unknown Node Type" << endl;
         return;
-      case NDB_MGM_NODE_TYPE_REP:
-	abort();
       }
     }
 
@@ -2094,226 +2020,5 @@
   ndbout << "Invalid arguments: expected <BackupId>" << endl;
   return;
 }
-
-#ifdef HAVE_GLOBAL_REPLICATION
-/*****************************************************************************
- * Global Replication
- *
- * For information about the different commands, see
- * GrepReq::Request in file signaldata/grepImpl.cpp.
- *
- * Below are commands as of 2003-07-05 (may change!):
- * START = 0,            ///< Start Global Replication (all phases)
- * START_METALOG = 1,    ///< Start Global Replication (all phases)
- * START_METASCAN = 2,   ///< Start Global Replication (all phases)
- * START_DATALOG = 3,    ///< Start Global Replication (all phases)
- * START_DATASCAN = 4,   ///< Start Global Replication (all phases)
- * START_REQUESTOR = 5,  ///< Start Global Replication (all phases)
- * ABORT = 6,            ///< Immediate stop (removes subscription)
- * SLOW_STOP = 7,        ///< Stop after finishing applying current GCI epoch
- * FAST_STOP = 8,        ///< Stop after finishing applying all PS GCI epochs
- * START_TRANSFER = 9,   ///< Start SS-PS transfer
- * STOP_TRANSFER = 10,   ///< Stop SS-PS transfer
- * START_APPLY = 11,     ///< Start applying GCI epochs in SS
- * STOP_APPLY = 12,      ///< Stop applying GCI epochs in SS
- * STATUS = 13,           ///< Status
- * START_SUBSCR = 14,
- * REMOVE_BUFFERS = 15,
- * DROP_TABLE = 16
-
- *****************************************************************************/
-
-void
-CommandInterpreter::executeRep(char* parameters) 
-{
-  if (emptyString(parameters)) {
-    ndbout << helpTextRep;
-    return;
-  }
-
-  char * line = my_strdup(parameters,MYF(MY_WME));
-  My_auto_ptr<char> ap1((char*)line);
-  char * firstToken = strtok(line, " ");
-  
-  struct ndb_rep_reply  reply;
-  unsigned int          repId;
-
-
-  if (!strcasecmp(firstToken, "CONNECT")) {
-    char * host = strtok(NULL, "\0");
-    for (unsigned int i = 0; i < strlen(host); ++i) {
-      host[i] = tolower(host[i]);
-    }
-    
-    if(host == NULL)
-    {
-      ndbout_c("host:port must be specified.");
-      return;
-    }
-    
-    if(rep_connected) {
-      if(m_repserver != NULL) {
-	ndb_rep_disconnect(m_repserver);
-	rep_connected = false;
-      }       
-    }
-          
-    if(m_repserver == NULL)
-      m_repserver = ndb_rep_create_handle();
-    if(ndb_rep_connect(m_repserver, host) < 0)
-      ndbout_c("Failed to connect to %s", host); 
-    else
-      rep_connected=true;
-    return;
-    
-    if(!rep_connected) {
-      ndbout_c("Not connected to REP server");
-    }
-  }
-    
-  /********
-   * START 
-   ********/
-  if (!strcasecmp(firstToken, "START")) {
-    
-    unsigned int          req;
-    char *startType = strtok(NULL, "\0");
-    
-    if (startType == NULL) {                
-      req = GrepReq::START;
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::START_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::START_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::START_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::START_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::START_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::START_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::START_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::START_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::START_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION START'");
-      return;
-    }
-
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-    
-    if (result != 0) {
-      ndbout << "Start of Global Replication failed" << endl;
-    } else {
-      ndbout << "Start of Global Replication ordered" << endl;
-    }
-    return;
-  }
-
-  /********
-   * STOP
-   ********/
-  if (!strcasecmp(firstToken, "STOP")) {    
-    unsigned int          req;
-    char *startType = strtok(NULL, " ");
-    unsigned int epoch = 0;
-    
-    if (startType == NULL) {                 
-      /**
-       * Stop immediately
-       */
-      req = GrepReq::STOP;
-    } else if (!strcasecmp(startType, "EPOCH")) {  
-      char *strEpoch = strtok(NULL, "\0");
-      if(strEpoch == NULL) {
-	ndbout_c("Epoch expected!");
-	return;
-      }
-      req = GrepReq::STOP;
-      epoch=atoi(strEpoch);      
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::STOP_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::STOP_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::STOP_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::STOP_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::STOP_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::STOP_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::STOP_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::STOP_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::STOP_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION STOP'");
-      return;
-    }
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-    
-    if (result != 0) {
-      ndbout << "Stop command failed" << endl;
-    } else {
-      ndbout << "Stop ordered" << endl;
-    }
-    return;
-  }
-
-  /*********
-   * STATUS
-   *********/
-  if (!strcasecmp(firstToken, "STATUS")) {
-    struct rep_state repstate;
-    int result = 
-      ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Status request of Global Replication failed" << endl;
-    } else {
-      ndbout << "Status request of Global Replication ordered" << endl;
-      ndbout << "See printout at one of the DB nodes" << endl;
-      ndbout << "(Better status report is under development.)" << endl;
-      ndbout << " SubscriptionId " << repstate.subid 
-	     << " SubscriptionKey " << repstate.subkey << endl;
-    }
-    return;
-  }
-
-  /*********
-   * QUERY (see repapi.h for querable counters)
-   *********/
-  if (!strcasecmp(firstToken, "QUERY")) {
-    char *query = strtok(NULL, "\0");
-    int queryCounter=-1;
-    if(query != NULL) {
-      queryCounter = atoi(query);
-    }
-    struct rep_state repstate;
-    unsigned repId = 0;
-    int result = ndb_rep_query(m_repserver, (QueryCounter)queryCounter,
-			       &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Query repserver failed" << endl;
-    } else {
-      ndbout << "Query repserver sucessful" << endl;
-      ndbout_c("repstate : QueryCounter %d, f=%d l=%d"
-	       " nodegroups %d" , 
-	       repstate.queryCounter,
-	       repstate.first[0], repstate.last[0],
-	       repstate.no_of_nodegroups );
-    }
-    return;
-  }
-}
-#endif // HAVE_GLOBAL_REPLICATION
 
 template class Vector<char const*>;

--- 1.73.17.2/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-01-19 11:14:13 +03:00
+++ 1.90/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-02-02 23:20:21 +03:00
@@ -37,10 +37,10 @@
 #include <signaldata/EventReport.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
 #include <signaldata/ManagementServer.hpp>
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
 #include <NdbSleep.h>
 #include <EventLogger.hpp>
 #include <DebuggerNames.hpp>
@@ -479,10 +479,6 @@
       case NODE_TYPE_MGM:
 	nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
 	break;
-      case NODE_TYPE_REP:
-	nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
-	break;
-      case NODE_TYPE_EXT_REP:
       default:
 	break;
       }
@@ -1726,9 +1722,6 @@
     break;
   case GSN_EVENT_REP:
   {
-    EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend());
-    if (rep->getNodeId() == 0)
-      rep->setNodeId(refToNode(signal->theSendersBlockRef));
     eventReport(signal->getDataPtr());
     break;
   }
@@ -1769,7 +1762,6 @@
       DBUG_VOID_RETURN;
     }
   }
-  
   rep->setNodeId(_ownNodeId);
   eventReport(theData);
   DBUG_VOID_RETURN;
@@ -1842,6 +1834,88 @@
   }
 }
 
+int
+MgmtSrvr::alloc_node_id_req(Uint32 free_node_id)
+{
+  SignalSender ss(theFacade);
+  ss.lock(); // lock will be released on exit
+
+  SimpleSignal ssig;
+  AllocNodeIdReq* req = CAST_PTR(AllocNodeIdReq, ssig.getDataPtrSend());
+  ssig.set(ss, TestOrd::TraceAPI, QMGR, GSN_ALLOC_NODEID_REQ,
+	   AllocNodeIdReq::SignalLength);
+  
+  req->senderRef = ss.getOwnRef();
+  req->senderData = 19;
+  req->nodeId = free_node_id;
+
+  int do_send = 1;
+  NodeId nodeId = 0;
+  while (1)
+  {
+    if (nodeId == 0)
+    {
+      bool next;
+      while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+            theFacade->get_node_alive(nodeId) == false);
+      if (!next)
+        return NO_CONTACT_WITH_DB_NODES;
+      do_send = 1;
+    }
+    if (do_send)
+    {
+      if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
+        return SEND_OR_RECEIVE_FAILED;
+      }
+      do_send = 0;
+    }
+    
+    SimpleSignal *signal = ss.waitFor();
+
+    int gsn = signal->readSignalNumber();
+    switch (gsn) {
+    case GSN_ALLOC_NODEID_CONF:
+    {
+      const AllocNodeIdConf * const conf =
+        CAST_CONSTPTR(AllocNodeIdConf, signal->getDataPtr());
+      return 0;
+    }
+    case GSN_ALLOC_NODEID_REF:
+    {
+      const AllocNodeIdRef * const ref =
+        CAST_CONSTPTR(AllocNodeIdRef, signal->getDataPtr());
+      if (ref->errorCode == AllocNodeIdRef::NotMaster ||
+          ref->errorCode == AllocNodeIdRef::Busy)
+      {
+        do_send = 1;
+        nodeId = refToNode(ref->masterRef);
+        continue;
+      }
+      return ref->errorCode;
+    }
+    case GSN_NF_COMPLETEREP:
+    {
+      const NFCompleteRep * const rep =
+        CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr());
+#ifdef VM_TRACE
+      ndbout_c("Node %d fail completed", rep->failedNodeId);
+#endif
+      if (rep->failedNodeId == nodeId)
+        nodeId = 0;
+      continue;
+    }
+    case GSN_NODE_FAILREP:{
+      // ignore NF_COMPLETEREP will come
+      continue;
+    }
+    default:
+      report_unknown_signal(signal);
+      return SEND_OR_RECEIVE_FAILED;
+    }
+  }
+  return 0;
+}
+
 bool
 MgmtSrvr::alloc_node_id(NodeId * nodeId, 
 			enum ndb_mgm_node_type type,
@@ -1966,6 +2040,39 @@
   }
   NdbMutex_Unlock(m_configMutex);
 
+  if (id_found && client_addr != 0)
+  {
+    int res = alloc_node_id_req(id_found);
+    unsigned save_id_found = id_found;
+    switch (res)
+    {
+    case 0:
+      // ok continue
+      break;
+    case NO_CONTACT_WITH_DB_NODES:
+      // ok continue
+      break;
+    default:
+      // something wrong
+      id_found = 0;
+      break;
+
+    }
+    if (id_found == 0)
+    {
+      char buf[128];
+      ndb_error_string(res, buf, sizeof(buf));
+      error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
+			  save_id_found, res, buf);
+      g_eventLogger.warning("Cluster refused allocation of id %d. "
+                            "Connection from ip %s. "
+                            "Returned error string \"%s\"", save_id_found,
+                            inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr),
+                            error_string.c_str());
+      DBUG_RETURN(false);
+    }
+  }
+
   if (id_found)
   {
     *nodeId= id_found;
@@ -2288,17 +2395,6 @@
   return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : SEND_OR_RECEIVE_FAILED;
 }
 
-
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
-  require(false);
-  return 0;
-}
 
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)

--- 1.30.9.1/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-01-16 16:13:14 +03:00
+++ 1.41/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-02-02 23:20:22 +03:00
@@ -339,11 +339,6 @@
   int abortBackup(Uint32 backupId);
   int performBackup(Uint32* backupId);
 
-  /**
-   * Global Replication
-   */
-  int repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted = false);
-  
   //**************************************************************************
   // Description: Set event report level for a DB process
   // Parameters:
@@ -518,7 +513,8 @@
    *   @return  -1 if block not found, otherwise block number
    */
   int getBlockNumber(const BaseString &blockName);
-  
+
+  int alloc_node_id_req(Uint32 free_node_id);
   //**************************************************************************
   
   int _blockNumber;

--- 1.43/mysql-test/r/type_float.result	2005-12-02 14:01:37 +03:00
+++ 1.44/mysql-test/r/type_float.result	2006-02-02 23:20:16 +03:00
@@ -240,6 +240,28 @@
   `d` double(22,9) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1, t2, t3;
+create table t1 select  105213674794682365.00 + 0.0 x;
+show warnings;
+Level	Code	Message
+desc  t1;
+Field	Type	Null	Key	Default	Extra
+x	decimal(21,2) unsigned	NO		0.00	
+drop table t1;
+create table t1 select 0.0 x;
+desc t1;
+Field	Type	Null	Key	Default	Extra
+x	decimal(2,1) unsigned	NO		0.0	
+create table t2 select 105213674794682365.00 y;
+desc t2;
+Field	Type	Null	Key	Default	Extra
+y	decimal(20,2) unsigned	NO		0.00	
+create table t3 select x+y a from t1,t2;
+show warnings;
+Level	Code	Message
+desc t3;
+Field	Type	Null	Key	Default	Extra
+a	decimal(21,2) unsigned	NO		0.00	
+drop table t1,t2,t3;
 create table t1 (s1 float(0,2));
 ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
 create table t1 (s1 float(1,2));

--- 1.100/mysql-test/r/sp-error.result	2006-01-19 13:48:01 +03:00
+++ 1.101/mysql-test/r/sp-error.result	2006-02-02 23:20:16 +03:00
@@ -464,19 +464,6 @@
 call bug3294()|
 ERROR 42S02: Unknown table 't5'
 drop procedure bug3294|
-drop procedure if exists bug6807|
-create procedure bug6807()
-begin
-declare id int;
-set id = connection_id();
-kill query id;
-select 'Not reached';
-end|
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-drop procedure bug6807|
 drop procedure if exists bug8776_1|
 drop procedure if exists bug8776_2|
 drop procedure if exists bug8776_3|

--- 1.183/mysql-test/r/sp.result	2006-02-02 11:59:18 +03:00
+++ 1.184/mysql-test/r/sp.result	2006-02-02 23:20:16 +03:00
@@ -1178,8 +1178,8 @@
 delete from t1 |
 delete from t2 |
 drop table t4|
-drop table if exists fac|
-create table fac (n int unsigned not null primary key, f bigint unsigned)|
+drop table if exists t3|
+create table t3 (n int unsigned not null primary key, f bigint unsigned)|
 drop procedure if exists ifac|
 create procedure ifac(n int unsigned)
 begin
@@ -1189,13 +1189,13 @@
 end if;
 while i <= n do
 begin
-insert into test.fac values (i, fac(i));
+insert into test.t3 values (i, fac(i));
 set i = i + 1;
 end;
 end while;
 end|
 call ifac(20)|
-select * from fac|
+select * from t3|
 n	f
 1	1
 2	2
@@ -1217,7 +1217,7 @@
 18	6402373705728000
 19	121645100408832000
 20	2432902008176640000
-drop table fac|
+drop table t3|
 show function status like '%f%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
 test	fac	FUNCTION	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
@@ -1225,12 +1225,12 @@
 drop function fac|
 show function status like '%f%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
-drop table if exists primes|
-create table primes (
+drop table if exists t3|
+create table t3 (
 i int unsigned not null primary key,
 p bigint unsigned not null
 )|
-insert into primes values
+insert into t3 values
 ( 0,   3), ( 1,   5), ( 2,   7), ( 3,  11), ( 4,  13),
 ( 5,  17), ( 6,  19), ( 7,  23), ( 8,  29), ( 9,  31),
 (10,  37), (11,  41), (12,  43), (13,  47), (14,  53),
@@ -1253,7 +1253,7 @@
 else
 begin
 declare p bigint unsigned;
-select t.p into p from test.primes t where t.i = s;
+select t.p into p from test.t3 t where t.i = s;
 if b+p > r then
 set pp = 1;
 leave again;
@@ -1278,7 +1278,7 @@
 declare pp bool default 0;
 call opp(p, pp);
 if pp then
-insert into test.primes values (i, p);
+insert into test.t3 values (i, p);
 set i = i+1;
 end if;
 set p = p+2;
@@ -1299,7 +1299,7 @@
 else
 begin
 declare p bigint unsigned;
-select t.p into p from test.primes t where t.i = s;
+select t.p into p from test.t3 t where t.i = s;
 if b+p > r then
 set pp = 1;
 leave again;
@@ -1318,47 +1318,47 @@
 test	ip	PROCEDURE	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
 test	opp	PROCEDURE	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
 call ip(200)|
-select * from primes where i=45 or i=100 or i=199|
+select * from t3 where i=45 or i=100 or i=199|
 i	p
 45	211
 100	557
 199	1229
-drop table primes|
+drop table t3|
 drop procedure opp|
 drop procedure ip|
 show procedure status like '%p%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
-drop table if exists fib|
-create table fib ( f bigint unsigned not null )|
+drop table if exists t3|
+create table t3 ( f bigint unsigned not null )|
 drop procedure if exists fib|
 create procedure fib(n int unsigned)
 begin
 if n > 1 then
 begin
 declare x, y bigint unsigned;
-declare c cursor for select f from fib order by f desc limit 2;
+declare c cursor for select f from t3 order by f desc limit 2;
 open c;
 fetch c into y;
 fetch c into x;
 close c;
-insert into fib values (x+y);
+insert into t3 values (x+y);
 call fib(n-1);
 end;
 end if;
 end|
 set @@max_sp_recursion_depth= 20|
-insert into fib values (0), (1)|
+insert into t3 values (0), (1)|
 call fib(3)|
-select * from fib order by f asc|
+select * from t3 order by f asc|
 f
 0
 1
 1
 2
-delete from fib|
-insert into fib values (0), (1)|
-call fib(20)|
-select * from fib order by f asc|
+delete from t3|
+insert into t3 values (0), (1)|
+call fib(10)|
+select * from t3 order by f asc|
 f
 0
 1
@@ -1371,17 +1371,7 @@
 21
 34
 55
-89
-144
-233
-377
-610
-987
-1597
-2584
-4181
-6765
-drop table fib|
+drop table t3|
 drop procedure fib|
 set @@max_sp_recursion_depth= 0|
 drop procedure if exists bar|

--- 1.101/mysql-test/t/sp-error.test	2006-01-04 13:18:54 +03:00
+++ 1.102/mysql-test/t/sp-error.test	2006-02-02 23:20:17 +03:00
@@ -1534,6 +1534,7 @@
 drop function bug13012_2|
 delimiter ;|
 
+#
 # BUG#11555 "Stored procedures: current SP tables locking make 
 # impossible view security". We should not expose names of tables
 # which are implicitly used by view (via stored routines/triggers).
@@ -1594,7 +1595,33 @@
 drop table t1;
 drop view v1;
 
+#
+# BUG#15658: Server crashes after creating function as empty string
+#
+--disable_warnings
+drop procedure if exists ` bug15658`;
+--enable_warnings
 
+--error ER_SP_WRONG_NAME
+create procedure ``() select 1;
+--error ER_SP_WRONG_NAME
+create procedure ` `() select 1;
+--error ER_SP_WRONG_NAME
+create procedure `bug15658 `() select 1;
+--error ER_WRONG_DB_NAME
+create procedure ``.bug15658() select 1;
+--error ER_WRONG_DB_NAME
+create procedure `x `.bug15658() select 1;
+
+# This should work
+create procedure ` bug15658`() select 1;
+call ` bug15658`();
+--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+show procedure status;
+drop procedure ` bug15658`;
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

--- 1.172/mysql-test/t/sp.test	2006-01-20 10:32:18 +03:00
+++ 1.173/mysql-test/t/sp.test	2006-02-02 23:20:17 +03:00
@@ -1444,11 +1444,11 @@
 call ifac(20)|
 select * from t3|
 drop table t3|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show function status like '%f%'|
 drop procedure ifac|
 drop function fac|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show function status like '%f%'|
 
 
@@ -1531,7 +1531,7 @@
   end while;
 end|
 show create procedure opp|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like '%p%'|
 
 # This isn't the fastest way in the world to compute prime numbers, so
@@ -1549,7 +1549,7 @@
 drop table t3|
 drop procedure opp|
 drop procedure ip|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like '%p%'|
 
 
@@ -1618,13 +1618,13 @@
 create procedure bar(x char(16), y int)
  comment "111111111111" sql security invoker
  insert into test.t1 values (x, y)|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like 'bar'|
 alter procedure bar comment "2222222222" sql security definer|
 alter procedure bar comment "3333333333"|
 alter procedure bar|
 show create procedure bar|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like 'bar'|
 drop procedure bar|
 
@@ -2574,7 +2574,6 @@
   show databases like 'foo';
   show errors;
   show columns from t1;
-  show grants for 'root'@'localhost';
   show keys from t1;
   show open tables like 'foo';
   show privileges;
@@ -2596,20 +2595,6 @@
 
 drop procedure bug4902|
 
-# We need separate SP for SHOW PROCESSLIST  since we want use replace_column
---disable_warnings
-drop procedure if exists bug4902_2|
---enable_warnings
-create procedure bug4902_2()
-begin
-  show processlist;
-end|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
-drop procedure bug4902_2|
-
 #
 # BUG#4904
 #
@@ -2824,44 +2809,6 @@
 delete from t1|
 drop procedure bug4941|
 
-
-#
-# BUG#3583: query cache doesn't work for stored procedures
-#
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
-create procedure bug3583()
-begin
-  declare c int;
-
-  select * from t1;
-  select count(*) into c from t1;
-  select c;
-end|
-
-insert into t1 values ("x", 3), ("y", 5)|
-set @x = @@query_cache_size|
-set global query_cache_size = 10*1024*1024|
-
-flush status|
-flush query cache|
-show status like 'Qcache_hits'|
-call bug3583()|
-show status like 'Qcache_hits'|
-call bug3583()|
-call bug3583()|
-show status like 'Qcache_hits'|
-
-set global query_cache_size = @x|
-flush status|
-flush query cache|
-delete from t1|
-drop procedure bug3583|
-
 #
 # BUG#4905: Stored procedure doesn't clear for "Rows affected"
 #
@@ -3171,24 +3118,6 @@
 drop function bug5240|
 
 #
-# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
-#
---disable_warnings
-drop function if exists bug5278|
---enable_warnings
-create function bug5278 () returns char
-begin
-  SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
-  return 'okay';
-end|
-
---error 1133
-select bug5278()|
---error 1133
-select bug5278()|
-drop function bug5278|
-
-#
 # BUG#7992: rolling back temporary Item tree changes in SP
 #
 --disable_warnings
@@ -4209,9 +4138,13 @@
 --error 1062
 select bug12379()|
 select 1|
+# statement-based binlogging will show warning which row-based won't;
+# so we hide it (this warning is already tested in rpl_stm_sp.test)
+--disable_warnings
 call bug12379_1()|
 select 2|
 call bug12379_2()|
+--enable_warnings
 select 3|
 --error 1062
 call bug12379_3()|
@@ -4785,24 +4718,6 @@
 call bug10100t(5)|
 
 #end of the stack checking
-set @@max_sp_recursion_depth=255|
-set @var=1|
-#disable log because error about stack overrun contains numbers which
-#depend on a system
--- disable_result_log
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100p(255, @var)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pt(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pv(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pd(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pc(1,255)|
--- enable_result_log
-set @@max_sp_recursion_depth=0|
-
 deallocate prepare stmt2|
 
 drop function bug10100f|

--- 1.198/sql/sp_head.cc	2006-01-20 15:59:18 +03:00
+++ 1.199/sql/sp_head.cc	2006-02-02 23:20:18 +03:00
@@ -180,11 +180,11 @@
   case SQLCOM_SHOW_ERRORS:
   case SQLCOM_SHOW_FIELDS:
   case SQLCOM_SHOW_GRANTS:
-  case SQLCOM_SHOW_INNODB_STATUS:
+  case SQLCOM_SHOW_ENGINE_STATUS:
+  case SQLCOM_SHOW_ENGINE_LOGS:
+  case SQLCOM_SHOW_ENGINE_MUTEX:
   case SQLCOM_SHOW_KEYS:
-  case SQLCOM_SHOW_LOGS:
   case SQLCOM_SHOW_MASTER_STAT:
-  case SQLCOM_SHOW_MUTEX_STATUS:
   case SQLCOM_SHOW_NEW_MASTER:
   case SQLCOM_SHOW_OPEN_TABLES:
   case SQLCOM_SHOW_PRIVILEGES:
@@ -314,6 +314,9 @@
 {
   DBUG_ENTER("sp_eval_expr");
 
+  if (!expr_item)
+    DBUG_RETURN(TRUE);
+
   if (!(expr_item= sp_prepare_func_item(thd, &expr_item)))
     DBUG_RETURN(TRUE);
 
@@ -497,7 +500,7 @@
 sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
 {
   DBUG_ENTER("sp_head::init_strings");
-  uchar *endp;                  /* Used to trim the end */
+  const uchar *endp;                            /* Used to trim the end */
   /* During parsing, we must use thd->mem_root */
   MEM_ROOT *root= thd->mem_root;
 
@@ -698,7 +701,8 @@
   field_length= !m_return_field_def.length ?
                 field_max_length : m_return_field_def.length;
 
-  field= ::make_field((char*) 0,                    /* field ptr */
+  field= ::make_field(table->s,                     /* TABLE_SHARE ptr */
+                      (char*) 0,                    /* field ptr */
                       field_length,                 /* field [max] length */
                       (uchar*) "",                  /* null ptr */
                       0,                            /* null bit */
@@ -708,8 +712,10 @@
                       m_return_field_def.geom_type,
                       Field::NONE,                  /* unreg check */
                       m_return_field_def.interval,
-                      field_name ? field_name : (const char *) m_name.str,
-                      table);
+                      field_name ? field_name : (const char *) m_name.str);
+
+  if (field)
+    field->init(table);
   
   DBUG_RETURN(field);
 }
@@ -723,6 +729,9 @@
 
 /*
   StoredRoutinesBinlogging
+  This paragraph applies only to statement-based binlogging. Row-based
+  binlogging does not need anything special like this.
+
   Top-down overview:
 
   1. Statements
@@ -1290,56 +1299,62 @@
 
   thd->spcont= nctx;
 
-  binlog_save_options= thd->options;
-  need_binlog_call= mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG);
+  /*
+    If row-based binlogging, we don't need to binlog the function's call, let
+    each substatement be binlogged its way.
+  */
+  need_binlog_call= mysql_bin_log.is_open() &&
+    (thd->options & OPTION_BIN_LOG) && !binlog_row_based;
   if (need_binlog_call)
   {
     reset_dynamic(&thd->user_var_events);
     mysql_bin_log.start_union_events(thd);
+    binlog_save_options= thd->options;
+    thd->options&= ~OPTION_BIN_LOG;
   }
-    
-  thd->options&= ~OPTION_BIN_LOG;
+
   err_status= execute(thd);
-  thd->options= binlog_save_options;
-  
-  if (need_binlog_call)
-    mysql_bin_log.stop_union_events(thd);
 
-  if (need_binlog_call && thd->binlog_evt_union.unioned_events)
+  if (need_binlog_call)
   {
-    char buf[256];
-    String bufstr(buf, sizeof(buf), &my_charset_bin);
-    bufstr.length(0);
-    bufstr.append(STRING_WITH_LEN("DO "));
-    append_identifier(thd, &bufstr, m_name.str, m_name.length);
-    bufstr.append('(');
-    for (uint i=0; i < argcount; i++)
+    mysql_bin_log.stop_union_events(thd);
+    thd->options= binlog_save_options;
+    if (thd->binlog_evt_union.unioned_events)
     {
-      String str_value_holder;
-      String *str_value;
-
-      if (i)
-        bufstr.append(',');
-
-      str_value= sp_get_item_value(param_values[i], &str_value_holder);
+      char buf[256];
+      String bufstr(buf, sizeof(buf), &my_charset_bin);
+      bufstr.length(0);
+      bufstr.append(STRING_WITH_LEN("DO "));
+      append_identifier(thd, &bufstr, m_name.str, m_name.length);
+      bufstr.append('(');
+      for (uint i=0; i < argcount; i++)
+      {
+        String str_value_holder;
+        String *str_value;
 
-      if (str_value)
-        bufstr.append(*str_value);
-      else
-        bufstr.append(STRING_WITH_LEN("NULL"));
-    }
-    bufstr.append(')');
-    
-    Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
-                          thd->binlog_evt_union.unioned_events_trans, FALSE);
-    if (mysql_bin_log.write(&qinfo) && 
-        thd->binlog_evt_union.unioned_events_trans)
-    {
-      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
-                   "Invoked ROUTINE modified a transactional table but MySQL "
-                   "failed to reflect this change in the binary log");
+        if (i)
+          bufstr.append(',');
+        
+        str_value= sp_get_item_value(param_values[i], &str_value_holder);
+
+        if (str_value)
+          bufstr.append(*str_value);
+        else
+          bufstr.append(STRING_WITH_LEN("NULL"));
+      }
+      bufstr.append(')');
+      
+      Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
+                            thd->binlog_evt_union.unioned_events_trans, FALSE);
+      if (mysql_bin_log.write(&qinfo) &&
+          thd->binlog_evt_union.unioned_events_trans)
+      {
+        push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+                     "Invoked ROUTINE modified a transactional table but MySQL "
+                     "failed to reflect this change in the binary log");
+      }
+      reset_dynamic(&thd->user_var_events);
     }
-    reset_dynamic(&thd->user_var_events);
   }
 
   if (m_type == TYPE_ENUM_FUNCTION && !err_status)

--- 1.77/sql/sp_head.h	2006-01-19 18:13:00 +03:00
+++ 1.78/sql/sp_head.h	2006-02-02 23:20:18 +03:00
@@ -132,8 +132,7 @@
 
   create_field m_return_field_def; /* This is used for FUNCTIONs only. */
 
-  uchar *m_tmp_query;		// Temporary pointer to sub query string
-  uint m_old_cmq;		// Old CLIENT_MULTI_QUERIES value
+  const uchar *m_tmp_query;	// Temporary pointer to sub query string
   st_sp_chistics *m_chistics;
   ulong m_sql_mode;		// For SHOW CREATE and execution
   LEX_STRING m_qname;		// db.name
@@ -181,7 +180,7 @@
   */
   HASH m_sroutines;
   // Pointers set during parsing
-  uchar *m_param_begin, *m_param_end, *m_body_begin;
+  const uchar *m_param_begin, *m_param_end, *m_body_begin;
 
   /*
     Security context for stored routine which should be run under

--- 1.224/BitKeeper/etc/ignore	2006-01-31 06:58:13 +03:00
+++ 1.225/BitKeeper/etc/ignore	2006-02-02 23:19:51 +03:00
@@ -48,6 +48,7 @@
 50
 =6
 BUILD/compile-pentium-maintainer
+BitKeeper/etc/RESYNC_TREE
 BitKeeper/etc/config
 BitKeeper/etc/csets
 BitKeeper/etc/csets-in
@@ -295,6 +296,7 @@
 libmysql/*.vcproj
 libmysql/conf_to_src
 libmysql/debug/libmysql.exp
+libmysql/libmysql.ver
 libmysql/my_static.h
 libmysql/my_time.c
 libmysql/mysys_priv.h
@@ -1611,4 +1613,3 @@
 vio/viotest.cpp
 zlib/*.ds?
 zlib/*.vcproj
-BitKeeper/etc/RESYNC_TREE

--- 1.159/sql/sql_prepare.cc	2006-01-19 12:29:00 +03:00
+++ 1.160/sql/sql_prepare.cc	2006-02-02 23:20:18 +03:00
@@ -2120,6 +2120,8 @@
       were closed in the end of previous prepare or execute call.
     */
     tables->table= 0;
+    /* Reset is_schema_table_processed value(needed for I_S tables */
+    tables->is_schema_table_processed= FALSE;
 
     if (tables->prep_on_expr)
     {

--- 1.169/tests/mysql_client_test.c	2006-01-30 12:57:34 +03:00
+++ 1.170/tests/mysql_client_test.c	2006-02-02 23:26:53 +03:00
@@ -14697,7 +14697,86 @@
   mysql_close(lmysql);
 }
 
+/* Bug #16144: mysql_stmt_attr_get type error */
 
+static void test_bug16144()
+{
+  const my_bool flag_orig= (my_bool) 0xde;
+  my_bool flag= flag_orig;
+  MYSQL_STMT *stmt;
+  myheader("test_bug16144");
+
+  /* Check that attr_get returns correct data on little and big endian CPUs */
+  stmt= mysql_stmt_init(mysql);
+  mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (const void*) &flag);
+  mysql_stmt_attr_get(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &flag);
+  DIE_UNLESS(flag == flag_orig);
+  mysql_stmt_close(stmt);
+}
+
+/*
+  Bug #15613: "libmysqlclient API function mysql_stmt_prepare returns wrong
+  field length"
+*/
+
+static void test_bug15613()
+{
+  MYSQL_STMT *stmt;
+  const char *stmt_text;
+  MYSQL_RES *metadata;
+  MYSQL_FIELD *field;
+  int rc;
+  myheader("test_bug15613");
+
+  /* I. Prepare the table */
+  rc= mysql_query(mysql, "set names latin1");
+  myquery(rc);
+  mysql_query(mysql, "drop table if exists t1");
+  rc= mysql_query(mysql,
+                  "create table t1 (t text character set utf8, "
+                                   "tt tinytext character set utf8, "
+                                   "mt mediumtext character set utf8, "
+                                   "lt longtext character set utf8, "
+                                   "vl varchar(255) character set latin1,"
+                                   "vb varchar(255) character set binary,"
+                                   "vu varchar(255) character set utf8)");
+  myquery(rc);
+
+  stmt= mysql_stmt_init(mysql);
+
+  /* II. Check SELECT metadata */
+  stmt_text= ("select t, tt, mt, lt, vl, vb, vu from t1");
+  rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+  metadata= mysql_stmt_result_metadata(stmt);
+  field= mysql_fetch_fields(metadata);
+  if (!opt_silent)
+  {
+    printf("Field lengths (client character set is latin1):\n"
+           "text character set utf8:\t\t%lu\n"
+           "tinytext character set utf8:\t\t%lu\n"
+           "mediumtext character set utf8:\t\t%lu\n"
+           "longtext character set utf8:\t\t%lu\n"
+           "varchar(255) character set latin1:\t%lu\n"
+           "varchar(255) character set binary:\t%lu\n"
+           "varchar(255) character set utf8:\t%lu\n",
+           field[0].length, field[1].length, field[2].length, field[3].length,
+           field[4].length, field[5].length, field[6].length);
+  }
+  DIE_UNLESS(field[0].length == 65535);
+  DIE_UNLESS(field[1].length == 255);
+  DIE_UNLESS(field[2].length == 16777215);
+  DIE_UNLESS(field[3].length == 4294967295UL);
+  DIE_UNLESS(field[4].length == 255);
+  DIE_UNLESS(field[5].length == 255);
+  DIE_UNLESS(field[6].length == 255);
+
+  /* III. Cleanup */
+  rc= mysql_query(mysql, "drop table t1");
+  myquery(rc);
+  rc= mysql_query(mysql, "set names default");
+  myquery(rc);
+  mysql_stmt_close(stmt);
+}
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -14957,9 +15036,10 @@
   { "test_bug13488", test_bug13488 },
   { "test_bug13524", test_bug13524 },
   { "test_bug14845", test_bug14845 },
-  { "test_bug15510", test_bug15510 },
   { "test_opt_reconnect", test_opt_reconnect },
-
+  { "test_bug15510", test_bug15510},
+  { "test_bug16144", test_bug16144 },
+  { "test_bug15613", test_bug15613 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.1 tree (konstantin:1.2129)Konstantin Osipov2 Feb