Commit 6cb699d2 authored by tomas@poseidon.ndb.mysql.com's avatar tomas@poseidon.ndb.mysql.com

Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb
parents 08438b60 ca4b18fb
...@@ -448,6 +448,14 @@ int main(int argc,char *argv[]) ...@@ -448,6 +448,14 @@ int main(int argc,char *argv[])
MYF(MY_WME)); MYF(MY_WME));
if (histfile) if (histfile)
sprintf(histfile,"%s/.mysql_history",getenv("HOME")); 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) if (histfile)
{ {
...@@ -484,7 +492,7 @@ sig_handler mysql_end(int sig) ...@@ -484,7 +492,7 @@ sig_handler mysql_end(int sig)
{ {
mysql_close(&mysql); mysql_close(&mysql);
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
if (!status.batch && !quick && !opt_html && !opt_xml) if (!status.batch && !quick && !opt_html && !opt_xml && histfile)
{ {
/* write-history */ /* write-history */
if (verbose) if (verbose)
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT #ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, {"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, (gptr*) &opt_ssl_verify_server_cert, (gptr*) &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
......
...@@ -1017,6 +1017,13 @@ t ...@@ -1017,6 +1017,13 @@ t
1000000 1000000
1 1
drop table t1; 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); create table t1 (d decimal default null);
insert into t1 values (null); insert into t1 values (null);
select format(d, 2) from t1; select format(d, 2) from t1;
......
...@@ -1136,6 +1136,23 @@ table_schema='information_schema' and ...@@ -1136,6 +1136,23 @@ table_schema='information_schema' and
group by column_type order by num; group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num column_type group_concat(table_schema, '.', table_name) num
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2 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 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"; select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
......
...@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause' ...@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user'; 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 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 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 5 16 NULL NULL utf8 utf8_bin char(16) 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 t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
......
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;
...@@ -94,8 +94,6 @@ create temporary table t102 (id int); ...@@ -94,8 +94,6 @@ 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 t201 (id int);
create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (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); create table t1(f int);
insert into t1 values (1); insert into t1 values (1);
select * from t1 /* must be 1 */; select * from t1 /* must be 1 */;
......
...@@ -3427,3 +3427,22 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -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 A range PRIMARY PRIMARY 12 NULL 3 Using where
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
drop table t1, t2; 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;
...@@ -666,7 +666,14 @@ select rpad(i, 7, ' ') as t from t1; ...@@ -666,7 +666,14 @@ select rpad(i, 7, ' ') as t from t1;
--disable_metadata --disable_metadata
drop table t1; 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 # Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
......
...@@ -807,6 +807,26 @@ table_schema='information_schema' and ...@@ -807,6 +807,26 @@ table_schema='information_schema' and
(column_type = 'varchar(7)' or column_type = 'varchar(20)') (column_type = 'varchar(7)' or column_type = 'varchar(20)')
group by column_type order by num; 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. # End of 5.0 tests.
# #
......
-- 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
...@@ -40,7 +40,6 @@ eval select * into dumpfile "../tmp/outfile-test.2" from t1; ...@@ -40,7 +40,6 @@ eval select * into dumpfile "../tmp/outfile-test.2" from t1;
--error 1086 --error 1086
eval select * into dumpfile "../tmp/outfile-test.3" from t1; eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log; enable_query_log;
--error 13,2
select load_file(concat(@tmpdir,"/outfile-test.not-exist")); select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.1 --exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.1
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.2 --exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.2
......
...@@ -171,8 +171,18 @@ create temporary table t102 (id int); ...@@ -171,8 +171,18 @@ 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 t201 (id int);
create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (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 #now do something to show that slave is ok after DROP temp tables
connection master; connection master;
......
...@@ -2899,3 +2899,24 @@ select 'In next EXPLAIN, B.rows must be exactly 10:' Z; ...@@ -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 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); 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; 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;
...@@ -2579,7 +2579,7 @@ String *Item_load_file::val_str(String *str) ...@@ -2579,7 +2579,7 @@ String *Item_load_file::val_str(String *str)
(void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "", (void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME); 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; goto err;
if (!(stat_info.st_mode & S_IROTH)) if (!(stat_info.st_mode & S_IROTH))
......
...@@ -2932,7 +2932,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, ...@@ -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 field->real_type() == MYSQL_TYPE_STRING) // For binary type
{ {
uint32 octet_max_length= field->max_length(); 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; octet_max_length /= field->charset()->mbmaxlen;
longlong char_max_len= is_blob ? longlong char_max_len= is_blob ?
(longlong) octet_max_length / field->charset()->mbminlen : (longlong) octet_max_length / field->charset()->mbminlen :
...@@ -3169,17 +3169,18 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, ...@@ -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) const char *wild, bool full_access, const char *sp_user)
{ {
String tmp_string; String tmp_string;
String sp_db, sp_name, definer;
TIME time; TIME time;
LEX *lex= thd->lex; LEX *lex= thd->lex;
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
const char *sp_db, *sp_name, *definer; get_field(thd->mem_root, proc_table->field[0], &sp_db);
sp_db= get_field(thd->mem_root, proc_table->field[0]); get_field(thd->mem_root, proc_table->field[1], &sp_name);
sp_name= get_field(thd->mem_root, proc_table->field[1]); get_field(thd->mem_root, proc_table->field[11], &definer);
definer= get_field(thd->mem_root, proc_table->field[11]);
if (!full_access) if (!full_access)
full_access= !strcmp(sp_user, definer); full_access= !strcmp(sp_user, definer.ptr());
if (!full_access && check_some_routine_access(thd, sp_db, sp_name, if (!full_access && check_some_routine_access(thd, sp_db.ptr(), sp_name.ptr(),
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE)) proc_table->field[2]->val_int() ==
TYPE_ENUM_PROCEDURE))
return 0; return 0;
if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
...@@ -3189,13 +3190,13 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, ...@@ -3189,13 +3190,13 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
lex->orig_sql_command == SQLCOM_END) lex->orig_sql_command == SQLCOM_END)
{ {
restore_record(table, s->default_values); 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(); 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); get_field(thd->mem_root, proc_table->field[3], &tmp_string);
table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs); 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); get_field(thd->mem_root, proc_table->field[2], &tmp_string);
table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs); table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs);
if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) 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, ...@@ -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); table->field[17]->store(tmp_string.ptr(), tmp_string.length(), cs);
get_field(thd->mem_root, proc_table->field[15], &tmp_string); get_field(thd->mem_root, proc_table->field[15], &tmp_string);
table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs); 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); return schema_table_store_record(thd, table);
} }
} }
......
...@@ -110,6 +110,7 @@ public: ...@@ -110,6 +110,7 @@ public:
unsigned no_db_nodes(); unsigned no_db_nodes();
unsigned node_id(); unsigned node_id();
unsigned get_connect_count() const;
void init_get_next_node(Ndb_cluster_connection_node_iter &iter); void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
unsigned int get_next_node(Ndb_cluster_connection_node_iter &iter); unsigned int get_next_node(Ndb_cluster_connection_node_iter &iter);
......
...@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): ...@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
noOfAliveNodes= 0; noOfAliveNodes= 0;
noOfConnectedNodes= 0; noOfConnectedNodes= 0;
theClusterMgrThread= 0; theClusterMgrThread= 0;
m_connect_count = 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -445,6 +446,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ ...@@ -445,6 +446,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
theNode.nfCompleteRep = false; theNode.nfCompleteRep = false;
if(noOfAliveNodes == 0) if(noOfAliveNodes == 0)
{ {
theFacade.m_globalDictCache.lock();
theFacade.m_globalDictCache.invalidate_all();
theFacade.m_globalDictCache.unlock();
m_connect_count ++;
NFCompleteRep rep; NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){ for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){
......
...@@ -80,6 +80,7 @@ public: ...@@ -80,6 +80,7 @@ public:
bool isClusterAlive() const; bool isClusterAlive() const;
void hb_received(NodeId); void hb_received(NodeId);
Uint32 m_connect_count;
private: private:
Uint32 noOfAliveNodes; Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes; Uint32 noOfConnectedNodes;
......
...@@ -280,6 +280,41 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ...@@ -280,6 +280,41 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
DBUG_RETURN(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 void
GlobalDictCache::release(NdbTableImpl * tab, int invalidate) GlobalDictCache::release(NdbTableImpl * tab, int invalidate)
{ {
......
...@@ -71,6 +71,9 @@ public: ...@@ -71,6 +71,9 @@ public:
void alter_table_rep(const char * name, void alter_table_rep(const char * name,
Uint32 tableId, Uint32 tableVersion, bool altered); Uint32 tableId, Uint32 tableVersion, bool altered);
unsigned get_size();
void invalidate_all();
public: public:
enum Status { enum Status {
OK = 0, OK = 0,
......
...@@ -318,6 +318,12 @@ TransporterFacade::unlock_mutex() ...@@ -318,6 +318,12 @@ TransporterFacade::unlock_mutex()
#include "ClusterMgr.hpp" #include "ClusterMgr.hpp"
inline
unsigned Ndb_cluster_connection_impl::get_connect_count() const
{
return TransporterFacade::instance()->theClusterMgr->m_connect_count;
}
inline inline
bool bool
TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size) TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size)
......
...@@ -253,6 +253,12 @@ Ndb_cluster_connection::wait_until_ready(int timeout, ...@@ -253,6 +253,12 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
} while (1); } while (1);
} }
unsigned Ndb_cluster_connection::get_connect_count() const
{
return m_impl.get_connect_count();
}
/* /*
......
...@@ -40,6 +40,7 @@ class Ndb_cluster_connection_impl : public Ndb_cluster_connection ...@@ -40,6 +40,7 @@ class Ndb_cluster_connection_impl : public Ndb_cluster_connection
void init_get_next_node(Ndb_cluster_connection_node_iter &iter); void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
Uint32 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: private:
friend class Ndb; friend class Ndb;
friend class NdbImpl; friend class NdbImpl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment