summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2006-05-16 10:37:40 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2006-05-16 10:37:40 +0200
commitbae04d9b6f46ac40dbad747d3e1770b111f2a4bf (patch)
tree83f5d73ce1228e4e6dc0f0f5c079508f5a2757e2
parent853343c2c4278d6b3e1000dd3318d0d96307c0ec (diff)
parente235928810d403287dd08ca76460474e7c8d91e4 (diff)
downloadmariadb-git-bae04d9b6f46ac40dbad747d3e1770b111f2a4bf.tar.gz
Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb client/mysql.cc: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/rpl_temporary.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/t/rpl_temporary.test: Auto merged sql/item_strfunc.cc: Auto merged sql/sql_show.cc: Auto merged storage/ndb/src/ndbapi/ClusterMgr.cpp: Auto merged storage/ndb/src/ndbapi/ClusterMgr.hpp: Auto merged storage/ndb/src/ndbapi/DictCache.hpp: Auto merged storage/ndb/src/ndbapi/TransporterFacade.hpp: Auto merged storage/ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp: Auto merged mysql-test/r/information_schema.result: manual merge mysql-test/t/information_schema.test: manual merge sql/ha_ndbcluster.cc: manual merge storage/ndb/include/ndbapi/ndb_cluster_connection.hpp: manual merge storage/ndb/src/ndbapi/DictCache.cpp: manual merge
-rw-r--r--client/mysql.cc10
-rw-r--r--include/sslopt-longopts.h2
-rw-r--r--mysql-test/r/func_str.result7
-rw-r--r--mysql-test/r/information_schema.result17
-rw-r--r--mysql-test/r/join.result4
-rw-r--r--mysql-test/r/ndb_autodiscover3.result45
-rw-r--r--mysql-test/r/outfile.resultbin1130 -> 1159 bytes
-rw-r--r--mysql-test/r/rpl_temporary.result2
-rw-r--r--mysql-test/r/select.result19
-rw-r--r--mysql-test/t/func_str.test9
-rw-r--r--mysql-test/t/information_schema.test20
-rw-r--r--mysql-test/t/ndb_autodiscover3.test65
-rw-r--r--mysql-test/t/outfile.test1
-rw-r--r--mysql-test/t/rpl_temporary.test14
-rw-r--r--mysql-test/t/select.test21
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/sql_show.cc25
-rw-r--r--storage/ndb/include/ndbapi/ndb_cluster_connection.hpp1
-rw-r--r--storage/ndb/src/ndbapi/ClusterMgr.cpp5
-rw-r--r--storage/ndb/src/ndbapi/ClusterMgr.hpp1
-rw-r--r--storage/ndb/src/ndbapi/DictCache.cpp35
-rw-r--r--storage/ndb/src/ndbapi/DictCache.hpp3
-rw-r--r--storage/ndb/src/ndbapi/TransporterFacade.hpp6
-rw-r--r--storage/ndb/src/ndbapi/ndb_cluster_connection.cpp6
-rw-r--r--storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp1
25 files changed, 298 insertions, 23 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 739368dec18..8b121579cb0 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -448,6 +448,14 @@ int main(int argc,char *argv[])
MYF(MY_WME));
if (histfile)
sprintf(histfile,"%s/.mysql_history",getenv("HOME"));
+ char link_name[FN_REFLEN];
+ if (my_readlink(link_name, histfile, 0) == 0 &&
+ strncmp(link_name, "/dev/null", 10) == 0)
+ {
+ /* The .mysql_history file is a symlink to /dev/null, don't use it */
+ my_free(histfile, MYF(MY_ALLOW_ZERO_PTR));
+ histfile= 0;
+ }
}
if (histfile)
{
@@ -484,7 +492,7 @@ sig_handler mysql_end(int sig)
{
mysql_close(&mysql);
#ifdef HAVE_READLINE
- if (!status.batch && !quick && !opt_html && !opt_xml)
+ if (!status.batch && !quick && !opt_html && !opt_xml && histfile)
{
/* write-history */
if (verbose)
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index f444a7eb7ce..b0769af10fe 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -39,7 +39,7 @@
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
- "Verify servers \"Common Name\" in it's cert against hostname used when connecting. This option is disabled by default.",
+ "Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
(gptr*) &opt_ssl_verify_server_cert, (gptr*) &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 0b706b24488..960a5178fd8 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1017,6 +1017,13 @@ t
1000000
1
drop table t1;
+select load_file("lkjlkj");
+load_file("lkjlkj")
+NULL
+select ifnull(load_file("lkjlkj"),"it's null");
+ifnull(load_file("lkjlkj"),"it's null")
+it's null
+End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
select format(d, 2) from t1;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 7524827310a..710c44fa4b6 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1136,6 +1136,23 @@ table_schema='information_schema' and
group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
+create table t1(f1 char(1) not null, f2 char(9) not null)
+default character set utf8;
+select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
+information_schema.columns where table_schema='test' and table_name = 't1';
+CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH
+1 3
+9 27
+drop table t1;
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
+'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+routine_name
+
+delete from proc where name='';
+use test;
varchar(20) information_schema.COLUMNS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS 6
select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index ecf76d477a0..86288caf398 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
+user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/r/ndb_autodiscover3.result b/mysql-test/r/ndb_autodiscover3.result
new file mode 100644
index 00000000000..8bc1b968436
--- /dev/null
+++ b/mysql-test/r/ndb_autodiscover3.result
@@ -0,0 +1,45 @@
+drop table if exists t1, t2;
+create table t1 (a int key) engine=ndbcluster;
+begin;
+insert into t1 values (1);
+insert into t1 values (2);
+ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+drop table t1;
+create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
+insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
+select * from t2 order by a limit 3;
+a b
+1 1
+2 1
+3 1
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+select * from t2 order by a limit 3;
+ERROR HY000: Can't lock file (errno: 241)
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+show tables;
+Tables_in_test
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+drop table t2;
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index ee8c3249c9d..040dff576f8 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 929dc33c447..7f6fa17e11c 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -94,8 +94,6 @@ create temporary table t102 (id int);
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);
-set @con1_id=connection_id();
-kill @con1_id;
create table t1(f int);
insert into t1 values (1);
select * from t1 /* must be 1 */;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 19e1b67fd74..f45e16f66c1 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3427,3 +3427,22 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 3 Using where
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
drop table t1, t2;
+CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
+INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
+(3,1), (5,1), (8,9), (2,2), (0,9);
+CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
+INSERT INTO t2 VALUES
+(1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
+(5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
+(0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 85cedee0f4a..dee06231deb 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -666,7 +666,14 @@ select rpad(i, 7, ' ') as t from t1;
--disable_metadata
drop table t1;
-# End of 4.1 tests
+#
+# Bug #10418: LOAD_FILE does not behave like in manual if file does not exist
+#
+
+select load_file("lkjlkj");
+select ifnull(load_file("lkjlkj"),"it's null");
+
+--echo End of 4.1 tests
#
# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index edb376bc73b..274b4eae71f 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -808,6 +808,26 @@ table_schema='information_schema' and
group by column_type order by num;
#
+# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
+#
+create table t1(f1 char(1) not null, f2 char(9) not null)
+default character set utf8;
+select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
+information_schema.columns where table_schema='test' and table_name = 't1';
+drop table t1;
+
+#
+# Bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
+#
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
+'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+delete from proc where name='';
+use test;
+
+#
# End of 5.0 tests.
#
# Show engines
diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test
new file mode 100644
index 00000000000..73b4bf8b94f
--- /dev/null
+++ b/mysql-test/t/ndb_autodiscover3.test
@@ -0,0 +1,65 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/not_embedded.inc
+
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+#
+# Transaction ongoing while cluster is restarted
+#
+--connection server1
+create table t1 (a int key) engine=ndbcluster;
+
+begin;
+insert into t1 values (1);
+
+--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--error 1297
+insert into t1 values (2);
+--error 1296
+commit;
+
+drop table t1;
+
+#
+# Stale cache after restart -i
+#
+--connection server1
+create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
+insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
+select * from t2 order by a limit 3;
+
+--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--connection server2
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+
+# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
+--connection server1
+--error 1015
+select * from t2 order by a limit 3;
+select * from t2 order by a limit 3;
+
+--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--connection server1
+show tables;
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+
+# server 2 should have a stale cache, but with right frm, transaction need not be retried
+--connection server2
+select * from t2 order by a limit 3;
+
+drop table t2;
+# End of 4.1 tests
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index d404a6fff9f..c48e6c9730d 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -40,7 +40,6 @@ eval select * into dumpfile "../tmp/outfile-test.2" from t1;
--error 1086
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log;
---error 13,2
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.1
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.2
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index 612ab54dff1..93e22e74597 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -171,8 +171,18 @@ create temporary table t102 (id int);
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);
-set @con1_id=connection_id();
-kill @con1_id;
+
+#
+# Don't kill our own connection to the server as
+# the result code differs depending on platform.
+#
+# Select the id to kill into a variable of mysqltest
+let $con1_id= `select connection_id()`;
+# Switch connection to avoid killing our own connection
+connection master;
+--disable_query_log
+eval kill $con1_id;
+--enable_query_log
#now do something to show that slave is ok after DROP temp tables
connection master;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 033350d138a..4b6ae921b9b 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2899,3 +2899,24 @@ select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
drop table t1, t2;
+
+#
+#Bug #18940: selection of optimal execution plan caused by equality
+# propagation (the bug was fixed by the patch for bug #17379)
+
+CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
+INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
+ (3,1), (5,1), (8,9), (2,2), (0,9);
+
+CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
+INSERT INTO t2 VALUES
+ (1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
+ (5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
+ (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);
+
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
+
+DROP TABLE t1, t2;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 1e483f32b02..eb1fbf4855d 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2579,7 +2579,7 @@ String *Item_load_file::val_str(String *str)
(void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
- if (!my_stat(path, &stat_info, MYF(MY_WME)))
+ if (!my_stat(path, &stat_info, MYF(0)))
goto err;
if (!(stat_info.st_mode & S_IROTH))
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 5fad0c7e09b..28bedf62ea5 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2932,7 +2932,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
field->real_type() == MYSQL_TYPE_STRING) // For binary type
{
uint32 octet_max_length= field->max_length();
- if (octet_max_length != (uint32) 4294967295U)
+ if (is_blob && octet_max_length != (uint32) 4294967295U)
octet_max_length /= field->charset()->mbmaxlen;
longlong char_max_len= is_blob ?
(longlong) octet_max_length / field->charset()->mbminlen :
@@ -3169,17 +3169,18 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
const char *wild, bool full_access, const char *sp_user)
{
String tmp_string;
+ String sp_db, sp_name, definer;
TIME time;
LEX *lex= thd->lex;
CHARSET_INFO *cs= system_charset_info;
- const char *sp_db, *sp_name, *definer;
- sp_db= get_field(thd->mem_root, proc_table->field[0]);
- sp_name= get_field(thd->mem_root, proc_table->field[1]);
- definer= get_field(thd->mem_root, proc_table->field[11]);
+ get_field(thd->mem_root, proc_table->field[0], &sp_db);
+ get_field(thd->mem_root, proc_table->field[1], &sp_name);
+ get_field(thd->mem_root, proc_table->field[11], &definer);
if (!full_access)
- full_access= !strcmp(sp_user, definer);
- if (!full_access && check_some_routine_access(thd, sp_db, sp_name,
- proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE))
+ full_access= !strcmp(sp_user, definer.ptr());
+ if (!full_access && check_some_routine_access(thd, sp_db.ptr(), sp_name.ptr(),
+ proc_table->field[2]->val_int() ==
+ TYPE_ENUM_PROCEDURE))
return 0;
if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
@@ -3189,13 +3190,13 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
lex->orig_sql_command == SQLCOM_END)
{
restore_record(table, s->default_values);
- if (!wild || !wild[0] || !wild_compare(sp_name, wild, 0))
+ if (!wild || !wild[0] || !wild_compare(sp_name.ptr(), wild, 0))
{
int enum_idx= proc_table->field[5]->val_int();
- table->field[3]->store(sp_name, strlen(sp_name), cs);
+ table->field[3]->store(sp_name.ptr(), sp_name.length(), cs);
get_field(thd->mem_root, proc_table->field[3], &tmp_string);
table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
- table->field[2]->store(sp_db, strlen(sp_db), cs);
+ table->field[2]->store(sp_db.ptr(), sp_db.length(), cs);
get_field(thd->mem_root, proc_table->field[2], &tmp_string);
table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs);
if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION)
@@ -3227,7 +3228,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
table->field[17]->store(tmp_string.ptr(), tmp_string.length(), cs);
get_field(thd->mem_root, proc_table->field[15], &tmp_string);
table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs);
- table->field[19]->store(definer, strlen(definer), cs);
+ table->field[19]->store(definer.ptr(), definer.length(), cs);
return schema_table_store_record(thd, table);
}
}
diff --git a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
index 01c700d14b2..a803d010e61 100644
--- a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
+++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
@@ -110,6 +110,7 @@ public:
unsigned no_db_nodes();
unsigned node_id();
+ unsigned get_connect_count() const;
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
unsigned int get_next_node(Ndb_cluster_connection_node_iter &iter);
diff --git a/storage/ndb/src/ndbapi/ClusterMgr.cpp b/storage/ndb/src/ndbapi/ClusterMgr.cpp
index 2ff403d53b3..4d29de4e680 100644
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp
@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
noOfAliveNodes= 0;
noOfConnectedNodes= 0;
theClusterMgrThread= 0;
+ m_connect_count = 0;
DBUG_VOID_RETURN;
}
@@ -445,6 +446,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
theNode.nfCompleteRep = false;
if(noOfAliveNodes == 0)
{
+ theFacade.m_globalDictCache.lock();
+ theFacade.m_globalDictCache.invalidate_all();
+ theFacade.m_globalDictCache.unlock();
+ m_connect_count ++;
NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){
diff --git a/storage/ndb/src/ndbapi/ClusterMgr.hpp b/storage/ndb/src/ndbapi/ClusterMgr.hpp
index 31682885f90..4bc6a92ad7c 100644
--- a/storage/ndb/src/ndbapi/ClusterMgr.hpp
+++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp
@@ -80,6 +80,7 @@ public:
bool isClusterAlive() const;
void hb_received(NodeId);
+ Uint32 m_connect_count;
private:
Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes;
diff --git a/storage/ndb/src/ndbapi/DictCache.cpp b/storage/ndb/src/ndbapi/DictCache.cpp
index 47e48974449..0933578eed3 100644
--- a/storage/ndb/src/ndbapi/DictCache.cpp
+++ b/storage/ndb/src/ndbapi/DictCache.cpp
@@ -280,6 +280,41 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
DBUG_RETURN(tab);
}
+unsigned
+GlobalDictCache::get_size()
+{
+ NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+ int sz = 0;
+ while(curr != 0){
+ sz += curr->theData->size();
+ curr = m_tableHash.getNext(curr);
+ }
+ return sz;
+}
+
+void
+GlobalDictCache::invalidate_all()
+{
+ DBUG_ENTER("GlobalDictCache::invalidate_all");
+ NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+ while(curr != 0){
+ Vector<TableVersion> * vers = curr->theData;
+ if (vers->size())
+ {
+ TableVersion * ver = & vers->back();
+ ver->m_impl->m_status = NdbDictionary::Object::Invalid;
+ ver->m_status = DROPPED;
+ if (ver->m_refCount == 0)
+ {
+ delete ver->m_impl;
+ vers->erase(vers->size() - 1);
+ }
+ }
+ curr = m_tableHash.getNext(curr);
+ }
+ DBUG_VOID_RETURN;
+}
+
void
GlobalDictCache::release(NdbTableImpl * tab, int invalidate)
{
diff --git a/storage/ndb/src/ndbapi/DictCache.hpp b/storage/ndb/src/ndbapi/DictCache.hpp
index f134e6b348e..77344586669 100644
--- a/storage/ndb/src/ndbapi/DictCache.hpp
+++ b/storage/ndb/src/ndbapi/DictCache.hpp
@@ -71,6 +71,9 @@ public:
void alter_table_rep(const char * name,
Uint32 tableId, Uint32 tableVersion, bool altered);
+
+ unsigned get_size();
+ void invalidate_all();
public:
enum Status {
OK = 0,
diff --git a/storage/ndb/src/ndbapi/TransporterFacade.hpp b/storage/ndb/src/ndbapi/TransporterFacade.hpp
index eb2f162da88..e75c5930614 100644
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp
@@ -319,6 +319,12 @@ TransporterFacade::unlock_mutex()
#include "ClusterMgr.hpp"
inline
+unsigned Ndb_cluster_connection_impl::get_connect_count() const
+{
+ return TransporterFacade::instance()->theClusterMgr->m_connect_count;
+}
+
+inline
bool
TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size)
{
diff --git a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 544f7424a82..a7e645f5100 100644
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -253,6 +253,12 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
} while (1);
}
+unsigned Ndb_cluster_connection::get_connect_count() const
+{
+ return m_impl.get_connect_count();
+}
+
+
/*
diff --git a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
index db6e1f9e6ed..6f0df0403d9 100644
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
@@ -40,6 +40,7 @@ class Ndb_cluster_connection_impl : public Ndb_cluster_connection
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter);
+ inline unsigned get_connect_count() const;
private:
friend class Ndb;
friend class NdbImpl;