List:Commits« Previous MessageNext Message »
From:Hakan Kuecuekyilmaz Date:October 22 2008 4:01pm
Subject:bzr commit into mysql-6.0-falcon-team branch (hky:2876)
View as plain text  
#At file:///home/hakan/work/mysql/mysql-6.0-falcon-team-to-merge/

 2876 Hakan Kuecuekyilmaz	2008-10-22 [merge]
      Merged:
          mysql-6.0 --> mysql-6.0-falcon --> mysql-6.0-falcon-team
modified:
  .bzrignore
  include/errmsg.h
  libmysql/errmsg.c
  libmysql/libmysql.c
  libmysqld/libmysqld.c
  mysql-test/r/create.result
  mysql-test/r/log_tables.result
  mysql-test/r/mysql.result
  mysql-test/r/partition.result
  mysql-test/r/partition_innodb.result
  mysql-test/r/plugin.result
  mysql-test/r/sp.result
  mysql-test/r/storage_engine_basic.result
  mysql-test/r/variables.result
  mysql-test/suite/falcon/r/falcon_bugs.result
  mysql-test/suite/falcon/t/falcon_bugs.test
  mysql-test/t/sp.test
  mysys/my_largepage.c
  scripts/make_win_bin_dist
  sql-common/client.c
  sql/backup/backup_info.cc
  sql/backup/backup_info.h
  sql/backup/backup_kernel.h
  sql/backup/backup_test.cc
  sql/backup/error.h
  sql/backup/kernel.cc
  sql/backup/logger.cc
  sql/backup/logger.h
  sql/log.cc
  sql/mysql_priv.h
  sql/mysqld.cc
  sql/share/errmsg.txt
  sql/si_objects.cc
  sql/si_objects.h
  sql/sql_class.cc
  sql/sql_table.cc
  storage/falcon/NNode.h
  storage/falcon/StorageVersion.h
  storage/falcon/Types.h
  storage/falcon/ha_falcon.cpp
  storage/falcon/plug.in
  support-files/my-huge.cnf.sh
  support-files/my-large.cnf.sh
  support-files/my-medium.cnf.sh
  support-files/my-small.cnf.sh
  support-files/mysql.spec.sh
  tests/mysql_client_test.c

=== modified file '.bzrignore'
--- a/.bzrignore	2008-10-01 12:02:28 +0000
+++ b/.bzrignore	2008-10-16 12:39:30 +0000
@@ -1898,3 +1898,4 @@ mysql-test/tps.log
 libmysqld/event_parse_data.cc
 client/transaction.h
 libmysqld/transaction.cc
+libmysqld/rpl_handler.cc

=== modified file 'include/errmsg.h'
--- a/include/errmsg.h	2008-05-20 16:36:26 +0000
+++ b/include/errmsg.h	2008-10-17 12:39:34 +0000
@@ -97,6 +97,7 @@ extern const char *client_errors[];	/* E
 #define CR_SERVER_LOST_EXTENDED			2055
 #define CR_STMT_CLOSED				2056
 #define CR_NEW_STMT_METADATA                    2057
-#define CR_ERROR_LAST  /*Copy last error nr:*/  2057
+#define CR_ALREADY_CONNECTED                    2058
+#define CR_ERROR_LAST  /*Copy last error nr:*/  2058
 /* Add error numbers before CR_ERROR_LAST and change it accordingly. */
 

=== modified file 'libmysql/errmsg.c'
--- a/libmysql/errmsg.c	2008-05-20 16:36:26 +0000
+++ b/libmysql/errmsg.c	2008-10-17 12:39:34 +0000
@@ -85,6 +85,7 @@ const char *client_errors[]=
   "Lost connection to MySQL server at '%s', system error: %d",
   "Statement closed indirectly because of a preceeding %s() call",
   "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
+  "This handle is already connected. Use a separate handle for each connection."
   ""
 };
 
@@ -151,6 +152,7 @@ const char *client_errors[]=
   "Lost connection to MySQL server at '%s', system error: %d",
   "Statement closed indirectly because of a preceeding %s() call",
   "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
+  "This handle is already connected. Use a separate handle for each connection."
   ""
 };
 
@@ -215,6 +217,7 @@ const char *client_errors[]=
   "Lost connection to MySQL server at '%s', system error: %d",
   "Statement closed indirectly because of a preceeding %s() call",
   "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
+  "This handle is already connected. Use a separate handle for each connection."
   ""
 };
 #endif

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2008-08-07 17:52:43 +0000
+++ b/libmysql/libmysql.c	2008-10-17 11:03:46 +0000
@@ -1748,19 +1748,21 @@ static void alloc_stmt_fields(MYSQL_STMT
 	 field= stmt->fields;
        field && fields < end; fields++, field++)
   {
-    field->catalog  = strdup_root(alloc,fields->catalog);
-    field->db       = strdup_root(alloc,fields->db);
-    field->table    = strdup_root(alloc,fields->table);
-    field->org_table= strdup_root(alloc,fields->org_table);
-    field->name     = strdup_root(alloc,fields->name);
-    field->org_name = strdup_root(alloc,fields->org_name);
-    field->charsetnr= fields->charsetnr;
-    field->length   = fields->length;
-    field->type     = fields->type;
-    field->flags    = fields->flags;
-    field->decimals = fields->decimals;
-    field->def      = fields->def ? strdup_root(alloc,fields->def): 0;
-    field->max_length= 0;
+    *field= *fields; /* To copy all numeric parts. */
+    field->catalog=   strmake_root(alloc, fields->catalog,
+                                   fields->catalog_length);
+    field->db=        strmake_root(alloc, fields->db, fields->db_length);
+    field->table=     strmake_root(alloc, fields->table, fields->table_length);
+    field->org_table= strmake_root(alloc, fields->org_table,
+                                   fields->org_table_length);
+    field->name=      strmake_root(alloc, fields->name, fields->name_length);
+    field->org_name=  strmake_root(alloc, fields->org_name,
+                                   fields->org_name_length);
+    field->def      = fields->def ? strmake_root(alloc, fields->def,
+                                                 fields->def_length) : 0;
+    field->def_length= field->def ? fields->def_length : 0;
+    field->extension= 0; /* Avoid dangling links. */
+    field->max_length= 0; /* max_length is set in mysql_stmt_store_result() */
   }
 }
 

=== modified file 'libmysqld/libmysqld.c'
--- a/libmysqld/libmysqld.c	2008-03-27 18:40:00 +0000
+++ b/libmysqld/libmysqld.c	2008-10-17 15:11:28 +0000
@@ -28,6 +28,7 @@
 #include <sys/stat.h>
 #include <signal.h>
 #include <time.h>
+#include <sql_common.h>
 #include "client_settings.h"
 #ifdef	 HAVE_PWD_H
 #include <pwd.h>
@@ -81,14 +82,6 @@ static my_bool is_NT(void)
 ** Shut down connection
 **************************************************************************/
 
-static void end_server(MYSQL *mysql)
-{
-  DBUG_ENTER("end_server");
-  free_old_query(mysql);
-  DBUG_VOID_RETURN;
-}
-
-
 int mysql_init_character_set(MYSQL *mysql);
 
 MYSQL * STDCALL
@@ -104,6 +97,13 @@ mysql_real_connect(MYSQL *mysql,const ch
 		      db ? db : "(Null)",
 		      user ? user : "(Null)"));
 
+  /* Test whether we're already connected */
+  if (mysql->server_version)
+  {
+    set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate);
+    DBUG_RETURN(0);
+  }
+
   if (!host || !host[0])
     host= mysql->options.host;
 
