Below is the list of changes that have just been committed into a local
5.1 repository of iggy. When iggy 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.2171 06/06/02 17:23:04 iggy@stripped +86 -0
Merge mysql.com:/mnt/storeage/mysql-5.0-maint
into mysql.com:/mnt/storeage/mysql-5.1-new-maint_mergetest
Practice Merge only. Will not be pushed. Please disregard.
vio/Makefile.am
1.20 06/06/02 14:54:53 iggy@stripped +0 -0
Auto merged
storage/ndb/tools/restore/consumer_restore.cpp
1.30 06/06/02 14:54:53 iggy@stripped +0 -0
Auto merged
storage/ndb/test/ndbapi/testInterpreter.cpp
1.5 06/06/02 14:54:53 iggy@stripped +0 -0
Auto merged
storage/ndb/test/ndbapi/testDict.cpp
1.27 06/06/02 14:54:52 iggy@stripped +0 -0
Auto merged
storage/ndb/test/ndbapi/Makefile.am
1.28 06/06/02 14:54:52 iggy@stripped +0 -1
Auto merged
storage/ndb/src/ndbapi/DictCache.hpp
1.14 06/06/02 14:54:51 iggy@stripped +0 -0
Auto merged
storage/ndb/src/ndbapi/DictCache.cpp
1.26 06/06/02 14:54:51 iggy@stripped +0 -0
Auto merged
storage/ndb/src/mgmsrv/Services.cpp
1.65 06/06/02 14:54:51 iggy@stripped +0 -0
Auto merged
storage/ndb/src/kernel/vm/Configuration.cpp
1.49 06/06/02 14:54:51 iggy@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
1.34 06/06/02 14:54:50 iggy@stripped +0 -0
Auto merged
storage/ndb/src/common/util/socket_io.cpp
1.9 06/06/02 14:54:50 iggy@stripped +0 -0
Auto merged
storage/ndb/src/common/util/SocketServer.cpp
1.21 06/06/02 14:54:50 iggy@stripped +0 -0
Auto merged
storage/ndb/include/util/SocketServer.hpp
1.12 06/06/02 14:54:49 iggy@stripped +0 -0
Auto merged
storage/heap/hp_write.c
1.24 06/06/02 14:54:49 iggy@stripped +0 -0
Auto merged
storage/heap/hp_create.c
1.25 06/06/02 14:54:49 iggy@stripped +0 -0
Auto merged
sql/table.cc
1.215 06/06/02 14:54:49 iggy@stripped +0 -0
Auto merged
sql/sql_update.cc
1.191 06/06/02 14:54:48 iggy@stripped +0 -0
Auto merged
sql/sql_show.cc
1.337 06/06/02 14:54:48 iggy@stripped +0 -0
Auto merged
sql/sql_load.cc
1.98 06/06/02 14:54:46 iggy@stripped +0 -0
Auto merged
sql/sql_lex.h
1.231 06/06/02 14:54:46 iggy@stripped +0 -0
Auto merged
sql/sql_insert.cc
1.201 06/06/02 14:54:46 iggy@stripped +0 -0
Auto merged
sql/sql_delete.cc
1.182 06/06/02 14:54:45 iggy@stripped +0 -0
Auto merged
sql/sql_acl.cc
1.193 06/06/02 14:54:45 iggy@stripped +0 -0
Auto merged
sql/sp_head.cc
1.222 06/06/02 14:54:44 iggy@stripped +0 -0
Auto merged
sql/set_var.h
1.86 06/06/02 14:54:44 iggy@stripped +0 -0
Auto merged
sql/opt_range.cc
1.218 06/06/02 14:54:43 iggy@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.403 06/06/02 14:54:42 iggy@stripped +0 -0
Auto merged
sql/lock.cc
1.92 06/06/02 14:54:42 iggy@stripped +0 -0
Auto merged
sql/item_timefunc.cc
1.119 06/06/02 14:54:42 iggy@stripped +0 -0
Auto merged
sql/item_subselect.cc
1.124 06/06/02 14:54:41 iggy@stripped +0 -0
Auto merged
sql/item_strfunc.h
1.108 06/06/02 14:54:41 iggy@stripped +0 -0
Auto merged
sql/item_func.cc
1.294 06/06/02 14:54:41 iggy@stripped +0 -0
Auto merged
sql/item_cmpfunc.cc
1.204 06/06/02 14:54:41 iggy@stripped +0 -0
Auto merged
sql/item.h
1.201 06/06/02 14:54:40 iggy@stripped +0 -0
Auto merged
sql/item.cc
1.191 06/06/02 14:54:40 iggy@stripped +0 -0
Auto merged
sql/field.h
1.184 06/06/02 14:54:39 iggy@stripped +0 -0
Auto merged
sql/Makefile.am
1.139 06/06/02 14:54:39 iggy@stripped +0 -0
Auto merged
server-tools/instance-manager/guardian.cc
1.22 06/06/02 14:54:39 iggy@stripped +0 -0
Auto merged
server-tools/instance-manager/Makefile.am
1.36 06/06/02 14:54:38 iggy@stripped +0 -0
Auto merged
mysys/default.c
1.81 06/06/02 14:54:38 iggy@stripped +0 -0
Auto merged
mysql-test/t/wait_timeout.test
1.5 06/06/02 14:54:38 iggy@stripped +0 -0
Auto merged
mysql-test/t/view_grant.test
1.16 06/06/02 14:54:38 iggy@stripped +0 -0
Auto merged
mysql-test/t/view.test
1.147 06/06/02 14:54:37 iggy@stripped +0 -0
Auto merged
mysql-test/t/variables.test
1.60 06/06/02 14:54:37 iggy@stripped +0 -0
Auto merged
mysql-test/t/strict.test
1.21 06/06/02 14:54:37 iggy@stripped +0 -0
Auto merged
mysql-test/t/sp.test
1.191 06/06/02 14:54:37 iggy@stripped +0 -0
Auto merged
mysql-test/t/rpl_stm_until.test
1.24 06/06/02 14:54:36 iggy@stripped +0 -0
Auto merged
mysql-test/t/ps.test
1.65 06/06/02 14:54:36 iggy@stripped +0 -0
Auto merged
mysql-test/t/ndb_alter_table.test
1.32 06/06/02 14:54:36 iggy@stripped +0 -0
Auto merged
mysql-test/t/mysqlbinlog.test
1.25 06/06/02 14:54:36 iggy@stripped +0 -0
Auto merged
mysql-test/t/lock_multi.test
1.15 06/06/02 14:54:35 iggy@stripped +0 -0
Auto merged
mysql-test/t/join_outer.test
1.38 06/06/02 14:54:35 iggy@stripped +0 -0
Auto merged
mysql-test/t/init_connect.test
1.7 06/06/02 14:54:35 iggy@stripped +0 -2
Auto merged
mysql-test/r/view_grant.result
1.19 06/06/02 14:54:34 iggy@stripped +1 -1
Auto merged
mysql-test/r/view.result
1.161 06/06/02 14:54:34 iggy@stripped +0 -0
Auto merged
mysql-test/r/variables.result
1.85 06/06/02 14:54:34 iggy@stripped +0 -0
Auto merged
mysql-test/r/type_ranges.result
1.40 06/06/02 14:54:34 iggy@stripped +0 -0
Auto merged
mysql-test/r/subselect.result
1.146 06/06/02 14:54:33 iggy@stripped +0 -0
Auto merged
mysql-test/r/strict.result
1.30 06/06/02 14:54:33 iggy@stripped +0 -0
Auto merged
mysql-test/r/sp.result
1.208 06/06/02 14:54:33 iggy@stripped +0 -0
Auto merged
mysql-test/r/rpl_temporary.result
1.28 06/06/02 14:54:32 iggy@stripped +0 -0
Auto merged
mysql-test/r/ps.result
1.67 06/06/02 14:54:32 iggy@stripped +0 -0
Auto merged
mysql-test/r/ndb_blob.result
1.19 06/06/02 14:54:32 iggy@stripped +0 -0
Auto merged
mysql-test/r/lock_multi.result
1.17 06/06/02 14:54:31 iggy@stripped +0 -0
Auto merged
mysql-test/r/information_schema_db.result
1.16 06/06/02 14:54:31 iggy@stripped +0 -0
Auto merged
mysql-test/r/heap_btree.result
1.21 06/06/02 14:54:31 iggy@stripped +0 -0
Auto merged
mysql-test/r/heap.result
1.50 06/06/02 14:54:31 iggy@stripped +0 -0
Auto merged
mysql-test/r/group_min_max.result
1.25 06/06/02 14:54:30 iggy@stripped +0 -1
Auto merged
mysql-test/r/grant.result
1.52 06/06/02 14:54:30 iggy@stripped +0 -0
Auto merged
mysql-test/r/func_str.result
1.116 06/06/02 14:54:30 iggy@stripped +0 -0
Auto merged
mysql-test/r/func_group.result
1.50 06/06/02 14:54:30 iggy@stripped +0 -0
Auto merged
mysql-test/r/binlog_stm_mix_innodb_myisam.result
1.30 06/06/02 14:54:30 iggy@stripped +0 -0
Auto merged
mysql-test/r/binlog_stm_drop_tmp_tbl.result
1.18 06/06/02 14:54:29 iggy@stripped +0 -0
Auto merged
mysql-test/mysql-test-run.sh
1.324 06/06/02 14:54:29 iggy@stripped +0 -0
Auto merged
mysql-test/mysql-test-run.pl
1.120 06/06/02 14:54:29 iggy@stripped +1 -4
Auto merged
libmysqld/examples/Makefile.am
1.34 06/06/02 14:54:29 iggy@stripped +0 -0
Auto merged
libmysql_r/Makefile.am
1.28 06/06/02 14:54:28 iggy@stripped +0 -0
Auto merged
libmysql/libmysql.c
1.254 06/06/02 14:54:28 iggy@stripped +0 -0
Auto merged
libmysql/Makefile.am
1.52 06/06/02 14:54:28 iggy@stripped +0 -0
Auto merged
include/violite.h
1.50 06/06/02 14:54:28 iggy@stripped +0 -0
Auto merged
include/my_sys.h
1.195 06/06/02 14:54:28 iggy@stripped +0 -0
Auto merged
include/my_pthread.h
1.96 06/06/02 14:54:27 iggy@stripped +0 -0
Auto merged
client/mysqltest.c
1.212 06/06/02 14:54:27 iggy@stripped +0 -0
Auto merged
BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7
1.6 06/06/02 14:54:26 iggy@stripped +0 -0
Auto merged
mysql-test/t/rpl_stm_until.test
1.21.3.2 06/06/02 14:54:26 iggy@stripped +0 -0
Merge rename: mysql-test/t/rpl_until.test -> mysql-test/t/rpl_stm_until.test
mysql-test/r/binlog_stm_mix_innodb_myisam.result
1.24.4.2 06/06/02 14:54:26 iggy@stripped +0 -0
Merge rename: mysql-test/r/mix_innodb_myisam_binlog.result -> mysql-test/r/binlog_stm_mix_innodb_myisam.result
mysql-test/r/binlog_stm_drop_tmp_tbl.result
1.16.1.2 06/06/02 14:54:26 iggy@stripped +0 -0
Merge rename: mysql-test/r/drop_temp_table.result -> mysql-test/r/binlog_stm_drop_tmp_tbl.result
BitKeeper/deleted/.del-yassl.m4~e55e55c1e863abaf
1.19 06/06/02 14:54:26 iggy@stripped +0 -0
Auto merged
BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7
1.5 06/06/02 14:54:26 iggy@stripped +0 -0
Merge rename: mysql-test/init_db.sql -> BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7
BitKeeper/deleted/.del-Makefile.am~abb265028eb9b6a7
1.24 06/06/02 14:54:26 iggy@stripped +0 -0
Auto merged
storage/ndb/tools/restore/consumer_restore.cpp
1.14.9.3 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/tools/restore/consumer_restore.cpp -> storage/ndb/tools/restore/consumer_restore.cpp
storage/ndb/test/ndbapi/testInterpreter.cpp
1.3.1.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/test/ndbapi/testInterpreter.cpp -> storage/ndb/test/ndbapi/testInterpreter.cpp
storage/ndb/test/ndbapi/testDict.cpp
1.20.4.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/test/ndbapi/testDict.cpp -> storage/ndb/test/ndbapi/testDict.cpp
storage/ndb/test/ndbapi/Makefile.am
1.19.7.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/test/ndbapi/Makefile.am -> storage/ndb/test/ndbapi/Makefile.am
storage/ndb/src/ndbapi/DictCache.hpp
1.6.6.3 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/ndbapi/DictCache.hpp -> storage/ndb/src/ndbapi/DictCache.hpp
storage/ndb/src/ndbapi/DictCache.cpp
1.12.5.3 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/ndbapi/DictCache.cpp -> storage/ndb/src/ndbapi/DictCache.cpp
storage/ndb/src/mgmsrv/Services.cpp
1.45.20.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/mgmsrv/Services.cpp -> storage/ndb/src/mgmsrv/Services.cpp
storage/ndb/src/kernel/vm/Configuration.cpp
1.39.7.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/kernel/vm/Configuration.cpp -> storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
1.14.10.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp -> storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
storage/ndb/src/common/util/socket_io.cpp
1.7.1.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/common/util/socket_io.cpp -> storage/ndb/src/common/util/socket_io.cpp
storage/ndb/src/common/util/SocketServer.cpp
1.15.5.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/src/common/util/SocketServer.cpp -> storage/ndb/src/common/util/SocketServer.cpp
storage/ndb/include/util/SocketServer.hpp
1.6.4.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: ndb/include/util/SocketServer.hpp -> storage/ndb/include/util/SocketServer.hpp
storage/heap/hp_write.c
1.22.1.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: heap/hp_write.c -> storage/heap/hp_write.c
storage/heap/hp_create.c
1.20.3.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: heap/hp_create.c -> storage/heap/hp_create.c
BitKeeper/deleted/.del-yassl.m4~e55e55c1e863abaf
1.10.1.6 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: config/ac-macros/yassl.m4 -> BitKeeper/deleted/.del-yassl.m4~e55e55c1e863abaf
BitKeeper/deleted/.del-Makefile.am~abb265028eb9b6a7
1.22.1.2 06/06/02 14:54:25 iggy@stripped +0 -0
Merge rename: tools/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~abb265028eb9b6a7
# 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: iggy
# Host: rolltop.ignatz42.dyndns.org
# Root: /mnt/storeage/mysql-5.1-new-maint_mergetest/RESYNC
--- 1.20.3.1/heap/hp_create.c 2006-05-10 12:50:00 -04:00
+++ 1.25/storage/heap/hp_create.c 2006-06-02 14:54:49 -04:00
@@ -237,6 +237,16 @@
HP_PTRS_IN_NOD * block->level_info[i - 1].records_under_level);
}
+
+static inline void heap_try_free(HP_SHARE *share)
+{
+ if (share->open_count == 0)
+ hp_free(share);
+ else
+ share->delete_on_close= 1;
+}
+
+
int heap_delete_table(const char *name)
{
int result;
@@ -246,10 +256,7 @@
pthread_mutex_lock(&THR_LOCK_heap);
if ((share= hp_find_named_heap(name)))
{
- if (share->open_count == 0)
- hp_free(share);
- else
- share->delete_on_close= 1;
+ heap_try_free(share);
result= 0;
}
else
@@ -259,6 +266,17 @@
pthread_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(result);
}
+
+
+void heap_drop_table(HP_INFO *info)
+{
+ DBUG_ENTER("heap_drop_table");
+ pthread_mutex_lock(&THR_LOCK_heap);
+ heap_try_free(info->s);
+ pthread_mutex_unlock(&THR_LOCK_heap);
+ DBUG_VOID_RETURN;
+}
+
void hp_free(HP_SHARE *share)
{
--- 1.95/include/my_pthread.h 2006-04-17 16:05:14 -04:00
+++ 1.96/include/my_pthread.h 2006-06-02 14:54:27 -04:00
@@ -226,12 +226,14 @@
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
-#define my_sigset(A,B) do { struct sigaction s; sigset_t set; \
+#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
+ DBUG_ASSERT((A) != 0); \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
- sigaction((A), &s, (struct sigaction *) NULL); \
+ rc= sigaction((A), &s, (struct sigaction *) NULL);\
+ DBUG_ASSERT(rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))
--- 1.49/include/violite.h 2006-05-12 06:31:59 -04:00
+++ 1.50/include/violite.h 2006-06-02 14:54:28 -04:00
@@ -102,6 +102,7 @@
#define HEADER_DES_LOCL_H dummy_something
#define YASSL_MYSQL_COMPATIBLE
+#define YASSL_PREFIX
#include <openssl/ssl.h>
#include <openssl/err.h>
--- 1.51/libmysql/Makefile.am 2006-05-12 04:51:01 -04:00
+++ 1.52/libmysql/Makefile.am 2006-06-02 14:54:28 -04:00
@@ -24,7 +24,7 @@
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
+ $(openssl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared
--- 1.80/mysys/default.c 2006-04-15 11:48:54 -04:00
+++ 1.81/mysys/default.c 2006-06-02 14:54:38 -04:00
@@ -755,7 +755,9 @@
value_end=value;
/* remove quotes around argument */
- if ((*value == '\"' || *value == '\'') && *value == value_end[-1])
+ if ((*value == '\"' || *value == '\'') && /* First char is quote */
+ (value + 1 < value_end ) && /* String is longer than 1 */
+ *value == value_end[-1] ) /* First char is equal to last char */
{
value++;
value_end--;
--- 1.138/sql/Makefile.am 2006-05-12 04:51:01 -04:00
+++ 1.139/sql/Makefile.am 2006-06-02 14:54:39 -04:00
@@ -22,7 +22,7 @@
MYSQLLIBdir= $(pkglibdir)
INCLUDES = @ZLIB_INCLUDES@ \
-I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/regex -I$(srcdir) $(yassl_includes) \
+ -I$(top_srcdir)/regex -I$(srcdir) \
$(openssl_includes)
WRAPLIBS= @WRAPLIBS@
SUBDIRS = share
--- 1.190/sql/item.cc 2006-05-18 04:53:09 -04:00
+++ 1.191/sql/item.cc 2006-06-02 14:54:40 -04:00
@@ -304,6 +304,7 @@
marker= 0;
maybe_null=null_value=with_sum_func=unsigned_flag=0;
decimals= 0; max_length= 0;
+ with_subselect= 0;
/* Put item in free list so that we can free all items at end */
THD *thd= current_thd;
@@ -4881,7 +4882,16 @@
void Item_ref::print(String *str)
{
if (ref)
- (*ref)->print(str);
+ {
+ if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF &&
+ name && alias_name_used)
+ {
+ THD *thd= current_thd;
+ append_identifier(thd, str, name, (uint) strlen(name));
+ }
+ else
+ (*ref)->print(str);
+ }
else
Item_ident::print(str);
}
@@ -5413,7 +5423,7 @@
}
-void Item_trigger_field::set_required_privilege(const bool rw)
+void Item_trigger_field::set_required_privilege(bool rw)
{
/*
Require SELECT and UPDATE privilege if this field will be read and
--- 1.200/sql/item.h 2006-05-18 04:53:10 -04:00
+++ 1.201/sql/item.h 2006-06-02 14:54:40 -04:00
@@ -417,6 +417,8 @@
required, otherwise we only reading it and SELECT
privilege might be required.
*/
+ Settable_routine_parameter() {}
+ virtual ~Settable_routine_parameter() {}
virtual void set_required_privilege(bool rw) {};
/*
@@ -490,6 +492,9 @@
my_bool is_autogenerated_name; /* indicate was name of this Item
autogenerated or set by user */
DTCollation collation;
+ my_bool with_subselect; /* If this item is a subselect or some
+ of its arguments is or contains a
+ subselect */
// alloc & destruct is done as start of select using sql_alloc
Item();
@@ -2233,7 +2238,7 @@
void cleanup();
private:
- void set_required_privilege(const bool rw);
+ void set_required_privilege(bool rw);
bool set_value(THD *thd, sp_rcontext *ctx, Item **it);
public:
@@ -2286,6 +2291,7 @@
max_length= item->max_length;
decimals= item->decimals;
collation.set(item->collation);
+ unsigned_flag= item->unsigned_flag;
return 0;
};
virtual void store(Item *)= 0;
--- 1.203/sql/item_cmpfunc.cc 2006-04-25 13:00:08 -04:00
+++ 1.204/sql/item_cmpfunc.cc 2006-06-02 14:54:41 -04:00
@@ -204,10 +204,28 @@
/*
- Convert a constant expression or string to an integer.
- This is done when comparing DATE's of different formats and
- also when comparing bigint to strings (in which case the string
- is converted once to a bigint).
+ Convert a constant item to an int and replace the original item
+
+ SYNOPSIS
+ convert_constant_item()
+ thd thread handle
+ field item will be converted using the type of this field
+ item [in/out] reference to the item to convert
+
+ DESCRIPTION
+ The function converts a constant expression or string to an integer.
+ On successful conversion the original item is substituted for the
+ result of the item evaluation.
+ This is done when comparing DATE/TIME of different formats and
+ also when comparing bigint to strings (in which case strings
+ are converted to bigints).
+
+ NOTES
+ This function is called only at prepare stage.
+ As all derived tables are filled only after all derived tables
+ are prepared we do not evaluate items with subselects here because
+ they can contain derived tables and thus we may attempt to use a
+ table that has not been populated yet.
RESULT VALUES
0 Can't convert item
@@ -216,7 +234,7 @@
static bool convert_constant_item(THD *thd, Field *field, Item **item)
{
- if ((*item)->const_item())
+ if (!(*item)->with_subselect && (*item)->const_item())
{
/* For comparison purposes allow invalid dates like 2000-01-32 */
ulong orig_sql_mode= field->table->in_use->variables.sql_mode;
@@ -2570,7 +2588,9 @@
(item= *li.ref())->check_cols(1))
return TRUE; /* purecov: inspected */
used_tables_cache|= item->used_tables();
- if (!item->const_item())
+ if (item->const_item())
+ and_tables_cache= (table_map) 0;
+ else
{
tmp_table_map= item->not_null_tables();
not_null_tables_cache|= tmp_table_map;
@@ -2578,6 +2598,7 @@
const_item_cache= FALSE;
}
with_sum_func= with_sum_func || item->with_sum_func;
+ with_subselect|= item->with_subselect;
if (item->maybe_null)
maybe_null=1;
}
--- 1.293/sql/item_func.cc 2006-05-18 05:56:46 -04:00
+++ 1.294/sql/item_func.cc 2006-06-02 14:54:41 -04:00
@@ -184,6 +184,7 @@
used_tables_cache|= item->used_tables();
not_null_tables_cache|= item->not_null_tables();
const_item_cache&= item->const_item();
+ with_subselect|= item->with_subselect;
}
}
fix_length_and_dec();
--- 1.107/sql/item_strfunc.h 2006-04-24 16:17:44 -04:00
+++ 1.108/sql/item_strfunc.h 2006-06-02 14:54:41 -04:00
@@ -542,7 +542,7 @@
void fix_length_and_dec()
{
collation.set(default_charset());
- decimals=0; max_length=64;
+ max_length= 64;
}
};
--- 1.118/sql/item_timefunc.cc 2006-05-17 14:46:14 -04:00
+++ 1.119/sql/item_timefunc.cc 2006-06-02 14:54:42 -04:00
@@ -2010,39 +2010,11 @@
bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
{
- INTERVAL interval, other_interval;
- String val= value; // Because of const
-
- if (this == item)
- return TRUE;
-
- if ((item->type() != FUNC_ITEM) ||
- (arg_count != ((Item_func*) item)->arg_count) ||
- (func_name() != ((Item_func*) item)->func_name()))
- return FALSE;
-
Item_date_add_interval *other= (Item_date_add_interval*) item;
-
- if ((int_type != other->int_type) ||
- (!args[0]->eq(other->args[0], binary_cmp)))
- return FALSE;
-
- if (!args[1]->const_item() || !other->args[1]->const_item())
- return (args[1]->eq(other->args[1], binary_cmp));
-
- if (get_interval_value(args[1], int_type, &val, &interval))
- return FALSE;
-
- val= other->value;
-
- if ((get_interval_value(other->args[1], other->int_type, &val,
- &other_interval)) ||
- ((date_sub_interval ^ interval.neg) ^
- (other->date_sub_interval ^ other_interval.neg)))
- return FALSE;
-
- // Assume comparing same types here due to earlier check
- return memcmp(&interval, &other_interval, sizeof(INTERVAL)) == 0;
+ if (!Item_func::eq(item, binary_cmp))
+ return 0;
+ return ((int_type == other->int_type) &&
+ (date_sub_interval == other->date_sub_interval));
}
--- 1.91/sql/lock.cc 2006-04-25 04:57:27 -04:00
+++ 1.92/sql/lock.cc 2006-06-02 14:54:42 -04:00
@@ -1174,16 +1174,17 @@
if (!thd->global_read_lock)
{
+ const char *old_message;
(void) pthread_mutex_lock(&LOCK_global_read_lock);
- const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_global_read_lock,
- "Waiting to get readlock");
+ old_message=thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
+ "Waiting to get readlock");
DBUG_PRINT("info",
("waiting_for: %d protect_against: %d",
waiting_for_read_lock, protect_against_global_read_lock));
waiting_for_read_lock++;
while (protect_against_global_read_lock && !thd->killed)
- pthread_cond_wait(&COND_refresh, &LOCK_global_read_lock);
+ pthread_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
waiting_for_read_lock--;
if (thd->killed)
{
@@ -1205,9 +1206,15 @@
DBUG_RETURN(0);
}
+
void unlock_global_read_lock(THD *thd)
{
uint tmp;
+ DBUG_ENTER("unlock_global_read_lock");
+ DBUG_PRINT("info",
+ ("global_read_lock: %u global_read_lock_blocks_commit: %u",
+ global_read_lock, global_read_lock_blocks_commit));
+
pthread_mutex_lock(&LOCK_global_read_lock);
tmp= --global_read_lock;
if (thd->global_read_lock == MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT)
@@ -1215,8 +1222,13 @@
pthread_mutex_unlock(&LOCK_global_read_lock);
/* Send the signal outside the mutex to avoid a context switch */
if (!tmp)
- pthread_cond_broadcast(&COND_refresh);
+ {
+ DBUG_PRINT("signal", ("Broadcasting COND_global_read_lock"));
+ pthread_cond_broadcast(&COND_global_read_lock);
+ }
thd->global_read_lock= 0;
+
+ DBUG_VOID_RETURN;
}
#define must_wait (global_read_lock && \
@@ -1254,11 +1266,15 @@
*/
DBUG_RETURN(is_not_commit);
}
- old_message=thd->enter_cond(&COND_refresh, &LOCK_global_read_lock,
+ old_message=thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
"Waiting for release of readlock");
while (must_wait && ! thd->killed &&
(!abort_on_refresh || thd->version == refresh_version))
- (void) pthread_cond_wait(&COND_refresh,&LOCK_global_read_lock);
+ {
+ DBUG_PRINT("signal", ("Waiting for COND_global_read_lock"));
+ (void) pthread_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
+ DBUG_PRINT("signal", ("Got COND_global_read_lock"));
+ }
if (thd->killed)
result=1;
}
@@ -1287,7 +1303,7 @@
(waiting_for_read_lock || global_read_lock_blocks_commit));
(void) pthread_mutex_unlock(&LOCK_global_read_lock);
if (tmp)
- pthread_cond_broadcast(&COND_refresh);
+ pthread_cond_broadcast(&COND_global_read_lock);
DBUG_VOID_RETURN;
}
@@ -1309,10 +1325,10 @@
/* For testing we set up some blocking, to see if we can be killed */
DBUG_EXECUTE_IF("make_global_read_lock_block_commit_loop",
protect_against_global_read_lock++;);
- old_message= thd->enter_cond(&COND_refresh, &LOCK_global_read_lock,
+ old_message= thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
"Waiting for all running commits to finish");
while (protect_against_global_read_lock && !thd->killed)
- pthread_cond_wait(&COND_refresh, &LOCK_global_read_lock);
+ pthread_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
DBUG_EXECUTE_IF("make_global_read_lock_block_commit_loop",
protect_against_global_read_lock--;);
if ((error= test(thd->killed)))
--- 1.402/sql/mysql_priv.h 2006-05-18 05:56:46 -04:00
+++ 1.403/sql/mysql_priv.h 2006-06-02 14:54:42 -04:00
@@ -847,6 +847,7 @@
bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
Item ***copy_func, Field **from_field,
+ Field **def_field,
bool group, bool modify_item,
bool table_cant_handle_bit_fields,
bool make_copy_field,
@@ -1103,6 +1104,13 @@
bool setup_tables(THD *thd, Name_resolution_context *context,
List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
Item **conds, TABLE_LIST **leaves, bool select_insert);
+bool setup_tables_and_check_access (THD *thd,
+ Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause,
+ TABLE_LIST *tables, Item **conds,
+ TABLE_LIST **leaves,
+ bool select_insert,
+ ulong want_access);
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
List<Item> *sum_func_list, uint wild_num);
bool setup_fields(THD *thd, Item** ref_pointer_array,
@@ -1498,6 +1506,7 @@
extern bool opt_using_transactions, mysqld_embedded;
extern bool using_update_log, opt_large_files, server_id_supplied;
extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
+extern my_bool opt_log_queries_not_using_indexes;
extern bool opt_disable_networking, opt_skip_show_db;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop, shutdown_in_progress, grant_option;
@@ -1542,6 +1551,7 @@
extern int mysqld_server_started;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
+extern pthread_cond_t COND_global_read_lock;
extern pthread_attr_t connection_attrib;
extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches;
@@ -1936,6 +1946,16 @@
return -1;
}
+/*
+ is_user_table()
+ return true if the table was created explicitly
+*/
+
+inline bool is_user_table(TABLE * table)
+{
+ const char *name= table->s->table_name;
+ return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
+}
/*
Some functions that are different in the embedded library and the normal
--- 1.217/sql/opt_range.cc 2006-05-13 14:40:23 -04:00
+++ 1.218/sql/opt_range.cc 2006-06-02 14:54:43 -04:00
@@ -4698,17 +4698,46 @@
if (inv)
{
- /*
- We get here for conditions like "t.keypart NOT IN (....)".
-
- If the IN-list contains only constants (and func->array is an ordered
- array of them), we construct the appropriate SEL_ARG tree manually,
- because constructing it using the range analyzer (as
- AND_i( t.keypart != c_i)) will cause lots of memory to be consumed
- (see BUG#15872).
- */
if (func->array && func->cmp_type != ROW_RESULT)
{
+ /*
+ We get here for conditions in form "t.key NOT IN (c1, c2, ...)"
+ (where c{i} are constants).
+ Our goal is to produce a SEL_ARG graph that represents intervals:
+
+ ($MIN<t.key<c1) OR (c1<t.key<c2) OR (c2<t.key<c3) OR ... (*)
+
+ where $MIN is either "-inf" or NULL.
+
+ The most straightforward way to handle NOT IN would be to convert
+ it to "(t.key != c1) AND (t.key != c2) AND ..." and let the range
+ optimizer to build SEL_ARG graph from that. However that will cause
+ the range optimizer to use O(N^2) memory (it's a bug, not filed),
+ and people do use big NOT IN lists (see BUG#15872). Also, for big
+ NOT IN lists constructing/using graph (*) does not make the query
+ faster.
+
+ So, we will handle NOT IN manually in the following way:
+ * if the number of entries in the NOT IN list is less then
+ NOT_IN_IGNORE_THRESHOLD, we will construct SEL_ARG graph (*)
+ manually.
+ * Otherwise, we will construct a smaller graph: for
+ "t.key NOT IN (c1,...cN)" we construct a graph representing
+ ($MIN < t.key) OR (cN < t.key) // here sequence of c_i is
+ // ordered.
+
+ A note about partially-covering indexes: for those (e.g. for
+ "a CHAR(10), KEY(a(5))") the handling is correct (albeit not very
+ efficient):
+ Instead of "t.key < c1" we get "t.key <= prefix-val(c1)".
+ Combining the intervals in (*) together, we get:
+ (-inf<=t.key<=c1) OR (c1<=t.key<=c2) OR (c2<=t.key<=c3) OR ...
+ i.e. actually we get intervals combined into one interval:
+ (-inf<=t.key<=+inf). This doesn't make much sense but it doesn't
+ cause any problems.
+ */
+ MEM_ROOT *tmp_root= param->mem_root;
+ param->thd->mem_root= param->old_root;
/*
Create one Item_type constant object. We'll need it as
get_mm_parts only accepts constant values wrapped in Item_Type
@@ -4717,25 +4746,35 @@
per-statement mem_root (while thd->mem_root is currently pointing
to mem_root local to range optimizer).
*/
- MEM_ROOT *tmp_root= param->mem_root;
- param->thd->mem_root= param->old_root;
Item *value_item= func->array->create_item();
param->thd->mem_root= tmp_root;
if (!value_item)
break;
- /* Get a SEL_TREE for "-inf < X < c_0" interval */
- func->array->value_to_item(0, value_item);
- tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
- value_item, cmp_type);
- if (!tree)
+ /* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */
+ uint i=0;
+ do
+ {
+ func->array->value_to_item(i, value_item);
+ tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
+ value_item, cmp_type);
+ if (!tree)
+ break;
+ i++;
+ } while (i < func->array->count && tree->type == SEL_TREE::IMPOSSIBLE);
+
+ if (!tree || tree->type == SEL_TREE::IMPOSSIBLE)
+ {
+ /* We get here in cases like "t.unsigned NOT IN (-1,-2,-3) */
+ tree= NULL;
break;
+ }
#define NOT_IN_IGNORE_THRESHOLD 1000
SEL_TREE *tree2;
if (func->array->count < NOT_IN_IGNORE_THRESHOLD)
{
- for (uint i=1; i < func->array->count; i++)
+ for (; i < func->array->count; i++)
{
if (func->array->compare_elems(i, i-1))
{
@@ -4743,32 +4782,44 @@
func->array->value_to_item(i, value_item);
tree2= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
value_item, cmp_type);
-
+ if (!tree2)
+ {
+ tree= NULL;
+ break;
+ }
+
/* Change all intervals to be "c_{i-1} < X < c_i" */
for (uint idx= 0; idx < param->keys; idx++)
{
- SEL_ARG *new_interval;
- if ((new_interval= tree2->keys[idx]))
+ SEL_ARG *new_interval, *last_val;
+ if (((new_interval= tree2->keys[idx])) &&
+ ((last_val= tree->keys[idx]->last())))
{
- SEL_ARG *last_val= tree->keys[idx]->last();
new_interval->min_value= last_val->max_value;
new_interval->min_flag= NEAR_MIN;
}
}
+ /*
+ The following doesn't try to allocate memory so no need to
+ check for NULL.
+ */
tree= tree_or(param, tree, tree2);
}
}
}
else
func->array->value_to_item(func->array->count - 1, value_item);
-
- /*
- Get the SEL_TREE for the last "c_last < X < +inf" interval
- (value_item cotains c_last already)
- */
- tree2= get_mm_parts(param, cond_func, field, Item_func::GT_FUNC,
- value_item, cmp_type);
- tree= tree_or(param, tree, tree2);
+
+ if (tree && tree->type != SEL_TREE::IMPOSSIBLE)
+ {
+ /*
+ Get the SEL_TREE for the last "c_last < X < +inf" interval
+ (value_item cotains c_last already)
+ */
+ tree2= get_mm_parts(param, cond_func, field, Item_func::GT_FUNC,
+ value_item, cmp_type);
+ tree= tree_or(param, tree, tree2);
+ }
}
else
{
--- 1.192/sql/sql_acl.cc 2006-05-12 06:32:00 -04:00
+++ 1.193/sql/sql_acl.cc 2006-06-02 14:54:45 -04:00
@@ -342,7 +342,8 @@
"case that has been forced to lowercase because "
"lower_case_table_names is set. It will not be "
"possible to remove this privilege using REVOKE.",
- host.host.hostname, host.db);
+ host.host.hostname ? host.host.hostname : "",
+ host.db ? host.db : "");
}
host.access= get_access(table,2);
host.access= fix_rights_for_db(host.access);
@@ -351,7 +352,8 @@
{
sql_print_warning("'host' entry '%s|%s' "
"ignored in --skip-name-resolve mode.",
- host.host.hostname, host.db?host.db:"");
+ host.host.hostname ? host.host.hostname : "",
+ host.db ? host.db : "");
continue;
}
#ifndef TO_BE_REMOVED
@@ -421,7 +423,8 @@
{
sql_print_warning("'user' entry '%s@%s' "
"ignored in --skip-name-resolve mode.",
- user.user, user.host.hostname);
+ user.user ? user.user : "",
+ user.host.hostname ? user.host.hostname : "");
continue;
}
@@ -544,8 +547,8 @@
#endif
}
VOID(push_dynamic(&acl_users,(gptr) &user));
- if (!user.host.hostname || user.host.hostname[0] == wild_many &&
- !user.host.hostname[1])
+ if (!user.host.hostname ||
+ (user.host.hostname[0] == wild_many && !user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect
}
}
@@ -571,7 +574,9 @@
{
sql_print_warning("'db' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
- db.db, db.user, db.host.hostname);
+ db.db,
+ db.user ? db.user : "",
+ db.host.hostname ? db.host.hostname : "");
continue;
}
db.access=get_access(table,3);
@@ -590,7 +595,9 @@
"case that has been forced to lowercase because "
"lower_case_table_names is set. It will not be "
"possible to remove this privilege using REVOKE.",
- db.db, db.user, db.host.hostname, db.host.hostname);
+ db.db,
+ db.user ? db.user : "",
+ db.host.hostname ? db.host.hostname : "");
}
}
db.sort=get_sort(3,db.host.hostname,db.db,db.user);
@@ -1088,6 +1095,8 @@
sctx->master_access= 0;
sctx->db_access= 0;
+ sctx->priv_user= (char *) "";
+ *sctx->priv_host= 0;
/*
Find acl entry in user database.
@@ -1162,8 +1171,7 @@
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user && !user[0] ||
- acl_user->user &&
- !strcmp(user,acl_user->user))
+ acl_user->user && !strcmp(user,acl_user->user))
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname &&
@@ -1226,8 +1234,8 @@
set_user_salt(&acl_user, password, password_len);
VOID(push_dynamic(&acl_users,(gptr) &acl_user));
- if (!acl_user.host.hostname || acl_user.host.hostname[0] == wild_many
- && !acl_user.host.hostname[1])
+ if (!acl_user.host.hostname ||
+ (acl_user.host.hostname[0] == wild_many && !acl_user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect /* purecov: tested */
qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
sizeof(ACL_USER),(qsort_cmp) acl_compare);
@@ -1287,7 +1295,7 @@
ACL_DB acl_db;
safe_mutex_assert_owner(&acl_cache->lock);
acl_db.user=strdup_root(&mem,user);
- update_hostname(&acl_db.host,strdup_root(&mem,host));
+ update_hostname(&acl_db.host, *host ? strdup_root(&mem,host) : 0);
acl_db.db=strdup_root(&mem,db);
acl_db.access=privileges;
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
@@ -1674,11 +1682,10 @@
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
DBUG_PRINT("info",("strcmp('%s','%s'), compare_hostname('%s','%s'),",
- user,
- acl_user->user ? acl_user->user : "",
- host,
- acl_user->host.hostname ? acl_user->host.hostname :
- ""));
+ user, acl_user->user ? acl_user->user : "",
+ host,
+ acl_user->host.hostname ? acl_user->host.hostname :
+ ""));
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
{
@@ -1728,7 +1735,7 @@
static void update_hostname(acl_host_and_ip *host, const char *hostname)
{
- host->hostname=(char*) hostname; // This will not be modified!
+ host->hostname=(char*) hostname; // This will not be modified!
if (!hostname ||
(!(hostname=calc_ip(hostname,&host->ip,'/')) ||
!(hostname=calc_ip(hostname+1,&host->ip_mask,'\0'))))
@@ -1748,8 +1755,8 @@
}
return (!host->hostname ||
(hostname && !wild_case_compare(system_charset_info,
- hostname,host->hostname)) ||
- (ip && !wild_compare(ip,host->hostname,0)));
+ hostname, host->hostname)) ||
+ (ip && !wild_compare(ip, host->hostname, 0)));
}
bool hostname_requires_resolving(const char *hostname)
@@ -2397,7 +2404,8 @@
{
if (exact)
{
- if ((host &&
+ if (!grant_name->host.hostname ||
+ (host &&
!my_strcasecmp(system_charset_info, host,
grant_name->host.hostname)) ||
(ip && !strcmp(ip, grant_name->host.hostname)))
@@ -3497,8 +3505,10 @@
{
sql_print_warning("'tables_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
- mem_check->tname, mem_check->user,
- mem_check->host, mem_check->host);
+ mem_check->tname,
+ mem_check->user ? mem_check->user : "",
+ mem_check->host.hostname ?
+ mem_check->host.hostname : "");
continue;
}
}
@@ -3536,7 +3546,8 @@
sql_print_warning("'procs_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
mem_check->tname, mem_check->user,
- mem_check->host);
+ mem_check->host.hostname ?
+ mem_check->host.hostname : "");
continue;
}
}
@@ -3692,6 +3703,7 @@
TABLE_LIST *table, *first_not_own_table= thd->lex->first_not_own_table();
Security_context *sctx= thd->security_ctx;
uint i;
+ ulong orig_want_access= want_access;
DBUG_ENTER("check_grant");
DBUG_ASSERT(number > 0);
@@ -3713,18 +3725,22 @@
table->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
}
- want_access&= ~sctx->master_access;
- if (!want_access)
- DBUG_RETURN(0); // ok
-
rw_rdlock(&LOCK_grant);
for (table= tables;
table && number-- && table != first_not_own_table;
table= table->next_global)
{
GRANT_TABLE *grant_table;
+ sctx = test(table->security_ctx) ?
+ table->security_ctx : thd->security_ctx;
+
+ want_access= orig_want_access;
+ want_access&= ~sctx->master_access;
+ if (!want_access)
+ continue; // ok
+
if (!(~table->grant.privilege & want_access) ||
- table->derived || table->schema_table || table->belong_to_view)
+ table->derived || table->schema_table)
{
/*
It is subquery in the FROM clause. VIEW set table->derived after
@@ -4243,11 +4259,6 @@
DBUG_RETURN(TRUE);
}
- if (!lex_user->host.str)
- {
- lex_user->host.str= (char*) "%";
- lex_user->host.length=1;
- }
if (lex_user->host.length > HOSTNAME_LENGTH ||
lex_user->user.length > USERNAME_LENGTH)
{
@@ -4457,16 +4468,17 @@
/* Add table & column access */
for (index=0 ; index < column_priv_hash.records ; index++)
{
- const char *user;
+ const char *user, *host;
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index);
if (!(user=grant_table->user))
user= "";
+ if (!(host= grant_table->host.hostname))
+ host= "";
if (!strcmp(lex_user->user.str,user) &&
- !my_strcasecmp(system_charset_info, lex_user->host.str,
- grant_table->host.hostname))
+ !my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
ulong table_access= grant_table->privs;
if ((table_access | grant_table->cols) != 0)
@@ -4593,15 +4605,16 @@
/* Add routine access */
for (index=0 ; index < hash->records ; index++)
{
- const char *user;
+ const char *user, *host;
GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, index);
if (!(user=grant_proc->user))
user= "";
+ if (!(host= grant_proc->host.hostname))
+ host= "";
if (!strcmp(lex_user->user.str,user) &&
- !my_strcasecmp(system_charset_info, lex_user->host.str,
- grant_proc->host.hostname))
+ !my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
ulong proc_access= grant_proc->privs;
if (proc_access != 0)
@@ -5055,39 +5068,37 @@
{
/*
Get a pointer to the element.
- Unfortunaltely, the host default differs for the structures.
*/
switch (struct_no) {
case 0:
acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
user= acl_user->user;
- if (!(host= acl_user->host.hostname))
- host= "%";
- break;
+ host= acl_user->host.hostname;
+ break;
case 1:
acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
user= acl_db->user;
- if (!(host= acl_db->host.hostname))
- host= "%";
+ host= acl_db->host.hostname;
break;
case 2:
grant_name= (GRANT_NAME*) hash_element(&column_priv_hash, idx);
user= grant_name->user;
- if (!(host= grant_name->host.hostname))
- host= "%";
+ host= grant_name->host.hostname;
break;
case 3:
grant_name= (GRANT_NAME*) hash_element(&proc_priv_hash, idx);
user= grant_name->user;
- if (!(host= grant_name->host.hostname))
- host= "%";
+ host= grant_name->host.hostname;
break;
}
if (! user)
user= "";
+ if (! host)
+ host= "";
+
#ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
struct_no, idx, user, host));
@@ -5671,8 +5682,10 @@
LEX_USER lex_user;
lex_user.user.str= grant_proc->user;
lex_user.user.length= strlen(grant_proc->user);
- lex_user.host.str= grant_proc->host.hostname;
- lex_user.host.length= strlen(grant_proc->host.hostname);
+ lex_user.host.str= grant_proc->host.hostname ?
+ grant_proc->host.hostname : (char*)"";
+ lex_user.host.length= grant_proc->host.hostname ?
+ strlen(grant_proc->host.hostname) : 0;
if (!replace_routine_table(thd,grant_proc,tables[4].table,lex_user,
grant_proc->db, grant_proc->tname,
is_proc, ~(ulong)0, 1))
@@ -5979,16 +5992,17 @@
for (index=0 ; index < column_priv_hash.records ; index++)
{
- const char *user, *is_grantable= "YES";
+ const char *user, *host, *is_grantable= "YES";
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index);
if (!(user=grant_table->user))
user= "";
+ if (!(host= grant_table->host.hostname))
+ host= "";
if (no_global_access &&
(strcmp(thd->security_ctx->priv_user, user) ||
- my_strcasecmp(system_charset_info, curr_host,
- grant_table->host.hostname)))
+ my_strcasecmp(system_charset_info, curr_host, host)))
continue;
ulong table_access= grant_table->privs;
@@ -6004,7 +6018,7 @@
if (!(table_access & GRANT_ACL))
is_grantable= "NO";
- strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS);
+ strxmov(buff, "'", user, "'@'", host, "'", NullS);
if (!test_access)
update_schema_privilege(table, buff, grant_table->db, grant_table->tname,
0, 0, STRING_WITH_LEN("USAGE"), is_grantable);
@@ -6046,16 +6060,17 @@
for (index=0 ; index < column_priv_hash.records ; index++)
{
- const char *user, *is_grantable= "YES";
+ const char *user, *host, *is_grantable= "YES";
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index);
if (!(user=grant_table->user))
user= "";
+ if (!(host= grant_table->host.hostname))
+ host= "";
if (no_global_access &&
(strcmp(thd->security_ctx->priv_user, user) ||
- my_strcasecmp(system_charset_info, curr_host,
- grant_table->host.hostname)))
+ my_strcasecmp(system_charset_info, curr_host, host)))
continue;
ulong table_access= grant_table->cols;
@@ -6065,7 +6080,7 @@
is_grantable= "NO";
ulong test_access= table_access & ~GRANT_ACL;
- strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS);
+ strxmov(buff, "'", user, "'@'", host, "'", NullS);
if (!test_access)
continue;
else
@@ -6154,20 +6169,21 @@
}
/* table privileges */
+ rw_rdlock(&LOCK_grant);
if (grant->version != grant_version)
{
- rw_rdlock(&LOCK_grant);
grant->grant_table=
table_hash_search(sctx->host, sctx->ip, db,
sctx->priv_user,
table, 0); /* purecov: inspected */
grant->version= grant_version; /* purecov: inspected */
- rw_unlock(&LOCK_grant);
}
if (grant->grant_table != 0)
{
grant->privilege|= grant->grant_table->privs;
}
+ rw_unlock(&LOCK_grant);
+
DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
DBUG_VOID_RETURN;
}
--- 1.181/sql/sql_delete.cc 2006-04-13 16:49:23 -04:00
+++ 1.182/sql/sql_delete.cc 2006-06-02 14:54:45 -04:00
@@ -394,10 +394,11 @@
DBUG_ENTER("mysql_prepare_delete");
thd->lex->allow_sum_func= 0;
- if (setup_tables(thd, &thd->lex->select_lex.context,
- &thd->lex->select_lex.top_join_list,
- table_list, conds, &select_lex->leaf_tables,
- FALSE) ||
+ if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
+ table_list, conds,
+ &select_lex->leaf_tables, FALSE,
+ DELETE_ACL) ||
setup_conds(thd, table_list, select_lex->leaf_tables, conds) ||
setup_ftfuncs(select_lex))
DBUG_RETURN(TRUE);
@@ -456,10 +457,11 @@
lex->query_tables also point on local list of DELETE SELECT_LEX
*/
- if (setup_tables(thd, &thd->lex->select_lex.context,
- &thd->lex->select_lex.top_join_list,
- lex->query_tables, &lex->select_lex.where,
- &lex->select_lex.leaf_tables, FALSE))
+ if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
+ lex->query_tables, &lex->select_lex.where,
+ &lex->select_lex.leaf_tables, FALSE,
+ DELETE_ACL))
DBUG_RETURN(TRUE);
--- 1.200/sql/sql_insert.cc 2006-05-18 07:35:11 -04:00
+++ 1.201/sql/sql_insert.cc 2006-06-02 14:54:46 -04:00
@@ -759,10 +759,11 @@
bool insert_into_view= (table_list->view != 0);
DBUG_ENTER("mysql_prepare_insert_check_table");
- if (setup_tables(thd, &thd->lex->select_lex.context,
- &thd->lex->select_lex.top_join_list,
- table_list, where, &thd->lex->select_lex.leaf_tables,
- select_insert))
+ if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
+ table_list, where,
+ &thd->lex->select_lex.leaf_tables,
+ select_insert, INSERT_ACL))
DBUG_RETURN(TRUE);
if (insert_into_view && !fields.elements)
@@ -2588,12 +2589,13 @@
while ((item=it++))
{
create_field *cr_field;
- Field *field;
+ Field *field, *def_field;
if (item->type() == Item::FUNC_ITEM)
- field=item->tmp_table_field(&tmp_table);
+ field= item->tmp_table_field(&tmp_table);
else
- field=create_tmp_field(thd, &tmp_table, item, item->type(),
- (Item ***) 0, &tmp_field, 0, 0, 0, 0, 0);
+ field= create_tmp_field(thd, &tmp_table, item, item->type(),
+ (Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
+ 0);
if (!field ||
!(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ?
((Item_field *)item)->field :
--- 1.230/sql/sql_lex.h 2006-05-12 04:26:30 -04:00
+++ 1.231/sql/sql_lex.h 2006-06-02 14:54:46 -04:00
@@ -750,9 +750,95 @@
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
XA_SUSPEND, XA_FOR_MIGRATE};
+
+/*
+ Class representing list of all tables used by statement.
+ It also contains information about stored functions used by statement
+ since during its execution we may have to add all tables used by its
+ stored functions/triggers to this list in order to pre-open and lock
+ them.
+
+ Also used by st_lex::reset_n_backup/restore_backup_query_tables_list()
+ methods to save and restore this information.
+*/
+
+class Query_tables_list
+{
+public:
+ /* Global list of all tables used by this statement */
+ TABLE_LIST *query_tables;
+ /* Pointer to next_global member of last element in the previous list. */
+ TABLE_LIST **query_tables_last;
+ /*
+ If non-0 then indicates that query requires prelocking and points to
+ next_global member of last own element in query table list (i.e. last
+ table which was not added to it as part of preparation to prelocking).
+ 0 - indicates that this query does not need prelocking.
+ */
+ TABLE_LIST **query_tables_own_last;
+ /* Set of stored routines called by statement. */
+ HASH sroutines;
+ /*
+ List linking elements of 'sroutines' set. Allows you to add new elements
+ to this set as you iterate through the list of existing elements.
+ 'sroutines_list_own_last' is pointer to ::next member of last element of
+ this list which represents routine which is explicitly used by query.
+ 'sroutines_list_own_elements' number of explicitly used routines.
+ We use these two members for restoring of 'sroutines_list' to the state
+ in which it was right after query parsing.
+ */
+ SQL_LIST sroutines_list;
+ byte **sroutines_list_own_last;
+ uint sroutines_list_own_elements;
+
+ /*
+ These constructor and destructor serve for creation/destruction
+ of Query_tables_list instances which are used as backup storage.
+ */
+ Query_tables_list() {}
+ ~Query_tables_list() {}
+
+ /* Initializes (or resets) Query_tables_list object for "real" use. */
+ void reset_query_tables_list(bool init);
+ void destroy_query_tables_list();
+ void set_query_tables_list(Query_tables_list *state)
+ {
+ *this= *state;
+ }
+
+ void add_to_query_tables(TABLE_LIST *table)
+ {
+ *(table->prev_global= query_tables_last)= table;
+ query_tables_last= &table->next_global;
+ }
+ bool requires_prelocking()
+ {
+ return test(query_tables_own_last);
+ }
+ void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last)
+ {
+ query_tables_own_last= tables_own_last;
+ }
+ /* Return pointer to first not-own table in query-tables or 0 */
+ TABLE_LIST* first_not_own_table()
+ {
+ return ( query_tables_own_last ? *query_tables_own_last : 0);
+ }
+ void chop_off_not_own_tables()
+ {
+ if (query_tables_own_last)
+ {
+ *query_tables_own_last= 0;
+ query_tables_last= query_tables_own_last;
+ query_tables_own_last= 0;
+ }
+ }
+};
+
+
/* The state of the lex parsing. This is saved in the THD struct */
-typedef struct st_lex
+typedef struct st_lex : public Query_tables_list
{
uint yylineno,yytoklen; /* Simulate lex */
LEX_YYSTYPE yylval;
@@ -785,14 +871,6 @@
gptr yacc_yyss,yacc_yyvs;
THD *thd;
CHARSET_INFO *charset;
- TABLE_LIST *query_tables; /* global list of all tables in this query */
- /*
- last element next_global of previous list (used only for list building
- during parsing and VIEW processing. This pointer could be invalid during
- processing of information schema tables(see get_schema_tables_result
- function)
- */
- TABLE_LIST **query_tables_last;
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert;
/* Position (first character index) of SELECT of CREATE VIEW statement */
@@ -933,20 +1011,6 @@
bool sp_lex_in_use; /* Keep track on lex usage in SPs for error handling */
bool all_privileges;
sp_pcontext *spcont;
- /* Set of stored routines called by statement. */
- HASH sroutines;
- /*
- List linking elements of 'sroutines' set. Allows you to add new elements
- to this set as you iterate through the list of existing elements.
- 'sroutines_list_own_last' is pointer to ::next member of last element of
- this list which represents routine which is explicitly used by query.
- 'sroutines_list_own_elements' number of explicitly used routines.
- We use these two members for restoring of 'sroutines_list' to the state
- in which it was right after query parsing.
- */
- SQL_LIST sroutines_list;
- byte **sroutines_list_own_last;
- uint sroutines_list_own_elements;
st_sp_chistics sp_chistics;
@@ -987,14 +1051,6 @@
const char *stmt_definition_begin;
/*
- If non-0 then indicates that query requires prelocking and points to
- next_global member of last own element in query table list (i.e. last
- table which was not added to it as part of preparation to prelocking).
- 0 - indicates that this query does not need prelocking.
- */
- TABLE_LIST **query_tables_own_last;
-
- /*
Pointers to part of LOAD DATA statement that should be rewritten
during replication ("LOCAL 'filename' REPLACE INTO" part).
*/
@@ -1012,7 +1068,7 @@
virtual ~st_lex()
{
- hash_free(&sroutines);
+ destroy_query_tables_list();
}
inline void uncacheable(uint8 cause)
@@ -1037,11 +1093,6 @@
TABLE_LIST *unlink_first_table(bool *link_to_local);
void link_first_table_back(TABLE_LIST *first, bool link_to_local);
void first_lists_tables_same();
- inline void add_to_query_tables(TABLE_LIST *table)
- {
- *(table->prev_global= query_tables_last)= table;
- query_tables_last= &table->next_global;
- }
bool add_time_zone_tables_to_query_tables(THD *thd);
bool can_be_merged();
@@ -1073,28 +1124,7 @@
return FALSE;
}
}
- inline bool requires_prelocking()
- {
- return test(query_tables_own_last);
- }
- inline void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last)
- {
- query_tables_own_last= tables_own_last;
- }
- /* Return pointer to first not-own table in query-tables or 0 */
- TABLE_LIST* first_not_own_table()
- {
- return ( query_tables_own_last ? *query_tables_own_last : 0);
- }
- void chop_off_not_own_tables()
- {
- if (query_tables_own_last)
- {
- *query_tables_own_last= 0;
- query_tables_last= query_tables_own_last;
- query_tables_own_last= 0;
- }
- }
+
void cleanup_after_one_table_open();
bool push_context(Name_resolution_context *context)
@@ -1111,6 +1141,9 @@
{
return context_stack.head();
}
+
+ void reset_n_backup_query_tables_list(Query_tables_list *backup);
+ void restore_backup_query_tables_list(Query_tables_list *backup);
} LEX;
struct st_lex_local: public st_lex
--- 1.97/sql/sql_load.cc 2006-04-15 21:17:26 -04:00
+++ 1.98/sql/sql_load.cc 2006-06-02 14:54:46 -04:00
@@ -153,10 +153,11 @@
ha_enable_transaction(thd, FALSE);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
- if (setup_tables(thd, &thd->lex->select_lex.context,
- &thd->lex->select_lex.top_join_list,
- table_list, &unused_conds,
- &thd->lex->select_lex.leaf_tables, FALSE))
+ if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
+ table_list, &unused_conds,
+ &thd->lex->select_lex.leaf_tables, FALSE,
+ INSERT_ACL | UPDATE_ACL))
DBUG_RETURN(-1);
if (!table_list->table || // do not suport join view
!table_list->updatable || // and derived tables
--- 1.336/sql/sql_show.cc 2006-05-16 04:25:45 -04:00
+++ 1.337/sql/sql_show.cc 2006-06-02 14:54:48 -04:00
@@ -2339,7 +2339,6 @@
TABLE *table= tables->table;
SELECT_LEX *select_lex= &lex->select_lex;
SELECT_LEX *old_all_select_lex= lex->all_selects_list;
- TABLE_LIST **save_query_tables_last= lex->query_tables_last;
enum_sql_command save_sql_command= lex->sql_command;
SELECT_LEX *lsel= tables->schema_select_lex;
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
@@ -2358,6 +2357,7 @@
enum legacy_db_type not_used;
Open_tables_state open_tables_state_backup;
bool save_view_prepare_mode= lex->view_prepare_mode;
+ Query_tables_list query_tables_list_backup;
lex->view_prepare_mode= TRUE;
DBUG_ENTER("get_all_tables");
@@ -2370,6 +2370,8 @@
*/
lex->sql_command= SQLCOM_SHOW_FIELDS;
+ lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
+
/*
We should not introduce deadlocks even if we already have some
tables open and locked, since we won't lock tables which we will
@@ -2410,8 +2412,7 @@
show_table_list->db),
show_table_list->alias));
thd->temporary_tables= 0;
- close_thread_tables(thd);
- show_table_list->table= 0;
+ close_tables_for_reopen(thd, &show_table_list);
goto err;
}
@@ -2522,9 +2523,10 @@
in this case.
*/
res= schema_table->process_table(thd, show_table_list, table,
- res, base_name,
- show_table_list->alias);
- close_thread_tables(thd);
+ res, base_name,
+ show_table_list->alias);
+ close_tables_for_reopen(thd, &show_table_list);
+ DBUG_ASSERT(!lex->query_tables_own_last);
if (res)
goto err;
}
@@ -2541,11 +2543,10 @@
error= 0;
err:
thd->restore_backup_open_tables_state(&open_tables_state_backup);
+ lex->restore_backup_query_tables_list(&query_tables_list_backup);
lex->derived_tables= derived_tables;
lex->all_selects_list= old_all_select_lex;
- lex->query_tables_last= save_query_tables_last;
lex->view_prepare_mode= save_view_prepare_mode;
- *save_query_tables_last= 0;
lex->sql_command= save_sql_command;
DBUG_RETURN(error);
}
@@ -3391,11 +3392,33 @@
if (tables->view)
{
+ Security_context *sctx= thd->security_ctx;
+ ulong grant= SHOW_VIEW_ACL;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ char *save_table_name= tables->table_name;
+ if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
+ sctx->priv_user) &&
+ !my_strcasecmp(system_charset_info, tables->definer.host.str,
+ sctx->priv_host))
+ grant= SHOW_VIEW_ACL;
+ else
+ {
+ tables->table_name= tables->view_name.str;
+ if (check_access(thd, SHOW_VIEW_ACL , base_name,
+ &tables->grant.privilege, 0, 1,
+ test(tables->schema_table)))
+ grant= get_table_grant(thd, tables);
+ else
+ grant= tables->grant.privilege;
+ }
+ tables->table_name= save_table_name;
+#endif
+
restore_record(table, s->default_values);
table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
- table->field[2]->store(tables->view_name.str, tables->view_name.length,
- cs);
- table->field[3]->store(tables->query.str, tables->query.length, cs);
+ table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
+ if (grant & SHOW_VIEW_ACL)
+ table->field[3]->store(tables->query.str, tables->query.length, cs);
if (tables->with_check != VIEW_CHECK_NONE)
{
--- 1.190/sql/sql_update.cc 2006-04-05 12:12:23 -04:00
+++ 1.191/sql/sql_update.cc 2006-06-02 14:54:48 -04:00
@@ -748,9 +748,11 @@
tables.alias= table_list->alias;
thd->lex->allow_sum_func= 0;
- if (setup_tables(thd, &select_lex->context, &select_lex->top_join_list,
- table_list, conds, &select_lex->leaf_tables,
- FALSE) ||
+ if (setup_tables_and_check_access(thd, &select_lex->context,
+ &select_lex->top_join_list,
+ table_list, conds,
+ &select_lex->leaf_tables,
+ FALSE, UPDATE_ACL) ||
setup_conds(thd, table_list, select_lex->leaf_tables, conds) ||
select_lex->setup_ref_array(thd, order_num) ||
setup_order(thd, select_lex->ref_pointer_array,
@@ -841,10 +843,11 @@
call in setup_tables()).
*/
- if (setup_tables(thd, &lex->select_lex.context,
- &lex->select_lex.top_join_list,
- table_list, &lex->select_lex.where,
- &lex->select_lex.leaf_tables, FALSE))
+ if (setup_tables_and_check_access(thd, &lex->select_lex.context,
+ &lex->select_lex.top_join_list,
+ table_list, &lex->select_lex.where,
+ &lex->select_lex.leaf_tables, FALSE,
+ UPDATE_ACL))
DBUG_RETURN(TRUE);
if (setup_fields_with_no_wrap(thd, 0, *fields, 2, 0, 0))
--- 1.214/sql/table.cc 2006-05-12 12:22:23 -04:00
+++ 1.215/sql/table.cc 2006-06-02 14:54:49 -04:00
@@ -2823,7 +2823,8 @@
if (thd->net.last_errno == ER_BAD_FIELD_ERROR ||
thd->net.last_errno == ER_SP_DOES_NOT_EXIST ||
thd->net.last_errno == ER_PROCACCESS_DENIED_ERROR ||
- thd->net.last_errno == ER_COLUMNACCESS_DENIED_ERROR)
+ thd->net.last_errno == ER_COLUMNACCESS_DENIED_ERROR ||
+ thd->net.last_errno == ER_TABLEACCESS_DENIED_ERROR)
{
TABLE_LIST *top= top_table();
thd->clear_error();
@@ -3183,8 +3184,18 @@
definer.host.str,
thd->db))
{
- my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
- DBUG_RETURN(TRUE);
+ if (thd->lex->sql_command == SQLCOM_SHOW_CREATE)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_NO_SUCH_USER,
+ ER(ER_NO_SUCH_USER),
+ definer.user.str, definer.host.str);
+ }
+ else
+ {
+ my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
+ DBUG_RETURN(TRUE);
+ }
}
}
DBUG_RETURN(FALSE);
--- 1.19/vio/Makefile.am 2006-05-12 04:51:02 -04:00
+++ 1.20/vio/Makefile.am 2006-06-02 14:54:53 -04:00
@@ -20,7 +20,7 @@
yassl_dummy_link_fix=
endif
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes) $(yassl_includes)
+ $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs)
pkglib_LIBRARIES= libvio.a
noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
--- 1.20/mysql-test/r/heap_btree.result 2006-05-04 08:34:26 -04:00
+++ 1.21/mysql-test/r/heap_btree.result 2006-06-02 14:54:31 -04:00
@@ -256,3 +256,6 @@
INDEX_LENGTH
21
DROP TABLE t1;
+CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES(NULL),(NULL);
+DROP TABLE t1;
--- 1.145/mysql-test/r/subselect.result 2006-05-17 06:29:12 -04:00
+++ 1.146/mysql-test/r/subselect.result 2006-06-02 14:54:33 -04:00
@@ -3177,3 +3177,30 @@
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
DROP TABLE t1;
+create table t1 (i int, j bigint);
+insert into t1 values (1, 2), (2, 2), (3, 2);
+select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
+min(i)
+1
+drop table t1;
+CREATE TABLE t1 (i BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (10000000000000000000);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (i BIGINT UNSIGNED);
+INSERT INTO t2 VALUES (10000000000000000000);
+INSERT INTO t2 VALUES (1);
+/* simple test */
+SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
+i
+10000000000000000000
+1
+/* subquery test */
+SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
+i
+10000000000000000000
+/* subquery test with cast*/
+SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
+i
+10000000000000000000
+DROP TABLE t1;
+DROP TABLE t2;
--- 1.160/mysql-test/r/view.result 2006-05-17 14:46:13 -04:00
+++ 1.161/mysql-test/r/view.result 2006-06-02 14:54:34 -04:00
@@ -2660,3 +2660,79 @@
id t COUNT(*)
DROP VIEW v1;
DROP TABLE t1;
+CREATE TABLE t1 (i INT, j BIGINT);
+INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
+CREATE VIEW v1 AS SELECT MIN(j) AS j FROM t1;
+CREATE VIEW v2 AS SELECT MIN(i) FROM t1 WHERE j = ( SELECT * FROM v1 );
+SELECT * FROM v2;
+MIN(i)
+1
+DROP VIEW v2, v1;
+DROP TABLE t1;
+CREATE TABLE t1(
+fName varchar(25) NOT NULL,
+lName varchar(25) NOT NULL,
+DOB date NOT NULL,
+uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1(fName, lName, DOB) VALUES
+('Hank', 'Hill', '1964-09-29'),
+('Tom', 'Adams', '1908-02-14'),
+('Homer', 'Simpson', '1968-03-05');
+CREATE VIEW v1 AS
+SELECT (year(now())-year(DOB)) AS Age
+FROM t1 HAVING Age < 75;
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
+SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
+Age
+42
+38
+SELECT * FROM v1;
+Age
+42
+38
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
+INSERT INTO t1(id) VALUES (1), (2), (3), (4);
+INSERT INTO t1 VALUES (5,'yyy'), (6,'yyy');
+SELECT * FROM t1;
+id a
+1 xxx
+2 xxx
+3 xxx
+4 xxx
+5 yyy
+6 yyy
+CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a;
+SELECT * FROM v1;
+a m
+xxx 1
+yyy 5
+CREATE TABLE t2 SELECT * FROM v1;
+INSERT INTO t2(m) VALUES (0);
+SELECT * FROM t2;
+a m
+xxx 1
+yyy 5
+xxx 0
+DROP VIEW v1;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (id int PRIMARY KEY, e ENUM('a','b') NOT NULL DEFAULT 'b');
+INSERT INTO t1(id) VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (4,'a');
+SELECT * FROM t1;
+id e
+1 b
+2 b
+3 b
+4 a
+CREATE VIEW v1(m, e) AS SELECT MIN(id), e FROM t1 GROUP BY e;
+CREATE TABLE t2 SELECT * FROM v1;
+SELECT * FROM t2;
+m e
+4 a
+1 b
+DROP VIEW v1;
+DROP TABLE IF EXISTS t1,t2;
--- 1.146/mysql-test/t/view.test 2006-05-17 14:46:13 -04:00
+++ 1.147/mysql-test/t/view.test 2006-06-02 14:54:37 -04:00
@@ -2533,3 +2533,71 @@
DROP VIEW v1;
DROP TABLE t1;
+
+#
+# Bug#19077: A nested materialized view is used before being populated.
+#
+CREATE TABLE t1 (i INT, j BIGINT);
+INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
+CREATE VIEW v1 AS SELECT MIN(j) AS j FROM t1;
+CREATE VIEW v2 AS SELECT MIN(i) FROM t1 WHERE j = ( SELECT * FROM v1 );
+SELECT * FROM v2;
+DROP VIEW v2, v1;
+DROP TABLE t1;
+
+#
+# Bug #19573: VIEW with HAVING that refers an alias name
+#
+
+CREATE TABLE t1(
+ fName varchar(25) NOT NULL,
+ lName varchar(25) NOT NULL,
+ DOB date NOT NULL,
+ uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
+
+INSERT INTO t1(fName, lName, DOB) VALUES
+ ('Hank', 'Hill', '1964-09-29'),
+ ('Tom', 'Adams', '1908-02-14'),
+ ('Homer', 'Simpson', '1968-03-05');
+
+CREATE VIEW v1 AS
+ SELECT (year(now())-year(DOB)) AS Age
+ FROM t1 HAVING Age < 75;
+SHOW CREATE VIEW v1;
+
+SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
+SELECT * FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+#
+# Bug #19089: wrong inherited dafault values in temp table views
+#
+
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
+INSERT INTO t1(id) VALUES (1), (2), (3), (4);
+INSERT INTO t1 VALUES (5,'yyy'), (6,'yyy');
+SELECT * FROM t1;
+
+CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a;
+SELECT * FROM v1;
+
+CREATE TABLE t2 SELECT * FROM v1;
+INSERT INTO t2(m) VALUES (0);
+SELECT * FROM t2;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (id int PRIMARY KEY, e ENUM('a','b') NOT NULL DEFAULT 'b');
+INSERT INTO t1(id) VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (4,'a');
+SELECT * FROM t1;
+
+CREATE VIEW v1(m, e) AS SELECT MIN(id), e FROM t1 GROUP BY e;
+CREATE TABLE t2 SELECT * FROM v1;
+SELECT * FROM t2;
+
+DROP VIEW v1;
+DROP TABLE IF EXISTS t1,t2;
--- 1.123/sql/item_subselect.cc 2006-05-17 06:29:13 -04:00
+++ 1.124/sql/item_subselect.cc 2006-06-02 14:54:41 -04:00
@@ -39,6 +39,7 @@
engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(0),
const_item_cache(1), engine_changed(0), changed(0)
{
+ with_subselect= 1;
reset();
/*
item value is NULL if select_subselect not changed this value
@@ -406,6 +407,7 @@
engine->fix_length_and_dec(row);
value= *row;
}
+ unsigned_flag= value->unsigned_flag;
/*
If there are not tables in subquery then ability to have NULL value
depends on SELECT list (if single row subquery have tables then it
--- 1.24/mysql-test/t/mysqlbinlog.test 2006-02-14 13:26:17 -05:00
+++ 1.25/mysql-test/t/mysqlbinlog.test 2006-06-02 14:54:36 -04:00
@@ -124,9 +124,22 @@
select HEX(f) from t04;
select HEX(f) from t4;
+#
+# BUG#14157: utf8 encoding in binlog without set character_set_client
+#
+# BUG:
+# This test only works on the MySQL-internal rpl machines.
+# Needs to be fixed. Problem is that koi8r is not installed
+# on many machines.
+#
+flush logs;
+# resulted log is client charset insensitive (latin1 not koi8r) as it must be
+# --exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 | $MYSQL --default-character-set=latin1
+#select * from t5 /* must be (1),(1) */;
# clean up
drop table t1, t2, t03, t04, t3, t4;
-# End of 4.1 tests
+# End of 5.0 tests
--- 1.21.3.1/mysql-test/t/rpl_until.test 2006-05-11 10:42:41 -04:00
+++ 1.24/mysql-test/t/rpl_stm_until.test 2006-06-02 14:54:36 -04:00
@@ -1,4 +1,7 @@
-source include/master-slave.inc;
+-- source include/have_binlog_format_statement.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
# prepare version for substitutions
let $VERSION=`select version()`;
@@ -19,12 +22,10 @@
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
---replace_result $VERSION VERSION
-show binlog events;
# try to replicate all queries until drop of t1
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=319;
+start slave until master_log_file='master-bin.000001', master_log_pos=323;
sleep 2;
wait_for_slave_to_stop;
# here table should be still not deleted
@@ -43,7 +44,7 @@
--replace_column 1 # 9 # 11 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
-# try replicate all until second insert to t2;
+# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
sleep 2;
wait_for_slave_to_stop;
--- 1.15/mysql-test/r/information_schema_db.result 2006-05-02 07:31:32 -04:00
+++ 1.16/mysql-test/r/information_schema_db.result 2006-06-02 14:54:31 -04:00
@@ -1,3 +1,7 @@
+drop table if exists t1,t2;
+drop view if exists v1,v2;
+drop function if exists f1;
+drop function if exists f2;
use INFORMATION_SCHEMA;
show tables;
Tables_in_information_schema
@@ -31,10 +35,12 @@
TABLE_PRIVILEGES
TRIGGERS
create database `inf%`;
+create database mbase;
use `inf%`;
show tables;
Tables_in_inf%
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
+grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
create table t1 (f1 int);
create function func1(curr_int int) returns int
begin
@@ -43,9 +49,58 @@
return ret_val;
end|
create view v1 as select f1 from t1 where f1 = func1(f1);
+create function func2() returns int return 1;
+use mbase;
+create procedure p1 ()
+begin
+select table_name from information_schema.key_column_usage
+order by table_name;
+end|
+create table t1
+(f1 int(10) unsigned not null,
+f2 varchar(100) not null,
+primary key (f1), unique key (f2));
select * from information_schema.tables;
+call mbase.p1();
+call mbase.p1();
+call mbase.p1();
+use `inf%`;
drop user mysqltest_1@localhost;
+drop table t1;
+select table_name, table_type, table_comment from information_schema.tables
+where table_schema='inf%' and func2();
+table_name table_type table_comment
+v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
+select table_name, table_type, table_comment from information_schema.tables
+where table_schema='inf%' and func2();
+table_name table_type table_comment
+v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
drop view v1;
drop function func1;
-drop table t1;
+drop function func2;
drop database `inf%`;
+drop procedure mbase.p1;
+drop database mbase;
+use test;
+create table t1 (i int);
+create function f1 () returns int return (select max(i) from t1);
+create view v1 as select f1();
+create table t2 (id int);
+create function f2 () returns int return (select max(i) from t2);
+create view v2 as select f2();
+drop table t2;
+select table_name, table_type, table_comment from information_schema.tables
+where table_schema='test';
+table_name table_type table_comment
+t1 BASE TABLE
+v1 VIEW VIEW
+v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
+drop table t1;
+select table_name, table_type, table_comment from information_schema.tables
+where table_schema='test';
+table_name table_type table_comment
+v1 VIEW View 'test.v1' references invalid table(s) or column(s) or function(s) or define
+v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
+drop function f1;
+drop function f2;
+drop view v1, v2;
--- 1.24.4.1/mysql-test/r/mix_innodb_myisam_binlog.result 2006-05-14 04:35:29 -04:00
+++ 1.30/mysql-test/r/binlog_stm_mix_innodb_myisam.result 2006-06-02 14:54:30 -04:00
@@ -6,12 +6,12 @@
insert into t1 values(1);
insert into t2 select * from t1;
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Xid 1 # COMMIT /* xid=8 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(1)
+master-bin.000001 257 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 351 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
@@ -21,12 +21,12 @@
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(2)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Query 1 # use `test`; ROLLBACK
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(2)
+master-bin.000001 257 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 351 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -39,15 +39,15 @@
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(3)
-master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
-master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 616 Xid 1 # COMMIT /* xid=25 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(3)
+master-bin.000001 257 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 342 Query 1 # use `test`; insert into t1 values(4)
+master-bin.000001 429 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 523 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 620 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
@@ -65,16 +65,16 @@
a
5
7
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(5)
-master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
-master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7)
-master-bin.000001 703 Xid 1 # COMMIT /* xid=37 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(5)
+master-bin.000001 257 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 342 Query 1 # use `test`; insert into t1 values(6)
+master-bin.000001 429 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 523 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 620 Query 1 # use `test`; insert into t1 values(7)
+master-bin.000001 707 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
@@ -87,43 +87,43 @@
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Query 1 # use `test`; ROLLBACK
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(8)
+master-bin.000001 257 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 351 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9)
-master-bin.000001 185 Xid 1 # COMMIT /* xid=60 */
-master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 102 Query 1 # use `test`; insert into t1 values(9)
+master-bin.000001 189 Xid 1 # COMMIT /* xid= */
+master-bin.000001 216 Query 1 # use `test`; insert into t2 select * from t1
delete from t1;
delete from t2;
reset master;
insert into t1 values(10);
begin;
insert into t2 select * from t1;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */
-master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 102 Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 190 Xid 1 # COMMIT /* xid= */
+master-bin.000001 217 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */
-master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 307 Query 1 # use `test`; BEGIN
-master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11)
-master-bin.000001 463 Xid 1 # COMMIT /* xid=68 */
+master-bin.000001 102 Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 190 Xid 1 # COMMIT /* xid= */
+master-bin.000001 217 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 311 Query 1 # use `test`; BEGIN
+master-bin.000001 379 Query 1 # use `test`; insert into t1 values(11)
+master-bin.000001 467 Xid 1 # COMMIT /* xid= */
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
@@ -132,12 +132,12 @@
insert into t1 values(12);
insert into t2 select * from t1;
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12)
-master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 348 Xid 1 # COMMIT /* xid=78 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(12)
+master-bin.000001 258 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 352 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
@@ -145,7 +145,7 @@
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
@@ -157,11 +157,11 @@
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14)
-master-bin.000001 254 Xid 1 # COMMIT /* xid=94 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(14)
+master-bin.000001 258 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
@@ -177,15 +177,15 @@
a
16
18
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 258 Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 346 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
-alter table t2 type=MyISAM;
+alter table t2 engine=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
@@ -229,31 +229,31 @@
select get_lock("lock1",60);
get_lock("lock1",60)
1
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */
-master-bin.000001 369 Query 1 # use `test`; delete from t1
-master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */
-master-bin.000001 473 Query 1 # use `test`; delete from t2
-master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */
-master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM
-master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1)
-master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */
-master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20)
-master-bin.000001 870 Query 1 # use `test`; drop table t1,t2
-master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
-master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1)
-master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */
-master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
-master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1)
-master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int)
-master-bin.000001 1452 Query 1 # use `test`; insert t0 select * from t1
-master-bin.000001 1541 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
-master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=innodb
-master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
+master-bin.000001 102 Query 1 # use `test`; BEGIN
+master-bin.000001 170 Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 258 Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 346 Xid 1 # COMMIT /* xid= */
+master-bin.000001 373 Query 1 # use `test`; delete from t1
+master-bin.000001 450 Xid 1 # COMMIT /* xid= */
+master-bin.000001 477 Query 1 # use `test`; delete from t2
+master-bin.000001 554 Xid 1 # COMMIT /* xid= */
+master-bin.000001 581 Query 1 # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 672 Query 1 # use `test`; insert into t1 values (1)
+master-bin.000001 760 Xid 1 # COMMIT /* xid= */
+master-bin.000001 787 Query 1 # use `test`; insert into t2 values (20)
+master-bin.000001 876 Query 1 # use `test`; drop table t1,t2
+master-bin.000001 955 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
+master-bin.000001 1065 Query 1 # use `test`; insert into ti values(1)
+master-bin.000001 1152 Xid 1 # COMMIT /* xid= */
+master-bin.000001 1179 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
+master-bin.000001 1289 Query 1 # use `test`; insert t1 values (1)
+master-bin.000001 1372 Query 1 # use `test`; create table t0 (n int)
+master-bin.000001 1458 Query 1 # use `test`; insert t0 select * from t1
+master-bin.000001 1547 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
+master-bin.000001 1654 Query 1 # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 1754 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
do release_lock("lock1");
drop table t0,t2;
reset master;
--- 1.18/mysql-test/r/view_grant.result 2006-05-17 09:05:48 -04:00
+++ 1.19/mysql-test/r/view_grant.result 2006-06-02 14:54:34 -04:00
@@ -535,3 +535,88 @@
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1`
drop view v1;
drop view v2;
+CREATE DATABASE mysqltest1;
+CREATE USER readonly@localhost;
+CREATE TABLE mysqltest1.t1 (x INT);
+INSERT INTO mysqltest1.t1 VALUES (1), (2);
+CREATE SQL SECURITY INVOKER VIEW mysqltest1.v_t1 AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ts AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ti AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly;
+GRANT SELECT ON mysqltest1.v_ts TO readonly;
+GRANT INSERT ON mysqltest1.v_ti TO readonly;
+GRANT UPDATE ON mysqltest1.v_tu TO readonly;
+GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly;
+GRANT DELETE ON mysqltest1.v_td TO readonly;
+GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly;
+SELECT * FROM mysqltest1.v_t1;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+INSERT INTO mysqltest1.v_t1 VALUES(4);
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DELETE FROM mysqltest1.v_t1 WHERE x = 1;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+UPDATE mysqltest1.v_t1 SET x = 3;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DELETE FROM mysqltest1.v_t1;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SELECT 1 FROM mysqltest1.v_t1;
+ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SELECT * FROM mysqltest1.t1;
+ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1'
+SELECT * FROM mysqltest1.v_ts;
+x
+1
+2
+SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
+ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1'
+SELECT * FROM mysqltest1.v_ti;
+ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 'v_ti'
+INSERT INTO mysqltest1.v_ts VALUES (100);
+ERROR 42000: INSERT command denied to user 'readonly'@'localhost' for table 'v_ts'
+INSERT INTO mysqltest1.v_ti VALUES (100);
+UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
+ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts'
+UPDATE mysqltest1.v_ts SET x= 200;
+ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts'
+UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
+UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
+UPDATE mysqltest1.v_tu SET x= 200;
+DELETE FROM mysqltest1.v_ts WHERE x= 200;
+ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts'
+DELETE FROM mysqltest1.v_ts;
+ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts'
+DELETE FROM mysqltest1.v_td WHERE x= 200;
+ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for column 'x' in table 'v_td'
+DELETE FROM mysqltest1.v_tds WHERE x= 200;
+DELETE FROM mysqltest1.v_td;
+DROP VIEW mysqltest1.v_tds;
+DROP VIEW mysqltest1.v_td;
+DROP VIEW mysqltest1.v_tus;
+DROP VIEW mysqltest1.v_tu;
+DROP VIEW mysqltest1.v_ti;
+DROP VIEW mysqltest1.v_ts;
+DROP VIEW mysqltest1.v_t1;
+DROP TABLE mysqltest1.t1;
+DROP USER readonly@localhost;
+DROP DATABASE mysqltest1;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
+Warnings:
+Note 1449 There is no 'no-such-user'@'localhost' registered
+SHOW CREATE VIEW v;
+View Create View
+v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `t1`.`a` AS `a` from `t1`
+Warnings:
+Note 1449 There is no 'no-such-user'@'localhost' registered
+SELECT * FROM v;
+ERROR HY000: There is no 'no-such-user'@'localhost' registered
+DROP VIEW v;
+DROP TABLE t1;
+USE test;
--- 1.15/mysql-test/t/view_grant.test 2006-05-01 20:12:47 -04:00
+++ 1.16/mysql-test/t/view_grant.test 2006-06-02 14:54:38 -04:00
@@ -718,3 +718,98 @@
show create view v2;
drop view v1;
drop view v2;
+
+#
+# Bug#18681: View privileges are broken
+#
+CREATE DATABASE mysqltest1;
+CREATE USER readonly@localhost;
+CREATE TABLE mysqltest1.t1 (x INT);
+INSERT INTO mysqltest1.t1 VALUES (1), (2);
+CREATE SQL SECURITY INVOKER VIEW mysqltest1.v_t1 AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ts AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ti AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
+CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly;
+GRANT SELECT ON mysqltest1.v_ts TO readonly;
+GRANT INSERT ON mysqltest1.v_ti TO readonly;
+GRANT UPDATE ON mysqltest1.v_tu TO readonly;
+GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly;
+GRANT DELETE ON mysqltest1.v_td TO readonly;
+GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly;
+
+CONNECT (n1,localhost,readonly,,);
+CONNECTION n1;
+
+--error 1356
+SELECT * FROM mysqltest1.v_t1;
+--error 1356
+INSERT INTO mysqltest1.v_t1 VALUES(4);
+--error 1356
+DELETE FROM mysqltest1.v_t1 WHERE x = 1;
+--error 1356
+UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
+--error 1356
+UPDATE mysqltest1.v_t1 SET x = 3;
+--error 1356
+DELETE FROM mysqltest1.v_t1;
+--error 1356
+SELECT 1 FROM mysqltest1.v_t1;
+--error 1142
+SELECT * FROM mysqltest1.t1;
+
+SELECT * FROM mysqltest1.v_ts;
+--error 1142
+SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
+--error 1142
+SELECT * FROM mysqltest1.v_ti;
+
+--error 1142
+INSERT INTO mysqltest1.v_ts VALUES (100);
+INSERT INTO mysqltest1.v_ti VALUES (100);
+
+--error 1142
+UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
+--error 1142
+UPDATE mysqltest1.v_ts SET x= 200;
+UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
+UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
+UPDATE mysqltest1.v_tu SET x= 200;
+
+--error 1142
+DELETE FROM mysqltest1.v_ts WHERE x= 200;
+--error 1142
+DELETE FROM mysqltest1.v_ts;
+--error 1143
+DELETE FROM mysqltest1.v_td WHERE x= 200;
+DELETE FROM mysqltest1.v_tds WHERE x= 200;
+DELETE FROM mysqltest1.v_td;
+
+CONNECTION default;
+DROP VIEW mysqltest1.v_tds;
+DROP VIEW mysqltest1.v_td;
+DROP VIEW mysqltest1.v_tus;
+DROP VIEW mysqltest1.v_tu;
+DROP VIEW mysqltest1.v_ti;
+DROP VIEW mysqltest1.v_ts;
+DROP VIEW mysqltest1.v_t1;
+DROP TABLE mysqltest1.t1;
+DROP USER readonly@localhost;
+DROP DATABASE mysqltest1;
+
+#
+# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
+--warning 1448
+SHOW CREATE VIEW v;
+--error 1449
+SELECT * FROM v;
+DROP VIEW v;
+DROP TABLE t1;
+USE test;
--- 1.4/mysql-test/t/wait_timeout.test 2006-02-25 13:35:07 -05:00
+++ 1.5/mysql-test/t/wait_timeout.test 2006-06-02 14:54:38 -04:00
@@ -4,10 +4,41 @@
#
# Bug #8731: wait_timeout does not work on Mac OS X
#
+
+
+# Connect with another connection and reset counters
+--disable_query_log
+connect (wait_con,localhost,root,,test,,);
+flush status; # Reset counters
+connection wait_con;
+let $retries=300;
+let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
+set @aborted_clients= 0;
+--enable_query_log
+
+# Disable reconnect and do the query
+connection default;
--disable_reconnect
select 1;
-# wait_timeout is 1, so we should get disconnected now
---sleep 2
+
+# Switch to wait_con and wait until server has aborted the connection
+--disable_query_log
+connection wait_con;
+while (!`select @aborted_clients`)
+{
+ sleep 0.1;
+ let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
+ eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
+
+ dec $retries;
+ if (!$retries)
+ {
+ Failed to detect that client has been aborted;
+ }
+}
+--enable_query_log
+
+connection default;
# When the connection is closed in this way, the error code should
# be consistent see bug#2845 for an explanation
--error 2006
@@ -15,12 +46,41 @@
--enable_reconnect
select 3;
+#
# Do the same test as above on a TCP connection
+# (which we get by specifying a ip adress)
+
+# Connect with another connection and reset counters
+--disable_query_log
+connection wait_con;
+flush status; # Reset counters
+let $retries=300;
+let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
+set @aborted_clients= 0;
+--enable_query_log
+
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
--disable_reconnect
select 1;
-# wait_timeout is 1, so we should get disconnected now
---sleep 2
+
+# Switch to wait_con and wait until server has aborted the connection
+--disable_query_log
+connection wait_con;
+while (!`select @aborted_clients`)
+{
+ sleep 0.1;
+ let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
+ eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
+
+ dec $retries;
+ if (!$retries)
+ {
+ Failed to detect that client has been aborted;
+ }
+}
+--enable_query_log
+
+connection con1;
# When the connection is closed in this way, the error code should
# be consistent see bug#2845 for an explanation
--error 2006
--- 1.35/server-tools/instance-manager/Makefile.am 2006-05-12 04:51:01 -04:00
+++ 1.36/server-tools/instance-manager/Makefile.am 2006-06-02 14:54:38 -04:00
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES= @ZLIB_INCLUDES@ -I$(top_srcdir)/include \
- @openssl_includes@ @yassl_includes@ -I$(top_builddir)/include
+ @openssl_includes@ -I$(top_builddir)/include
DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER
--- 1.31/mysql-test/t/ndb_alter_table.test 2006-04-27 09:12:33 -04:00
+++ 1.32/mysql-test/t/ndb_alter_table.test 2006-06-02 14:54:36 -04:00
@@ -3,7 +3,7 @@
-- source include/not_embedded.inc
--disable_warnings
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, t2;
drop database if exists mysqltest;
--enable_warnings
@@ -323,6 +323,21 @@
create index tx2
on t1 (c010, c011, c012, c013);
+drop table t1;
+
+# simple test that auto incr is not lost at rename or alter
+create table t1 (a int primary key auto_increment, b int) engine=ndb;
+insert into t1 (b) values (101),(102),(103);
+select * from t1 where a = 3;
+alter table t1 rename t2;
+insert into t2 (b) values (201),(202),(203);
+select * from t2 where a = 6;
+alter table t2 add c int;
+insert into t2 (b) values (301),(302),(303);
+select * from t2 where a = 9;
+alter table t2 rename t1;
+insert into t1 (b) values (401),(402),(403);
+select * from t1 where a = 12;
drop table t1;
# End of 4.1 tests
--- 1.6.4.1/ndb/include/util/SocketServer.hpp 2006-05-19 03:59:31 -04:00
+++ 1.12/storage/ndb/include/util/SocketServer.hpp 2006-06-02 14:54:49 -04:00
@@ -60,6 +60,7 @@
*/
class Service {
public:
+ Service() {}
virtual ~Service(){}
/**
--- 1.14.10.1/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2006-05-11 06:46:41 -04:00
+++ 1.34/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2006-06-02 14:54:50 -04:00
@@ -68,13 +68,13 @@
};
static BlockInfo ALL_BLOCKS[] = {
+ { NDBFS_REF, 0 , 2000, 2999 },
{ DBTC_REF, 1 , 8000, 8035 },
{ DBDIH_REF, 1 , 7000, 7173 },
{ DBLQH_REF, 1 , 5000, 5030 },
{ DBACC_REF, 1 , 3000, 3999 },
{ DBTUP_REF, 1 , 4000, 4007 },
{ DBDICT_REF, 1 , 6000, 6003 },
- { NDBFS_REF, 0 , 2000, 2999 },
{ NDBCNTR_REF, 0 , 1000, 1999 },
{ QMGR_REF, 1 , 1, 999 },
{ CMVMI_REF, 1 , 9000, 9999 },
@@ -83,11 +83,16 @@
{ DBUTIL_REF, 1 , 11000, 11999 },
{ SUMA_REF, 1 , 13000, 13999 },
{ DBTUX_REF, 1 , 12000, 12999 }
+ ,{ TSMAN_REF, 1 , 0, 0 }
+ ,{ LGMAN_REF, 1 , 0, 0 }
+ ,{ PGMAN_REF, 1 , 0, 0 }
+ ,{ RESTORE_REF,1 , 0, 0 }
};
static const Uint32 ALL_BLOCKS_SZ = sizeof(ALL_BLOCKS)/sizeof(BlockInfo);
static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
+ CMVMI_REF,
DBTUP_REF,
DBACC_REF,
DBTC_REF,
@@ -98,11 +103,14 @@
NDBFS_REF,
NDBCNTR_REF,
QMGR_REF,
- CMVMI_REF,
TRIX_REF,
BACKUP_REF,
DBUTIL_REF,
- SUMA_REF
+ SUMA_REF,
+ TSMAN_REF,
+ LGMAN_REF,
+ PGMAN_REF,
+ RESTORE_REF
};
/*******************************/
@@ -131,7 +139,7 @@
jam();
Uint32 to_3= 0;
const ndb_mgm_configuration_iterator * p =
- theConfiguration.getOwnConfigIterator();
+ m_ctx.m_config.getOwnConfigIterator();
ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT, &to_3);
BaseString tmp;
tmp.append("Shutting down node as total restart time exceeds "
@@ -160,6 +168,16 @@
}//switch
}//Ndbcntr::execCONTINUEB()
+void
+Ndbcntr::execAPI_START_REP(Signal* signal)
+{
+ if(refToBlock(signal->getSendersBlockRef()) == QMGR)
+ {
+ for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
+ sendSignal(ALL_BLOCKS[i].Ref, GSN_API_START_REP, signal, 1, JBB);
+ }
+ }
+}
/*******************************/
/* SYSTEM_ERROR */
/*******************************/
@@ -187,6 +205,20 @@
killingNode, data1);
break;
+ case SystemError::CopySubscriptionRef:
+ BaseString::snprintf(buf, sizeof(buf),
+ "Node %d killed this node because "
+ "it could not copy a subscription during node restart. "
+ "Copy subscription error code: %u.",
+ killingNode, data1);
+ break;
+ case SystemError::CopySubscriberRef:
+ BaseString::snprintf(buf, sizeof(buf),
+ "Node %d killed this node because "
+ "it could not start a subscriber during node restart. "
+ "Copy subscription error code: %u.",
+ killingNode, data1);
+ break;
default:
BaseString::snprintf(buf, sizeof(buf), "System error %d, "
" this node was killed by node %d",
@@ -209,7 +241,7 @@
Uint32 senderData = req->senderData;
const ndb_mgm_configuration_iterator * p =
- theConfiguration.getOwnConfigIterator();
+ m_ctx.m_config.getOwnConfigIterator();
ndbrequire(p != 0);
ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
@@ -224,16 +256,12 @@
jamEntry();
cstartPhase = signal->theData[1];
- NodeState newState(NodeState::SL_STARTING, cstartPhase,
- (NodeState::StartType)ctypeOfStart);
- updateNodeState(signal, newState);
-
cndbBlocksCount = 0;
cinternalStartphase = cstartPhase - 1;
switch (cstartPhase) {
case 0:
- if(theConfiguration.getInitialStart()){
+ if(m_ctx.m_config.getInitialStart()){
jam();
c_fsRemoveCount = 0;
clearFilesystem(signal);
@@ -476,7 +504,7 @@
Uint32 to_3 = 0;
const ndb_mgm_configuration_iterator * p =
- theConfiguration.getOwnConfigIterator();
+ m_ctx.m_config.getOwnConfigIterator();
ndbrequire(p != 0);
ndb_mgm_get_int_parameter(p, CFG_DB_START_PARTIAL_TIMEOUT, &to_1);
@@ -591,6 +619,13 @@
Uint32 nodeId = signal->theData[0];
c_startedNodes.set(nodeId);
c_start.m_starting.clear(nodeId);
+
+ /**
+ * Inform all interested blocks that node has started
+ */
+ for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
+ sendSignal(ALL_BLOCKS[i].Ref, GSN_NODE_START_REP, signal, 1, JBB);
+ }
if(!c_start.m_starting.isclear()){
jam();
@@ -1464,6 +1499,9 @@
sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
NodeFailRep::SignalLength, JBB);
+ sendSignal(QMGR_REF, GSN_NODE_FAILREP, signal,
+ NodeFailRep::SignalLength, JBB);
+
if (c_stopRec.stopReq.senderRef)
{
jam();
@@ -1631,7 +1669,6 @@
//w.add(DictTabInfo::MinLoadFactor, 70);
//w.add(DictTabInfo::MaxLoadFactor, 80);
w.add(DictTabInfo::FragmentTypeVal, (Uint32)table.fragmentType);
- //w.add(DictTabInfo::TableStorageVal, (Uint32)DictTabInfo::MainMemory);
//w.add(DictTabInfo::NoOfKeyAttr, 1);
w.add(DictTabInfo::NoOfAttributes, (Uint32)table.columnCount);
//w.add(DictTabInfo::NoOfNullable, (Uint32)0);
@@ -1643,9 +1680,12 @@
const SysColumn& column = table.columnList[i];
ndbassert(column.pos == i);
w.add(DictTabInfo::AttributeName, column.name);
- w.add(DictTabInfo::AttributeId, (Uint32)column.pos);
+ w.add(DictTabInfo::AttributeId, (Uint32)i);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)column.keyFlag);
- //w.add(DictTabInfo::AttributeStorage, (Uint32)DictTabInfo::MainMemory);
+ w.add(DictTabInfo::AttributeStorageType,
+ (Uint32)NDB_STORAGETYPE_MEMORY);
+ w.add(DictTabInfo::AttributeArrayType,
+ (Uint32)NDB_ARRAYTYPE_FIXED);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)column.nullable);
w.add(DictTabInfo::AttributeExtType, (Uint32)column.type);
w.add(DictTabInfo::AttributeExtLength, (Uint32)column.length);
@@ -1766,9 +1806,9 @@
tKeyDataPtr[0] = tkey;
- AttributeHeader::init(&tAIDataPtr[0], 0, 1);
+ AttributeHeader::init(&tAIDataPtr[0], 0, 1 << 2);
tAIDataPtr[1] = tkey;
- AttributeHeader::init(&tAIDataPtr[2], 1, 2);
+ AttributeHeader::init(&tAIDataPtr[2], 1, 2 << 2);
tAIDataPtr[3] = (tkey << 16);
tAIDataPtr[4] = 1;
sendSignal(DBTC_REF, GSN_TCKEYREQ, signal,
@@ -1982,8 +2022,8 @@
}
if (arg == DumpStateOrd::NdbcntrTestStopOnError){
- if (theConfiguration.stopOnError() == true)
- ((Configuration&)theConfiguration).stopOnError(false);
+ if (m_ctx.m_config.stopOnError() == true)
+ ((Configuration&)m_ctx.m_config).stopOnError(false);
const BlockReference tblockref = calcNdbCntrBlockRef(getOwnNodeId());
@@ -2186,7 +2226,7 @@
jam();
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo))
{
- ((Configuration&)theConfiguration).stopOnError(false);
+ ((Configuration&)m_ctx.m_config).stopOnError(false);
}
}
if(!c_stopRec.checkNodeFail(signal))
@@ -2828,6 +2868,10 @@
currentBlockIndex = 0;
+ NodeState newState(NodeState::SL_STARTING, currentStartPhase,
+ (NodeState::StartType)cntr.ctypeOfStart);
+ cntr.updateNodeState(signal, newState);
+
if(start != 0){
/**
* At least one wanted this start phase, report it
--- 1.39.7.1/ndb/src/kernel/vm/Configuration.cpp 2006-05-22 10:27:22 -04:00
+++ 1.49/storage/ndb/src/kernel/vm/Configuration.cpp 2006-06-02 14:54:51 -04:00
@@ -659,13 +659,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);
@@ -730,14 +726,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
@@ -753,14 +749,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);
@@ -843,7 +836,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);
@@ -852,14 +845,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);
@@ -873,7 +866,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.45.20.1/ndb/src/mgmsrv/Services.cpp 2006-05-19 03:59:31 -04:00
+++ 1.65/storage/ndb/src/mgmsrv/Services.cpp 2006-06-02 14:54:51 -04:00
@@ -485,7 +485,8 @@
NDB_TICKS tick= 0;
/* only report error on second attempt as not to clog the cluster log */
while (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype,
- (struct sockaddr*)&addr, &addrlen, error_code, error_string,
+ (struct sockaddr*)&addr, &addrlen,
+ error_code, error_string,
tick == 0 ? 0 : log_event))
{
/* NDB_MGM_ALLOCID_CONFIG_MISMATCH is a non retriable error */
--- 1.12.5.2/ndb/src/ndbapi/DictCache.cpp 2006-05-25 07:08:30 -04:00
+++ 1.26/storage/ndb/src/ndbapi/DictCache.cpp 2006-06-02 14:54:51 -04:00
@@ -27,6 +27,7 @@
Ndb_local_table_info *
Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
{
+ assert(! is_ndb_blob_table(table_impl));
Uint32 tot_size= sizeof(Ndb_local_table_info) - sizeof(Uint64)
+ ((sz+7) & ~7); // round to Uint64
void *data= malloc(tot_size);
@@ -44,6 +45,7 @@
Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl)
{
+ assert(! is_ndb_blob_table(table_impl));
m_table_impl= table_impl;
m_first_tuple_id = ~(Uint64)0;
m_last_tuple_id = ~(Uint64)0;
@@ -63,19 +65,24 @@
Ndb_local_table_info *
LocalDictCache::get(const char * name){
+ ASSERT_NOT_MYSQLD;
+ assert(! is_ndb_blob_table(name));
const Uint32 len = strlen(name);
return m_tableHash.getData(name, len);
}
void
LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){
- const Uint32 id = tab_info->m_table_impl->m_tableId;
-
+ ASSERT_NOT_MYSQLD;
+ assert(! is_ndb_blob_table(name));
+ const Uint32 id = tab_info->m_table_impl->m_id;
m_tableHash.insertKey(name, strlen(name), id, tab_info);
}
void
LocalDictCache::drop(const char * name){
+ ASSERT_NOT_MYSQLD;
+ assert(! is_ndb_blob_table(name));
Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name));
DBUG_ASSERT(info != 0);
Ndb_local_table_info::destroy(info);
@@ -98,8 +105,15 @@
Vector<TableVersion> * vers = curr->theData;
const unsigned sz = vers->size();
for(unsigned i = 0; i<sz ; i++){
- if((* vers)[i].m_impl != 0)
+ TableVersion tv= (*vers)[i];
+ DBUG_PRINT(" ", ("vers[%d]: ver: %d, refCount: %d, status: %d",
+ i, tv.m_version, tv.m_refCount, tv.m_status));
+ if(tv.m_impl != 0)
+ {
+ DBUG_PRINT(" ", ("m_impl: internalname: %s",
+ tv.m_impl->m_internalName.c_str()));
delete (* vers)[i].m_impl;
+ }
}
delete curr->theData;
curr->theData= NULL;
@@ -122,8 +136,8 @@
const unsigned sz = vers->size();
for(unsigned i = 0; i<sz ; i++){
TableVersion tv= (*vers)[i];
- DBUG_PRINT(" ", ("vers[%d]: ver: %d, refCount: %d, status: %d",
- sz, tv.m_version, tv.m_refCount, tv.m_status));
+ DBUG_PRINT(" ", ("impl: %p vers[%d]: ver: %d, refCount: %d, status: %d",
+ tv.m_impl, i, tv.m_version, tv.m_refCount, tv.m_status));
if(tv.m_impl != 0)
{
DBUG_PRINT(" ", ("m_impl: internalname: %s",
@@ -145,6 +159,7 @@
{
DBUG_ENTER("GlobalDictCache::get");
DBUG_PRINT("enter", ("name: %s", name));
+ assert(! is_ndb_blob_table(name));
const Uint32 len = strlen(name);
Vector<TableVersion> * versions = 0;
@@ -161,12 +176,29 @@
TableVersion * ver = & versions->back();
switch(ver->m_status){
case OK:
+ if (ver->m_impl->m_status == NdbDictionary::Object::Invalid)
+ {
+ ver->m_status = DROPPED;
+ retreive = true; // Break loop
+ if (ver->m_refCount == 0)
+ {
+ delete ver->m_impl;
+ versions->erase(versions->size() - 1);
+ }
+ break;
+ }
ver->m_refCount++;
+ DBUG_PRINT("info", ("Table OK tab: %p version=%x.%x refCount=%u",
+ ver->m_impl,
+ ver->m_impl->m_version & 0xFFFFFF,
+ ver->m_impl->m_version >> 24,
+ ver->m_refCount));
DBUG_RETURN(ver->m_impl);
case DROPPED:
retreive = true; // Break loop
break;
case RETREIVING:
+ DBUG_PRINT("info", ("Wait for retrieving thread"));
NdbCondition_WaitTimeout(m_waitForTableCondition, m_mutex, waitTime);
continue;
}
@@ -181,6 +213,7 @@
tmp.m_status = RETREIVING;
tmp.m_refCount = 1; // The one retreiving it
versions->push_back(tmp);
+ DBUG_PRINT("info", ("No table found"));
DBUG_RETURN(0);
}
@@ -188,8 +221,12 @@
GlobalDictCache::put(const char * name, NdbTableImpl * tab)
{
DBUG_ENTER("GlobalDictCache::put");
- DBUG_PRINT("enter", ("name: %s, internal_name: %s",
- name, tab ? tab->m_internalName.c_str() : "tab NULL"));
+ DBUG_PRINT("enter", ("tab: %p name: %s, internal_name: %s version: %x.%x",
+ tab, name,
+ tab ? tab->m_internalName.c_str() : "tab NULL",
+ tab ? tab->m_version & 0xFFFFFF : 0,
+ tab ? tab->m_version >> 24 : 0));
+ assert(! is_ndb_blob_table(name));
const Uint32 len = strlen(name);
Vector<TableVersion> * vers = m_tableHash.getData(name, len);
@@ -221,12 +258,14 @@
vers->erase(sz - 1);
}
else if (ver.m_impl == 0) {
+ DBUG_PRINT("info", ("Table OK"));
ver.m_impl = tab;
ver.m_version = tab->m_version;
ver.m_status = OK;
}
else if (ver.m_impl == &f_invalid_table)
{
+ DBUG_PRINT("info", ("Table DROPPED invalid"));
ver.m_impl = tab;
ver.m_version = tab->m_version;
ver.m_status = DROPPED;
@@ -234,6 +273,7 @@
}
else if(ver.m_impl == &f_altered_table)
{
+ DBUG_PRINT("info", ("Table DROPPED altered"));
ver.m_impl = tab;
ver.m_version = tab->m_version;
ver.m_status = DROPPED;
@@ -247,62 +287,6 @@
DBUG_RETURN(tab);
}
-void
-GlobalDictCache::drop(NdbTableImpl * tab)
-{
- DBUG_ENTER("GlobalDictCache::drop");
- DBUG_PRINT("enter", ("internal_name: %s", tab->m_internalName.c_str()));
-
- unsigned i;
- const Uint32 len = strlen(tab->m_internalName.c_str());
- Vector<TableVersion> * vers =
- m_tableHash.getData(tab->m_internalName.c_str(), len);
- if(vers == 0){
- // Should always tried to retreive it first
- // and thus there should be a record
- abort();
- }
-
- const Uint32 sz = vers->size();
- if(sz == 0){
- // Should always tried to retreive it first
- // and thus there should be a record
- abort();
- }
-
- for(i = 0; i < sz; i++){
- TableVersion & ver = (* vers)[i];
- if(ver.m_impl == tab){
- if(ver.m_refCount == 0 || ver.m_status == RETREIVING ||
- ver.m_version != tab->m_version){
- DBUG_PRINT("info", ("Dropping with refCount=%d status=%d impl=%p",
- ver.m_refCount, ver.m_status, ver.m_impl));
- break;
- }
- DBUG_PRINT("info", ("Found table to drop, i: %d, name: %s",
- i, ver.m_impl->m_internalName.c_str()));
- ver.m_refCount--;
- ver.m_status = DROPPED;
- if(ver.m_refCount == 0){
- DBUG_PRINT("info", ("refCount is zero, deleting m_impl"))
- delete ver.m_impl;
- vers->erase(i);
- }
- DBUG_VOID_RETURN;
- }
- }
-
- for(i = 0; i<sz; i++){
- TableVersion & ver = (* vers)[i];
- DBUG_PRINT("info", ("%d: version: %d refCount: %d status: %d impl: %p",
- i, ver.m_version, ver.m_refCount,
- ver.m_status, ver.m_impl));
- }
-
- abort();
-}
-
-
unsigned
GlobalDictCache::get_size()
{
@@ -312,6 +296,10 @@
sz += curr->theData->size();
curr = m_tableHash.getNext(curr);
}
+ if (sz)
+ {
+ printCache();
+ }
return sz;
}
@@ -339,10 +327,12 @@
}
void
-GlobalDictCache::release(NdbTableImpl * tab)
+GlobalDictCache::release(NdbTableImpl * tab, int invalidate)
{
DBUG_ENTER("GlobalDictCache::release");
- DBUG_PRINT("enter", ("internal_name: %s", tab->m_internalName.c_str()));
+ DBUG_PRINT("enter", ("tab: %p internal_name: %s",
+ tab, tab->m_internalName.c_str()));
+ assert(! is_ndb_blob_table(tab));
unsigned i;
const Uint32 len = strlen(tab->m_internalName.c_str());
@@ -372,15 +362,26 @@
}
ver.m_refCount--;
+ if (ver.m_impl->m_status == NdbDictionary::Object::Invalid || invalidate)
+ {
+ ver.m_impl->m_status = NdbDictionary::Object::Invalid;
+ ver.m_status = DROPPED;
+ }
+ if (ver.m_refCount == 0 && ver.m_status == DROPPED)
+ {
+ DBUG_PRINT("info", ("refCount is zero, deleting m_impl"));
+ delete ver.m_impl;
+ vers->erase(i);
+ }
DBUG_VOID_RETURN;
}
}
for(i = 0; i<sz; i++){
TableVersion & ver = (* vers)[i];
- DBUG_PRINT("info", ("%d: version: %d refCount: %d status: %d impl: %p",
- i, ver.m_version, ver.m_refCount,
- ver.m_status, ver.m_impl));
+ ndbout_c("%d: version: %d refCount: %d status: %d impl: %p",
+ i, ver.m_version, ver.m_refCount,
+ ver.m_status, ver.m_impl);
}
abort();
@@ -392,39 +393,47 @@
Uint32 tableVersion,
bool altered)
{
+ DBUG_ENTER("GlobalDictCache::alter_table_rep");
+ assert(! is_ndb_blob_table(name));
const Uint32 len = strlen(name);
Vector<TableVersion> * vers =
m_tableHash.getData(name, len);
if(vers == 0)
{
- return;
+ DBUG_VOID_RETURN;
}
const Uint32 sz = vers->size();
if(sz == 0)
{
- return;
+ DBUG_VOID_RETURN;
}
for(Uint32 i = 0; i < sz; i++)
{
TableVersion & ver = (* vers)[i];
if(ver.m_version == tableVersion && ver.m_impl &&
- ver.m_impl->m_tableId == tableId)
+ ver.m_impl->m_id == tableId)
{
ver.m_status = DROPPED;
ver.m_impl->m_status = altered ?
NdbDictionary::Object::Altered : NdbDictionary::Object::Invalid;
- return;
+ if (ver.m_refCount == 0)
+ {
+ delete ver.m_impl;
+ vers->erase(i);
+ }
+ DBUG_VOID_RETURN;
}
if(i == sz - 1 && ver.m_status == RETREIVING)
{
ver.m_impl = altered ? &f_altered_table : &f_invalid_table;
- return;
+ DBUG_VOID_RETURN;
}
}
+ DBUG_VOID_RETURN;
}
template class Vector<GlobalDictCache::TableVersion>;
--- 1.6.6.2/ndb/src/ndbapi/DictCache.hpp 2006-05-25 07:08:30 -04:00
+++ 1.14/storage/ndb/src/ndbapi/DictCache.hpp 2006-06-02 14:54:51 -04:00
@@ -68,11 +68,11 @@
GlobalDictCache();
~GlobalDictCache();
+ NdbTableImpl * get(NdbTableImpl *tab);
NdbTableImpl * get(const char * name);
NdbTableImpl* put(const char * name, NdbTableImpl *);
- void drop(NdbTableImpl *);
- void release(NdbTableImpl *);
+ void release(NdbTableImpl *, int invalidate = 0);
void alter_table_rep(const char * name,
Uint32 tableId, Uint32 tableVersion, bool altered);
--- 1.20.4.1/ndb/test/ndbapi/testDict.cpp 2006-05-17 06:30:57 -04:00
+++ 1.27/storage/ndb/test/ndbapi/testDict.cpp 2006-06-02 14:54:52 -04:00
@@ -109,7 +109,7 @@
const NdbDictionary::Table* pTab = ctx->getTab();
// Try to create table in db
- if (pTab->createTableInDb(pNdb) != 0){
+ if (NDBT_Tables::createTable(pNdb, pTab->getName()) != 0){
return NDBT_FAILED;
}
@@ -151,7 +151,7 @@
}
// Try to create table in db
- if (pTab->createTableInDb(pNdb) == 0){
+ if (NDBT_Tables::createTable(pNdb, pTab->getName()) == 0){
result = NDBT_FAILED;
}
@@ -203,7 +203,7 @@
ndbout << i << ": ";
// Try to create table in db
- if (pTab->createTableInDb(pNdb) != 0){
+ if (NDBT_Tables::createTable(pNdb, pTab->getName()) != 0){
return NDBT_FAILED;
}
@@ -254,7 +254,8 @@
while (i < loops){
ndbout << i << ": ";
// Try to create table in db
- if (pTab->createTableInDb(pNdb) != 0){
+
+ if (NDBT_Tables::createTable(pNdb, pTab->getName()) != 0){
return NDBT_FAILED;
}
@@ -336,7 +337,7 @@
Ndb* pNdb = GETNDB(step);
g_debug << "Creating table" << endl;
- if (pTab->createTableInDb(pNdb) != 0){
+ if (NDBT_Tables::createTable(pNdb, pTab->getName()) != 0){
g_err << "createTableInDb failed" << endl;
result = NDBT_FAILED;
continue;
@@ -357,7 +358,6 @@
g_debug << "Dropping table" << endl;
-
if (pNdb->getDictionary()->dropTable(pTab2->getName()) != 0){
g_err << "Failed to drop "<<pTab2->getName()<<" in db" << endl;
result = NDBT_FAILED;
@@ -1473,6 +1473,99 @@
return NDBT_OK;
}
+int
+runCreateLogfileGroup(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::LogfileGroup lg;
+ lg.setName("DEFAULT-LG");
+ lg.setUndoBufferSize(8*1024*1024);
+
+ int res;
+ res = pNdb->getDictionary()->createLogfileGroup(lg);
+ if(res != 0){
+ g_err << "Failed to create logfilegroup:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ NdbDictionary::Undofile uf;
+ uf.setPath("undofile01.dat");
+ uf.setSize(5*1024*1024);
+ uf.setLogfileGroup("DEFAULT-LG");
+
+ res = pNdb->getDictionary()->createUndofile(uf);
+ if(res != 0){
+ g_err << "Failed to create undofile:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ uf.setPath("undofile02.dat");
+ uf.setSize(5*1024*1024);
+ uf.setLogfileGroup("DEFAULT-LG");
+
+ res = pNdb->getDictionary()->createUndofile(uf);
+ if(res != 0){
+ g_err << "Failed to create undofile:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+
+int
+runCreateTablespace(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Tablespace lg;
+ lg.setName("DEFAULT-TS");
+ lg.setExtentSize(1024*1024);
+ lg.setDefaultLogfileGroup("DEFAULT-LG");
+
+ int res;
+ res = pNdb->getDictionary()->createTablespace(lg);
+ if(res != 0){
+ g_err << "Failed to create tablespace:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ NdbDictionary::Datafile uf;
+ uf.setPath("datafile01.dat");
+ uf.setSize(10*1024*1024);
+ uf.setTablespace("DEFAULT-TS");
+
+ res = pNdb->getDictionary()->createDatafile(uf);
+ if(res != 0){
+ g_err << "Failed to create datafile:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+int
+runCreateDiskTable(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+
+ NdbDictionary::Table tab = *ctx->getTab();
+ tab.setTablespace("DEFAULT-TS");
+
+ for(Uint32 i = 0; i<tab.getNoOfColumns(); i++)
+ if(!tab.getColumn(i)->getPrimaryKey())
+ tab.getColumn(i)->setStorageType(NdbDictionary::Column::StorageTypeDisk);
+
+ int res;
+ res = pNdb->getDictionary()->createTable(tab);
+ if(res != 0){
+ g_err << "Failed to create table:"
+ << endl << pNdb->getDictionary()->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+
int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
static int acclst[] = { 3001 };
static int tuplst[] = { 4007, 4008, 4009, 4010, 4011, 4012 };
@@ -1650,6 +1743,15 @@
TESTCASE("DictionaryPerf",
""){
INITIALIZER(runTestDictionaryPerf);
+}
+TESTCASE("CreateLogfileGroup", ""){
+ INITIALIZER(runCreateLogfileGroup);
+}
+TESTCASE("CreateTablespace", ""){
+ INITIALIZER(runCreateTablespace);
+}
+TESTCASE("CreateDiskTable", ""){
+ INITIALIZER(runCreateDiskTable);
}
TESTCASE("FailAddFragment",
"Fail add fragment or attribute in ACC or TUP or TUX\n"){
--- 1.49/mysql-test/r/heap.result 2006-05-09 11:13:31 -04:00
+++ 1.50/mysql-test/r/heap.result 2006-06-02 14:54:31 -04:00
@@ -718,3 +718,16 @@
t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2;
+CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
+KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE b='aa';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
+COUNT(*)
+2
+DROP TABLE t1;
--- 1.39/mysql-test/r/type_ranges.result 2005-12-02 06:01:37 -05:00
+++ 1.40/mysql-test/r/type_ranges.result 2006-06-02 14:54:34 -04:00
@@ -241,7 +241,7 @@
auto int(5) unsigned NULL NO 0 #
string char(10) latin1_swedish_ci YES newdefault #
tiny tinyint(4) NULL NO 0 #
-short smallint(6) NULL NO 0 #
+short smallint(6) NULL NO #
medium mediumint(8) NULL NO 0 #
long_int int(11) NULL NO 0 #
longlong bigint(13) NULL NO 0 #
@@ -259,7 +259,7 @@
new_blob_col varchar(20) latin1_swedish_ci YES NULL #
tinyblob_col tinyblob NULL YES NULL #
mediumblob_col mediumblob NULL NO #
-options enum('one','two','tree') latin1_swedish_ci NO one #
+options enum('one','two','tree') latin1_swedish_ci NO #
flags set('one','two','tree') latin1_swedish_ci NO #
new_field char(10) latin1_swedish_ci NO new #
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
--- 1.84/mysql-test/r/variables.result 2006-05-15 21:33:34 -04:00
+++ 1.85/mysql-test/r/variables.result 2006-06-02 14:54:34 -04:00
@@ -639,6 +639,35 @@
@@version_compile_os;
@@version @@version_comment @@version_compile_machine @@version_compile_os
# # # #
+select @@basedir, @@datadir, @@tmpdir;
+@@basedir @@datadir @@tmpdir
+# # #
+show variables like 'basedir';
+Variable_name Value
+basedir #
+show variables like 'datadir';
+Variable_name Value
+datadir #
+show variables like 'tmpdir';
+Variable_name Value
+tmpdir #
+select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
+@@ssl_ca @@ssl_capath @@ssl_cert @@ssl_cipher @@ssl_key
+# # # # #
+show variables like 'ssl%';
+Variable_name Value
+ssl_ca #
+ssl_capath #
+ssl_cert #
+ssl_cipher #
+ssl_key #
+select @@log_queries_not_using_indexes;
+@@log_queries_not_using_indexes
+0
+show variables like 'log_queries_not_using_indexes';
+Variable_name Value
+log_queries_not_using_indexes OFF
+End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;
set global delayed_insert_timeout =@my_delayed_insert_timeout;
@@ -666,4 +695,3 @@
set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
-End of 5.0 tests
--- 1.37/mysql-test/t/join_outer.test 2006-05-17 23:48:37 -04:00
+++ 1.38/mysql-test/t/join_outer.test 2006-06-02 14:54:35 -04:00
@@ -761,24 +761,10 @@
#
# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
-#
+#
-CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
- INDEX (name)) ENGINE=InnoDB;
-CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
- FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
-INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
+# Test case moved to join_outer_innodb
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%';
-
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%' OR FALSE;
-
-DROP TABLE t1,t2;
#
# Bug 19396: LEFT OUTER JOIN over views in curly braces
--- 1.59/mysql-test/t/variables.test 2006-05-15 21:33:34 -04:00
+++ 1.60/mysql-test/t/variables.test 2006-06-02 14:54:37 -04:00
@@ -540,7 +540,42 @@
@@version_compile_os;
#
-# Bug #19263: variables.test doesn't clean up after itself (II/II -- restore)
+# Bug #1039: make tmpdir and datadir available as @@variables (also included
+# basedir)
+#
+# Don't actually output, since it depends on the system
+--replace_column 1 # 2 # 3 #
+select @@basedir, @@datadir, @@tmpdir;
+--replace_column 2 #
+show variables like 'basedir';
+--replace_column 2 #
+show variables like 'datadir';
+--replace_column 2 #
+show variables like 'tmpdir';
+
+#
+# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
+#
+# Don't actually output, since it depends on the system
+--replace_column 1 # 2 # 3 # 4 # 5 #
+select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
+--replace_column 2 #
+show variables like 'ssl%';
+
+#
+# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
+# and as @@log_queries_not_using_indexes
+#
+select @@log_queries_not_using_indexes;
+show variables like 'log_queries_not_using_indexes';
+
+--echo End of 5.0 tests
+
+# This is at the very after the versioned tests, since it involves doing
+# cleanup
+#
+# Bug #19263: variables.test doesn't clean up after itself (II/II --
+# restore)
#
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;
@@ -569,5 +604,3 @@
set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
-
---echo End of 5.0 tests
--- 1.16/mysql-test/r/lock_multi.result 2006-03-29 06:27:30 -05:00
+++ 1.17/mysql-test/r/lock_multi.result 2006-06-02 14:54:31 -04:00
@@ -50,3 +50,19 @@
a int(11) YES NULL
unlock tables;
drop table t1;
+use mysql;
+LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
+FLUSH TABLES;
+use mysql;
+ SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+OPTIMIZE TABLES columns_priv, db, host, user;
+Table Op Msg_type Msg_text
+mysql.columns_priv optimize status OK
+mysql.db optimize status OK
+mysql.host optimize status OK
+mysql.user optimize status OK
+UNLOCK TABLES;
+Select_priv
+N
+use test;
+use test;
--- 1.14/mysql-test/t/lock_multi.test 2006-03-29 06:27:30 -05:00
+++ 1.15/mysql-test/t/lock_multi.test 2006-06-02 14:54:35 -04:00
@@ -126,3 +126,35 @@
connection locker;
unlock tables;
drop table t1;
+
+#
+# Bug#16986 - Deadlock condition with MyISAM tables
+#
+connection locker;
+use mysql;
+LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
+FLUSH TABLES;
+--sleep 1
+#
+connection reader;
+use mysql;
+#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
+send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+--sleep 1
+#
+connection locker;
+# Make test case independent from earlier grants.
+--replace_result "Table is already up to date" "OK"
+OPTIMIZE TABLES columns_priv, db, host, user;
+UNLOCK TABLES;
+#
+connection reader;
+reap;
+use test;
+#
+connection locker;
+use test;
+#
+connection default;
+
+# End of 5.0 tests
--- 1.51/mysql-test/r/grant.result 2006-03-07 14:00:40 -05:00
+++ 1.52/mysql-test/r/grant.result 2006-06-02 14:54:30 -04:00
@@ -357,12 +357,12 @@
Grants for grant_user@localhost
GRANT USAGE ON *.* TO 'grant_user'@'localhost'
GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
-select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv order by Column_name;
Host Db User Table_name Column_name Column_priv
-localhost test grant_user t1 b Insert
-localhost test grant_user t1 d Insert
localhost test grant_user t1 a Insert
+localhost test grant_user t1 b Insert
localhost test grant_user t1 c Insert
+localhost test grant_user t1 d Insert
revoke ALL PRIVILEGES on t1 from grant_user@localhost;
show grants for grant_user@localhost;
Grants for grant_user@localhost
@@ -381,13 +381,27 @@
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
-show grants for mysqltest_3@localhost;
-Grants for mysqltest_3@localhost
-GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
-GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost'
-GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost'
-GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
-GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
+SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_3'@'localhost' NULL mysqltest_1 t1 a UPDATE NO
+'mysqltest_3'@'localhost' NULL mysqltest_2 t1 c SELECT NO
+'mysqltest_3'@'localhost' NULL mysqltest_1 t2 b SELECT NO
+'mysqltest_3'@'localhost' NULL mysqltest_2 t2 d UPDATE NO
+SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
+SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_3'@'localhost' NULL USAGE NO
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
@@ -593,6 +607,7 @@
flush privileges;
delete from tables_priv where host = '' and user = 'mysqltest_1';
flush privileges;
+use test;
set @user123="non-existent";
select * from mysql.db where user=@user123;
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
@@ -623,7 +638,6 @@
Grants for mysqltest_7@
GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517'
drop user mysqltest_7@;
-flush privileges;
show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
create database mysqltest;
@@ -644,3 +658,214 @@
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
+use test;
+create table t1 (a int);
+create table t2 as select * from mysql.user where user='';
+delete from mysql.user where user='';
+flush privileges;
+create user mysqltest_8@'';
+create user mysqltest_8;
+create user mysqltest_8@host8;
+create user mysqltest_8@'';
+ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@''
+create user mysqltest_8;
+ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%'
+create user mysqltest_8@host8;
+ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8'
+select user, QUOTE(host) from mysql.user where user="mysqltest_8";
+user QUOTE(host)
+mysqltest_8 ''
+mysqltest_8 '%'
+mysqltest_8 'host8'
+Schema privileges
+grant select on mysqltest.* to mysqltest_8@'';
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
+grant select on mysqltest.* to mysqltest_8@;
+show grants for mysqltest_8@;
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
+grant select on mysqltest.* to mysqltest_8;
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'
+select * from information_schema.schema_privileges
+where grantee like "'mysqltest_8'%";
+GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_8'@'%' NULL mysqltest SELECT NO
+'mysqltest_8'@'' NULL mysqltest SELECT NO
+select * from t1;
+a
+revoke select on mysqltest.* from mysqltest_8@'';
+revoke select on mysqltest.* from mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+select * from information_schema.schema_privileges
+where grantee like "'mysqltest_8'%";
+GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8@;
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+grant select on mysqltest.* to mysqltest_8@'';
+flush privileges;
+show grants for mysqltest_8@;
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
+revoke select on mysqltest.* from mysqltest_8@'';
+flush privileges;
+Column privileges
+grant update (a) on t1 to mysqltest_8@'';
+grant update (a) on t1 to mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
+select * from information_schema.column_privileges;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_8'@'%' NULL test t1 a UPDATE NO
+'mysqltest_8'@'' NULL test t1 a UPDATE NO
+select * from t1;
+a
+revoke update (a) on t1 from mysqltest_8@'';
+revoke update (a) on t1 from mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+select * from information_schema.column_privileges;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+Table privileges
+grant update on t1 to mysqltest_8@'';
+grant update on t1 to mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
+select * from information_schema.table_privileges;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_8'@'%' NULL test t1 UPDATE NO
+'mysqltest_8'@'' NULL test t1 UPDATE NO
+select * from t1;
+a
+revoke update on t1 from mysqltest_8@'';
+revoke update on t1 from mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+select * from information_schema.table_privileges;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+"DROP USER" should clear privileges
+grant all privileges on mysqltest.* to mysqltest_8@'';
+grant select on mysqltest.* to mysqltest_8@'';
+grant update on t1 to mysqltest_8@'';
+grant update (a) on t1 to mysqltest_8@'';
+grant all privileges on mysqltest.* to mysqltest_8;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
+GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
+select * from information_schema.user_privileges
+where grantee like "'mysqltest_8'%";
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_8'@'host8' NULL USAGE NO
+'mysqltest_8'@'%' NULL USAGE NO
+'mysqltest_8'@'' NULL USAGE NO
+select * from t1;
+a
+flush privileges;
+show grants for mysqltest_8@'';
+Grants for mysqltest_8@
+GRANT USAGE ON *.* TO 'mysqltest_8'@''
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
+GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
+drop user mysqltest_8@'';
+show grants for mysqltest_8@'';
+ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host ''
+show grants for mysqltest_8;
+Grants for mysqltest_8@%
+GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
+select * from information_schema.user_privileges
+where grantee like "'mysqltest_8'%";
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+'mysqltest_8'@'host8' NULL USAGE NO
+'mysqltest_8'@'%' NULL USAGE NO
+drop user mysqltest_8;
+connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO)
+show grants for mysqltest_8;
+ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
+drop user mysqltest_8@host8;
+show grants for mysqltest_8@host8;
+ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8'
+insert into mysql.user select * from t2;
+flush privileges;
+drop table t2;
+drop table t1;
--- 1.85/sql/set_var.h 2006-04-19 13:12:18 -04:00
+++ 1.86/sql/set_var.h 2006-06-02 14:54:44 -04:00
@@ -231,6 +231,35 @@
};
+class sys_var_const_str_ptr :public sys_var
+{
+public:
+ char **value; // Pointer to const value
+ sys_var_const_str_ptr(const char *name_arg, char **value_arg)
+ :sys_var(name_arg),value(value_arg)
+ {}
+ bool check(THD *thd, set_var *var)
+ {
+ return 1;
+ }
+ bool update(THD *thd, set_var *var)
+ {
+ return 1;
+ }
+ SHOW_TYPE type() { return SHOW_CHAR; }
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ {
+ return (byte*) *value;
+ }
+ bool check_update_type(Item_result type)
+ {
+ return 1;
+ }
+ bool check_default(enum_var_type type) { return 1; }
+ bool is_readonly() const { return 1; }
+};
+
+
class sys_var_enum :public sys_var
{
uint *value;
--- 1.29/mysql-test/r/strict.result 2006-02-22 04:09:51 -05:00
+++ 1.30/mysql-test/r/strict.result 2006-06-02 14:54:33 -04:00
@@ -1288,3 +1288,13 @@
select * from t1;
a
drop table t1;
+set sql_mode='traditional';
+create table t1 (date date not null);
+create table t2 select date from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `date` date NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t1;
+set @@sql_mode= @org_mode;
--- 1.20/mysql-test/t/strict.test 2005-12-01 06:30:05 -05:00
+++ 1.21/mysql-test/t/strict.test 2006-06-02 14:54:37 -04:00
@@ -1145,3 +1145,13 @@
insert into t1 values(b'101');
select * from t1;
drop table t1;
+
+#
+# Bug#17626 CREATE TABLE ... SELECT failure with TRADITIONAL SQL mode
+#
+set sql_mode='traditional';
+create table t1 (date date not null);
+create table t2 select date from t1;
+show create table t2;
+drop table t2,t1;
+set @@sql_mode= @org_mode;
--- 1.115/mysql-test/r/func_str.result 2006-05-17 04:15:26 -04:00
+++ 1.116/mysql-test/r/func_str.result 2006-06-02 14:54:30 -04:00
@@ -1046,4 +1046,10 @@
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
20.06
+select conv("18383815659218730760",10,10) + 0;
+conv("18383815659218730760",10,10) + 0
+1.8383815659219e+19
+select "18383815659218730760" + 0;
+"18383815659218730760" + 0
+1.8383815659219e+19
End of 5.0 tests
--- 1.211/client/mysqltest.c 2006-05-18 17:36:46 -04:00
+++ 1.212/client/mysqltest.c 2006-06-02 14:54:27 -04:00
@@ -2757,6 +2757,9 @@
#ifdef HAVE_OPENSSL
if (opt_use_ssl || con_ssl)
{
+ /* Turn on ssl_verify_server_cert only if host is "localhost" */
+ opt_ssl_verify_server_cert= !strcmp(con_host, "localhost");
+
mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
--- 1.18/mysql-test/r/ndb_blob.result 2006-05-04 08:34:26 -04:00
+++ 1.19/mysql-test/r/ndb_blob.result 2006-06-02 14:54:32 -04:00
@@ -500,3 +500,69 @@
count(*)
0
drop table t1;
+create table t1 (
+a varchar(40) not null,
+b mediumint not null,
+t text,
+c varchar(2) not null,
+d bigint not null,
+primary key (a,b,c),
+key (c,a),
+unique key (d)
+) engine=ndb;
+insert into t1 (a,b,c,d,t) values ('a',1110,'a',1,@v1);
+insert into t1 (a,b,c,d,t) values ('b',1110,'a',2,@v2);
+insert into t1 (a,b,c,d,t) values ('a',1110,'b',3,@v3);
+insert into t1 (a,b,c,d,t) values ('b',1110,'b',4,@v4);
+select a,b,c,d,sha1(t) from t1 order by c,a;
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+b 1110 b 4 NULL
+select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='a';
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='b';
+a b c d sha1(t)
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+update t1 set t=@v4 where a='b' and b=1110 and c='a';
+update t1 set t=@v2 where a='b' and b=1110 and c='b';
+select a,b,c,d,sha1(t) from t1 order by c,a;
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+b 1110 a 2 NULL
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
+update t1 set t=@v2 where d=2;
+update t1 set t=@v4 where d=4;
+select a,b,c,d,sha1(t) from t1 order by c,a;
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+b 1110 b 4 NULL
+update t1 set t=@v4 where a='b' and c='a';
+update t1 set t=@v2 where a='b' and c='b';
+select a,b,c,d,sha1(t) from t1 order by c,a;
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+b 1110 a 2 NULL
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
+update t1 set t=@v2 where b+d=1112;
+update t1 set t=@v4 where b+d=1114;
+select a,b,c,d,sha1(t) from t1 order by c,a;
+a b c d sha1(t)
+a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
+b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
+a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
+b 1110 b 4 NULL
+delete from t1 where a='a' and b=1110 and c='a';
+delete from t1 where a='b' and c='a';
+delete from t1 where d=3;
+delete from t1 where b+d=1114;
+select count(*) from t1;
+count(*)
+0
+drop table t1;
--- 1.207/mysql-test/r/sp.result 2006-05-18 14:21:31 -04:00
+++ 1.208/mysql-test/r/sp.result 2006-06-02 14:54:33 -04:00
@@ -4954,4 +4954,34 @@
DROP FUNCTION bug18589_f1|
DROP PROCEDURE bug18589_p1|
DROP PROCEDURE bug18589_p2|
+DROP FUNCTION IF EXISTS bug18037_f1|
+DROP PROCEDURE IF EXISTS bug18037_p1|
+DROP PROCEDURE IF EXISTS bug18037_p2|
+CREATE FUNCTION bug18037_f1() RETURNS INT
+BEGIN
+RETURN @@server_id;
+END|
+CREATE PROCEDURE bug18037_p1()
+BEGIN
+DECLARE v INT DEFAULT @@server_id;
+END|
+CREATE PROCEDURE bug18037_p2()
+BEGIN
+CASE @@server_id
+WHEN -1 THEN
+SELECT 0;
+ELSE
+SELECT 1;
+END CASE;
+END|
+SELECT bug18037_f1()|
+bug18037_f1()
+1
+CALL bug18037_p1()|
+CALL bug18037_p2()|
+1
+1
+DROP FUNCTION bug18037_f1|
+DROP PROCEDURE bug18037_p1|
+DROP PROCEDURE bug18037_p2|
drop table t1,t2;
--- 1.190/mysql-test/t/sp.test 2006-05-18 14:21:31 -04:00
+++ 1.191/mysql-test/t/sp.test 2006-06-02 14:54:37 -04:00
@@ -5833,6 +5833,52 @@
#
+# BUG#18037: Server crash when returning system variable in stored procedures
+# BUG#19633: Stack corruption in fix_fields()/THD::rollback_item_tree_changes()
+#
+
+# Prepare.
+
+--disable_warnings
+DROP FUNCTION IF EXISTS bug18037_f1|
+DROP PROCEDURE IF EXISTS bug18037_p1|
+DROP PROCEDURE IF EXISTS bug18037_p2|
+--enable_warnings
+
+# Test case.
+
+CREATE FUNCTION bug18037_f1() RETURNS INT
+BEGIN
+ RETURN @@server_id;
+END|
+
+CREATE PROCEDURE bug18037_p1()
+BEGIN
+ DECLARE v INT DEFAULT @@server_id;
+END|
+
+CREATE PROCEDURE bug18037_p2()
+BEGIN
+ CASE @@server_id
+ WHEN -1 THEN
+ SELECT 0;
+ ELSE
+ SELECT 1;
+ END CASE;
+END|
+
+SELECT bug18037_f1()|
+CALL bug18037_p1()|
+CALL bug18037_p2()|
+
+# Cleanup.
+
+DROP FUNCTION bug18037_f1|
+DROP PROCEDURE bug18037_p1|
+DROP PROCEDURE bug18037_p2|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
--- 1.221/sql/sp_head.cc 2006-05-18 05:56:46 -04:00
+++ 1.222/sql/sp_head.cc 2006-06-02 14:54:44 -04:00
@@ -249,6 +249,7 @@
case SQLCOM_TRUNCATE:
case SQLCOM_COMMIT:
case SQLCOM_ROLLBACK:
+ case SQLCOM_LOAD:
case SQLCOM_LOAD_MASTER_DATA:
case SQLCOM_LOCK_TABLES:
case SQLCOM_CREATE_PROCEDURE:
--- 1.21/server-tools/instance-manager/guardian.cc 2006-04-10 12:34:08 -04:00
+++ 1.22/server-tools/instance-manager/guardian.cc 2006-06-02 14:54:39 -04:00
@@ -139,9 +139,12 @@
case JUST_CRASHED:
if (current_time - current_node->crash_moment <= 2)
{
- instance->start();
- log_info("guardian: starting instance %s",
- instance->options.instance_name);
+ if (instance->is_crashed())
+ {
+ instance->start();
+ log_info("guardian: starting instance %s",
+ instance->options.instance_name);
+ }
}
else
current_node->state= CRASHED;
@@ -152,11 +155,14 @@
{
if ((current_node->restart_counter < restart_retry))
{
- instance->start();
- current_node->last_checked= current_time;
- current_node->restart_counter++;
- log_info("guardian: restarting instance %s",
- instance->options.instance_name);
+ if (instance->is_crashed())
+ {
+ instance->start();
+ current_node->last_checked= current_time;
+ current_node->restart_counter++;
+ log_info("guardian: restarting instance %s",
+ instance->options.instance_name);
+ }
}
else
current_node->state= CRASHED_AND_ABANDONED;
--- 1.66/mysql-test/r/ps.result 2006-05-03 10:03:57 -04:00
+++ 1.67/mysql-test/r/ps.result 2006-06-02 14:54:32 -04:00
@@ -1157,3 +1157,4 @@
Warnings:
Error 1146 Table 'test.t4' doesn't exist
deallocate prepare stmt;
+drop table t1, t2, t3;
--- 1.64/mysql-test/t/ps.test 2006-05-03 10:03:58 -04:00
+++ 1.65/mysql-test/t/ps.test 2006-06-02 14:54:36 -04:00
@@ -1145,5 +1145,5 @@
execute stmt;
execute stmt;
deallocate prepare stmt;
-
+drop table t1, t2, t3;
# End of 5.0 tests
--- 1.10.1.5/config/ac-macros/yassl.m4 2006-05-31 10:19:00 -04:00
+++ 1.19/BitKeeper/deleted/.del-yassl.m4~e55e55c1e863abaf 2006-06-02 14:54:26 -04:00
@@ -1,11 +1,3 @@
-AC_CONFIG_FILES(extra/yassl/Makefile dnl
-extra/yassl/taocrypt/Makefile dnl
-extra/yassl/taocrypt/src/Makefile dnl
-extra/yassl/src/Makefile dnl
-extra/yassl/testsuite/Makefile dnl
-extra/yassl/taocrypt/test/Makefile dnl
-extra/yassl/taocrypt/benchmark/Makefile)
-
AC_DEFUN([MYSQL_CHECK_YASSL], [
AC_MSG_CHECKING(for yaSSL)
AC_ARG_WITH([yassl], [ --with-yassl Include the yaSSL support],,)
@@ -17,7 +9,14 @@
AC_MSG_ERROR([Cannot configure MySQL to use yaSSL and OpenSSL simultaneously.])
fi
AC_MSG_RESULT([using bundled yaSSL])
- yassl_dir="extra/yassl"
+ AC_CONFIG_FILES(extra/yassl/Makefile dnl
+ extra/yassl/taocrypt/Makefile dnl
+ extra/yassl/taocrypt/benchmark/Makefile dnl
+ extra/yassl/taocrypt/src/Makefile dnl
+ extra/yassl/taocrypt/test/Makefile dnl
+ extra/yassl/src/Makefile dnl
+ extra/yassl/testsuite/Makefile)
+ yassl_dir="yassl"
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
--- 1.33/libmysqld/examples/Makefile.am 2005-11-28 14:07:09 -05:00
+++ 1.34/libmysqld/examples/Makefile.am 2006-06-02 14:54:29 -04:00
@@ -34,7 +34,7 @@
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
- $(openssl_includes) $(yassl_includes)
+ $(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
--- 1.27/libmysql_r/Makefile.am 2006-04-12 08:08:11 -04:00
+++ 1.28/libmysql_r/Makefile.am 2006-06-02 14:54:28 -04:00
@@ -25,7 +25,7 @@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
+ $(openssl_includes) @ZLIB_INCLUDES@
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared
--- 1.19.7.1/ndb/test/ndbapi/Makefile.am 2006-05-16 12:33:18 -04:00
+++ 1.28/storage/ndb/test/ndbapi/Makefile.am 2006-06-02 14:54:52 -04:00
@@ -35,7 +35,6 @@
testPartitioning \
testBitfield \
DbCreate DbAsyncGenerator \
-test_event_multi_table \
testSRBank \
test_event_merge
@@ -81,14 +80,13 @@
testBitfield_SOURCES = testBitfield.cpp
DbCreate_SOURCES = bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp bench/dbPopulate.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp
DbAsyncGenerator_SOURCES = bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp bench/dbGenerator.h bench/macros.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp
-test_event_multi_table_SOURCES = test_event_multi_table.cpp
testSRBank_SOURCES = testSRBank.cpp
test_event_merge_SOURCES = test_event_merge.cpp
-INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel
+INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/include/kernel
-include $(top_srcdir)/ndb/config/common.mk.am
-include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+include $(top_srcdir)/storage/ndb/config/common.mk.am
+include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am
##testDict_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
##testIndex_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
@@ -106,62 +104,62 @@
testScan.dsp
flexBench.dsp: Makefile \
- $(top_srcdir)/ndb/config/win-prg.am \
- $(top_srcdir)/ndb/config/win-name \
- $(top_srcdir)/ndb/config/win-includes \
- $(top_srcdir)/ndb/config/win-sources \
- $(top_srcdir)/ndb/config/win-libraries
- cat $(top_srcdir)/ndb/config/win-prg.am > $@
- @$(top_srcdir)/ndb/config/win-name $@ flexBench
- @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
- @$(top_srcdir)/ndb/config/win-sources $@ $(flexBench_SOURCES)
- @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+ $(top_srcdir)/storage/ndb/config/win-prg.am \
+ $(top_srcdir)/storage/ndb/config/win-name \
+ $(top_srcdir)/storage/ndb/config/win-includes \
+ $(top_srcdir)/storage/ndb/config/win-sources \
+ $(top_srcdir)/storage/ndb/config/win-libraries
+ cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+ @$(top_srcdir)/storage/ndb/config/win-name $@ flexBench
+ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+ @$(top_srcdir)/storage/ndb/config/win-sources $@ $(flexBench_SOURCES)
+ @$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
testBasic.dsp: Makefile \
- $(top_srcdir)/ndb/config/win-prg.am \
- $(top_srcdir)/ndb/config/win-name \
- $(top_srcdir)/ndb/config/win-includes \
- $(top_srcdir)/ndb/config/win-sources \
- $(top_srcdir)/ndb/config/win-libraries
- cat $(top_srcdir)/ndb/config/win-prg.am > $@
- @$(top_srcdir)/ndb/config/win-name $@ testBasic
- @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
- @$(top_srcdir)/ndb/config/win-sources $@ $(testBasic_SOURCES)
- @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+ $(top_srcdir)/storage/ndb/config/win-prg.am \
+ $(top_srcdir)/storage/ndb/config/win-name \
+ $(top_srcdir)/storage/ndb/config/win-includes \
+ $(top_srcdir)/storage/ndb/config/win-sources \
+ $(top_srcdir)/storage/ndb/config/win-libraries
+ cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+ @$(top_srcdir)/storage/ndb/config/win-name $@ testBasic
+ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+ @$(top_srcdir)/storage/ndb/config/win-sources $@ $(testBasic_SOURCES)
+ @$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
testOIBasic.dsp: Makefile \
- $(top_srcdir)/ndb/config/win-prg.am \
- $(top_srcdir)/ndb/config/win-name \
- $(top_srcdir)/ndb/config/win-includes \
- $(top_srcdir)/ndb/config/win-sources \
- $(top_srcdir)/ndb/config/win-libraries
- cat $(top_srcdir)/ndb/config/win-prg.am > $@
- @$(top_srcdir)/ndb/config/win-name $@ testOIBasic
- @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
- @$(top_srcdir)/ndb/config/win-sources $@ $(testOIBasic_SOURCES)
- @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+ $(top_srcdir)/storage/ndb/config/win-prg.am \
+ $(top_srcdir)/storage/ndb/config/win-name \
+ $(top_srcdir)/storage/ndb/config/win-includes \
+ $(top_srcdir)/storage/ndb/config/win-sources \
+ $(top_srcdir)/storage/ndb/config/win-libraries
+ cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+ @$(top_srcdir)/storage/ndb/config/win-name $@ testOIBasic
+ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+ @$(top_srcdir)/storage/ndb/config/win-sources $@ $(testOIBasic_SOURCES)
+ @$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
testBlobs.dsp: Makefile \
- $(top_srcdir)/ndb/config/win-prg.am \
- $(top_srcdir)/ndb/config/win-name \
- $(top_srcdir)/ndb/config/win-includes \
- $(top_srcdir)/ndb/config/win-sources \
- $(top_srcdir)/ndb/config/win-libraries
- cat $(top_srcdir)/ndb/config/win-prg.am > $@
- @$(top_srcdir)/ndb/config/win-name $@ testBlobs
- @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
- @$(top_srcdir)/ndb/config/win-sources $@ $(testBlobs_SOURCES)
- @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+ $(top_srcdir)/storage/ndb/config/win-prg.am \
+ $(top_srcdir)/storage/ndb/config/win-name \
+ $(top_srcdir)/storage/ndb/config/win-includes \
+ $(top_srcdir)/storage/ndb/config/win-sources \
+ $(top_srcdir)/storage/ndb/config/win-libraries
+ cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+ @$(top_srcdir)/storage/ndb/config/win-name $@ testBlobs
+ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+ @$(top_srcdir)/storage/ndb/config/win-sources $@ $(testBlobs_SOURCES)
+ @$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
testScan.dsp: Makefile \
- $(top_srcdir)/ndb/config/win-prg.am \
- $(top_srcdir)/ndb/config/win-name \
- $(top_srcdir)/ndb/config/win-includes \
- $(top_srcdir)/ndb/config/win-sources \
- $(top_srcdir)/ndb/config/win-libraries
- cat $(top_srcdir)/ndb/config/win-prg.am > $@
- @$(top_srcdir)/ndb/config/win-name $@ testScan
- @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
- @$(top_srcdir)/ndb/config/win-sources $@ $(testScan_SOURCES)
- @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+ $(top_srcdir)/storage/ndb/config/win-prg.am \
+ $(top_srcdir)/storage/ndb/config/win-name \
+ $(top_srcdir)/storage/ndb/config/win-includes \
+ $(top_srcdir)/storage/ndb/config/win-sources \
+ $(top_srcdir)/storage/ndb/config/win-libraries
+ cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+ @$(top_srcdir)/storage/ndb/config/win-name $@ testScan
+ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+ @$(top_srcdir)/storage/ndb/config/win-sources $@ $(testScan_SOURCES)
+ @$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
--- 1.14.9.2/ndb/tools/restore/consumer_restore.cpp 2006-05-17 06:30:57 -04:00
+++ 1.30/storage/ndb/tools/restore/consumer_restore.cpp 2006-06-02 14:54:53 -04:00
@@ -16,6 +16,7 @@
#include <NDBT_ReturnCodes.h>
#include "consumer_restore.hpp"
+#include <my_sys.h>
#include <NdbSleep.h>
extern my_bool opt_core;
@@ -25,6 +26,8 @@
extern FilteredNdbOut debug;
static void callback(int, NdbTransaction*, void*);
+static Uint32 get_part_id(const NdbDictionary::Table *table,
+ Uint32 hash_value);
extern const char * g_connect_string;
extern BaseString g_options;
@@ -34,7 +37,7 @@
{
release();
- if (!m_restore && !m_restore_meta)
+ if (!m_restore && !m_restore_meta && !m_restore_epoch)
return true;
m_cluster_connection = new Ndb_cluster_connection(g_connect_string);
@@ -158,13 +161,483 @@
return ret;
}
+
+static bool default_nodegroups(NdbDictionary::Table *table)
+{
+ Uint16 *node_groups = (Uint16*)table->getFragmentData();
+ Uint32 no_parts = table->getFragmentDataLen() >> 1;
+ Uint32 i;
+
+ if (node_groups[0] != 0)
+ return false;
+ for (i = 1; i < no_parts; i++)
+ {
+ if (node_groups[i] != UNDEF_NODEGROUP)
+ return false;
+ }
+ return true;
+}
+
+
+static Uint32 get_no_fragments(Uint64 max_rows, Uint32 no_nodes)
+{
+ Uint32 i = 0;
+ Uint32 acc_row_size = 27;
+ Uint32 acc_fragment_size = 512*1024*1024;
+ Uint32 no_parts= (max_rows*acc_row_size)/acc_fragment_size + 1;
+ Uint32 reported_parts = no_nodes;
+ while (reported_parts < no_parts && ++i < 4 &&
+ (reported_parts + no_parts) < MAX_NDB_PARTITIONS)
+ reported_parts+= no_nodes;
+ if (reported_parts < no_parts)
+ {
+ err << "Table will be restored but will not be able to handle the maximum";
+ err << " amount of rows as requested" << endl;
+ }
+ return reported_parts;
+}
+
+
+static void set_default_nodegroups(NdbDictionary::Table *table)
+{
+ Uint32 no_parts = table->getFragmentCount();
+ Uint16 node_group[MAX_NDB_PARTITIONS];
+ Uint32 i;
+
+ node_group[0] = 0;
+ for (i = 1; i < no_parts; i++)
+ {
+ node_group[i] = UNDEF_NODEGROUP;
+ }
+ table->setFragmentData((const void*)node_group, 2 * no_parts);
+}
+
+Uint32 BackupRestore::map_ng(Uint32 ng)
+{
+ NODE_GROUP_MAP *ng_map = m_nodegroup_map;
+
+ if (ng == UNDEF_NODEGROUP ||
+ ng_map[ng].map_array[0] == UNDEF_NODEGROUP)
+ {
+ return ng;
+ }
+ else
+ {
+ Uint32 new_ng;
+ Uint32 curr_inx = ng_map[ng].curr_index;
+ Uint32 new_curr_inx = curr_inx + 1;
+
+ assert(ng < MAX_NDB_PARTITIONS);
+ assert(curr_inx < MAX_MAPS_PER_NODE_GROUP);
+ assert(new_curr_inx < MAX_MAPS_PER_NODE_GROUP);
+
+ if (new_curr_inx >= MAX_MAPS_PER_NODE_GROUP)
+ new_curr_inx = 0;
+ else if (ng_map[ng].map_array[new_curr_inx] == UNDEF_NODEGROUP)
+ new_curr_inx = 0;
+ new_ng = ng_map[ng].map_array[curr_inx];
+ ng_map[ng].curr_index = new_curr_inx;
+ return new_ng;
+ }
+}
+
+
+bool BackupRestore::map_nodegroups(Uint16 *ng_array, Uint32 no_parts)
+{
+ Uint32 i;
+ bool mapped = FALSE;
+ DBUG_ENTER("map_nodegroups");
+
+ assert(no_parts < MAX_NDB_PARTITIONS);
+ for (i = 0; i < no_parts; i++)
+ {
+ Uint32 ng;
+ ng = map_ng((Uint32)ng_array[i]);
+ if (ng != ng_array[i])
+ mapped = TRUE;
+ ng_array[i] = ng;
+ }
+ DBUG_RETURN(mapped);
+}
+
+
+static void copy_byte(const char **data, char **new_data, uint *len)
+{
+ **new_data = **data;
+ (*data)++;
+ (*new_data)++;
+ (*len)++;
+}
+
+
+bool BackupRestore::search_replace(char *search_str, char **new_data,
+ const char **data, const char *end_data,
+ uint *new_data_len)
+{
+ uint search_str_len = strlen(search_str);
+ uint inx = 0;
+ bool in_delimiters = FALSE;
+ bool escape_char = FALSE;
+ char start_delimiter = 0;
+ DBUG_ENTER("search_replace");
+
+ do
+ {
+ char c = **data;
+ copy_byte(data, new_data, new_data_len);
+ if (escape_char)
+ {
+ escape_char = FALSE;
+ }
+ else if (in_delimiters)
+ {
+ if (c == start_delimiter)
+ in_delimiters = FALSE;
+ }
+ else if (c == '\'' || c == '\"')
+ {
+ in_delimiters = TRUE;
+ start_delimiter = c;
+ }
+ else if (c == '\\')
+ {
+ escape_char = TRUE;
+ }
+ else if (c == search_str[inx])
+ {
+ inx++;
+ if (inx == search_str_len)
+ {
+ bool found = FALSE;
+ uint number = 0;
+ while (*data != end_data)
+ {
+ if (isdigit(**data))
+ {
+ found = TRUE;
+ number = (10 * number) + (**data);
+ if (number > MAX_NDB_NODES)
+ break;
+ }
+ else if (found)
+ {
+ /*
+ After long and tedious preparations we have actually found
+ a node group identifier to convert. We'll use the mapping
+ table created for node groups and then insert the new number
+ instead of the old number.
+ */
+ uint temp = map_ng(number);
+ int no_digits = 0;
+ char digits[10];
+ while (temp != 0)
+ {
+ digits[no_digits] = temp % 10;
+ no_digits++;
+ temp/=10;
+ }
+ for (no_digits--; no_digits >= 0; no_digits--)
+ {
+ **new_data = digits[no_digits];
+ *new_data_len+=1;
+ }
+ DBUG_RETURN(FALSE);
+ }
+ else
+ break;
+ (*data)++;
+ }
+ DBUG_RETURN(TRUE);
+ }
+ }
+ else
+ inx = 0;
+ } while (*data < end_data);
+ DBUG_RETURN(FALSE);
+}
+
+bool BackupRestore::map_in_frm(char *new_data, const char *data,
+ uint data_len, uint *new_data_len)
+{
+ const char *end_data= data + data_len;
+ const char *end_part_data;
+ const char *part_data;
+ char *extra_ptr;
+ uint start_key_definition_len = uint2korr(data + 6);
+ uint key_definition_len = uint4korr(data + 47);
+ uint part_info_len;
+ DBUG_ENTER("map_in_frm");
+
+ if (data_len < 4096) goto error;
+ extra_ptr = (char*)data + start_key_definition_len + key_definition_len;
+ if ((int)data_len < ((extra_ptr - data) + 2)) goto error;
+ extra_ptr = extra_ptr + 2 + uint2korr(extra_ptr);
+ if ((int)data_len < ((extra_ptr - data) + 2)) goto error;
+ extra_ptr = extra_ptr + 2 + uint2korr(extra_ptr);
+ if ((int)data_len < ((extra_ptr - data) + 4)) goto error;
+ part_info_len = uint4korr(extra_ptr);
+ part_data = extra_ptr + 4;
+ if ((int)data_len < ((part_data + part_info_len) - data)) goto error;
+
+ do
+ {
+ copy_byte(&data, &new_data, new_data_len);
+ } while (data < part_data);
+ end_part_data = part_data + part_info_len;
+ do
+ {
+ if (search_replace((char*)" NODEGROUP = ", &new_data, &data,
+ end_part_data, new_data_len))
+ goto error;
+ } while (data != end_part_data);
+ do
+ {
+ copy_byte(&data, &new_data, new_data_len);
+ } while (data < end_data);
+ DBUG_RETURN(FALSE);
+error:
+ DBUG_RETURN(TRUE);
+}
+
+
+bool BackupRestore::translate_frm(NdbDictionary::Table *table)
+{
+ const void *pack_data, *data, *new_pack_data;
+ char *new_data;
+ uint data_len, pack_len, new_data_len, new_pack_len;
+ uint no_parts, extra_growth;
+ DBUG_ENTER("translate_frm");
+
+ pack_data = table->getFrmData();
+ no_parts = table->getFragmentCount();
+ /*
+ Add max 4 characters per partition to handle worst case
+ of mapping from single digit to 5-digit number.
+ Fairly future-proof, ok up to 99999 node groups.
+ */
+ extra_growth = no_parts * 4;
+ if (unpackfrm(&data, &data_len, pack_data))
+ {
+ DBUG_RETURN(TRUE);
+ }
+ if ((new_data = my_malloc(data_len + extra_growth, MYF(0))))
+ {
+ DBUG_RETURN(TRUE);
+ }
+ if (map_in_frm(new_data, (const char*)data, data_len, &new_data_len))
+ {
+ my_free(new_data, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+ if (packfrm((const void*)new_data, new_data_len,
+ &new_pack_data, &new_pack_len))
+ {
+ my_free(new_data, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+ table->setFrm(new_pack_data, new_pack_len);
+ DBUG_RETURN(FALSE);
+}
+
+#include <signaldata/DictTabInfo.hpp>
+
+bool
+BackupRestore::object(Uint32 type, const void * ptr)
+{
+ if (!m_restore_meta)
+ return true;
+
+ NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
+ switch(type){
+ case DictTabInfo::Tablespace:
+ {
+ NdbDictionary::Tablespace old(*(NdbDictionary::Tablespace*)ptr);
+
+ Uint32 id = old.getObjectId();
+
+ if (!m_no_restore_disk)
+ {
+ NdbDictionary::LogfileGroup * lg = m_logfilegroups[old.getDefaultLogfileGroupId()];
+ old.setDefaultLogfileGroup(* lg);
+ info << "Creating tablespace: " << old.getName() << "..." << flush;
+ int ret = dict->createTablespace(old);
+ if (ret)
+ {
+ NdbError errobj= dict->getNdbError();
+ info << "FAILED " << errobj << endl;
+ return false;
+ }
+ info << "done" << endl;
+ }
+
+ NdbDictionary::Tablespace curr = dict->getTablespace(old.getName());
+ NdbError errobj = dict->getNdbError();
+ if(errobj.classification == ndberror_cl_none)
+ {
+ NdbDictionary::Tablespace* currptr = new NdbDictionary::Tablespace(curr);
+ NdbDictionary::Tablespace * null = 0;
+ m_tablespaces.set(currptr, id, null);
+ debug << "Retreived tablespace: " << currptr->getName()
+ << " oldid: " << id << " newid: " << currptr->getObjectId()
+ << " " << (void*)currptr << endl;
+ return true;
+ }
+
+ err << "Failed to retrieve tablespace \"" << old.getName() << "\": "
+ << errobj << endl;
+
+ return false;
+ break;
+ }
+ case DictTabInfo::LogfileGroup:
+ {
+ NdbDictionary::LogfileGroup old(*(NdbDictionary::LogfileGroup*)ptr);
+
+ Uint32 id = old.getObjectId();
+
+ if (!m_no_restore_disk)
+ {
+ info << "Creating logfile group: " << old.getName() << "..." << flush;
+ int ret = dict->createLogfileGroup(old);
+ if (ret)
+ {
+ NdbError errobj= dict->getNdbError();
+ info << "FAILED" << errobj << endl;
+ return false;
+ }
+ info << "done" << endl;
+ }
+
+ NdbDictionary::LogfileGroup curr = dict->getLogfileGroup(old.getName());
+ NdbError errobj = dict->getNdbError();
+ if(errobj.classification == ndberror_cl_none)
+ {
+ NdbDictionary::LogfileGroup* currptr =
+ new NdbDictionary::LogfileGroup(curr);
+ NdbDictionary::LogfileGroup * null = 0;
+ m_logfilegroups.set(currptr, id, null);
+ debug << "Retreived logfile group: " << currptr->getName()
+ << " oldid: " << id << " newid: " << currptr->getObjectId()
+ << " " << (void*)currptr << endl;
+ return true;
+ }
+
+ err << "Failed to retrieve logfile group \"" << old.getName() << "\": "
+ << errobj << endl;
+
+ return false;
+ break;
+ }
+ case DictTabInfo::Datafile:
+ {
+ if (!m_no_restore_disk)
+ {
+ NdbDictionary::Datafile old(*(NdbDictionary::Datafile*)ptr);
+ NdbDictionary::Tablespace * ts = m_tablespaces[old.getTablespaceId()];
+ debug << "Connecting datafile " << old.getPath()
+ << " to tablespace: oldid: " << old.getTablespaceId()
+ << " newid: " << ts->getObjectId() << endl;
+ old.setTablespace(* ts);
+ info << "Creating datafile \"" << old.getPath() << "\"..." << flush;
+ if (dict->createDatafile(old))
+ {
+ info << "FAILED " << dict->getNdbError() << endl;
+ return false;
+ }
+ info << "done" << endl;
+ }
+ return true;
+ break;
+ }
+ case DictTabInfo::Undofile:
+ {
+ if (!m_no_restore_disk)
+ {
+ NdbDictionary::Undofile old(*(NdbDictionary::Undofile*)ptr);
+ NdbDictionary::LogfileGroup * lg =
+ m_logfilegroups[old.getLogfileGroupId()];
+ debug << "Connecting undofile " << old.getPath()
+ << " to logfile group: oldid: " << old.getLogfileGroupId()
+ << " newid: " << lg->getObjectId()
+ << " " << (void*)lg << endl;
+ old.setLogfileGroup(* lg);
+ info << "Creating undofile \"" << old.getPath() << "\"..." << flush;
+ if (dict->createUndofile(old))
+ {
+ info << "FAILED " << dict->getNdbError() << endl;
+ return false;
+ }
+ info << "done" << endl;
+ }
+ return true;
+ break;
+ }
+ }
+ return true;
+}
+
+bool
+BackupRestore::update_apply_status(const RestoreMetaData &metaData)
+{
+ if (!m_restore_epoch)
+ return true;
+
+ bool result= false;
+
+ m_ndb->setDatabaseName(NDB_REP_DB);
+ m_ndb->setSchemaName("def");
+
+ NdbDictionary::Dictionary *dict= m_ndb->getDictionary();
+ const NdbDictionary::Table *ndbtab= dict->getTable(Ndb_apply_table);
+ if (!ndbtab)
+ {
+ err << Ndb_apply_table << ": "
+ << dict->getNdbError() << endl;
+ return false;
+ }
+ Uint32 server_id= 0;
+ Uint64 epoch= metaData.getStopGCP();
+ NdbTransaction * trans= m_ndb->startTransaction();
+ if (!trans)
+ {
+ err << Ndb_apply_table << ": "
+ << m_ndb->getNdbError() << endl;
+ return false;
+ }
+ NdbOperation * op= trans->getNdbOperation(ndbtab);
+ if (!op)
+ {
+ err << Ndb_apply_table << ": "
+ << trans->getNdbError() << endl;
+ goto err;
+ }
+ if (op->writeTuple() ||
+ op->equal(0u, (const char *)&server_id, sizeof(server_id)) ||
+ op->setValue(1u, (const char *)&epoch, sizeof(epoch)))
+ {
+ err << Ndb_apply_table << ": "
+ << op->getNdbError() << endl;
+ goto err;
+ }
+ if (trans->execute(NdbTransaction::Commit))
+ {
+ err << Ndb_apply_table << ": "
+ << trans->getNdbError() << endl;
+ goto err;
+ }
+ result= true;
+err:
+ m_ndb->closeTransaction(trans);
+ return result;
+}
+
bool
BackupRestore::table(const TableS & table){
if (!m_restore && !m_restore_meta)
return true;
const char * name = table.getTableName();
-
+
/**
* Ignore blob tables
*/
@@ -188,15 +661,71 @@
m_ndb->setSchemaName(split[1].c_str());
NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
- if(m_restore_meta){
+ if(m_restore_meta)
+ {
NdbDictionary::Table copy(*table.m_dictTable);
copy.setName(split[2].c_str());
+ Uint32 id;
+ if (copy.getTablespace(&id))
+ {
+ debug << "Connecting " << name << " to tablespace oldid: " << id << flush;
+ NdbDictionary::Tablespace* ts = m_tablespaces[id];
+ debug << " newid: " << ts->getObjectId() << endl;
+ copy.setTablespace(* ts);
+ }
+
+ if (copy.getDefaultNoPartitionsFlag())
+ {
+ /*
+ Table was defined with default number of partitions. We can restore
+ it with whatever is the default in this cluster.
+ We use the max_rows parameter in calculating the default number.
+ */
+ Uint32 no_nodes = m_cluster_connection->no_db_nodes();
+ copy.setFragmentCount(get_no_fragments(copy.getMaxRows(),
+ no_nodes));
+ set_default_nodegroups(©);
+ }
+ else
+ {
+ /*
+ Table was defined with specific number of partitions. It should be
+ restored with the same number of partitions. It will either be
+ restored in the same node groups as when backup was taken or by
+ using a node group map supplied to the ndb_restore program.
+ */
+ Uint16 *ng_array = (Uint16*)copy.getFragmentData();
+ Uint16 no_parts = copy.getFragmentCount();
+ if (map_nodegroups(ng_array, no_parts))
+ {
+ if (translate_frm(©))
+ {
+ err << "Create table " << table.getTableName() << " failed: ";
+ err << "Translate frm error" << endl;
+ return false;
+ }
+ }
+ copy.setFragmentData((const void *)ng_array, no_parts << 1);
+ }
if (dict->createTable(copy) == -1)
{
err << "Create table " << table.getTableName() << " failed: "
- << dict->getNdbError() << endl;
+ << dict->getNdbError() << endl;
+ if (dict->getNdbError().code == 771)
+ {
+ /*
+ The user on the cluster where the backup was created had specified
+ specific node groups for partitions. Some of these node groups
+ didn't exist on this cluster. We will warn the user of this and
+ inform him of his option.
+ */
+ err << "The node groups defined in the table didn't exist in this";
+ err << " cluster." << endl << "There is an option to use the";
+ err << " the parameter ndb-nodegroup-map to define a mapping from";
+ err << endl << "the old nodegroups to new nodegroups" << endl;
+ }
return false;
}
info << "Successfully restored table " << table.getTableName()<< endl ;
@@ -207,7 +736,50 @@
err << "Unable to find table: " << split[2].c_str() << endl;
return false;
}
- if(m_restore_meta){
+ if(m_restore_meta)
+ {
+ if (tab->getFrmData())
+ {
+ // a MySQL Server table is restored, thus an event should be created
+ BaseString event_name("REPL$");
+ event_name.append(split[0].c_str());
+ event_name.append("/");
+ event_name.append(split[2].c_str());
+
+ NdbDictionary::Event my_event(event_name.c_str());
+ my_event.setTable(*tab);
+ my_event.addTableEvent(NdbDictionary::Event::TE_ALL);
+
+ // add all columns to the event
+ bool has_blobs = false;
+ for(int a= 0; a < tab->getNoOfColumns(); a++)
+ {
+ my_event.addEventColumn(a);
+ NdbDictionary::Column::Type t = tab->getColumn(a)->getType();
+ if (t == NdbDictionary::Column::Blob ||
+ t == NdbDictionary::Column::Text)
+ has_blobs = true;
+ }
+ if (has_blobs)
+ my_event.mergeEvents(true);
+
+ while ( dict->createEvent(my_event) ) // Add event to database
+ {
+ if (dict->getNdbError().classification == NdbError::SchemaObjectExists)
+ {
+ info << "Event for table " << table.getTableName()
+ << " already exists, removing.\n";
+ if (!dict->dropEvent(my_event.getName()))
+ continue;
+ }
+ err << "Create table event for " << table.getTableName() << " failed: "
+ << dict->getNdbError() << endl;
+ dict->dropTable(split[2].c_str());
+ return false;
+ }
+ info << "Successfully restored table event " << event_name << endl ;
+ }
+
m_ndb->setAutoIncrementValue(tab, ~(Uint64)0, false);
}
const NdbDictionary::Table* null = 0;
@@ -275,7 +847,7 @@
return true;
}
-void BackupRestore::tuple(const TupleS & tup)
+void BackupRestore::tuple(const TupleS & tup, Uint32 fragmentId)
{
if (!m_restore)
return;
@@ -295,6 +867,7 @@
m_free_callback = cb->next;
cb->retries = 0;
+ cb->fragId = fragmentId;
cb->tup = tup; // must do copy!
tuple_a(cb);
@@ -302,6 +875,7 @@
void BackupRestore::tuple_a(restore_callback_t *cb)
{
+ Uint32 partition_id = cb->fragId;
while (cb->retries < 10)
{
/**
@@ -315,6 +889,7 @@
m_ndb->sendPollNdb(3000, 1);
continue;
}
+ err << "Cannot start transaction" << endl;
exitHandler();
} // if
@@ -327,6 +902,7 @@
{
if (errorHandler(cb))
continue;
+ err << "Cannot get operation: " << cb->connection->getNdbError() << endl;
exitHandler();
} // if
@@ -334,9 +910,37 @@
{
if (errorHandler(cb))
continue;
+ err << "Error defining op: " << cb->connection->getNdbError() << endl;
exitHandler();
} // if
-
+
+ if (table->getFragmentType() == NdbDictionary::Object::UserDefined)
+ {
+ if (table->getDefaultNoPartitionsFlag())
+ {
+ /*
+ This can only happen for HASH partitioning with
+ user defined hash function where user hasn't
+ specified the number of partitions and we
+ have to calculate it. We use the hash value
+ stored in the record to calculate the partition
+ to use.
+ */
+ int i = tup.getNoOfAttributes() - 1;
+ const AttributeData *attr_data = tup.getData(i);
+ Uint32 hash_value = *attr_data->u_int32_value;
+ op->setPartitionId(get_part_id(table, hash_value));
+ }
+ else
+ {
+ /*
+ Either RANGE or LIST (with or without subparts)
+ OR HASH partitioning with user defined hash
+ function but with fixed set of partitions.
+ */
+ op->setPartitionId(partition_id);
+ }
+ }
int ret = 0;
for (int j = 0; j < 2; j++)
{
@@ -347,11 +951,11 @@
int size = attr_desc->size;
int arraySize = attr_desc->arraySize;
char * dataPtr = attr_data->string_value;
- Uint32 length = (size * arraySize) / 8;
-
+ Uint32 length = attr_data->size;
+
if (j == 0 && tup.getTable()->have_auto_inc(i))
tup.getTable()->update_max_auto_val(dataPtr,size);
-
+
if (attr_desc->m_column->getPrimaryKey())
{
if (j == 1) continue;
@@ -379,6 +983,7 @@
{
if (errorHandler(cb))
continue;
+ err << "Error defining op: " << cb->connection->getNdbError() << endl;
exitHandler();
}
@@ -451,30 +1056,28 @@
switch(error.status)
{
case NdbError::Success:
+ err << "Success error: " << error << endl;
return false;
// ERROR!
- break;
case NdbError::TemporaryError:
err << "Temporary error: " << error << endl;
NdbSleep_MilliSleep(sleepTime);
return true;
// RETRY
- break;
case NdbError::UnknownResult:
- err << error << endl;
+ err << "Unknown: " << error << endl;
return false;
// ERROR!
- break;
default:
case NdbError::PermanentError:
//ERROR
- err << error << endl;
+ err << "Permanent: " << error << endl;
return false;
- break;
}
+ err << "No error status" << endl;
return false;
}
@@ -508,6 +1111,35 @@
tuple_free();
}
+static bool use_part_id(const NdbDictionary::Table *table)
+{
+ if (table->getDefaultNoPartitionsFlag() &&
+ (table->getFragmentType() == NdbDictionary::Object::UserDefined))
+ return false;
+ else
+ return true;
+}
+
+static Uint32 get_part_id(const NdbDictionary::Table *table,
+ Uint32 hash_value)
+{
+ Uint32 no_frags = table->getFragmentCount();
+
+ if (table->getLinearFlag())
+ {
+ Uint32 part_id;
+ Uint32 mask = 1;
+ while (no_frags > mask) mask <<= 1;
+ mask--;
+ part_id = hash_value & mask;
+ if (part_id >= no_frags)
+ part_id = hash_value & (mask >> 1);
+ return part_id;
+ }
+ else
+ return (hash_value % no_frags);
+}
+
void
BackupRestore::logEntry(const LogEntry & tup)
{
@@ -553,7 +1185,19 @@
err << "Error defining op: " << trans->getNdbError() << endl;
exitHandler();
} // if
-
+
+ if (table->getFragmentType() == NdbDictionary::Object::UserDefined)
+ {
+ if (table->getDefaultNoPartitionsFlag())
+ {
+ const AttributeS * attr = tup[tup.size()-1];
+ Uint32 hash_value = *(Uint32*)attr->Data.string_value;
+ op->setPartitionId(get_part_id(table, hash_value));
+ }
+ else
+ op->setPartitionId(tup.m_frag_id);
+ }
+
Bitmask<4096> keys;
for (Uint32 i= 0; i < tup.size(); i++)
{
@@ -719,3 +1363,5 @@
template class Vector<NdbDictionary::Table*>;
template class Vector<const NdbDictionary::Table*>;
+template class Vector<NdbDictionary::Tablespace*>;
+template class Vector<NdbDictionary::LogfileGroup*>;
--- 1.27/mysql-test/r/rpl_temporary.result 2006-05-17 04:15:27 -04:00
+++ 1.28/mysql-test/r/rpl_temporary.result 2006-06-02 14:54:32 -04:00
@@ -88,15 +88,24 @@
1
drop temporary table t4;
drop table t5;
-set @session.pseudo_thread_id=100;
+set @@session.pseudo_thread_id=100;
create temporary table t101 (id int);
create temporary table t102 (id int);
-set @session.pseudo_thread_id=200;
+set @@session.pseudo_thread_id=200;
create temporary table t201 (id int);
-create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int);
+create temporary table `t``201` (id int);
+create temporary table `#sql_not_user_table202` (id int);
+set @@session.pseudo_thread_id=300;
+create temporary table t301 (id int);
+create temporary table t302 (id int);
+create temporary table `#sql_not_user_table303` (id int);
create table t1(f int);
insert into t1 values (1);
select * from t1 /* must be 1 */;
f
+1
+drop table t1;
+select * from t1;
+a
1
drop table t1;
| Thread |
|---|
| • bk commit into 5.1 tree (iggy:1.2171) | Ignacio Galarza | 8 Jun |