@@ -215,7 +215,7 @@ error:
   {
     /* Free alloced memory */
     my_bool free_me=mysql->free_me;
-    end_server(mysql);
+    free_old_query(mysql);
     mysql->free_me=0;
     mysql_close(mysql);
     mysql->free_me=free_me;

=== modified file 'mysql-test/r/create.result'
--- a/mysql-test/r/create.result	2008-10-02 14:03:57 +0000
+++ b/mysql-test/r/create.result	2008-10-17 14:13:24 +0000
@@ -228,7 +228,7 @@ t1	CREATE TABLE `t1` (
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
 drop table t1;
 SET SESSION storage_engine="gemini";
-ERROR 42000: Unknown table engine 'gemini'
+ERROR 42000: Unknown storage engine 'gemini'
 SELECT @@storage_engine;
 @@storage_engine
 MEMORY
@@ -389,7 +389,7 @@ t1	CREATE TABLE `t1` (
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
 drop table t1;
 SET SESSION storage_engine="gemini";
-ERROR 42000: Unknown table engine 'gemini'
+ERROR 42000: Unknown storage engine 'gemini'
 SELECT @@storage_engine;
 @@storage_engine
 MEMORY

=== modified file 'mysql-test/r/log_tables.result'
--- a/mysql-test/r/log_tables.result	2008-09-29 18:20:59 +0000
+++ b/mysql-test/r/log_tables.result	2008-10-17 14:13:24 +0000
@@ -235,7 +235,7 @@ set @save_storage_engine= @@session.stor
 set storage_engine= MEMORY;
 alter table mysql.slow_log engine=NonExistentEngine;
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 alter table mysql.slow_log engine=memory;
 ERROR HY000: This storage engine cannot be used for log tables"
 set storage_engine= @save_storage_engine;

=== modified file 'mysql-test/r/mysql.result'
--- a/mysql-test/r/mysql.result	2008-07-23 11:28:20 +0000
+++ b/mysql-test/r/mysql.result	2008-10-17 14:13:24 +0000
@@ -378,9 +378,9 @@ WARNING: --server-arg option not support
 +---+
 | 1 | 
 +---+
-Warning (Code 1286): Unknown table engine 'nonexistent'
+Warning (Code 1286): Unknown storage engine 'nonexistent'
 Warning (Code 1266): Using storage engine MyISAM for table 't2'
-Warning (Code 1286): Unknown table engine 'nonexistent2'
+Warning (Code 1286): Unknown storage engine 'nonexistent2'
 Warning (Code 1266): Using storage engine MyISAM for table 't2'
 Error (Code 1050): Table 't2' already exists
 drop tables t1, t2;

=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2008-10-07 15:40:12 +0000
+++ b/mysql-test/r/partition.result	2008-10-17 14:13:24 +0000
@@ -2,30 +2,30 @@ drop table if exists t1, t2;
 CREATE TABLE t1 (a INT)
 ENGINE=NonExistentEngine;
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 Warning	1266	Using storage engine MyISAM for table 't1'
 DROP TABLE t1;
 CREATE TABLE t1 (a INT)
 ENGINE=NonExistentEngine
 PARTITION BY HASH (a);
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 Warning	1266	Using storage engine MyISAM for table 't1'
 DROP TABLE t1;
 CREATE TABLE t1 (a INT)
 ENGINE=Memory;
 ALTER TABLE t1 ENGINE=NonExistentEngine;
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 ALTER TABLE t1
 PARTITION BY HASH (a)
 (PARTITION p0 ENGINE=Memory,
 PARTITION p1 ENGINE=NonExistentEngine);
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 ALTER TABLE t1 ENGINE=NonExistentEngine;
 Warnings:
-Warning	1286	Unknown table engine 'NonExistentEngine'
+Warning	1286	Unknown storage engine 'NonExistentEngine'
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (

=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2008-07-07 17:54:50 +0000
+++ b/mysql-test/r/partition_innodb.result	2008-10-17 14:13:24 +0000
@@ -66,7 +66,7 @@ create table t1 (a int)
 engine = x
 partition by key (a);
 Warnings:
-Warning	1286	Unknown table engine 'x'
+Warning	1286	Unknown storage engine 'x'
 Warning	1266	Using storage engine MyISAM for table 't1'
 show create table t1;
 Table	Create Table
@@ -80,7 +80,7 @@ partition by list (a)
 (partition p0 values in (0));
 alter table t1 engine = x;
 Warnings:
-Warning	1286	Unknown table engine 'x'
+Warning	1286	Unknown storage engine 'x'
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (

=== modified file 'mysql-test/r/plugin.result'
--- a/mysql-test/r/plugin.result	2008-02-24 13:12:17 +0000
+++ b/mysql-test/r/plugin.result	2008-10-17 14:13:24 +0000
@@ -1,6 +1,6 @@
 CREATE TABLE t1(a int) ENGINE=EXAMPLE;
 Warnings:
-Warning	1286	Unknown table engine 'EXAMPLE'
+Warning	1286	Unknown storage engine 'EXAMPLE'
 Warning	1266	Using storage engine MyISAM for table 't1'
 DROP TABLE t1;
 INSTALL PLUGIN example SONAME 'ha_example.so';

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2008-09-25 11:46:17 +0000
+++ b/mysql-test/r/sp.result	2008-10-16 12:39:30 +0000
@@ -6948,3 +6948,21 @@ drop procedure p;
 # ------------------------------------------------------------------
 # -- End of 5.1 tests
 # ------------------------------------------------------------------
+DROP FUNCTION IF EXISTS f1;
+DROP TABLE IF EXISTS t_non_existing;
+DROP TABLE IF EXISTS t1;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+DECLARE v INT;
+SELECT a INTO v FROM t_non_existing;
+RETURN 1;
+END|
+CREATE TABLE t1 (a INT) ENGINE = myisam;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 WHERE a = f1();
+ERROR 42S02: Table 'test.t_non_existing' doesn't exist
+DROP FUNCTION f1;
+DROP TABLE t1;
+# ------------------------------------------------------------------
+# -- End of 6.0 tests
+# ------------------------------------------------------------------

=== modified file 'mysql-test/r/storage_engine_basic.result'
--- a/mysql-test/r/storage_engine_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/storage_engine_basic.result	2008-10-17 14:13:24 +0000
@@ -60,13 +60,13 @@ ERROR 42000: Incorrect argument type to 
 SET @@global.storage_engine = 65530.34.;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
 SET @@global.storage_engine = FILE;
-ERROR 42000: Unknown table engine 'FILE'
+ERROR 42000: Unknown storage engine 'FILE'
 SET @@session.storage_engine = 8199;
 ERROR 42000: Incorrect argument type to variable 'storage_engine'
 SET @@session.storage_engine = 65530.34.;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
 SET @@session.storage_engine = RECORD;
-ERROR 42000: Unknown table engine 'RECORD'
+ERROR 42000: Unknown storage engine 'RECORD'
 '#------------------FN_DYNVARS_005_05-----------------------#'
 SELECT @@global.storage_engine =
 VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2008-05-29 12:56:51 +0000
+++ b/mysql-test/r/variables.result	2008-10-17 14:13:24 +0000
@@ -378,7 +378,7 @@ ERROR HY000: Unknown system variable 'un
 set max_join_size="hello";
 ERROR 42000: Incorrect argument type to variable 'max_join_size'
 set storage_engine=UNKNOWN_TABLE_TYPE;
-ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
+ERROR 42000: Unknown storage engine 'UNKNOWN_TABLE_TYPE'
 set storage_engine=MERGE, big_tables=2;
 ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
 show local variables like 'storage_engine';

=== modified file 'mysql-test/suite/falcon/r/falcon_bugs.result'
--- a/mysql-test/suite/falcon/r/falcon_bugs.result	2007-11-26 15:50:23 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bugs.result	2008-10-02 21:05:39 +0000
@@ -3263,4 +3263,20 @@ count(*)
 select count(*) from t2 where b = 150;
 count(*)
 1
+#
+# Bug #36473 Assertion "! is_set()" fails in
+# Diagnostics_area::set_ok_status with Falcon
+# Ensure that we check the return value of update_auto_increment().
+#
+set @@storage_engine = falcon;
+drop table if exists t1;
+create table t1 (a tinyint(4) NOT NULL auto_increment, primary key (a));
+set @@sql_mode='strict_all_tables';
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+insert into t1 values (null);
+ERROR 22003: Out of range value for column 'a' at row 1
+set @@sql_mode=default;
+set auto_increment_offset=default;
+set auto_increment_increment=default;
 DROP TABLE t1, t2;

=== modified file 'mysql-test/suite/falcon/t/falcon_bugs.test'
--- a/mysql-test/suite/falcon/t/falcon_bugs.test	2007-12-19 18:55:35 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bugs.test	2008-10-02 21:05:39 +0000
@@ -1772,5 +1772,26 @@ update t1, t2 set t1.b = 150, t2.b = t1.
 select count(*) from t1 where b = 150;
 select count(*) from t2 where b = 150;
 
+
+--echo #
+--echo # Bug #36473 Assertion "! is_set()" fails in
+--echo # Diagnostics_area::set_ok_status with Falcon
+--echo # Ensure that we check the return value of update_auto_increment().
+--echo #
+set @@storage_engine = falcon;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a tinyint(4) NOT NULL auto_increment, primary key (a));
+set @@sql_mode='strict_all_tables';
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+--error ER_WARN_DATA_OUT_OF_RANGE
+insert into t1 values (null);
+set @@sql_mode=default;
+set auto_increment_offset=default;
+set auto_increment_increment=default;
+
 # Final cleanup.
 DROP TABLE t1, t2;

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2008-09-25 11:46:17 +0000
+++ b/mysql-test/t/sp.test	2008-10-16 12:39:30 +0000
@@ -8220,3 +8220,35 @@ drop procedure p;
 --echo # ------------------------------------------------------------------
 --echo # -- End of 5.1 tests
 --echo # ------------------------------------------------------------------
+
+#
+# Bug#39255: Stored procedures: crash if function references nonexistent table
+#
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+DROP TABLE IF EXISTS t_non_existing;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+   DECLARE v INT;
+   SELECT a INTO v FROM t_non_existing;
+   RETURN 1;
+END|
+delimiter ;|
+
+CREATE TABLE t1 (a INT) ENGINE = myisam;
+INSERT INTO t1 VALUES (1);
+
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t1 WHERE a = f1();
+
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 6.0 tests
+--echo # ------------------------------------------------------------------

=== modified file 'mysys/my_largepage.c'
--- a/mysys/my_largepage.c	2007-10-02 07:32:33 +0000
+++ b/mysys/my_largepage.c	2008-10-08 19:44:34 +0000
@@ -128,7 +128,7 @@ uchar* my_large_malloc_int(size_t size, 
   {
     if (my_flags & MY_WME)
       fprintf(stderr,
-              "Warning: Failed to allocate %lu bytesx from HugeTLB memory."
+              "Warning: Failed to allocate %lu bytes from HugeTLB memory."
               " errno %d\n", (ulong) size, errno);
 
     DBUG_RETURN(NULL);

=== modified file 'scripts/make_win_bin_dist'
--- a/scripts/make_win_bin_dist	2008-08-25 17:29:53 +0000
+++ b/scripts/make_win_bin_dist	2008-10-21 15:45:46 +0000
@@ -145,6 +145,7 @@ mkdir $DESTDIR
 mkdir $DESTDIR/bin
 cp client/$TARGET/*.exe                                  $DESTDIR/bin/
 cp extra/$TARGET/*.exe                                   $DESTDIR/bin/
+cp storage/maria/$TARGET/*.exe                           $DESTDIR/bin/ || true
 cp storage/myisam/$TARGET/*.exe                          $DESTDIR/bin/
 # Maria engine is optional, so clients might not exist
 if ls storage/maria/$TARGET/*.exe > /dev/null 2>&1; then

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2008-05-08 16:01:15 +0000
+++ b/sql-common/client.c	2008-10-17 12:39:34 +0000
@@ -1836,6 +1836,13 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 		      db ? db : "(Null)",
 		      user ? user : "(Null)"));
 
+  /* Test whether we're already connected */
+  if (net->vio)
+  {
+    set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate);
+    DBUG_RETURN(0);
+  }
+
   /* Don't give sigpipe errors if the client doesn't want them */
   set_sigpipe(mysql);
   mysql->methods= &client_methods;

=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc	2008-09-16 16:09:18 +0000
+++ b/sql/backup/backup_info.cc	2008-10-21 15:45:46 +0000
@@ -593,7 +593,7 @@ int Backup_info::add_all_dbs()
   using namespace obs;
 
   int res= 0;
-  ObjIterator *dbit= get_databases(m_ctx.m_thd);
+  Obj_iterator *dbit= get_databases(m_ctx.m_thd);
   
   if (!dbit)
   {
@@ -655,7 +655,7 @@ int Backup_info::add_all_dbs()
 
   @returns 0 on success, error code otherwise.
  */
-int Backup_info::add_objects(Db &db, const obj_type type, obs::ObjIterator &it)
+int Backup_info::add_objects(Db &db, const obj_type type, obs::Obj_iterator &it)
 {
   obs::Obj *obj;
   
@@ -680,7 +680,7 @@ int Backup_info::add_db_items(Db &db)
 
   // Add tables.
 
-  ObjIterator *it= get_db_tables(m_ctx.m_thd, &db.name()); 
+  Obj_iterator *it= get_db_tables(m_ctx.m_thd, &db.name());
 
   if (!it)
   {
@@ -922,7 +922,7 @@ int Backup_info::add_view_deps(obs::Obj 
   
   // Get an iterator to iterate over base views of the given one.
 
-  obs::ObjIterator *it= obs::get_view_base_views(m_ctx.m_thd, db_name, name);
+  obs::Obj_iterator *it= obs::get_view_base_views(m_ctx.m_thd, db_name, name);
 
   if (!it)
     return ERROR;

=== modified file 'sql/backup/backup_info.h'
--- a/sql/backup/backup_info.h	2008-08-20 13:23:10 +0000
+++ b/sql/backup/backup_info.h	2008-10-17 11:28:25 +0000
@@ -64,7 +64,7 @@ class Backup_info: public backup::Image_
   Table* add_table(Db&, obs::Obj*);
 
   int add_db_items(Db&);
-  int add_objects(Db&, const obj_type, obs::ObjIterator&);
+  int add_objects(Db&, const obj_type, obs::Obj_iterator&);
   int add_view_deps(obs::Obj&);
 
   struct Dep_node;

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2008-09-02 09:04:39 +0000
+++ b/sql/backup/backup_kernel.h	2008-10-08 10:54:19 +0000
@@ -87,6 +87,11 @@ class Backup_restore_ctx: public backup:
       ongoing backup/restore operation.  If pointer is null, no
       operation is currently running. */
   static Backup_restore_ctx *current_op;
+  /**
+     Indicates if @c run_lock mutex was initialized and thus it should
+     be properly destroyed during shutdown. @sa backup_shutdown().
+   */
+  static bool run_lock_initialized;
   static pthread_mutex_t  run_lock; ///< To guard @c current_op.
 
   /** 

=== modified file 'sql/backup/backup_test.cc'
--- a/sql/backup/backup_test.cc	2008-09-05 14:16:07 +0000
+++ b/sql/backup/backup_test.cc	2008-10-17 11:28:25 +0000
@@ -44,7 +44,7 @@ int execute_backup_test_command(THD *thd
   field_list.push_back(new Item_empty_string("serialization", 13));
   protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
 
-  //obs::ObjIterator *it= obs::get_databases(thd);
+  //obs::Obj_iterator *it= obs::get_databases(thd);
   List_iterator<LEX_STRING> it(*db_list);
   
   //if (it)
@@ -68,7 +68,7 @@ int execute_backup_test_command(THD *thd
       // List tables..
       //
 
-      obs::ObjIterator *tit= obs::get_db_tables(thd, db->get_name());
+      obs::Obj_iterator *tit= obs::get_db_tables(thd, db->get_name());
 
       if (tit)
       {
@@ -250,7 +250,7 @@ int execute_backup_test_command(THD *thd
           String user;
           String host;
           String *user_host= (String *)grant->get_name();
-          user_exists(thd, user_host);
+          check_user_existence(thd, user_host);
           protocol->store(C_STRING_WITH_LEN("GRANT"),
                           system_charset_info);
           grant->serialize(thd, &serial);

=== modified file 'sql/backup/error.h'
--- a/sql/backup/error.h	2008-04-08 15:32:47 +0000
+++ b/sql/backup/error.h	2008-10-03 14:15:40 +0000
@@ -3,6 +3,14 @@
 
 namespace util {
 
+/// Used to save messages pushed into the stack
+struct SAVED_MYSQL_ERROR {
+  uint code;
+  MYSQL_ERROR::enum_warning_level level;
+  char *msg;
+};
+
+
 /**
   Report error stored in MYSQL_ERROR structure to a client.
 
@@ -11,7 +19,7 @@ namespace util {
   @returns 0 if error was reported, non-zero otherwise.
  */
 inline
-int report_mysql_error(THD* thd, MYSQL_ERROR *err, int code= 0)
+int report_mysql_error(THD* thd, SAVED_MYSQL_ERROR *err, int code= 0)
 {
   DBUG_ASSERT(err);
 

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-10-09 13:07:54 +0000
+++ b/sql/backup/kernel.cc	2008-10-18 07:57:38 +0000
@@ -95,6 +95,7 @@
 int backup_init()
 {
   pthread_mutex_init(&Backup_restore_ctx::run_lock, MY_MUTEX_INIT_FAST);
+  Backup_restore_ctx::run_lock_initialized= TRUE;
   return 0;
 }
 
@@ -103,10 +104,18 @@ int backup_init()
   
   @note This function is called in the server shut-down sequences, just before
   it shuts-down all its plugins.
+
+  @note Due to way in which server's code is organized this function might be
+  called and should work normally even in situation when backup_init() was not
+  called at all.
  */
 void backup_shutdown()
 {
-  pthread_mutex_destroy(&Backup_restore_ctx::run_lock);
+  if (Backup_restore_ctx::run_lock_initialized)
+  {
+    pthread_mutex_destroy(&Backup_restore_ctx::run_lock);
+    Backup_restore_ctx::run_lock_initialized= FALSE;
+  }
 }
 
 /*
@@ -258,7 +267,7 @@ execute_backup_command(THD *thd, LEX *le
  */
 int send_error(Backup_restore_ctx &log, int error_code, ...)
 {
-  MYSQL_ERROR *error= log.last_saved_error();
+  util::SAVED_MYSQL_ERROR *error= log.last_saved_error();
 
   if (error && !util::report_mysql_error(log.thd(), error, error_code))
   {
@@ -366,6 +375,7 @@ class Mem_allocator
 // static members
 
 Backup_restore_ctx *Backup_restore_ctx::current_op= NULL;
+bool Backup_restore_ctx::run_lock_initialized= FALSE;
 pthread_mutex_t Backup_restore_ctx::run_lock;
 
 
@@ -1824,8 +1834,8 @@ int bcat_create_item(st_bstream_image_he
     {
       DBUG_PRINT("restore",(" tablespace has changed on the server - aborting"));
       info->m_ctx.fatal_error(ER_BACKUP_TS_CHANGE, desc,
-                              obs::describe_tablespace(sobj)->ptr(),
-                              obs::describe_tablespace(ts)->ptr());
+                              obs::get_tablespace_description(sobj)->ptr(),
+                              obs::get_tablespace_description(ts)->ptr());
       return BSTREAM_ERROR;
     }
   }
@@ -1845,7 +1855,7 @@ int bcat_create_item(st_bstream_image_he
             error handling work in WL#4384 with possible implementation
             via a related bug report.
     */
-    if (!obs::user_exists(thd, sobj->get_name()))
+    if (!obs::check_user_existence(thd, sobj->get_name()))
     {
       info->m_ctx.write_message(log_level::WARNING, 
                                 ER(ER_BACKUP_GRANT_SKIPPED),

=== modified file 'sql/backup/logger.cc'
--- a/sql/backup/logger.cc	2008-09-08 11:05:26 +0000
+++ b/sql/backup/logger.cc	2008-10-08 10:54:19 +0000
@@ -46,8 +46,12 @@ int Logger::write_message(log_level::val
    switch (level) {
    case log_level::ERROR:
      if (m_save_errors)
-       errors.push_front(new MYSQL_ERROR(::current_thd, error_code,
-                                         MYSQL_ERROR::WARN_LEVEL_ERROR, msg));
+     {
+       error.code= error_code;
+       error.level= MYSQL_ERROR::WARN_LEVEL_ERROR;
+       error.msg= sql_strdup(msg);
+     }
+
      sql_print_error(out);
      push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                          error_code, msg);

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2008-09-30 07:51:48 +0000
+++ b/sql/backup/logger.h	2008-10-18 07:57:38 +0000
@@ -69,7 +69,7 @@ class Logger
    void save_errors();
    void stop_save_errors();
    void clear_saved_errors();
-   MYSQL_ERROR *last_saved_error();
+   util::SAVED_MYSQL_ERROR *last_saved_error();
 
  protected:
 
@@ -81,8 +81,7 @@ class Logger
   int write_message(log_level::value level , int error_code, const char *msg);
 
  private:
-
-  List<MYSQL_ERROR> errors;  ///< Used to store saved errors.
+  util::SAVED_MYSQL_ERROR error;   ///< Used to store saved errors.
   bool m_save_errors;        ///< Flag telling if errors should be saved.
   Backup_log *backup_log;    ///< Backup log interface class.
 };
@@ -172,15 +171,15 @@ void Logger::stop_save_errors()
 /// Delete all saved errors to free resources.
 inline
 void Logger::clear_saved_errors()
-{ 
-  errors.delete_elements();
+{
+  memset(&error, 0, sizeof(error));
 }
 
 /// Return a pointer to most recent saved error.
 inline
-MYSQL_ERROR *Logger::last_saved_error()
+util::SAVED_MYSQL_ERROR *Logger::last_saved_error()
 { 
-  return errors.is_empty() ? NULL : errors.head();
+  return error.code ? &error : NULL;
 }
 
 /// Report start of an operation.

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2008-10-16 14:30:35 +0000
+++ b/sql/log.cc	2008-10-21 12:38:13 +0000
@@ -5131,7 +5131,7 @@ THD::binlog_set_pending_rows_event(Rows_
 int
 MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd)
 {
-  DBUG_ENTER(__FUNCTION__);
+  DBUG_ENTER("MYSQL_BIN_LOG::remove_pending_rows_event");
 
   binlog_trx_data *const trx_data=
     (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-10-17 17:47:16 +0000
+++ b/sql/mysql_priv.h	2008-10-20 12:25:30 +0000
@@ -526,7 +526,7 @@ enum open_table_mode
   Dont report errors for individual rows,
   But just report error on commit (or read ofcourse)
 */
-#define OPTION_ALLOW_BATCH              (ULL(1) << 33) // THD, intern (slave)
+#define OPTION_ALLOW_BATCH              (ULL(1) << 34) // THD, intern (slave)
 
 /**
   Maximum length of time zone name that we support

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-10-17 17:47:16 +0000
+++ b/sql/mysqld.cc	2008-10-20 12:25:30 +0000
@@ -5997,10 +5997,6 @@ struct my_option my_long_options[] =
    "Set the default storage engine (table type) for tables.",
    (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"default-table-type", OPT_STORAGE_ENGINE,
-   "(deprecated) Use --default-storage-engine.",
-   (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
-   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
    (uchar**) &default_tz_name, (uchar**) &default_tz_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-09-29 18:41:59 +0000
+++ b/sql/share/errmsg.txt	2008-10-18 07:57:38 +0000
@@ -5020,7 +5020,7 @@ ER_WARN_HOSTNAME_WONT_WORK  
         por "MySQL foi inicializado em modo --skip-name-resolve. Voc� necesita reincializ�-lo sem esta op��o para este grant funcionar"
         spa "MySQL esta inicializado en modo --skip-name-resolve. Usted necesita reinicializarlo sin esta opci�n para este derecho funcionar"
 ER_UNKNOWN_STORAGE_ENGINE 42000 
-        eng "Unknown table engine '%s'"
+        eng "Unknown storage engine '%s'"
         ger "Unbekannte Speicher-Engine '%s'"
         por "Motor de tabela desconhecido '%s'"
         spa "Desconocido motor de tabla '%s'"

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2008-10-10 10:11:22 +0000
+++ b/sql/si_objects.cc	2008-10-17 11:28:25 +0000
@@ -261,10 +261,10 @@ bool drop_object(THD *thd, const char *o
   cmd.append(" IF EXISTS ");
   if (name1 && (name1->length() > 0))
   {
-    append_identifier(thd, &cmd, name1->c_ptr(), name1->length());  
+    append_identifier(thd, &cmd, name1->c_ptr(), name1->length());
     cmd.append(".");
   }
-  append_identifier(thd, &cmd, name2->c_ptr(), name2->length());  
+  append_identifier(thd, &cmd, name2->c_ptr(), name2->length());
   DBUG_RETURN(silent_exec(thd, &cmd));
 }
 
@@ -279,7 +279,7 @@ bool drop_object(THD *thd, const char *o
 
   @note: The select condition is designed to form a WHERE clause based on
   the database/schema column of the information_schema views. Most views have
-  a database/schema column but for those that do not, you must ignore the 
+  a database/schema column but for those that do not, you must ignore the
   selection condition by passing db_list = NULL.
 
   @retval TABLE* The schema table
@@ -344,7 +344,7 @@ void prepend_db(THD *thd, String *serial
   */
   serialization->length(0);
   serialization->append("USE ");
-  append_identifier(thd, serialization, db_name->c_ptr(), db_name->length());  
+  append_identifier(thd, serialization, db_name->c_ptr(), db_name->length());
   serialization->append("; ");
   DBUG_VOID_RETURN;
 }
@@ -394,7 +394,7 @@ void delete_table_name_key(void *data)
 ///////////////////////////////////////////////////////////////////////////
 
 namespace obs {
-  
+
 /**
   Build a where clause for list of databases.
 
@@ -408,7 +408,7 @@ namespace obs {
 
   @returns NULL if no databases in list or pointer to COND tree.
 */
-COND *create_db_select_condition(THD *thd, 
+COND *create_db_select_condition(THD *thd,
                                  TABLE *t,
                                  List<LEX_STRING> *db_list)
 {
@@ -416,7 +416,7 @@ COND *create_db_select_condition(THD *th
   List_iterator< ::LEX_STRING> it(*db_list);
   ::LEX_STRING *db;
   DBUG_ENTER("Obj::create_select_condition()");
-  
+
   /*
     If no list of databases, just return NULL
   */
@@ -439,7 +439,7 @@ COND *create_db_select_condition(THD *th
   */
   Item *db_field= new Item_field(thd, thd->lex->current_context(), t->field[1]);
   in_db_list.push_front(db_field);
-  
+
   /*
     Build the in function item comparison and add list of databases.
   */
@@ -711,7 +711,7 @@ class TablespaceObj : public Obj
 {
 public:
   TablespaceObj(const String *ts_name);
-  
+
 public:
   virtual bool do_serialize(THD *thd, String *serialization);
 
@@ -891,7 +891,7 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////
 
-class InformationSchemaIterator : public ObjIterator
+class InformationSchemaIterator : public Obj_iterator
 {
 public:
   static bool prepare_is_table(
@@ -932,7 +932,7 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////
 
-class ObjIteratorDummyImpl : ObjIterator
+class ObjIteratorDummyImpl : Obj_iterator
 {
 public:
   ObjIteratorDummyImpl() { return; }
@@ -1081,7 +1081,7 @@ protected:
 private:
   String m_db_name;
 };
- 
+
 class TblGrantIterator : public InformationSchemaIterator
 {
 public:
@@ -1101,7 +1101,7 @@ protected:
 private:
   String m_db_name;
 };
- 
+
 class ColGrantIterator : public InformationSchemaIterator
 {
 public:
@@ -1121,7 +1121,7 @@ protected:
 private:
   String m_db_name;
 };
- 
+
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -1168,7 +1168,7 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////
 
-class ViewBaseObjectsIterator : public ObjIterator
+class ViewBaseObjectsIterator : public Obj_iterator
 {
 public:
   enum IteratorType
@@ -1197,13 +1197,13 @@ private:
   uint m_cur_idx;
 
 private:
-  friend ObjIterator *get_view_base_tables(THD *,
+  friend Obj_iterator *get_view_base_tables(THD *,
+                                            const String *,
+                                            const String *);
+
+  friend Obj_iterator *get_view_base_views(THD *,
                                            const String *,
                                            const String *);
-
-  friend ObjIterator *get_view_base_views(THD *,
-                                          const String *,
-                                          const String *);
 };
 
 ///////////////////////////////////////////////////////////////////////////
@@ -1509,13 +1509,13 @@ DbGrantObj* DbGrantIterator::create_obj(
   */
   if (db_name == m_db_name)
   {
-    DBUG_PRINT("DbGrantIterator::create", (" Found grant %s %s %s", 
+    DBUG_PRINT("DbGrantIterator::create", (" Found grant %s %s %s",
      db_name.ptr(), grantee.ptr(), priv_type.ptr()));
 
     /*
       Include grants for only users that exist at time of backup.
     */
-    if (user_exists(m_thd, &grantee))
+    if (check_user_existence(m_thd, &grantee))
       return new DbGrantObj(&grantee, &db_name, &priv_type);
     else
       return NULL;
@@ -1538,7 +1538,7 @@ TblGrantObj* TblGrantIterator::create_ob
   String db_name;   // corresponds with TABLE_SCHEMA
   String tbl_name;  // corresponds with TABLE_NAME
   String priv_type; // corresponds with PRIVILEGE_TYPE
- 
+
   t->field[0]->val_str(&grantee);
   t->field[2]->val_str(&db_name);
   t->field[3]->val_str(&tbl_name);
@@ -1553,13 +1553,13 @@ TblGrantObj* TblGrantIterator::create_ob
   */
   if (db_name == m_db_name)
   {
-    DBUG_PRINT("TblGrantIterator::create", (" Found grant %s %s %s %s", 
+    DBUG_PRINT("TblGrantIterator::create", (" Found grant %s %s %s %s",
      db_name.ptr(), grantee.ptr(), tbl_name.ptr(), priv_type.ptr()));
 
     /*
       Include grants for only users that exist at time of backup.
     */
-    if (user_exists(m_thd, &grantee))
+    if (check_user_existence(m_thd, &grantee))
       return new TblGrantObj(&grantee, &db_name, &tbl_name, &priv_type);
     else
       return NULL;
@@ -1583,7 +1583,7 @@ ColGrantObj* ColGrantIterator::create_ob
   String tbl_name;  // corresponds with TABLE_NAME
   String col_name;  // corresponds with COLUMN_NAME
   String priv_type; // corresponds with PRIVILEGE_TYPE
- 
+
   t->field[0]->val_str(&grantee);
   t->field[2]->val_str(&db_name);
   t->field[3]->val_str(&tbl_name);
@@ -1599,14 +1599,14 @@ ColGrantObj* ColGrantIterator::create_ob
   */
   if (db_name == m_db_name)
   {
-    DBUG_PRINT("ColGrantIterator::create", (" Found grant %s %s %s %s %s", 
+    DBUG_PRINT("ColGrantIterator::create", (" Found grant %s %s %s %s %s",
      db_name.ptr(), grantee.ptr(), tbl_name.ptr(), col_name.ptr(),
      priv_type.ptr()));
 
     /*
       Include grants for only users that exist at time of backup.
     */
-    if (user_exists(m_thd, &grantee))
+    if (check_user_existence(m_thd, &grantee))
       return new ColGrantObj(&grantee, &db_name, &tbl_name,
                              &col_name, &priv_type);
     else
@@ -1734,14 +1734,14 @@ TableObj *ViewBaseObjectsIterator::next(
 
 ///////////////////////////////////////////////////////////////////////////
 
-ObjIterator *get_databases(THD *thd)
+Obj_iterator *get_databases(THD *thd)
 {
   TABLE *is_table;
   handler *ha;
   my_bitmap_map *orig_columns;
 
   if (InformationSchemaIterator::prepare_is_table(
-      thd, &is_table, &ha, &orig_columns, SCH_SCHEMATA, 
+      thd, &is_table, &ha, &orig_columns, SCH_SCHEMATA,
       thd->lex->db_list))
     return NULL;
 
@@ -1810,37 +1810,37 @@ template
 ColGrantIterator *
 create_is_iterator<ColGrantIterator>(THD *, enum_schema_tables, const String *);
 
-ObjIterator *get_db_tables(THD *thd, const String *db_name)
+Obj_iterator *get_db_tables(THD *thd, const String *db_name)
 {
   return create_is_iterator<DbTablesIterator>(thd, SCH_TABLES, db_name);
 }
 
-ObjIterator *get_db_views(THD *thd, const String *db_name)
+Obj_iterator *get_db_views(THD *thd, const String *db_name)
 {
   return create_is_iterator<DbViewsIterator>(thd, SCH_TABLES, db_name);
 }
 
-ObjIterator *get_db_triggers(THD *thd, const String *db_name)
+Obj_iterator *get_db_triggers(THD *thd, const String *db_name)
 {
   return create_is_iterator<DbTriggerIterator>(thd, SCH_TRIGGERS, db_name);
 }
 
-ObjIterator *get_db_stored_procedures(THD *thd, const String *db_name)
+Obj_iterator *get_db_stored_procedures(THD *thd, const String *db_name)
 {
   return create_is_iterator<DbStoredProcIterator>(thd, SCH_PROCEDURES, db_name);
 }
 
-ObjIterator *get_db_stored_functions(THD *thd, const String *db_name)
+Obj_iterator *get_db_stored_functions(THD *thd, const String *db_name)
 {
   return create_is_iterator<DbStoredFuncIterator>(thd, SCH_PROCEDURES, db_name);
 }
 
-ObjIterator *get_db_events(THD *thd, const String *db_name)
+Obj_iterator *get_db_events(THD *thd, const String *db_name)
 {
 #ifdef HAVE_EVENT_SCHEDULER
   return create_is_iterator<DbEventIterator>(thd, SCH_EVENTS, db_name);
 #else
-  return (ObjIterator *)new ObjIteratorDummyImpl;
+  return (Obj_iterator *)new ObjIteratorDummyImpl;
 #endif
 }
 
@@ -1852,16 +1852,16 @@ ObjIterator *get_db_events(THD *thd, con
   The iterators return all of the grants for the database specified.
 */
 GrantObjIterator::GrantObjIterator(THD *thd, const String *db_name)
-: ObjIterator()
+: Obj_iterator()
 {
-  db_grants= create_is_iterator<DbGrantIterator>(thd, 
-                                                 SCH_SCHEMA_PRIVILEGES, 
+  db_grants= create_is_iterator<DbGrantIterator>(thd,
+                                                 SCH_SCHEMA_PRIVILEGES,
                                                  db_name);
   tbl_grants= create_is_iterator<TblGrantIterator>(thd,
-                                                 SCH_TABLE_PRIVILEGES, 
+                                                 SCH_TABLE_PRIVILEGES,
                                                  db_name);
-  col_grants= create_is_iterator<ColGrantIterator>(thd, 
-                                                 SCH_COLUMN_PRIVILEGES, 
+  col_grants= create_is_iterator<ColGrantIterator>(thd,
+                                                 SCH_COLUMN_PRIVILEGES,
                                                  db_name);
 }
 
@@ -1879,7 +1879,7 @@ Obj *GrantObjIterator::next()
 /**
   Creates a high-level iterator that iterates over database-, table-,
   routine-, and column-level privileges which shall permit a single
-  iterator from the si_objects to retrieve all of the privileges for 
+  iterator from the si_objects to retrieve all of the privileges for
   a given database.
 
   @param[IN] thd      Current THD object
@@ -1890,7 +1890,7 @@ Obj *GrantObjIterator::next()
   @return a pointer to an iterator object.
     @retval NULL in case of error.
 */
-ObjIterator *get_all_db_grants(THD *thd, const String *db_name)
+Obj_iterator *get_all_db_grants(THD *thd, const String *db_name)
 {
   return new GrantObjIterator(thd, db_name);
 }
@@ -1903,17 +1903,17 @@ ObjIterator *get_all_db_grants(THD *thd,
 
 ///////////////////////////////////////////////////////////////////////////
 
-ObjIterator* get_view_base_tables(THD *thd,
-                                  const String *db_name,
-                                  const String *view_name)
+Obj_iterator* get_view_base_tables(THD *thd,
+                                   const String *db_name,
+                                   const String *view_name)
 {
   return ViewBaseObjectsIterator::create(
     thd, db_name, view_name, ViewBaseObjectsIterator::GET_BASE_TABLES);
 }
 
-ObjIterator* get_view_base_views(THD *thd,
-                                 const String *db_name,
-                                 const String *view_name)
+Obj_iterator* get_view_base_views(THD *thd,
+                                  const String *db_name,
+                                  const String *view_name)
 {
   return ViewBaseObjectsIterator::create(
     thd, db_name, view_name, ViewBaseObjectsIterator::GET_BASE_VIEWS);
@@ -2918,8 +2918,8 @@ const String *TablespaceObj::build_seria
   if (m_ts_name.length() > 0)
   {
     THD *thd= current_thd;
-    append_identifier(thd, &m_create_stmt, 
-      m_ts_name.c_ptr(), m_ts_name.length());  
+    append_identifier(thd, &m_create_stmt,
+      m_ts_name.c_ptr(), m_ts_name.length());
   }
   m_create_stmt.append(" ADD DATAFILE '");
   m_create_stmt.append(m_datafile);
@@ -3046,7 +3046,7 @@ bool DbGrantObj::do_execute(THD *thd)
 TblGrantObj::TblGrantObj(const String *grantee,
                          const String *db_name,
                          const String *table_name,
-                         const String *priv_type) 
+                         const String *priv_type)
 : DbGrantObj(grantee, db_name, priv_type)
 {
   // copy strings to newly allocated memory
@@ -3095,7 +3095,7 @@ ColGrantObj::ColGrantObj(const String *g
                          const String *db_name,
                          const String *table_name,
                          const String *col_name,
-                         const String *priv_type) 
+                         const String *priv_type)
 : TblGrantObj(grantee, db_name, table_name, priv_type)
 {
   // copy strings to newly allocated memory
@@ -3188,10 +3188,10 @@ Obj *get_event(const String *db_name,
 
 Obj *materialize_database(const String *db_name,
                           uint serialization_version,
-                          const String *serialialization)
+                          const String *serialization)
 {
   Obj *obj= new DatabaseObj(db_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3199,10 +3199,10 @@ Obj *materialize_database(const String *
 Obj *materialize_table(const String *db_name,
                        const String *table_name,
                        uint serialization_version,
-                       const String *serialialization)
+                       const String *serialization)
 {
   Obj *obj= new TableObj(db_name, table_name, false);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3210,10 +3210,10 @@ Obj *materialize_table(const String *db_
 Obj *materialize_view(const String *db_name,
                       const String *view_name,
                       uint serialization_version,
-                      const String *serialialization)
+                      const String *serialization)
 {
   Obj *obj= new TableObj(db_name, view_name, true);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3221,10 +3221,10 @@ Obj *materialize_view(const String *db_n
 Obj *materialize_trigger(const String *db_name,
                          const String *trigger_name,
                          uint serialization_version,
-                         const String *serialialization)
+                         const String *serialization)
 {
   Obj *obj= new TriggerObj(db_name, trigger_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3232,10 +3232,10 @@ Obj *materialize_trigger(const String *d
 Obj *materialize_stored_procedure(const String *db_name,
                                   const String *stored_proc_name,
                                   uint serialization_version,
-                                  const String *serialialization)
+                                  const String *serialization)
 {
   Obj *obj= new StoredProcObj(db_name, stored_proc_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3243,10 +3243,10 @@ Obj *materialize_stored_procedure(const 
 Obj *materialize_stored_function(const String *db_name,
                                  const String *stored_func_name,
                                  uint serialization_version,
-                                 const String *serialialization)
+                                 const String *serialization)
 {
   Obj *obj= new StoredFuncObj(db_name, stored_func_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3255,10 +3255,10 @@ Obj *materialize_stored_function(const S
 Obj *materialize_event(const String *db_name,
                        const String *event_name,
                        uint serialization_version,
-                       const String *serialialization)
+                       const String *serialization)
 {
   Obj *obj= new EventObj(db_name, event_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3266,10 +3266,10 @@ Obj *materialize_event(const String *db_
 
 Obj *materialize_tablespace(const String *ts_name,
                             uint serialization_version,
-                            const String *serialialization)
+                            const String *serialization)
 {
   Obj *obj= new TablespaceObj(ts_name);
-  obj->materialize(serialization_version, serialialization);
+  obj->materialize(serialization_version, serialization);
 
   return obj;
 }
@@ -3293,7 +3293,7 @@ Obj *materialize_db_grant(const String *
     grants. We use DbGrantObj for all types of grants because
     we only have the GRANT statement in the serialization
     string and therefore do not that the 'parts' to create
-    the specific types. 
+    the specific types.
   */
   Obj *obj= get_db_grant(grantee, db_name);
   obj->materialize(serialization_version, serialization);
@@ -3383,10 +3383,7 @@ int split_user_host(String *grantee, Str
   return 0;
 }
 
-/*
-  Returns TRUE if user is defined on the system.
-*/
-bool user_exists(THD *thd, const String *grantee)
+bool check_user_existence(THD *thd, const String *grantee)
 {
   String user;
   String host;
@@ -3412,7 +3409,7 @@ bool user_exists(THD *thd, const String 
   Locate the row in the information_schema view for this tablespace.
 
   This method returns a row from a tablespace information_schema view
-  that matches the tablespace name passed. 
+  that matches the tablespace name passed.
 
   @param[in]     thd           Thread context
   @param[in]     is_table_idx  The information schema to search
@@ -3420,7 +3417,7 @@ bool user_exists(THD *thd, const String 
   @param[in]     ts_engine     Engine of the tablespace to find
   @param[out]    datafile      The datafile for the tablespace
   @param[out]    comments      The comments for the tablespace
-  
+
   @retval FALSE if tablespace exists and no errors
   @retval TRUE if tablespace does not exist or errors
 */
@@ -3529,14 +3526,14 @@ static bool find_tablespace_schema_row(T
   @param[out]    TablespaceObj A pointer to a new tablespace object
   @param[in]     ts_name       The name of the tablespace to find
   @param[in]     ts_engine     Engine of the tablespace to find
-  
+
   @note Caller is responsible for destroying the tablespace object.
 
   @retval FALSE if tablespace exists and no errors
   @retval TRUE if tablespace does not exist or errors
 */
 static bool get_tablespace_from_schema(THD *thd,
-                                       TablespaceObj **ts, 
+                                       TablespaceObj **ts,
                                        const String *ts_name,
                                        const String *ts_engine)
 {
@@ -3547,14 +3544,14 @@ static bool get_tablespace_from_schema(T
   /*
     Locate the row in TABLESPACES and get the comments.
   */
-  if (find_tablespace_schema_row(thd, SCH_TABLESPACES, 
+  if (find_tablespace_schema_row(thd, SCH_TABLESPACES,
       ts_name, ts_engine, &datafile, &comments))
     DBUG_RETURN(TRUE);
 
   /*
     Locate the row in FILES and get the datafile.
   */
-  if (find_tablespace_schema_row(thd, SCH_FILES, 
+  if (find_tablespace_schema_row(thd, SCH_FILES,
       ts_name, ts_engine, &datafile, &comments))
     DBUG_RETURN(TRUE);
 
@@ -3564,7 +3561,7 @@ static bool get_tablespace_from_schema(T
   if (datafile.length() == 0)
     DBUG_RETURN(TRUE);
 
-  DBUG_PRINT("get_tablespace_from_schema", (" Found tablespace %s %s", 
+  DBUG_PRINT("get_tablespace_from_schema", (" Found tablespace %s %s",
     ts_name->ptr(), datafile.ptr()));
 
   TablespaceObj *ts_local= new TablespaceObj(ts_name);
@@ -3578,20 +3575,20 @@ static bool get_tablespace_from_schema(T
 
 /**
   Retrieve the tablespace for a table if it exists
-  
+
   This method returns a @c TablespaceObj object if the table has a tablespace.
 
   @param[in]  thd       Thread context.
   @param[in]  db_name   The database name for the table.
   @param[in]  tbl_name  The table name.
-  
+
   @note Caller is responsible for destroying the object.
 
-  @retval Tablespace object if table uses a tablespace 
+  @retval Tablespace object if table uses a tablespace
   @retval NULL if table does not use a tablespace
 */
-Obj *get_tablespace_for_table(THD *thd, 
-                              const String *db_name, 
+Obj *get_tablespace_for_table(THD *thd,
+                              const String *db_name,
                               const String *tbl_name)
 {
   TablespaceObj *ts= NULL;
@@ -3599,7 +3596,7 @@ Obj *get_tablespace_for_table(THD *thd, 
   String ts_name, ts_engine;
   const char *ts_name_str= NULL;
   DBUG_ENTER("obs::get_tablespace_for_table()");
-  DBUG_PRINT("obs::get_tablespace_for_table", ("name: %s.%s", 
+  DBUG_PRINT("obs::get_tablespace_for_table", ("name: %s.%s",
              db_name->ptr(), tbl_name->ptr()));
 
   const char *db= db_name->ptr();
@@ -3641,12 +3638,12 @@ end:
   Determine if tablespace exists.
 
   This method determines if a materialized tablespace exists on the
-  system. This compares the name and all saved attributes of the 
+  system. This compares the name and all saved attributes of the
   tablespace. A FALSE return would mean either the tablespace does
   not exist or the tablespace attributes are different.
 
   @param[in]  Obj  The TablspaceObj pointer to compare.
-  
+
   @retval TRUE if it exists
   @retval FALSE if it does not exist
 */
@@ -3660,8 +3657,8 @@ bool tablespace_exists(THD *thd,
                              this_ts->get_engine());
   if (!other_ts)
     DBUG_RETURN(retval);
-  retval= (my_strcasecmp(system_charset_info, 
-           other_ts->build_serialization()->ptr(), 
+  retval= (my_strcasecmp(system_charset_info,
+           other_ts->build_serialization()->ptr(),
            ((TablespaceObj *)ts)->build_serialization()->ptr()) == 0);
   delete other_ts;
   DBUG_RETURN(retval);
@@ -3669,12 +3666,12 @@ bool tablespace_exists(THD *thd,
 
 /**
   Is there a tablespace with the given name?
-  
+
   This method determines if the tablespace referenced by name exists on the
   system. Returns a TablespaceObj if it exists or NULL if it doesn't.
 
   @param[in]  Obj  The TablspaceObj pointer to compare.
-  
+
   @note Caller is responsible for destroying the tablespace object.
 
   @returns the tablespace if found or NULL if not found
@@ -3695,12 +3692,12 @@ Obj *is_tablespace(THD *thd, Obj *ts)
   with the user.
 
   @param[in]  ts  The Tablspace to describe.
-  
+
   @returns tablespace description
 */
-const String *describe_tablespace(Obj *ts)
+const String *get_tablespace_description(Obj *ts)
 {
-  DBUG_ENTER("obs::describe_tablespace()");
+  DBUG_ENTER("obs::get_tablespace_description()");
   DBUG_RETURN(((TablespaceObj *)ts)->describe());
 }
 
@@ -3794,7 +3791,7 @@ TABLE_LIST *Name_locker::build_table_lis
   TABLE_LIST *tl= NULL;
   Obj *tbl= NULL;
   DBUG_ENTER("Name_locker::build_table_list()");
-  
+
   List_iterator<Obj> it(*tables);
   while ((tbl= it++))
   {

=== modified file 'sql/si_objects.h'
--- a/sql/si_objects.h	2008-09-11 16:28:29 +0000
+++ b/sql/si_objects.h	2008-10-17 11:28:25 +0000
@@ -19,10 +19,11 @@ namespace obs {
   Obj defines the basic set of operations for each database object.
 */
 
-class Obj { 
+class Obj
+{
 public:
 
-  bool serialize(THD *thd, String *serialialization);
+  bool serialize(THD *thd, String *serialization);
 
   /**
     Return the name of the object.
@@ -50,18 +51,18 @@ private:
     Read the object state from a given buffer and restores object state to
     the point, where it can be executed.
 
-    @param[in] serialialization_version The version of the serialization format.
-    @param[in] serialialization         Buffer contained serialized object.
+    @param[in] serialization_version The version of the serialization format.
+    @param[in] serialization         Buffer contained serialized object.
 
     @return error status.
       @retval FALSE on success.
       @retval TRUE on error.
   */
   virtual bool materialize(uint serialization_version,
-                           const String *serialialization) = 0;
+                           const String *serialization) = 0;
 
   /// Primitive implementing @c serialize() method.
-  virtual bool do_serialize(THD *thd, String *serialialization) = 0;
+  virtual bool do_serialize(THD *thd, String *serialization) = 0;
 
   /// Primitive implementing @c execute() method.
   virtual bool do_execute(THD *thd) = 0;
@@ -174,8 +175,8 @@ bool Obj::execute(THD *thd)
   the server must be able to materialize objects coded in any previous
   formats.
 
-  @param[in] thd              Server thread context.
-  @param[in] serialialization Buffer to serialize the object
+  @param[in] thd           Server thread context.
+  @param[in] serialization Buffer to serialize the object
 
   @return error status.
     @retval FALSE on success.
@@ -190,7 +191,7 @@ bool Obj::serialize(THD *thd, String *se
 {
   ulong saved_sql_mode= thd->variables.sql_mode;
   thd->variables.sql_mode= 0;
-  
+
   bool ret= do_serialize(thd, serialization);
 
   thd->variables.sql_mode= saved_sql_mode;
@@ -201,14 +202,14 @@ bool Obj::serialize(THD *thd, String *se
 ///////////////////////////////////////////////////////////////////////////
 
 /**
-  ObjIterator is a basic interface to enumerate the objects.
+  Obj_iterator is a basic interface to enumerate the objects.
 */
 
-class ObjIterator
+class Obj_iterator
 {
 public:
 
-  ObjIterator()
+  Obj_iterator()
   { }
 
   /**
@@ -223,7 +224,7 @@ public:
   virtual Obj *next() = 0;
 
 public:
-  virtual ~ObjIterator()
+  virtual ~Obj_iterator()
   { }
 
 };
@@ -232,12 +233,12 @@ public:
   GrantObjIternator is an encapsulation of the three iterators for each level
   of grant supported: database-, table- and routine-, and column-level.
 */
-class GrantObjIterator : public ObjIterator
+class GrantObjIterator : public Obj_iterator
 {
 public:
   GrantObjIterator(THD *thd, const String *db_name);
 
-  ~GrantObjIterator() 
+  ~GrantObjIterator()
   {
     delete db_grants;
     delete tbl_grants;
@@ -256,9 +257,9 @@ public:
   Obj *next();
 
 private:
-  ObjIterator *db_grants;  ///< database-level grants
-  ObjIterator *tbl_grants; ///< table- and routine-level grants
-  ObjIterator *col_grants; ///< column-level grants
+  Obj_iterator *db_grants;  ///< database-level grants
+  Obj_iterator *tbl_grants; ///< table- and routine-level grants
+  Obj_iterator *col_grants; ///< column-level grants
 };
 
 ///////////////////////////////////////////////////////////////////////////
@@ -400,7 +401,7 @@ Obj *get_event(const String *db_name, co
   @return a pointer to an iterator object.
 */
 
-ObjIterator *get_databases(THD *thd);
+Obj_iterator *get_databases(THD *thd);
 
 /**
   Create an iterator over all tables in the particular database.
@@ -411,7 +412,7 @@ ObjIterator *get_databases(THD *thd);
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_tables(THD *thd, const String *db_name);
+Obj_iterator *get_db_tables(THD *thd, const String *db_name);
 
 /**
   Create an iterator over all views in the particular database.
@@ -422,7 +423,7 @@ ObjIterator *get_db_tables(THD *thd, con
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_views(THD *thd, const String *db_name);
+Obj_iterator *get_db_views(THD *thd, const String *db_name);
 
 /**
   Create an iterator over all triggers in the particular database.
@@ -433,7 +434,7 @@ ObjIterator *get_db_views(THD *thd, cons
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_triggers(THD *thd, const String *db_name);
+Obj_iterator *get_db_triggers(THD *thd, const String *db_name);
 
 /**
   Create an iterator over all stored procedures in the particular database.
@@ -444,7 +445,7 @@ ObjIterator *get_db_triggers(THD *thd, c
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_stored_procedures(THD *thd, const String *db_name);
+Obj_iterator *get_db_stored_procedures(THD *thd, const String *db_name);
 
 /**
   Create an iterator over all stored functions in the particular database.
@@ -455,7 +456,7 @@ ObjIterator *get_db_stored_procedures(TH
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_stored_functions(THD *thd, const String *db_name);
+Obj_iterator *get_db_stored_functions(THD *thd, const String *db_name);
 
 /**
   Create an iterator over all events in the particular database.
@@ -466,15 +467,15 @@ ObjIterator *get_db_stored_functions(THD
     @retval NULL in case of error.
 */
 
-ObjIterator *get_db_events(THD *thd, const String *db_name);
+Obj_iterator *get_db_events(THD *thd, const String *db_name);
 
 /*
   Creates a high-level iterator that iterates over database-, table-,
   routine-, and column-level privileges which shall permit a single
-  iterator from the si_objects to retrieve all of the privileges for 
+  iterator from the si_objects to retrieve all of the privileges for
   a given database.
 */
-ObjIterator *get_all_db_grants(THD *thd, const String *db_name);
+Obj_iterator *get_all_db_grants(THD *thd, const String *db_name);
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -491,9 +492,9 @@ ObjIterator *get_all_db_grants(THD *thd,
     @retval NULL in case of error.
 */
 
-ObjIterator* get_view_base_tables(THD *thd,
-                                  const String *db_name,
-                                  const String *view_name);
+Obj_iterator* get_view_base_tables(THD *thd,
+                                   const String *db_name,
+                                   const String *view_name);
 
 /**
   Create an iterator overl all base tables in the particular view.
@@ -504,9 +505,9 @@ ObjIterator* get_view_base_tables(THD *t
     @retval NULL in case of error.
 */
 
-ObjIterator* get_view_base_views(THD *thd,
-                                 const String *db_name,
-                                 const String *view_name);
+Obj_iterator* get_view_base_views(THD *thd,
+                                  const String *db_name,
+                                  const String *view_name);
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -517,41 +518,41 @@ ObjIterator* get_view_base_views(THD *th
 
 Obj *materialize_database(const String *db_name,
                           uint serialization_version,
-                          const String *serialialization);
+                          const String *serialization);
 
 Obj *materialize_table(const String *db_name,
                        const String *table_name,
                        uint serialization_version,
-                       const String *serialialization);
+                       const String *serialization);
 
 Obj *materialize_view(const String *db_name,
                       const String *view_name,
                       uint serialization_version,
-                      const String *serialialization);
+                      const String *serialization);
 
 Obj *materialize_trigger(const String *db_name,
                          const String *trigger_name,
                          uint serialization_version,
-                         const String *serialialization);
+                         const String *serialization);
 
 Obj *materialize_stored_procedure(const String *db_name,
                                   const String *stored_proc_name,
                                   uint serialization_version,
-                                  const String *serialialization);
+                                  const String *serialization);
 
 Obj *materialize_stored_function(const String *db_name,
                                  const String *stored_func_name,
                                  uint serialization_version,
-                                 const String *serialialization);
+                                 const String *serialization);
 
 Obj *materialize_event(const String *db_name,
                        const String *event_name,
                        uint serialization_version,
-                       const String *serialialization);
+                       const String *serialization);
 
 Obj *materialize_tablespace(const String *ts_name,
                             uint serialization_version,
-                            const String *serialialization);
+                            const String *serialization);
 
 Obj *materialize_db_grant(const String *grantee,
                           const String *db_name,
@@ -560,6 +561,14 @@ Obj *materialize_db_grant(const String *
 
 ///////////////////////////////////////////////////////////////////////////
 
+/**
+  Check if the given database name is reserved for internal use.
+
+  @return
+    @retval TRUE if the given database name is reserved for internal use
+    @retval FALSE otherwise.
+*/
+
 bool is_internal_db_name(const String *db_name);
 
 ///////////////////////////////////////////////////////////////////////////
@@ -571,40 +580,49 @@ bool is_internal_db_name(const String *d
     @retval FALSE on success (the database exists and accessible).
     @retval TRUE on error (the database either not exists, or not accessible).
 */
+
 bool check_db_existence(const String *db_name);
 
 /*
-  Returns TRUE if user is defined on the system.
+  Check if the given user is actually defined on the system.
+
+  @return Existence status.
+    @retval TRUE if user is defined on the system.
+    @retval FALSE if user does not exist.
 */
-bool user_exists(THD *thd, const String *grantee);
+
+bool check_user_existence(THD *thd, const String *grantee);
 
 /*
   This method returns a @c TablespaceObj object if the table has a tablespace.
 */
-Obj *get_tablespace_for_table(THD *thd, 
-                              const String *db_name, 
+
+Obj *get_tablespace_for_table(THD *thd,
+                              const String *db_name,
                               const String *tbl_name);
 
 /*
   This method determines if a materialized tablespace exists on the
-  system. This compares the name and all saved attributes of the 
+  system. This compares the name and all saved attributes of the
   tablespace. A FALSE return would mean either the tablespace does
   not exist or the tablespace attributes are different.
 */
-bool tablespace_exists(THD *thd,
-                       Obj *ts);
+
+bool tablespace_exists(THD *thd, Obj *ts);
 
 /*
   This method determines if the tablespace referenced by name exists on the
   system. Returns a TablespaceObj if it exists or NULL if it doesn't.
 */
+
 Obj *is_tablespace(THD *thd, Obj *ts);
 
-/*
-  This method returns a description of the tablespace useful for communicating
-  with the user.
+/**
+  Return a description of the tablespace useful for communicating with the
+  user.
 */
-const String *describe_tablespace(Obj *ts);
+
+const String *get_tablespace_description(Obj *ts);
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -656,22 +674,22 @@ void ddl_blocker_exception_off(THD *thd)
   Creates a WHERE clause for information schema table lookups of the
   for FROM INFORMATION_SCHEMA.X WHERE <db_col> IN ('a','b','c').
 */
-COND *create_db_select_condition(THD *thd, 
+COND *create_db_select_condition(THD *thd,
                                  TABLE *t,
                                  List<LEX_STRING> *db_list);
 
 /*
   The following class is used to manage name locks on a list of tables.
 
-  This class uses a list of type List<Obj> to establish the table list 
+  This class uses a list of type List<Obj> to establish the table list
   that will be used to manage locks on the tables.
 */
 class Name_locker
 {
 public:
   Name_locker(THD *thd) { m_thd= thd; }
-  ~Name_locker() 
-  { 
+  ~Name_locker()
+  {
     free_table_list(m_table_list);
     m_table_list= NULL;
   }

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2008-10-08 15:29:55 +0000
+++ b/sql/sql_class.cc	2008-10-21 12:38:13 +0000
@@ -3517,7 +3517,7 @@ int THD::binlog_delete_row(TABLE* table,
 
 int THD::binlog_remove_pending_rows_event(bool clear_maps)
 {
-  DBUG_ENTER(__FUNCTION__);
+  DBUG_ENTER("THD::binlog_remove_pending_rows_event");
 
   if (!mysql_bin_log.is_open())
     DBUG_RETURN(0);

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-10-08 11:46:49 +0000
+++ b/sql/sql_table.cc	2008-10-16 12:18:07 +0000
@@ -7024,7 +7024,6 @@ view_err:
   /* Copy the data if necessary. */
   thd->count_cuted_fields= CHECK_FIELD_WARN;	// calc cuted fields
   thd->cuted_fields=0L;
-  thd_proc_info(thd, "copy to tmp table");
   copied=deleted=0;
   /*
     We do not copy data for MERGE tables. Only the children have data.
@@ -7035,6 +7034,7 @@ view_err:
     /* We don't want update TIMESTAMP fields during ALTER TABLE. */
     new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
     new_table->next_number_field=new_table->found_next_number_field;
+    thd_proc_info(thd, "copy to tmp table");
     error= copy_data_between_tables(table, new_table,
                                     alter_info->create_list, ignore,
                                    order_num, order, &copied, &deleted,
@@ -7604,6 +7604,12 @@ bool mysql_checksum_table(THD *thd, TABL
 	{
 	  for (;;)
 	  {
+            if (thd->killed)
+            {
+              t->file->ha_rnd_end();
+              thd->protocol->remove_last_row();
+              goto err;
+            }
 	    ha_checksum row_crc= 0;
             int error= t->file->rnd_next(t->record[0]);
             if (unlikely(error))

=== modified file 'storage/falcon/NNode.h'
--- a/storage/falcon/NNode.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/NNode.h	2008-09-20 23:20:02 +0000
@@ -109,7 +109,7 @@ enum NType {
 	Cast,
 	BlobRef,
 	Upper,
-	Lower,
+	Lower
    };
 
 class NNode  

=== modified file 'storage/falcon/StorageVersion.h'
--- a/storage/falcon/StorageVersion.h	2008-10-21 14:44:05 +0000
+++ b/storage/falcon/StorageVersion.h	2008-10-22 13:30:44 +0000
@@ -14,5 +14,5 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 
-#define FALCON_VERSION	"T1.2-8"
-#define FALCON_DATE		"21 October, 2008"
+#define FALCON_VERSION	"T1.2-9"
+#define FALCON_DATE		"22 October, 2008"

=== modified file 'storage/falcon/Types.h'
--- a/storage/falcon/Types.h	2008-06-19 15:09:45 +0000
+++ b/storage/falcon/Types.h	2008-09-20 23:20:02 +0000
@@ -70,7 +70,7 @@ enum JdbcType {
 	jdbcBLOB	= 2004,
 	jdbcCLOB	= 2005,
 	CLOB		= 2005,
-	NUMERIC		= 2,
+	NUMERIC		= 2
 	};
 #endif
 
@@ -103,7 +103,7 @@ enum TerType {
 	terScaledLong,
 	terScaledQuad,
 	terRepositoryBlob,
-	terRepositoryClob,
+	terRepositoryClob
 	};
 
 

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-10-16 02:53:35 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-10-22 12:01:16 +0000
@@ -1094,14 +1094,19 @@ int StorageInterface::write_row(uchar *b
 
 	if (table->next_number_field && buff == table->record[0])
 		{
-		update_auto_increment();
+		int code = update_auto_increment();
+		/*
+		   May fail, e.g. due to an out of range value in STRICT mode.
+		*/
+		if (code)
+			DBUG_RETURN(code);
 
 		/*
 		   If the new value is less than the current highest value, it will be
 		   ignored by setSequenceValue().
 		*/
 
-		int code = storageShare->setSequenceValue(table->next_number_field->val_int());
+		code = storageShare->setSequenceValue(table->next_number_field->val_int());
 
 		if (code)
 			DBUG_RETURN(error(code));

=== modified file 'storage/falcon/plug.in'
--- a/storage/falcon/plug.in	2008-08-20 13:27:29 +0000
+++ b/storage/falcon/plug.in	2008-09-23 09:08:59 +0000
@@ -66,33 +66,40 @@ MYSQL_PLUGIN_ACTIONS(falcon,[
   AC_CACHE_CHECK([compiler flag to enable implicit templates],
                  falcon_cxx_enable_implicit_templates,[
     CXXFLAGS="$ac_save_CXXFLAGS -fimplicit-templates"
-    AC_TRY_LINK([],
-      [int i = 0;
-       i++;],
-      falcon_cxx_enable_implicit_templates="-fimplicit-templates",
-      falcon_cxx_enable_implicit_templates=""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+      falcon_cxx_enable_implicit_templates="-fimplicit-templates"
     )
   ])
 
+  # -lstdc++ really shouldn't be here, and is only required while we continue
+  # to use gcc to link C++ code for the static linking hack.  Once we stop
+  # doing that it should be removed from here, and the CXXLDFLAG setting below
+  # will do the right thing for g++.
   AC_CACHE_CHECK([compiler flag to enable exceptions],
                  falcon_cxx_enable_exceptions,[
-    CXXFLAGS="$ac_save_CXXFLAGS -fexceptions -lstdc++"
-    AC_TRY_LINK([],
-      [int i = 0;
-       i++;],
-      falcon_cxx_enable_exceptions="-fexceptions -lstdc++",
-      falcon_cxx_enable_exceptions=""
-    )
+    m4_foreach([cxxflag], [[-fexceptions -lstdc++], [-features=except]],[
+      CXXFLAGS="$ac_save_CXXFLAGS cxxflag"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+        falcon_cxx_enable_exceptions="cxxflag"
+      )
+    ])
+  ])
+
+  AC_CACHE_CHECK([linker flag to enable STL],
+                 falcon_cxx_enable_stl,[
+    m4_foreach([cxxflag], [-lstdc++],[
+      CXXFLAGS="$ac_save_CXXFLAGS cxxflag"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+        falcon_cxx_enable_stl="cxxflag"
+      )
+    ])
   ])
 
   AC_CACHE_CHECK([compiler flag to silence offsetof warnings],
                  falcon_cxx_no_invalid_offsetof,[
     CXXFLAGS="$ac_save_CXXFLAGS -Wno-invalid-offsetof"
-    AC_TRY_LINK([],
-      [int i = 0;
-       i++;],
-      falcon_cxx_no_invalid_offsetof="-Wno-invalid-offsetof",
-      falcon_cxx_no_invalid_offsetof=""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+      falcon_cxx_no_invalid_offsetof="-Wno-invalid-offsetof"
     )
   ])
 
@@ -100,7 +107,7 @@ MYSQL_PLUGIN_ACTIONS(falcon,[
   AC_LANG_POP([C++])
 
   # Falcon uses exceptions and STL.
-  CXXLDFLAGS="$CXXLDFLAGS $falcon_cxx_enable_exceptions"
+  CXXLDFLAGS="$CXXLDFLAGS $falcon_cxx_enable_stl"
   FALCON_CXXFLAGS="$falcon_cxx_no_invalid_offsetof $falcon_cxx_enable_implicit_templates $falcon_cxx_enable_exceptions"
   case "$with_debug" in
     yes)  FALCON_CXXFLAGS="$FALCON_CXXFLAGS -D_DEBUG" ;;

=== modified file 'support-files/my-huge.cnf.sh'
--- a/support-files/my-huge.cnf.sh	2008-10-03 12:24:19 +0000
+++ b/support-files/my-huge.cnf.sh	2008-10-16 12:18:07 +0000
@@ -124,7 +124,6 @@ server-id	= 1
 #innodb_data_home_dir = @localstatedir@/
 #innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
 #innodb_log_group_home_dir = @localstatedir@/
-#innodb_log_arch_dir = @localstatedir@/
 # You can set .._buffer_pool_size up to 50 - 80 %
 # of RAM but beware of setting memory usage too high
 #innodb_buffer_pool_size = 384M

=== modified file 'support-files/my-large.cnf.sh'
--- a/support-files/my-large.cnf.sh	2008-10-03 12:24:19 +0000
+++ b/support-files/my-large.cnf.sh	2008-10-16 12:18:07 +0000
@@ -124,7 +124,6 @@ server-id	= 1
 #innodb_data_home_dir = @localstatedir@/
 #innodb_data_file_path = ibdata1:10M:autoextend
 #innodb_log_group_home_dir = @localstatedir@/
-#innodb_log_arch_dir = @localstatedir@/
 # You can set .._buffer_pool_size up to 50 - 80 %
 # of RAM but beware of setting memory usage too high
 #innodb_buffer_pool_size = 256M

=== modified file 'support-files/my-medium.cnf.sh'
--- a/support-files/my-medium.cnf.sh	2008-10-03 12:24:19 +0000
+++ b/support-files/my-medium.cnf.sh	2008-10-16 12:18:07 +0000
@@ -122,7 +122,6 @@ server-id	= 1
 #innodb_data_home_dir = @localstatedir@/
 #innodb_data_file_path = ibdata1:10M:autoextend
 #innodb_log_group_home_dir = @localstatedir@/
-#innodb_log_arch_dir = @localstatedir@/
 # You can set .._buffer_pool_size up to 50 - 80 %
 # of RAM but beware of setting memory usage too high
 #innodb_buffer_pool_size = 16M

=== modified file 'support-files/my-small.cnf.sh'
--- a/support-files/my-small.cnf.sh	2008-10-03 12:24:19 +0000
+++ b/support-files/my-small.cnf.sh	2008-10-16 12:18:07 +0000
@@ -55,7 +55,6 @@ server-id	= 1
 #innodb_data_home_dir = @localstatedir@/
 #innodb_data_file_path = ibdata1:10M:autoextend
 #innodb_log_group_home_dir = @localstatedir@/
-#innodb_log_arch_dir = @localstatedir@/
 # You can set .._buffer_pool_size up to 50 - 80 %
 # of RAM but beware of setting memory usage too high
 #innodb_buffer_pool_size = 16M

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2008-09-11 08:01:28 +0000
+++ b/support-files/mysql.spec.sh	2008-10-21 15:45:46 +0000
@@ -252,8 +252,8 @@ BuildMySQL() {
 # The --enable-assembler simply does nothing on systems that does not
 # support assembler speedups.
 sh -c  "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
-	CC=\"${CC:-$MYSQL_BUILD_CC}\" \
-	CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
+	CC=\"${MYSQL_BUILD_CC:-$CC}\" \
+	CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
 	CFLAGS=\"$CFLAGS\" \
 	CXXFLAGS=\"$CXXFLAGS\" \
 	LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2008-09-15 20:37:25 +0000
+++ b/tests/mysql_client_test.c	2008-10-17 12:39:34 +0000
@@ -18456,6 +18456,49 @@ static void test_bug38486(void)
   DBUG_VOID_RETURN;
 }
 
+
+/**
+     Bug# 33831 mysql_real_connect() should fail if
+     given an already connected MYSQL handle.
+*/
+
+static void test_bug33831(void)
+{
+  MYSQL *l_mysql;
+  my_bool error;
+
+  DBUG_ENTER("test_bug33831");
+  
+  error= 0;
+
+  if (!(l_mysql= mysql_init(NULL)))
+  {
+    myerror("mysql_init() failed");
+    DIE_UNLESS(0);
+  }
+  if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
+                           opt_password, current_db, opt_port,
+                           opt_unix_socket, 0)))
+  {
+    myerror("connection failed");
+    DIE_UNLESS(0);
+  }
+
+  if (mysql_real_connect(l_mysql, opt_host, opt_user,
+                         opt_password, current_db, opt_port,
+                         opt_unix_socket, 0))
+  {
+    myerror("connection should have failed");
+    DIE_UNLESS(0);
+  }
+
+
+  mysql_close(l_mysql);
+  
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -18770,6 +18813,7 @@ static struct my_tests_st my_tests[]= {
   { "test_wl4284_1", test_wl4284_1 },
   { "test_wl4435",   test_wl4435 },
   { "test_bug38486", test_bug38486 },
+  { "test_bug33831", test_bug33831 },
   { 0, 0 }
 };
 

Thread
bzr commit into mysql-6.0-falcon-team branch (hky:2876) Hakan Kuecuekyilmaz22 Oct