Merge bk-internal:/home/bk/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
This commit is contained in:
commit
875154606e
9
mysql-test/include/get_binlog_dump_thread_id.inc
Normal file
9
mysql-test/include/get_binlog_dump_thread_id.inc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
--exec $MYSQL test -e 'show processlist' | grep 'Binlog Dump' | cut -f1 > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t999;
|
||||||
|
--enable_warnings
|
||||||
|
create temporary table t999 (f int);
|
||||||
|
--replace_result $MYSQLTEST_VARDIR "."
|
||||||
|
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
|
||||||
|
let $id = `select f from t999`;
|
||||||
|
drop table t999;
|
@ -465,8 +465,7 @@ sub mtr_kill_leftovers () {
|
|||||||
|
|
||||||
if ( kill(0, @pids) ) # Check if some left
|
if ( kill(0, @pids) ) # Check if some left
|
||||||
{
|
{
|
||||||
# FIXME maybe just mtr_warning() ?
|
mtr_warning("can't kill process(es) " . join(" ", @pids));
|
||||||
mtr_error("can't kill process(es) " . join(" ", @pids));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,7 +478,7 @@ sub mtr_kill_leftovers () {
|
|||||||
{
|
{
|
||||||
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
|
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
|
||||||
{
|
{
|
||||||
mtr_error("can't kill old mysqld holding port $srv->{'port'}");
|
mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,6 +312,9 @@ our $opt_udiff;
|
|||||||
|
|
||||||
our $opt_skip_ndbcluster;
|
our $opt_skip_ndbcluster;
|
||||||
our $opt_with_ndbcluster;
|
our $opt_with_ndbcluster;
|
||||||
|
our $opt_with_ndbcluster_only= 0; # dummy, ignored
|
||||||
|
|
||||||
|
our $opt_with_openssl;
|
||||||
|
|
||||||
our $exe_ndb_mgm;
|
our $exe_ndb_mgm;
|
||||||
our $path_ndb_tools_dir;
|
our $path_ndb_tools_dir;
|
||||||
@ -572,6 +575,7 @@ sub command_line_setup () {
|
|||||||
'force' => \$opt_force,
|
'force' => \$opt_force,
|
||||||
'with-ndbcluster' => \$opt_with_ndbcluster,
|
'with-ndbcluster' => \$opt_with_ndbcluster,
|
||||||
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
|
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
|
||||||
|
'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
|
||||||
'do-test=s' => \$opt_do_test,
|
'do-test=s' => \$opt_do_test,
|
||||||
'suite=s' => \$opt_suite,
|
'suite=s' => \$opt_suite,
|
||||||
'skip-rpl' => \$opt_skip_rpl,
|
'skip-rpl' => \$opt_skip_rpl,
|
||||||
@ -677,6 +681,11 @@ sub command_line_setup () {
|
|||||||
print '#' x 78, "\n\n";
|
print '#' x 78, "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $opt_with_ndbcluster_only )
|
||||||
|
{
|
||||||
|
print "# Option '--with-ndbcluster-only' is ignored in this release.\n";
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $arg ( @ARGV )
|
foreach my $arg ( @ARGV )
|
||||||
{
|
{
|
||||||
if ( $arg =~ /^--skip-/ )
|
if ( $arg =~ /^--skip-/ )
|
||||||
@ -2933,11 +2942,6 @@ sub run_mysqltest ($) {
|
|||||||
|
|
||||||
mtr_init_args(\$args);
|
mtr_init_args(\$args);
|
||||||
|
|
||||||
if ( $opt_valgrind_mysqltest )
|
|
||||||
{
|
|
||||||
valgrind_arguments($args, \$exe);
|
|
||||||
}
|
|
||||||
|
|
||||||
mtr_add_arg($args, "--no-defaults");
|
mtr_add_arg($args, "--no-defaults");
|
||||||
mtr_add_arg($args, "--silent");
|
mtr_add_arg($args, "--silent");
|
||||||
mtr_add_arg($args, "-v");
|
mtr_add_arg($args, "-v");
|
||||||
@ -3053,6 +3057,17 @@ sub run_mysqltest ($) {
|
|||||||
# Add arguments that should not go into the MYSQL_TEST env var
|
# Add arguments that should not go into the MYSQL_TEST env var
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
if ( $opt_valgrind_mysqltest )
|
||||||
|
{
|
||||||
|
# Prefix the Valgrind options to the argument list.
|
||||||
|
# We do this here, since we do not want to Valgrind the nested invocations
|
||||||
|
# of mysqltest; that would mess up the stderr output causing test failure.
|
||||||
|
my @args_saved = @$args;
|
||||||
|
mtr_init_args(\$args);
|
||||||
|
valgrind_arguments($args, \$exe);
|
||||||
|
mtr_add_arg($args, "%s", $_) for @args_saved;
|
||||||
|
}
|
||||||
|
|
||||||
mtr_add_arg($args, "--test-file");
|
mtr_add_arg($args, "--test-file");
|
||||||
mtr_add_arg($args, $tinfo->{'path'});
|
mtr_add_arg($args, $tinfo->{'path'});
|
||||||
|
|
||||||
|
@ -277,6 +277,7 @@ EXTRA_MYSQLSHOW_OPT=""
|
|||||||
EXTRA_MYSQLBINLOG_OPT=""
|
EXTRA_MYSQLBINLOG_OPT=""
|
||||||
USE_RUNNING_SERVER=0
|
USE_RUNNING_SERVER=0
|
||||||
USE_NDBCLUSTER=@USE_NDBCLUSTER@
|
USE_NDBCLUSTER=@USE_NDBCLUSTER@
|
||||||
|
USE_NDBCLUSTER_ONLY=0
|
||||||
USE_RUNNING_NDBCLUSTER=""
|
USE_RUNNING_NDBCLUSTER=""
|
||||||
USE_PURIFY=""
|
USE_PURIFY=""
|
||||||
PURIFY_LOGS=""
|
PURIFY_LOGS=""
|
||||||
@ -315,6 +316,8 @@ STRESS_INIT_FILE=""
|
|||||||
STRESS_TEST_FILE=""
|
STRESS_TEST_FILE=""
|
||||||
STRESS_TEST=""
|
STRESS_TEST=""
|
||||||
|
|
||||||
|
$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
|
||||||
|
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--embedded-server)
|
--embedded-server)
|
||||||
@ -341,6 +344,10 @@ while test $# -gt 0; do
|
|||||||
--extern) USE_RUNNING_SERVER=1 ;;
|
--extern) USE_RUNNING_SERVER=1 ;;
|
||||||
--with-ndbcluster)
|
--with-ndbcluster)
|
||||||
USE_NDBCLUSTER="--ndbcluster" ;;
|
USE_NDBCLUSTER="--ndbcluster" ;;
|
||||||
|
--with-ndbcluster-only)
|
||||||
|
USE_NDBCLUSTER="--ndbcluster"
|
||||||
|
USE_NDBCLUSTER_SLAVE="--ndbcluster"
|
||||||
|
USE_NDBCLUSTER_ONLY=1 ;;
|
||||||
--ndb-connectstring=*)
|
--ndb-connectstring=*)
|
||||||
USE_NDBCLUSTER="--ndbcluster" ;
|
USE_NDBCLUSTER="--ndbcluster" ;
|
||||||
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
|
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
|
||||||
@ -1654,6 +1661,11 @@ run_testcase ()
|
|||||||
result_file="r/$tname.result"
|
result_file="r/$tname.result"
|
||||||
echo $tname > $CURRENT_TEST
|
echo $tname > $CURRENT_TEST
|
||||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
|
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
|
||||||
|
NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
|
||||||
|
if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
|
||||||
|
skip_test $tname
|
||||||
|
return
|
||||||
|
fi
|
||||||
if [ "$USE_MANAGER" = 1 ] ; then
|
if [ "$USE_MANAGER" = 1 ] ; then
|
||||||
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
|
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
|
||||||
fi
|
fi
|
||||||
|
@ -360,6 +360,42 @@ extract(SECOND FROM "1999-01-02 10:11:12")
|
|||||||
select extract(MONTH FROM "2001-02-00");
|
select extract(MONTH FROM "2001-02-00");
|
||||||
extract(MONTH FROM "2001-02-00")
|
extract(MONTH FROM "2001-02-00")
|
||||||
2
|
2
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
1
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
1
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
1
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
2
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
2
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
2
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
3
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
3
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
3
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
4
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
4
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
|
||||||
|
quarter
|
||||||
|
4
|
||||||
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
|
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
|
||||||
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
|
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
|
||||||
1968-01-20 03:14:08
|
1968-01-20 03:14:08
|
||||||
|
@ -359,3 +359,36 @@ group by s1 collate latin1_swedish_ci having s1 = 'y';
|
|||||||
s1 count(s1)
|
s1 count(s1)
|
||||||
y 1
|
y 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
DROP SCHEMA IF EXISTS HU;
|
||||||
|
CREATE SCHEMA HU ;
|
||||||
|
USE HU ;
|
||||||
|
CREATE TABLE STAFF
|
||||||
|
(EMPNUM CHAR(3) NOT NULL UNIQUE,
|
||||||
|
EMPNAME CHAR(20),
|
||||||
|
GRADE DECIMAL(4),
|
||||||
|
CITY CHAR(15));
|
||||||
|
CREATE TABLE PROJ
|
||||||
|
(PNUM CHAR(3) NOT NULL UNIQUE,
|
||||||
|
PNAME CHAR(20),
|
||||||
|
PTYPE CHAR(6),
|
||||||
|
BUDGET DECIMAL(9),
|
||||||
|
CITY CHAR(15));
|
||||||
|
INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
|
||||||
|
INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
|
||||||
|
INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
|
||||||
|
INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
|
||||||
|
INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
|
||||||
|
INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
|
||||||
|
INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
|
||||||
|
INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
|
||||||
|
INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
|
||||||
|
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
|
||||||
|
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
|
||||||
|
SELECT EMPNUM, GRADE*1000
|
||||||
|
FROM HU.STAFF WHERE GRADE * 1000 >
|
||||||
|
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
|
||||||
|
GROUP BY CITY, PTYPE
|
||||||
|
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
|
||||||
|
EMPNUM GRADE*1000
|
||||||
|
E3 13000
|
||||||
|
DROP SCHEMA HU;
|
||||||
|
@ -1821,7 +1821,7 @@ Variable_name Value
|
|||||||
innodb_sync_spin_loops 20
|
innodb_sync_spin_loops 20
|
||||||
show variables like "innodb_thread_concurrency";
|
show variables like "innodb_thread_concurrency";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
innodb_thread_concurrency 0
|
innodb_thread_concurrency 8
|
||||||
set global innodb_thread_concurrency=1001;
|
set global innodb_thread_concurrency=1001;
|
||||||
show variables like "innodb_thread_concurrency";
|
show variables like "innodb_thread_concurrency";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
|
@ -89,3 +89,17 @@ f
|
|||||||
7
|
7
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
create temporary table t3 (f int);
|
create temporary table t3 (f int);
|
||||||
|
create temporary table t4 (f int);
|
||||||
|
create table t5 (f int);
|
||||||
|
drop table if exists t999;
|
||||||
|
create temporary table t999 (f int);
|
||||||
|
LOAD DATA INFILE "./tmp/bl_dump_thread_id" into table t999;
|
||||||
|
drop table t999;
|
||||||
|
insert into t4 values (1);
|
||||||
|
kill `select id from information_schema.processlist where command='Binlog Dump'`;
|
||||||
|
insert into t5 select * from t4;
|
||||||
|
select * from t5 /* must be 1 after reconnection */;
|
||||||
|
f
|
||||||
|
1
|
||||||
|
drop temporary table t4;
|
||||||
|
drop table t5;
|
||||||
|
@ -564,3 +564,12 @@ b1+0 sum(b1) sum(b2)
|
|||||||
1 4 4
|
1 4 4
|
||||||
2 2 2
|
2 2 2
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
create table t1 (a bit(7));
|
||||||
|
insert into t1 values (0x60);
|
||||||
|
select * from t1;
|
||||||
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
|
def test t1 t1 a a 16 7 1 Y 0 0 63
|
||||||
|
a
|
||||||
|
`
|
||||||
|
drop table t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@ -402,3 +402,12 @@ t1 CREATE TABLE `t1` (
|
|||||||
`b` bit(10) default NULL
|
`b` bit(10) default NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a bit(7)) engine=innodb;
|
||||||
|
insert into t1 values (0x60);
|
||||||
|
select * from t1;
|
||||||
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
|
def test t1 t1 a a 16 7 1 Y 0 0 63
|
||||||
|
a
|
||||||
|
`
|
||||||
|
drop table t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@ -2579,3 +2579,24 @@ COUNT(*)
|
|||||||
2
|
2
|
||||||
DROP VIEW v2;
|
DROP VIEW v2;
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
|
||||||
|
td date DEFAULT NULL, KEY idx(td));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
|
||||||
|
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
|
||||||
|
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
SELECT * FROM t1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||||
|
id td
|
||||||
|
2 2005-01-02
|
||||||
|
3 2005-01-02
|
||||||
|
4 2005-01-03
|
||||||
|
5 2005-01-04
|
||||||
|
SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||||
|
id td
|
||||||
|
2 2005-01-02
|
||||||
|
3 2005-01-02
|
||||||
|
4 2005-01-03
|
||||||
|
5 2005-01-04
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -171,6 +171,8 @@ select cast(1.0e+300 as signed int);
|
|||||||
CREATE TABLE t1 (f1 double);
|
CREATE TABLE t1 (f1 double);
|
||||||
INSERT INTO t1 SET f1 = -1.0e+30 ;
|
INSERT INTO t1 SET f1 = -1.0e+30 ;
|
||||||
INSERT INTO t1 SET f1 = +1.0e+30 ;
|
INSERT INTO t1 SET f1 = +1.0e+30 ;
|
||||||
|
# Expected result is +-1e+30, but Windows returns +-1e+030.
|
||||||
|
--replace_result 1e+030 1e+30
|
||||||
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
|
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -139,6 +139,24 @@ select extract(MINUTE_SECOND FROM "10:11:12");
|
|||||||
select extract(SECOND FROM "1999-01-02 10:11:12");
|
select extract(SECOND FROM "1999-01-02 10:11:12");
|
||||||
select extract(MONTH FROM "2001-02-00");
|
select extract(MONTH FROM "2001-02-00");
|
||||||
|
|
||||||
|
#
|
||||||
|
# test EXTRACT QUARTER (Bug #18100)
|
||||||
|
#
|
||||||
|
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
|
||||||
|
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test big intervals (Bug #3498)
|
# Test big intervals (Bug #3498)
|
||||||
#
|
#
|
||||||
|
@ -347,3 +347,49 @@ group by s1 collate latin1_swedish_ci having s1 = 'y';
|
|||||||
# MySQL returns: 1 row, with count(s1) = 1
|
# MySQL returns: 1 row, with count(s1) = 1
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #15917: unexpected complain for a name in having clause
|
||||||
|
# when the server is run on Windows or with --lower-case-table-names=1
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP SCHEMA IF EXISTS HU;
|
||||||
|
--enable_warnings
|
||||||
|
CREATE SCHEMA HU ;
|
||||||
|
USE HU ;
|
||||||
|
|
||||||
|
CREATE TABLE STAFF
|
||||||
|
(EMPNUM CHAR(3) NOT NULL UNIQUE,
|
||||||
|
EMPNAME CHAR(20),
|
||||||
|
GRADE DECIMAL(4),
|
||||||
|
CITY CHAR(15));
|
||||||
|
|
||||||
|
CREATE TABLE PROJ
|
||||||
|
(PNUM CHAR(3) NOT NULL UNIQUE,
|
||||||
|
PNAME CHAR(20),
|
||||||
|
PTYPE CHAR(6),
|
||||||
|
BUDGET DECIMAL(9),
|
||||||
|
CITY CHAR(15));
|
||||||
|
|
||||||
|
INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
|
||||||
|
INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
|
||||||
|
INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
|
||||||
|
INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
|
||||||
|
INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
|
||||||
|
|
||||||
|
INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
|
||||||
|
INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
|
||||||
|
INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
|
||||||
|
INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
|
||||||
|
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
|
||||||
|
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
|
||||||
|
|
||||||
|
SELECT EMPNUM, GRADE*1000
|
||||||
|
FROM HU.STAFF WHERE GRADE * 1000 >
|
||||||
|
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
|
||||||
|
GROUP BY CITY, PTYPE
|
||||||
|
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
|
||||||
|
|
||||||
|
DROP SCHEMA HU;
|
||||||
|
@ -129,6 +129,31 @@ drop table t1,t2;
|
|||||||
create temporary table t3 (f int);
|
create temporary table t3 (f int);
|
||||||
sync_with_master;
|
sync_with_master;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#17284 erroneous temp table cleanup on slave
|
||||||
|
#
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
create temporary table t4 (f int);
|
||||||
|
create table t5 (f int);
|
||||||
|
sync_with_master;
|
||||||
|
# find dumper's $id
|
||||||
|
source include/get_binlog_dump_thread_id.inc;
|
||||||
|
insert into t4 values (1);
|
||||||
|
# a hint how to do that in 5.1
|
||||||
|
--replace_result $id "`select id from information_schema.processlist where command='Binlog Dump'`"
|
||||||
|
eval kill $id; # to stimulate reconnection by slave w/o timeout
|
||||||
|
insert into t5 select * from t4;
|
||||||
|
save_master_pos;
|
||||||
|
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
select * from t5 /* must be 1 after reconnection */;
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
drop temporary table t4;
|
||||||
|
drop table t5;
|
||||||
|
|
||||||
# The server will now close done
|
# The server will now close done
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 5.0 tests
|
||||||
|
@ -227,3 +227,15 @@ select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1;
|
|||||||
select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
|
select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
|
||||||
select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
|
select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #13601: Wrong field length reported for BIT fields
|
||||||
|
#
|
||||||
|
create table t1 (a bit(7));
|
||||||
|
insert into t1 values (0x60);
|
||||||
|
--enable_metadata
|
||||||
|
select * from t1;
|
||||||
|
--disable_metadata
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
@ -133,3 +133,15 @@ show create table t1;
|
|||||||
alter table t1 engine=innodb;
|
alter table t1 engine=innodb;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #13601: Wrong field length reported for BIT fields
|
||||||
|
#
|
||||||
|
create table t1 (a bit(7)) engine=innodb;
|
||||||
|
insert into t1 values (0x60);
|
||||||
|
--enable_metadata
|
||||||
|
select * from t1;
|
||||||
|
--disable_metadata
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
@ -2434,3 +2434,23 @@ SELECT COUNT(*) FROM t1 LEFT JOIN v2 ON t1.id=v2.id;
|
|||||||
DROP VIEW v2;
|
DROP VIEW v2;
|
||||||
|
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #16069: VIEW does return the same results as underlying SELECT
|
||||||
|
# with WHERE condition containing BETWEEN over dates
|
||||||
|
|
||||||
|
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
|
||||||
|
td date DEFAULT NULL, KEY idx(td));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
|
||||||
|
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
|
||||||
|
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
|
||||||
|
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||||
|
SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -30,12 +30,17 @@ class CmRegReq {
|
|||||||
friend class Qmgr;
|
friend class Qmgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 3 );
|
STATIC_CONST( SignalLength = 5 + NdbNodeBitmask::Size );
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Uint32 blockRef;
|
Uint32 blockRef;
|
||||||
Uint32 nodeId;
|
Uint32 nodeId;
|
||||||
Uint32 version; // See ndb_version.h
|
Uint32 version; // See ndb_version.h
|
||||||
|
|
||||||
|
Uint32 start_type; // As specified by cmd-line or mgm, NodeState::StartType
|
||||||
|
Uint32 latest_gci; // 0 means no fs
|
||||||
|
Uint32 skip_nodes[NdbNodeBitmask::Size]; // Nodes that does not _need_
|
||||||
|
// to be part of restart
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,8 +64,7 @@ private:
|
|||||||
* The dynamic id that the node reciving this signal has
|
* The dynamic id that the node reciving this signal has
|
||||||
*/
|
*/
|
||||||
Uint32 dynamicId;
|
Uint32 dynamicId;
|
||||||
|
Uint32 allNdbNodes[NdbNodeBitmask::Size];
|
||||||
Uint32 allNdbNodes[NdbNodeBitmask::Size];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +77,7 @@ class CmRegRef {
|
|||||||
friend class Qmgr;
|
friend class Qmgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 4 );
|
STATIC_CONST( SignalLength = 7 + NdbNodeBitmask::Size );
|
||||||
|
|
||||||
enum ErrorCode {
|
enum ErrorCode {
|
||||||
ZBUSY = 0, /* Only the president can send this */
|
ZBUSY = 0, /* Only the president can send this */
|
||||||
@ -85,14 +89,27 @@ public:
|
|||||||
* as president. */
|
* as president. */
|
||||||
ZNOT_PRESIDENT = 5, /* We are not president */
|
ZNOT_PRESIDENT = 5, /* We are not president */
|
||||||
ZNOT_DEAD = 6, /* We are not dead when we are starting */
|
ZNOT_DEAD = 6, /* We are not dead when we are starting */
|
||||||
ZINCOMPATIBLE_VERSION = 7
|
ZINCOMPATIBLE_VERSION = 7,
|
||||||
|
ZINCOMPATIBLE_START_TYPE = 8
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Uint32 blockRef;
|
Uint32 blockRef;
|
||||||
Uint32 nodeId;
|
Uint32 nodeId;
|
||||||
Uint32 errorCode;
|
Uint32 errorCode;
|
||||||
|
/**
|
||||||
|
* Applicable if ZELECTION
|
||||||
|
*/
|
||||||
Uint32 presidentCandidate;
|
Uint32 presidentCandidate;
|
||||||
|
Uint32 candidate_latest_gci; // 0 means non
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data for sending node sending node
|
||||||
|
*/
|
||||||
|
Uint32 latest_gci;
|
||||||
|
Uint32 start_type;
|
||||||
|
Uint32 skip_nodes[NdbNodeBitmask::Size]; // Nodes that does not _need_
|
||||||
|
// to be part of restart
|
||||||
};
|
};
|
||||||
|
|
||||||
class CmAdd {
|
class CmAdd {
|
||||||
|
@ -64,6 +64,7 @@ public:
|
|||||||
// 19 NDBFS Fipple with O_SYNC, O_CREATE etc.
|
// 19 NDBFS Fipple with O_SYNC, O_CREATE etc.
|
||||||
// 20-24 BACKUP
|
// 20-24 BACKUP
|
||||||
NdbcntrTestStopOnError = 25,
|
NdbcntrTestStopOnError = 25,
|
||||||
|
NdbcntrStopNodes = 70,
|
||||||
// 100-105 TUP and ACC
|
// 100-105 TUP and ACC
|
||||||
// 200-240 UTIL
|
// 200-240 UTIL
|
||||||
// 300-305 TRIX
|
// 300-305 TRIX
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define FAIL_REP_HPP
|
#define FAIL_REP_HPP
|
||||||
|
|
||||||
#include "SignalData.hpp"
|
#include "SignalData.hpp"
|
||||||
|
#include <NodeBitmask.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -27,6 +28,7 @@ class FailRep {
|
|||||||
* Sender(s) & Reciver(s)
|
* Sender(s) & Reciver(s)
|
||||||
*/
|
*/
|
||||||
friend class Qmgr;
|
friend class Qmgr;
|
||||||
|
friend class Ndbcntr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For printing
|
* For printing
|
||||||
@ -35,7 +37,8 @@ class FailRep {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 2 );
|
STATIC_CONST( SignalLength = 2 );
|
||||||
|
STATIC_CONST( ExtraLength = 1 + NdbNodeBitmask::Size );
|
||||||
|
|
||||||
enum FailCause {
|
enum FailCause {
|
||||||
ZOWN_FAILURE=0,
|
ZOWN_FAILURE=0,
|
||||||
ZOTHER_NODE_WHEN_WE_START=1,
|
ZOTHER_NODE_WHEN_WE_START=1,
|
||||||
@ -43,13 +46,20 @@ public:
|
|||||||
ZSTART_IN_REGREQ=3,
|
ZSTART_IN_REGREQ=3,
|
||||||
ZHEARTBEAT_FAILURE=4,
|
ZHEARTBEAT_FAILURE=4,
|
||||||
ZLINK_FAILURE=5,
|
ZLINK_FAILURE=5,
|
||||||
ZOTHERNODE_FAILED_DURING_START=6
|
ZOTHERNODE_FAILED_DURING_START=6,
|
||||||
|
ZMULTI_NODE_SHUTDOWN = 7,
|
||||||
|
ZPARTITIONED_CLUSTER = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Uint32 failNodeId;
|
Uint32 failNodeId;
|
||||||
Uint32 failCause;
|
Uint32 failCause;
|
||||||
|
/**
|
||||||
|
* Used when failCause == ZPARTITIONED_CLUSTER
|
||||||
|
*/
|
||||||
|
Uint32 president;
|
||||||
|
Uint32 partition[NdbNodeBitmask::Size];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class StopReq
|
|||||||
friend class MgmtSrvr;
|
friend class MgmtSrvr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 9 );
|
STATIC_CONST( SignalLength = 9 + NdbNodeBitmask::Size);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Uint32 senderRef;
|
Uint32 senderRef;
|
||||||
@ -49,29 +49,34 @@ public:
|
|||||||
Int32 readOperationTimeout; // Timeout before read operations are aborted
|
Int32 readOperationTimeout; // Timeout before read operations are aborted
|
||||||
Int32 operationTimeout; // Timeout before all operations are aborted
|
Int32 operationTimeout; // Timeout before all operations are aborted
|
||||||
|
|
||||||
|
Uint32 nodes[NdbNodeBitmask::Size];
|
||||||
|
|
||||||
static void setSystemStop(Uint32 & requestInfo, bool value);
|
static void setSystemStop(Uint32 & requestInfo, bool value);
|
||||||
static void setPerformRestart(Uint32 & requestInfo, bool value);
|
static void setPerformRestart(Uint32 & requestInfo, bool value);
|
||||||
static void setNoStart(Uint32 & requestInfo, bool value);
|
static void setNoStart(Uint32 & requestInfo, bool value);
|
||||||
static void setInitialStart(Uint32 & requestInfo, bool value);
|
static void setInitialStart(Uint32 & requestInfo, bool value);
|
||||||
static void setEscalateOnNodeFail(Uint32 & requestInfo, bool value);
|
|
||||||
/**
|
/**
|
||||||
* Don't perform "graceful" shutdown/restart...
|
* Don't perform "graceful" shutdown/restart...
|
||||||
*/
|
*/
|
||||||
static void setStopAbort(Uint32 & requestInfo, bool value);
|
static void setStopAbort(Uint32 & requestInfo, bool value);
|
||||||
|
static void setStopNodes(Uint32 & requestInfo, bool value);
|
||||||
|
|
||||||
static bool getSystemStop(const Uint32 & requestInfo);
|
static bool getSystemStop(const Uint32 & requestInfo);
|
||||||
static bool getPerformRestart(const Uint32 & requestInfo);
|
static bool getPerformRestart(const Uint32 & requestInfo);
|
||||||
static bool getNoStart(const Uint32 & requestInfo);
|
static bool getNoStart(const Uint32 & requestInfo);
|
||||||
static bool getInitialStart(const Uint32 & requestInfo);
|
static bool getInitialStart(const Uint32 & requestInfo);
|
||||||
static bool getEscalateOnNodeFail(const Uint32 & requestInfo);
|
|
||||||
static bool getStopAbort(const Uint32 & requestInfo);
|
static bool getStopAbort(const Uint32 & requestInfo);
|
||||||
|
static bool getStopNodes(const Uint32 & requestInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StopConf
|
struct StopConf
|
||||||
{
|
{
|
||||||
STATIC_CONST( SignalLength = 2 );
|
STATIC_CONST( SignalLength = 2 );
|
||||||
Uint32 senderData;
|
Uint32 senderData;
|
||||||
Uint32 nodeState;
|
union {
|
||||||
|
Uint32 nodeState;
|
||||||
|
Uint32 nodeId;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class StopRef
|
class StopRef
|
||||||
@ -87,19 +92,22 @@ class StopRef
|
|||||||
friend class Ndbcntr;
|
friend class Ndbcntr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 2 );
|
STATIC_CONST( SignalLength = 3 );
|
||||||
|
|
||||||
enum ErrorCode {
|
enum ErrorCode {
|
||||||
OK = 0,
|
OK = 0,
|
||||||
NodeShutdownInProgress = 1,
|
NodeShutdownInProgress = 1,
|
||||||
SystemShutdownInProgress = 2,
|
SystemShutdownInProgress = 2,
|
||||||
NodeShutdownWouldCauseSystemCrash = 3,
|
NodeShutdownWouldCauseSystemCrash = 3,
|
||||||
TransactionAbortFailed = 4
|
TransactionAbortFailed = 4,
|
||||||
|
UnsupportedNodeShutdown = 5,
|
||||||
|
MultiNodeShutdownNotMaster = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Uint32 senderData;
|
Uint32 senderData;
|
||||||
Uint32 errorCode;
|
Uint32 errorCode;
|
||||||
|
Uint32 masterNodeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -132,16 +140,16 @@ StopReq::getInitialStart(const Uint32 & requestInfo)
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
bool
|
bool
|
||||||
StopReq::getEscalateOnNodeFail(const Uint32 & requestInfo)
|
StopReq::getStopAbort(const Uint32 & requestInfo)
|
||||||
{
|
{
|
||||||
return requestInfo & 16;
|
return requestInfo & 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool
|
bool
|
||||||
StopReq::getStopAbort(const Uint32 & requestInfo)
|
StopReq::getStopNodes(const Uint32 & requestInfo)
|
||||||
{
|
{
|
||||||
return requestInfo & 32;
|
return requestInfo & 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,16 +193,6 @@ StopReq::setInitialStart(Uint32 & requestInfo, bool value)
|
|||||||
requestInfo &= ~8;
|
requestInfo &= ~8;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
StopReq::setEscalateOnNodeFail(Uint32 & requestInfo, bool value)
|
|
||||||
{
|
|
||||||
if(value)
|
|
||||||
requestInfo |= 16;
|
|
||||||
else
|
|
||||||
requestInfo &= ~16;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
StopReq::setStopAbort(Uint32 & requestInfo, bool value)
|
StopReq::setStopAbort(Uint32 & requestInfo, bool value)
|
||||||
@ -205,6 +203,15 @@ StopReq::setStopAbort(Uint32 & requestInfo, bool value)
|
|||||||
requestInfo &= ~32;
|
requestInfo &= ~32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
StopReq::setStopNodes(Uint32 & requestInfo, bool value)
|
||||||
|
{
|
||||||
|
if(value)
|
||||||
|
requestInfo |= 64;
|
||||||
|
else
|
||||||
|
requestInfo &= ~64;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ public:
|
|||||||
Complete = 1, ///< Wait for a GCP to complete
|
Complete = 1, ///< Wait for a GCP to complete
|
||||||
CompleteForceStart = 2, ///< Wait for a GCP to complete start one if needed
|
CompleteForceStart = 2, ///< Wait for a GCP to complete start one if needed
|
||||||
CompleteIfRunning = 3, ///< Wait for ongoing GCP
|
CompleteIfRunning = 3, ///< Wait for ongoing GCP
|
||||||
CurrentGCI = 8 ///< Immediately return current GCI
|
CurrentGCI = 8, ///< Immediately return current GCI
|
||||||
|
BlockStartGcp = 9,
|
||||||
|
UnblockStartGcp = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
Uint32 senderRef;
|
Uint32 senderRef;
|
||||||
@ -70,11 +72,12 @@ class WaitGCPConf {
|
|||||||
//friend class Grep::PSCoord;
|
//friend class Grep::PSCoord;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC_CONST( SignalLength = 2 );
|
STATIC_CONST( SignalLength = 3 );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Uint32 senderData;
|
Uint32 senderData;
|
||||||
Uint32 gcp;
|
Uint32 gcp;
|
||||||
|
Uint32 blockStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaitGCPRef {
|
class WaitGCPRef {
|
||||||
|
@ -166,10 +166,14 @@ extern "C" {
|
|||||||
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
|
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
|
||||||
NDB_LE_BackupCompleted = 56,
|
NDB_LE_BackupCompleted = 56,
|
||||||
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
|
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
|
||||||
NDB_LE_BackupAborted = 57
|
NDB_LE_BackupAborted = 57,
|
||||||
|
|
||||||
/* 58 used in 5.1 */
|
/* 58 used in 5.1 */
|
||||||
/* 59 used */
|
/* 59 used */
|
||||||
|
|
||||||
|
/** NDB_MGM_EVENT_CATEGORY_STARTUP */
|
||||||
|
NDB_LE_StartReport = 60
|
||||||
|
|
||||||
/* 60 unused */
|
/* 60 unused */
|
||||||
/* 61 unused */
|
/* 61 unused */
|
||||||
/* 62 unused */
|
/* 62 unused */
|
||||||
@ -625,6 +629,13 @@ extern "C" {
|
|||||||
unsigned type;
|
unsigned type;
|
||||||
unsigned node_id;
|
unsigned node_id;
|
||||||
} SingleUser;
|
} SingleUser;
|
||||||
|
/** Log even data @ref NDB_LE_StartReport */
|
||||||
|
struct {
|
||||||
|
unsigned report_type;
|
||||||
|
unsigned remaining_time;
|
||||||
|
unsigned bitmask_size;
|
||||||
|
unsigned bitmask_data[1];
|
||||||
|
} StartReport;
|
||||||
#ifndef DOXYGEN_FIX
|
#ifndef DOXYGEN_FIX
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
|
@ -707,6 +707,90 @@ void getTextSingleUser(QQQQ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getTextStartReport(QQQQ) {
|
||||||
|
Uint32 time = theData[2];
|
||||||
|
Uint32 sz = theData[3];
|
||||||
|
char mask1[100];
|
||||||
|
char mask2[100];
|
||||||
|
char mask3[100];
|
||||||
|
char mask4[100];
|
||||||
|
BitmaskImpl::getText(sz, theData + 4 + (0 * sz), mask1);
|
||||||
|
BitmaskImpl::getText(sz, theData + 4 + (1 * sz), mask2);
|
||||||
|
BitmaskImpl::getText(sz, theData + 4 + (2 * sz), mask3);
|
||||||
|
BitmaskImpl::getText(sz, theData + 4 + (3 * sz), mask4);
|
||||||
|
switch(theData[1]){
|
||||||
|
case 1: // Wait initial
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Initial start, waiting for %s to connect, "
|
||||||
|
" nodes [ all: %s connected: %s no-wait: %s ]",
|
||||||
|
mask4, mask1, mask2, mask3);
|
||||||
|
break;
|
||||||
|
case 2: // Wait partial
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Waiting until nodes: %s connects, "
|
||||||
|
"nodes [ all: %s connected: %s no-wait: %s ]",
|
||||||
|
mask4, mask1, mask2, mask3);
|
||||||
|
break;
|
||||||
|
case 3: // Wait partial timeout
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Waiting %u sec for nodes %s to connect, "
|
||||||
|
"nodes [ all: %s connected: %s no-wait: %s ]",
|
||||||
|
|
||||||
|
time, mask4, mask1, mask2, mask3);
|
||||||
|
break;
|
||||||
|
case 4: // Wait partioned
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Waiting for non partitioned start, "
|
||||||
|
"nodes [ all: %s connected: %s missing: %s no-wait: %s ]",
|
||||||
|
|
||||||
|
mask1, mask2, mask4, mask3);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Waiting %u sec for non partitioned start, "
|
||||||
|
"nodes [ all: %s connected: %s missing: %s no-wait: %s ]",
|
||||||
|
|
||||||
|
time, mask1, mask2, mask4, mask3);
|
||||||
|
break;
|
||||||
|
case 0x8000: // Do initial
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Initial start with nodes %s [ missing: %s no-wait: %s ]",
|
||||||
|
mask2, mask4, mask3);
|
||||||
|
break;
|
||||||
|
case 0x8001: // Do start
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Start with all nodes %s",
|
||||||
|
mask2);
|
||||||
|
break;
|
||||||
|
case 0x8002: // Do partial
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Start with nodes %s [ missing: %s no-wait: %s ]",
|
||||||
|
mask2, mask4, mask3);
|
||||||
|
break;
|
||||||
|
case 0x8003: // Do partioned
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Start potentially partitioned with nodes %s "
|
||||||
|
" [ missing: %s no-wait: %s ]",
|
||||||
|
mask2, mask4, mask3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
BaseString::snprintf
|
||||||
|
(m_text, m_text_len,
|
||||||
|
"Unknown startreport: 0x%x [ %s %s %s %s ]",
|
||||||
|
theData[1],
|
||||||
|
mask1, mask2, mask3, mask4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
BaseString::snprintf(m_text,
|
BaseString::snprintf(m_text,
|
||||||
m_text_len,
|
m_text_len,
|
||||||
@ -755,6 +839,7 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
|
|||||||
ROW(StartREDOLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
|
ROW(StartREDOLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
|
||||||
ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
|
ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
|
||||||
ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ),
|
ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ),
|
||||||
|
ROW(StartReport, LogLevel::llStartUp, 4, Logger::LL_INFO ),
|
||||||
|
|
||||||
// NODERESTART
|
// NODERESTART
|
||||||
ROW(NR_CopyDict, LogLevel::llNodeRestart, 8, Logger::LL_INFO ),
|
ROW(NR_CopyDict, LogLevel::llNodeRestart, 8, Logger::LL_INFO ),
|
||||||
|
@ -134,6 +134,9 @@ Cmvmi::~Cmvmi()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ERROR_INSERT
|
||||||
|
NodeBitmask c_error_9000_nodes_mask;
|
||||||
|
#endif
|
||||||
|
|
||||||
void Cmvmi::execNDB_TAMPER(Signal* signal)
|
void Cmvmi::execNDB_TAMPER(Signal* signal)
|
||||||
{
|
{
|
||||||
@ -419,21 +422,33 @@ void Cmvmi::execOPEN_COMREQ(Signal* signal)
|
|||||||
|
|
||||||
const Uint32 len = signal->getLength();
|
const Uint32 len = signal->getLength();
|
||||||
if(len == 2){
|
if(len == 2){
|
||||||
globalTransporterRegistry.do_connect(tStartingNode);
|
|
||||||
globalTransporterRegistry.setIOState(tStartingNode, HaltIO);
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
#ifdef ERROR_INSERT
|
||||||
// Report that the connection to the node is opened
|
if (! (ERROR_INSERTED(9000) && c_error_9000_nodes_mask.get(tStartingNode)))
|
||||||
//-----------------------------------------------------
|
#endif
|
||||||
signal->theData[0] = NDB_LE_CommunicationOpened;
|
{
|
||||||
signal->theData[1] = tStartingNode;
|
globalTransporterRegistry.do_connect(tStartingNode);
|
||||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
globalTransporterRegistry.setIOState(tStartingNode, HaltIO);
|
||||||
//-----------------------------------------------------
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// Report that the connection to the node is opened
|
||||||
|
//-----------------------------------------------------
|
||||||
|
signal->theData[0] = NDB_LE_CommunicationOpened;
|
||||||
|
signal->theData[1] = tStartingNode;
|
||||||
|
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
||||||
|
//-----------------------------------------------------
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for(unsigned int i = 1; i < MAX_NODES; i++ ) {
|
for(unsigned int i = 1; i < MAX_NODES; i++ ) {
|
||||||
jam();
|
jam();
|
||||||
if (i != getOwnNodeId() && getNodeInfo(i).m_type == tData2){
|
if (i != getOwnNodeId() && getNodeInfo(i).m_type == tData2){
|
||||||
jam();
|
jam();
|
||||||
|
|
||||||
|
#ifdef ERROR_INSERT
|
||||||
|
if (ERROR_INSERTED(9000) && c_error_9000_nodes_mask.get(i))
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
globalTransporterRegistry.do_connect(i);
|
globalTransporterRegistry.do_connect(i);
|
||||||
globalTransporterRegistry.setIOState(i, HaltIO);
|
globalTransporterRegistry.setIOState(i, HaltIO);
|
||||||
|
|
||||||
@ -1039,7 +1054,8 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DumpStateOrd * const & dumpState = (DumpStateOrd *)&signal->theData[0];
|
DumpStateOrd * const & dumpState = (DumpStateOrd *)&signal->theData[0];
|
||||||
if (dumpState->args[0] == DumpStateOrd::CmvmiDumpConnections){
|
Uint32 arg = dumpState->args[0];
|
||||||
|
if (arg == DumpStateOrd::CmvmiDumpConnections){
|
||||||
for(unsigned int i = 1; i < MAX_NODES; i++ ){
|
for(unsigned int i = 1; i < MAX_NODES; i++ ){
|
||||||
const char* nodeTypeStr = "";
|
const char* nodeTypeStr = "";
|
||||||
switch(getNodeInfo(i).m_type){
|
switch(getNodeInfo(i).m_type){
|
||||||
@ -1072,13 +1088,13 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpState->args[0] == DumpStateOrd::CmvmiDumpLongSignalMemory){
|
if (arg == DumpStateOrd::CmvmiDumpLongSignalMemory){
|
||||||
infoEvent("Cmvmi: g_sectionSegmentPool size: %d free: %d",
|
infoEvent("Cmvmi: g_sectionSegmentPool size: %d free: %d",
|
||||||
g_sectionSegmentPool.getSize(),
|
g_sectionSegmentPool.getSize(),
|
||||||
g_sectionSegmentPool.getNoOfFree());
|
g_sectionSegmentPool.getNoOfFree());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpState->args[0] == DumpStateOrd::CmvmiSetRestartOnErrorInsert)
|
if (arg == DumpStateOrd::CmvmiSetRestartOnErrorInsert)
|
||||||
{
|
{
|
||||||
if(signal->getLength() == 1)
|
if(signal->getLength() == 1)
|
||||||
{
|
{
|
||||||
@ -1098,7 +1114,7 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpState->args[0] == DumpStateOrd::CmvmiTestLongSigWithDelay) {
|
if (arg == DumpStateOrd::CmvmiTestLongSigWithDelay) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
Uint32 loopCount = dumpState->args[1];
|
Uint32 loopCount = dumpState->args[1];
|
||||||
const unsigned len0 = 11;
|
const unsigned len0 = 11;
|
||||||
@ -1126,6 +1142,30 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
|
|||||||
sendSignal(reference(), GSN_TESTSIG, signal, 8, JBB, ptr, 2);
|
sendSignal(reference(), GSN_TESTSIG, signal, 8, JBB, ptr, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ERROR_INSERT
|
||||||
|
if (arg == 9000)
|
||||||
|
{
|
||||||
|
SET_ERROR_INSERT_VALUE(9000);
|
||||||
|
for (Uint32 i = 1; i<signal->getLength(); i++)
|
||||||
|
c_error_9000_nodes_mask.set(signal->theData[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg == 9001)
|
||||||
|
{
|
||||||
|
CLEAR_ERROR_INSERT_VALUE;
|
||||||
|
for (Uint32 i = 0; i<MAX_NODES; i++)
|
||||||
|
{
|
||||||
|
if (c_error_9000_nodes_mask.get(i))
|
||||||
|
{
|
||||||
|
signal->theData[0] = 0;
|
||||||
|
signal->theData[1] = i;
|
||||||
|
EXECUTE_DIRECT(CMVMI, GSN_OPEN_COMREQ, signal, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c_error_9000_nodes_mask.clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VM_TRACE
|
#ifdef VM_TRACE
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,7 @@ void Dbdih::initData()
|
|||||||
cwaitLcpSr = false;
|
cwaitLcpSr = false;
|
||||||
c_blockCommit = false;
|
c_blockCommit = false;
|
||||||
c_blockCommitNo = 1;
|
c_blockCommitNo = 1;
|
||||||
|
cntrlblockref = RNIL;
|
||||||
}//Dbdih::initData()
|
}//Dbdih::initData()
|
||||||
|
|
||||||
void Dbdih::initRecords()
|
void Dbdih::initRecords()
|
||||||
|
@ -11659,7 +11659,7 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[])
|
|||||||
Uint32 tmngNode;
|
Uint32 tmngNode;
|
||||||
Uint32 tmngNodeGroup;
|
Uint32 tmngNodeGroup;
|
||||||
Uint32 tmngLimit;
|
Uint32 tmngLimit;
|
||||||
Uint32 i;
|
Uint32 i, j;
|
||||||
|
|
||||||
/**-----------------------------------------------------------------------
|
/**-----------------------------------------------------------------------
|
||||||
* ASSIGN ALL ACTIVE NODES INTO NODE GROUPS. HOT SPARE NODES ARE ASSIGNED
|
* ASSIGN ALL ACTIVE NODES INTO NODE GROUPS. HOT SPARE NODES ARE ASSIGNED
|
||||||
@ -11705,6 +11705,38 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[])
|
|||||||
Sysfile::setNodeGroup(mngNodeptr.i, SYSFILE->nodeGroups, mngNodeptr.p->nodeGroup);
|
Sysfile::setNodeGroup(mngNodeptr.i, SYSFILE->nodeGroups, mngNodeptr.p->nodeGroup);
|
||||||
}//if
|
}//if
|
||||||
}//for
|
}//for
|
||||||
|
|
||||||
|
for (i = 0; i<cnoOfNodeGroups; i++)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
bool alive = false;
|
||||||
|
NodeGroupRecordPtr NGPtr;
|
||||||
|
NGPtr.i = i;
|
||||||
|
ptrCheckGuard(NGPtr, MAX_NDB_NODES, nodeGroupRecord);
|
||||||
|
for (j = 0; j<NGPtr.p->nodeCount; j++)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
mngNodeptr.i = NGPtr.p->nodesInGroup[j];
|
||||||
|
ptrCheckGuard(mngNodeptr, MAX_NDB_NODES, nodeRecord);
|
||||||
|
if (checkNodeAlive(NGPtr.p->nodesInGroup[j]))
|
||||||
|
{
|
||||||
|
alive = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alive)
|
||||||
|
{
|
||||||
|
char buf[255];
|
||||||
|
BaseString::snprintf
|
||||||
|
(buf, sizeof(buf),
|
||||||
|
"Illegal initial start, no alive node in nodegroup %u", i);
|
||||||
|
progError(__LINE__,
|
||||||
|
NDBD_EXIT_SR_RESTARTCONFLICT,
|
||||||
|
buf);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}//Dbdih::makeNodeGroups()
|
}//Dbdih::makeNodeGroups()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12513,7 +12545,6 @@ void Dbdih::sendStartFragreq(Signal* signal,
|
|||||||
void Dbdih::setInitialActiveStatus()
|
void Dbdih::setInitialActiveStatus()
|
||||||
{
|
{
|
||||||
NodeRecordPtr siaNodeptr;
|
NodeRecordPtr siaNodeptr;
|
||||||
Uint32 tsiaNodeActiveStatus;
|
|
||||||
Uint32 tsiaNoActiveNodes;
|
Uint32 tsiaNoActiveNodes;
|
||||||
|
|
||||||
tsiaNoActiveNodes = csystemnodes - cnoHotSpare;
|
tsiaNoActiveNodes = csystemnodes - cnoHotSpare;
|
||||||
@ -12521,39 +12552,34 @@ void Dbdih::setInitialActiveStatus()
|
|||||||
SYSFILE->nodeStatus[i] = 0;
|
SYSFILE->nodeStatus[i] = 0;
|
||||||
for (siaNodeptr.i = 1; siaNodeptr.i < MAX_NDB_NODES; siaNodeptr.i++) {
|
for (siaNodeptr.i = 1; siaNodeptr.i < MAX_NDB_NODES; siaNodeptr.i++) {
|
||||||
ptrAss(siaNodeptr, nodeRecord);
|
ptrAss(siaNodeptr, nodeRecord);
|
||||||
if (siaNodeptr.p->nodeStatus == NodeRecord::ALIVE) {
|
switch(siaNodeptr.p->nodeStatus){
|
||||||
|
case NodeRecord::ALIVE:
|
||||||
|
case NodeRecord::DEAD:
|
||||||
if (tsiaNoActiveNodes == 0) {
|
if (tsiaNoActiveNodes == 0) {
|
||||||
jam();
|
jam();
|
||||||
siaNodeptr.p->activeStatus = Sysfile::NS_HotSpare;
|
siaNodeptr.p->activeStatus = Sysfile::NS_HotSpare;
|
||||||
} else {
|
} else {
|
||||||
jam();
|
jam();
|
||||||
tsiaNoActiveNodes = tsiaNoActiveNodes - 1;
|
tsiaNoActiveNodes = tsiaNoActiveNodes - 1;
|
||||||
siaNodeptr.p->activeStatus = Sysfile::NS_Active;
|
if (siaNodeptr.p->nodeStatus == NodeRecord::ALIVE)
|
||||||
}//if
|
{
|
||||||
} else {
|
jam();
|
||||||
jam();
|
siaNodeptr.p->activeStatus = Sysfile::NS_Active;
|
||||||
siaNodeptr.p->activeStatus = Sysfile::NS_NotDefined;
|
}
|
||||||
}//if
|
else
|
||||||
switch (siaNodeptr.p->activeStatus) {
|
{
|
||||||
case Sysfile::NS_Active:
|
siaNodeptr.p->activeStatus = Sysfile::NS_NotActive_NotTakenOver;
|
||||||
jam();
|
}
|
||||||
tsiaNodeActiveStatus = Sysfile::NS_Active;
|
}
|
||||||
break;
|
|
||||||
case Sysfile::NS_HotSpare:
|
|
||||||
jam();
|
|
||||||
tsiaNodeActiveStatus = Sysfile::NS_HotSpare;
|
|
||||||
break;
|
|
||||||
case Sysfile::NS_NotDefined:
|
|
||||||
jam();
|
|
||||||
tsiaNodeActiveStatus = Sysfile::NS_NotDefined;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ndbrequire(false);
|
jam();
|
||||||
return;
|
siaNodeptr.p->activeStatus = Sysfile::NS_NotDefined;
|
||||||
break;
|
break;
|
||||||
}//switch
|
}//if
|
||||||
Sysfile::setNodeStatus(siaNodeptr.i, SYSFILE->nodeStatus,
|
Sysfile::setNodeStatus(siaNodeptr.i,
|
||||||
tsiaNodeActiveStatus);
|
SYSFILE->nodeStatus,
|
||||||
|
siaNodeptr.p->activeStatus);
|
||||||
}//for
|
}//for
|
||||||
}//Dbdih::setInitialActiveStatus()
|
}//Dbdih::setInitialActiveStatus()
|
||||||
|
|
||||||
@ -14274,11 +14300,36 @@ void Dbdih::execWAIT_GCP_REQ(Signal* signal)
|
|||||||
jam();
|
jam();
|
||||||
conf->senderData = senderData;
|
conf->senderData = senderData;
|
||||||
conf->gcp = cnewgcp;
|
conf->gcp = cnewgcp;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
WaitGCPConf::SignalLength, JBB);
|
WaitGCPConf::SignalLength, JBB);
|
||||||
return;
|
return;
|
||||||
}//if
|
}//if
|
||||||
|
|
||||||
|
if (requestType == WaitGCPReq::BlockStartGcp)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
conf->senderData = senderData;
|
||||||
|
conf->gcp = cnewgcp;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
|
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
|
WaitGCPConf::SignalLength, JBB);
|
||||||
|
cgcpOrderBlocked = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestType == WaitGCPReq::UnblockStartGcp)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
conf->senderData = senderData;
|
||||||
|
conf->gcp = cnewgcp;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
|
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
|
WaitGCPConf::SignalLength, JBB);
|
||||||
|
cgcpOrderBlocked = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(isMaster()) {
|
if(isMaster()) {
|
||||||
/**
|
/**
|
||||||
* Master
|
* Master
|
||||||
@ -14290,6 +14341,7 @@ void Dbdih::execWAIT_GCP_REQ(Signal* signal)
|
|||||||
jam();
|
jam();
|
||||||
conf->senderData = senderData;
|
conf->senderData = senderData;
|
||||||
conf->gcp = coldgcp;
|
conf->gcp = coldgcp;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
WaitGCPConf::SignalLength, JBB);
|
WaitGCPConf::SignalLength, JBB);
|
||||||
return;
|
return;
|
||||||
@ -14376,6 +14428,7 @@ void Dbdih::execWAIT_GCP_CONF(Signal* signal)
|
|||||||
|
|
||||||
conf->senderData = ptr.p->clientData;
|
conf->senderData = ptr.p->clientData;
|
||||||
conf->gcp = gcp;
|
conf->gcp = gcp;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
sendSignal(ptr.p->clientRef, GSN_WAIT_GCP_CONF, signal,
|
sendSignal(ptr.p->clientRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
WaitGCPConf::SignalLength, JBB);
|
WaitGCPConf::SignalLength, JBB);
|
||||||
|
|
||||||
@ -14443,6 +14496,7 @@ void Dbdih::emptyWaitGCPMasterQueue(Signal* signal)
|
|||||||
|
|
||||||
c_waitGCPMasterList.next(ptr);
|
c_waitGCPMasterList.next(ptr);
|
||||||
conf->senderData = clientData;
|
conf->senderData = clientData;
|
||||||
|
conf->blockStatus = cgcpOrderBlocked;
|
||||||
sendSignal(clientRef, GSN_WAIT_GCP_CONF, signal,
|
sendSignal(clientRef, GSN_WAIT_GCP_CONF, signal,
|
||||||
WaitGCPConf::SignalLength, JBB);
|
WaitGCPConf::SignalLength, JBB);
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ private:
|
|||||||
void execWAIT_GCP_CONF(Signal* signal);
|
void execWAIT_GCP_CONF(Signal* signal);
|
||||||
|
|
||||||
void execSTOP_REQ(Signal* signal);
|
void execSTOP_REQ(Signal* signal);
|
||||||
|
void execSTOP_CONF(Signal* signal);
|
||||||
void execRESUME_REQ(Signal* signal);
|
void execRESUME_REQ(Signal* signal);
|
||||||
|
|
||||||
void execCHANGE_NODE_STATE_CONF(Signal* signal);
|
void execCHANGE_NODE_STATE_CONF(Signal* signal);
|
||||||
@ -338,6 +339,16 @@ public:
|
|||||||
void progError(int line, int cause, const char * extra) {
|
void progError(int line, int cause, const char * extra) {
|
||||||
cntr.progError(line, cause, extra);
|
cntr.progError(line, cause, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum StopNodesStep {
|
||||||
|
SR_BLOCK_GCP_START_GCP = 0,
|
||||||
|
SR_WAIT_COMPLETE_GCP = 1,
|
||||||
|
SR_UNBLOCK_GCP_START_GCP = 2,
|
||||||
|
SR_QMGR_STOP_REQ = 3,
|
||||||
|
SR_WAIT_NODE_FAILURES = 4,
|
||||||
|
SR_CLUSTER_SHUTDOWN = 12
|
||||||
|
} m_state;
|
||||||
|
SignalCounter m_stop_req_counter;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
StopRecord c_stopRec;
|
StopRecord c_stopRec;
|
||||||
|
@ -87,6 +87,7 @@ Ndbcntr::Ndbcntr(const class Configuration & conf):
|
|||||||
addRecSignal(GSN_STOP_ME_CONF, &Ndbcntr::execSTOP_ME_CONF);
|
addRecSignal(GSN_STOP_ME_CONF, &Ndbcntr::execSTOP_ME_CONF);
|
||||||
|
|
||||||
addRecSignal(GSN_STOP_REQ, &Ndbcntr::execSTOP_REQ);
|
addRecSignal(GSN_STOP_REQ, &Ndbcntr::execSTOP_REQ);
|
||||||
|
addRecSignal(GSN_STOP_CONF, &Ndbcntr::execSTOP_CONF);
|
||||||
addRecSignal(GSN_RESUME_REQ, &Ndbcntr::execRESUME_REQ);
|
addRecSignal(GSN_RESUME_REQ, &Ndbcntr::execRESUME_REQ);
|
||||||
|
|
||||||
addRecSignal(GSN_WAIT_GCP_REF, &Ndbcntr::execWAIT_GCP_REF);
|
addRecSignal(GSN_WAIT_GCP_REF, &Ndbcntr::execWAIT_GCP_REF);
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
#include <signaldata/FsRemoveReq.hpp>
|
#include <signaldata/FsRemoveReq.hpp>
|
||||||
#include <signaldata/ReadConfig.hpp>
|
#include <signaldata/ReadConfig.hpp>
|
||||||
|
|
||||||
|
#include <signaldata/FailRep.hpp>
|
||||||
|
|
||||||
#include <AttributeHeader.hpp>
|
#include <AttributeHeader.hpp>
|
||||||
#include <Configuration.hpp>
|
#include <Configuration.hpp>
|
||||||
#include <DebuggerNames.hpp>
|
#include <DebuggerNames.hpp>
|
||||||
@ -818,17 +820,9 @@ Ndbcntr::trySystemRestart(Signal* signal){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!allNodes && c_start.m_startPartialTimeout > now){
|
|
||||||
jam();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeState::StartType srType = NodeState::ST_SYSTEM_RESTART;
|
NodeState::StartType srType = NodeState::ST_SYSTEM_RESTART;
|
||||||
if(c_start.m_waiting.equal(c_start.m_withoutLog)){
|
if(c_start.m_waiting.equal(c_start.m_withoutLog))
|
||||||
if(!allNodes){
|
{
|
||||||
jam();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
jam();
|
jam();
|
||||||
srType = NodeState::ST_INITIAL_START;
|
srType = NodeState::ST_INITIAL_START;
|
||||||
c_start.m_starting = c_start.m_withoutLog; // Used for starting...
|
c_start.m_starting = c_start.m_withoutLog; // Used for starting...
|
||||||
@ -858,10 +852,6 @@ Ndbcntr::trySystemRestart(Signal* signal){
|
|||||||
ndbrequire(false); // All nodes -> partitioning, which is not allowed
|
ndbrequire(false); // All nodes -> partitioning, which is not allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c_start.m_startPartitionedTimeout > now){
|
|
||||||
jam();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1474,13 +1464,74 @@ void Ndbcntr::execNODE_FAILREP(Signal* signal)
|
|||||||
sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
|
sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
|
||||||
NodeFailRep::SignalLength, JBB);
|
NodeFailRep::SignalLength, JBB);
|
||||||
|
|
||||||
|
if (c_stopRec.stopReq.senderRef)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
switch(c_stopRec.m_state){
|
||||||
|
case StopRecord::SR_WAIT_NODE_FAILURES:
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
NdbNodeBitmask tmp;
|
||||||
|
tmp.assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
tmp.bitANDC(allFailed);
|
||||||
|
tmp.copyto(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
|
||||||
|
if (tmp.isclear())
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
if (c_stopRec.stopReq.senderRef != RNIL)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
StopConf * const stopConf = (StopConf *)&signal->theData[0];
|
||||||
|
stopConf->senderData = c_stopRec.stopReq.senderData;
|
||||||
|
stopConf->nodeState = (Uint32) NodeState::SL_SINGLEUSER;
|
||||||
|
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal,
|
||||||
|
StopConf::SignalLength, JBB);
|
||||||
|
}
|
||||||
|
|
||||||
|
c_stopRec.stopReq.senderRef = 0;
|
||||||
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
|
req->senderRef = reference();
|
||||||
|
req->senderData = StopRecord::SR_UNBLOCK_GCP_START_GCP;
|
||||||
|
req->requestType = WaitGCPReq::UnblockStartGcp;
|
||||||
|
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
|
WaitGCPReq::SignalLength, JBA);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StopRecord::SR_QMGR_STOP_REQ:
|
||||||
|
{
|
||||||
|
NdbNodeBitmask tmp;
|
||||||
|
tmp.assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
tmp.bitANDC(allFailed);
|
||||||
|
|
||||||
|
if (tmp.isclear())
|
||||||
|
{
|
||||||
|
Uint32 nodeId = allFailed.find(0);
|
||||||
|
tmp.set(nodeId);
|
||||||
|
|
||||||
|
StopConf* conf = (StopConf*)signal->getDataPtrSend();
|
||||||
|
conf->senderData = c_stopRec.stopReq.senderData;
|
||||||
|
conf->nodeId = nodeId;
|
||||||
|
sendSignal(reference(),
|
||||||
|
GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp.copyto(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signal->theData[0] = NDB_LE_NODE_FAILREP;
|
||||||
|
signal->theData[2] = 0;
|
||||||
|
|
||||||
Uint32 nodeId = 0;
|
Uint32 nodeId = 0;
|
||||||
while(!allFailed.isclear()){
|
while(!allFailed.isclear()){
|
||||||
nodeId = allFailed.find(nodeId + 1);
|
nodeId = allFailed.find(nodeId + 1);
|
||||||
allFailed.clear(nodeId);
|
allFailed.clear(nodeId);
|
||||||
signal->theData[0] = NDB_LE_NODE_FAILREP;
|
|
||||||
signal->theData[1] = nodeId;
|
signal->theData[1] = nodeId;
|
||||||
signal->theData[2] = 0;
|
|
||||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
|
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
|
||||||
}//for
|
}//for
|
||||||
|
|
||||||
@ -1924,13 +1975,15 @@ void
|
|||||||
Ndbcntr::execDUMP_STATE_ORD(Signal* signal)
|
Ndbcntr::execDUMP_STATE_ORD(Signal* signal)
|
||||||
{
|
{
|
||||||
DumpStateOrd * const & dumpState = (DumpStateOrd *)&signal->theData[0];
|
DumpStateOrd * const & dumpState = (DumpStateOrd *)&signal->theData[0];
|
||||||
if(signal->theData[0] == 13){
|
Uint32 arg = dumpState->args[0];
|
||||||
|
|
||||||
|
if(arg == 13){
|
||||||
infoEvent("Cntr: cstartPhase = %d, cinternalStartphase = %d, block = %d",
|
infoEvent("Cntr: cstartPhase = %d, cinternalStartphase = %d, block = %d",
|
||||||
cstartPhase, cinternalStartphase, cndbBlocksCount);
|
cstartPhase, cinternalStartphase, cndbBlocksCount);
|
||||||
infoEvent("Cntr: cmasterNodeId = %d", cmasterNodeId);
|
infoEvent("Cntr: cmasterNodeId = %d", cmasterNodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpState->args[0] == DumpStateOrd::NdbcntrTestStopOnError){
|
if (arg == DumpStateOrd::NdbcntrTestStopOnError){
|
||||||
if (theConfiguration.stopOnError() == true)
|
if (theConfiguration.stopOnError() == true)
|
||||||
((Configuration&)theConfiguration).stopOnError(false);
|
((Configuration&)theConfiguration).stopOnError(false);
|
||||||
|
|
||||||
@ -1943,6 +1996,28 @@ Ndbcntr::execDUMP_STATE_ORD(Signal* signal)
|
|||||||
SystemError::SignalLength, JBA);
|
SystemError::SignalLength, JBA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg == DumpStateOrd::NdbcntrStopNodes)
|
||||||
|
{
|
||||||
|
NdbNodeBitmask mask;
|
||||||
|
for(Uint32 i = 1; i<signal->getLength(); i++)
|
||||||
|
mask.set(signal->theData[i]);
|
||||||
|
|
||||||
|
StopReq* req = (StopReq*)signal->getDataPtrSend();
|
||||||
|
req->senderRef = RNIL;
|
||||||
|
req->senderData = 123;
|
||||||
|
req->requestInfo = 0;
|
||||||
|
req->singleuser = 0;
|
||||||
|
req->singleUserApi = 0;
|
||||||
|
mask.copyto(NdbNodeBitmask::Size, req->nodes);
|
||||||
|
StopReq::setPerformRestart(req->requestInfo, 1);
|
||||||
|
StopReq::setNoStart(req->requestInfo, 1);
|
||||||
|
StopReq::setStopNodes(req->requestInfo, 1);
|
||||||
|
StopReq::setStopAbort(req->requestInfo, 1);
|
||||||
|
|
||||||
|
sendSignal(reference(), GSN_STOP_REQ, signal,
|
||||||
|
StopReq::SignalLength, JBB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}//Ndbcntr::execDUMP_STATE_ORD()
|
}//Ndbcntr::execDUMP_STATE_ORD()
|
||||||
|
|
||||||
@ -2003,9 +2078,12 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
|
|||||||
Uint32 senderData = req->senderData;
|
Uint32 senderData = req->senderData;
|
||||||
BlockReference senderRef = req->senderRef;
|
BlockReference senderRef = req->senderRef;
|
||||||
bool abort = StopReq::getStopAbort(req->requestInfo);
|
bool abort = StopReq::getStopAbort(req->requestInfo);
|
||||||
|
bool stopnodes = StopReq::getStopNodes(req->requestInfo);
|
||||||
|
|
||||||
if(getNodeState().startLevel < NodeState::SL_STARTED ||
|
if(!singleuser &&
|
||||||
abort && !singleuser){
|
(getNodeState().startLevel < NodeState::SL_STARTED ||
|
||||||
|
(abort && !stopnodes)))
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Node is not started yet
|
* Node is not started yet
|
||||||
*
|
*
|
||||||
@ -2047,21 +2125,74 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
|
|||||||
else
|
else
|
||||||
ref->errorCode = StopRef::NodeShutdownInProgress;
|
ref->errorCode = StopRef::NodeShutdownInProgress;
|
||||||
ref->senderData = senderData;
|
ref->senderData = senderData;
|
||||||
sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
ref->masterNodeId = cmasterNodeId;
|
||||||
|
|
||||||
|
if (senderRef != RNIL)
|
||||||
|
sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopnodes && !abort)
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
ref->errorCode = StopRef::UnsupportedNodeShutdown;
|
||||||
|
ref->senderData = senderData;
|
||||||
|
ref->masterNodeId = cmasterNodeId;
|
||||||
|
if (senderRef != RNIL)
|
||||||
|
sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopnodes && cmasterNodeId != getOwnNodeId())
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
ref->errorCode = StopRef::MultiNodeShutdownNotMaster;
|
||||||
|
ref->senderData = senderData;
|
||||||
|
ref->masterNodeId = cmasterNodeId;
|
||||||
|
if (senderRef != RNIL)
|
||||||
|
sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
c_stopRec.stopReq = * req;
|
c_stopRec.stopReq = * req;
|
||||||
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
|
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
|
||||||
|
|
||||||
if(!singleuser) {
|
if (stopnodes)
|
||||||
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo)) {
|
{
|
||||||
|
jam();
|
||||||
|
|
||||||
|
if(!c_stopRec.checkNodeFail(signal))
|
||||||
|
{
|
||||||
jam();
|
jam();
|
||||||
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[100];
|
||||||
|
NdbNodeBitmask mask;
|
||||||
|
mask.assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
infoEvent("Initiating shutdown abort of %s", mask.getText(buf));
|
||||||
|
ndbout_c("Initiating shutdown abort of %s", mask.getText(buf));
|
||||||
|
|
||||||
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
|
req->senderRef = reference();
|
||||||
|
req->senderData = StopRecord::SR_BLOCK_GCP_START_GCP;
|
||||||
|
req->requestType = WaitGCPReq::BlockStartGcp;
|
||||||
|
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
|
WaitGCPReq::SignalLength, JBB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(!singleuser)
|
||||||
|
{
|
||||||
|
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo))
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo))
|
||||||
|
{
|
||||||
((Configuration&)theConfiguration).stopOnError(false);
|
((Configuration&)theConfiguration).stopOnError(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!c_stopRec.checkNodeFail(signal)){
|
if(!c_stopRec.checkNodeFail(signal))
|
||||||
|
{
|
||||||
jam();
|
jam();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2131,7 +2262,17 @@ Ndbcntr::StopRecord::checkNodeFail(Signal* signal){
|
|||||||
*/
|
*/
|
||||||
NodeBitmask ndbMask;
|
NodeBitmask ndbMask;
|
||||||
ndbMask.assign(cntr.c_startedNodes);
|
ndbMask.assign(cntr.c_startedNodes);
|
||||||
ndbMask.clear(cntr.getOwnNodeId());
|
|
||||||
|
if (StopReq::getStopNodes(stopReq.requestInfo))
|
||||||
|
{
|
||||||
|
NdbNodeBitmask tmp;
|
||||||
|
tmp.assign(NdbNodeBitmask::Size, stopReq.nodes);
|
||||||
|
ndbMask.bitANDC(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ndbMask.clear(cntr.getOwnNodeId());
|
||||||
|
}
|
||||||
|
|
||||||
CheckNodeGroups* sd = (CheckNodeGroups*)&signal->theData[0];
|
CheckNodeGroups* sd = (CheckNodeGroups*)&signal->theData[0];
|
||||||
sd->blockRef = cntr.reference();
|
sd->blockRef = cntr.reference();
|
||||||
@ -2151,9 +2292,11 @@ Ndbcntr::StopRecord::checkNodeFail(Signal* signal){
|
|||||||
|
|
||||||
ref->senderData = stopReq.senderData;
|
ref->senderData = stopReq.senderData;
|
||||||
ref->errorCode = StopRef::NodeShutdownWouldCauseSystemCrash;
|
ref->errorCode = StopRef::NodeShutdownWouldCauseSystemCrash;
|
||||||
|
ref->masterNodeId = cntr.cmasterNodeId;
|
||||||
|
|
||||||
const BlockReference bref = stopReq.senderRef;
|
const BlockReference bref = stopReq.senderRef;
|
||||||
cntr.sendSignal(bref, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
if (bref != RNIL)
|
||||||
|
cntr.sendSignal(bref, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||||
|
|
||||||
stopReq.senderRef = 0;
|
stopReq.senderRef = 0;
|
||||||
|
|
||||||
@ -2203,23 +2346,23 @@ Ndbcntr::StopRecord::checkTcTimeout(Signal* signal){
|
|||||||
if(stopReq.getSystemStop(stopReq.requestInfo) || stopReq.singleuser){
|
if(stopReq.getSystemStop(stopReq.requestInfo) || stopReq.singleuser){
|
||||||
jam();
|
jam();
|
||||||
if(stopReq.singleuser)
|
if(stopReq.singleuser)
|
||||||
{
|
{
|
||||||
jam();
|
jam();
|
||||||
AbortAllReq * req = (AbortAllReq*)&signal->theData[0];
|
AbortAllReq * req = (AbortAllReq*)&signal->theData[0];
|
||||||
req->senderRef = cntr.reference();
|
req->senderRef = cntr.reference();
|
||||||
req->senderData = 12;
|
req->senderData = 12;
|
||||||
cntr.sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal,
|
cntr.sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal,
|
||||||
AbortAllReq::SignalLength, JBB);
|
AbortAllReq::SignalLength, JBB);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
req->senderRef = cntr.reference();
|
req->senderRef = cntr.reference();
|
||||||
req->senderData = 12;
|
req->senderData = StopRecord::SR_CLUSTER_SHUTDOWN;
|
||||||
req->requestType = WaitGCPReq::CompleteForceStart;
|
req->requestType = WaitGCPReq::CompleteForceStart;
|
||||||
cntr.sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
cntr.sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
WaitGCPReq::SignalLength, JBB);
|
WaitGCPReq::SignalLength, JBB);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jam();
|
jam();
|
||||||
StopPermReq * req = (StopPermReq*)&signal->theData[0];
|
StopPermReq * req = (StopPermReq*)&signal->theData[0];
|
||||||
@ -2298,6 +2441,7 @@ void Ndbcntr::execABORT_ALL_REF(Signal* signal){
|
|||||||
StopRef * const stopRef = (StopRef *)&signal->theData[0];
|
StopRef * const stopRef = (StopRef *)&signal->theData[0];
|
||||||
stopRef->senderData = c_stopRec.stopReq.senderData;
|
stopRef->senderData = c_stopRec.stopReq.senderData;
|
||||||
stopRef->errorCode = StopRef::TransactionAbortFailed;
|
stopRef->errorCode = StopRef::TransactionAbortFailed;
|
||||||
|
stopRef->masterNodeId = cmasterNodeId;
|
||||||
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2381,7 +2525,7 @@ void Ndbcntr::execWAIT_GCP_REF(Signal* signal){
|
|||||||
|
|
||||||
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
req->senderRef = reference();
|
req->senderRef = reference();
|
||||||
req->senderData = 12;
|
req->senderData = StopRecord::SR_CLUSTER_SHUTDOWN;
|
||||||
req->requestType = WaitGCPReq::CompleteForceStart;
|
req->requestType = WaitGCPReq::CompleteForceStart;
|
||||||
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
WaitGCPReq::SignalLength, JBB);
|
WaitGCPReq::SignalLength, JBB);
|
||||||
@ -2390,29 +2534,129 @@ void Ndbcntr::execWAIT_GCP_REF(Signal* signal){
|
|||||||
void Ndbcntr::execWAIT_GCP_CONF(Signal* signal){
|
void Ndbcntr::execWAIT_GCP_CONF(Signal* signal){
|
||||||
jamEntry();
|
jamEntry();
|
||||||
|
|
||||||
ndbrequire(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
|
WaitGCPConf* conf = (WaitGCPConf*)signal->getDataPtr();
|
||||||
NodeState newState(NodeState::SL_STOPPING_3, true);
|
|
||||||
|
|
||||||
/**
|
switch(conf->senderData){
|
||||||
* Inform QMGR so that arbitrator won't kill us
|
case StopRecord::SR_BLOCK_GCP_START_GCP:
|
||||||
*/
|
{
|
||||||
NodeStateRep * rep = (NodeStateRep *)&signal->theData[0];
|
jam();
|
||||||
rep->nodeState = newState;
|
/**
|
||||||
rep->nodeState.masterNodeId = cmasterNodeId;
|
*
|
||||||
rep->nodeState.setNodeGroup(c_nodeGroup);
|
*/
|
||||||
EXECUTE_DIRECT(QMGR, GSN_NODE_STATE_REP, signal, NodeStateRep::SignalLength);
|
if(!c_stopRec.checkNodeFail(signal))
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
goto unblock;
|
||||||
|
}
|
||||||
|
|
||||||
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
|
req->senderRef = reference();
|
||||||
|
req->senderData = StopRecord::SR_WAIT_COMPLETE_GCP;
|
||||||
|
req->requestType = WaitGCPReq::CompleteIfRunning;
|
||||||
|
|
||||||
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
|
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
jam();
|
WaitGCPReq::SignalLength, JBB);
|
||||||
StartOrd * startOrd = (StartOrd *)&signal->theData[0];
|
return;
|
||||||
startOrd->restartInfo = c_stopRec.stopReq.requestInfo;
|
}
|
||||||
sendSignalWithDelay(CMVMI_REF, GSN_START_ORD, signal, 500,
|
case StopRecord::SR_UNBLOCK_GCP_START_GCP:
|
||||||
StartOrd::SignalLength);
|
{
|
||||||
} else {
|
jam();
|
||||||
jam();
|
return;
|
||||||
sendSignalWithDelay(CMVMI_REF, GSN_STOP_ORD, signal, 500, 1);
|
}
|
||||||
|
case StopRecord::SR_WAIT_COMPLETE_GCP:
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
if(!c_stopRec.checkNodeFail(signal))
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
goto unblock;
|
||||||
|
}
|
||||||
|
|
||||||
|
NdbNodeBitmask tmp;
|
||||||
|
tmp.assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
c_stopRec.m_stop_req_counter = tmp;
|
||||||
|
NodeReceiverGroup rg(QMGR, tmp);
|
||||||
|
StopReq * stopReq = (StopReq *)&signal->theData[0];
|
||||||
|
* stopReq = c_stopRec.stopReq;
|
||||||
|
stopReq->senderRef = reference();
|
||||||
|
sendSignal(rg, GSN_STOP_REQ, signal, StopReq::SignalLength, JBA);
|
||||||
|
c_stopRec.m_state = StopRecord::SR_QMGR_STOP_REQ;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case StopRecord::SR_CLUSTER_SHUTDOWN:
|
||||||
|
{
|
||||||
|
jam();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ndbrequire(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
|
||||||
|
NodeState newState(NodeState::SL_STOPPING_3, true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inform QMGR so that arbitrator won't kill us
|
||||||
|
*/
|
||||||
|
NodeStateRep * rep = (NodeStateRep *)&signal->theData[0];
|
||||||
|
rep->nodeState = newState;
|
||||||
|
rep->nodeState.masterNodeId = cmasterNodeId;
|
||||||
|
rep->nodeState.setNodeGroup(c_nodeGroup);
|
||||||
|
EXECUTE_DIRECT(QMGR, GSN_NODE_STATE_REP, signal,
|
||||||
|
NodeStateRep::SignalLength);
|
||||||
|
|
||||||
|
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
|
||||||
|
jam();
|
||||||
|
StartOrd * startOrd = (StartOrd *)&signal->theData[0];
|
||||||
|
startOrd->restartInfo = c_stopRec.stopReq.requestInfo;
|
||||||
|
sendSignalWithDelay(CMVMI_REF, GSN_START_ORD, signal, 500,
|
||||||
|
StartOrd::SignalLength);
|
||||||
|
} else {
|
||||||
|
jam();
|
||||||
|
sendSignalWithDelay(CMVMI_REF, GSN_STOP_ORD, signal, 500, 1);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unblock:
|
||||||
|
WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];
|
||||||
|
req->senderRef = reference();
|
||||||
|
req->senderData = StopRecord::SR_UNBLOCK_GCP_START_GCP;
|
||||||
|
req->requestType = WaitGCPReq::UnblockStartGcp;
|
||||||
|
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
|
||||||
|
WaitGCPReq::SignalLength, JBB);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Ndbcntr::execSTOP_CONF(Signal* signal)
|
||||||
|
{
|
||||||
|
jamEntry();
|
||||||
|
StopConf *conf = (StopConf*)signal->getDataPtr();
|
||||||
|
ndbrequire(c_stopRec.m_state == StopRecord::SR_QMGR_STOP_REQ);
|
||||||
|
c_stopRec.m_stop_req_counter.clearWaitingFor(conf->nodeId);
|
||||||
|
if (c_stopRec.m_stop_req_counter.done())
|
||||||
|
{
|
||||||
|
char buf[100];
|
||||||
|
NdbNodeBitmask mask;
|
||||||
|
mask.assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
|
||||||
|
infoEvent("Stopping of %s", mask.getText(buf));
|
||||||
|
ndbout_c("Stopping of %s", mask.getText(buf));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kill any node...
|
||||||
|
*/
|
||||||
|
FailRep * const failRep = (FailRep *)&signal->theData[0];
|
||||||
|
failRep->failCause = FailRep::ZMULTI_NODE_SHUTDOWN;
|
||||||
|
NodeReceiverGroup rg(QMGR, c_clusterNodes);
|
||||||
|
Uint32 nodeId = 0;
|
||||||
|
while ((nodeId = NdbNodeBitmask::find(c_stopRec.stopReq.nodes, nodeId+1))
|
||||||
|
!= NdbNodeBitmask::NotFound)
|
||||||
|
{
|
||||||
|
failRep->failNodeId = nodeId;
|
||||||
|
sendSignal(rg, GSN_FAIL_REP, signal, FailRep::SignalLength, JBA);
|
||||||
|
}
|
||||||
|
c_stopRec.m_state = StopRecord::SR_WAIT_NODE_FAILURES;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ndbcntr::execSTTORRY(Signal* signal){
|
void Ndbcntr::execSTTORRY(Signal* signal){
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <signaldata/CmRegSignalData.hpp>
|
#include <signaldata/CmRegSignalData.hpp>
|
||||||
#include <signaldata/ApiRegSignalData.hpp>
|
#include <signaldata/ApiRegSignalData.hpp>
|
||||||
#include <signaldata/FailRep.hpp>
|
#include <signaldata/FailRep.hpp>
|
||||||
|
#include <signaldata/StopReq.hpp>
|
||||||
|
|
||||||
#include "timer.hpp"
|
#include "timer.hpp"
|
||||||
|
|
||||||
@ -49,6 +50,7 @@
|
|||||||
#define ZAPI_HB_HANDLING 3
|
#define ZAPI_HB_HANDLING 3
|
||||||
#define ZTIMER_HANDLING 4
|
#define ZTIMER_HANDLING 4
|
||||||
#define ZARBIT_HANDLING 5
|
#define ZARBIT_HANDLING 5
|
||||||
|
#define ZSTART_FAILURE_LIMIT 6
|
||||||
|
|
||||||
/* Error Codes ------------------------------*/
|
/* Error Codes ------------------------------*/
|
||||||
#define ZERRTOOMANY 1101
|
#define ZERRTOOMANY 1101
|
||||||
@ -100,18 +102,42 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct StartRecord {
|
struct StartRecord {
|
||||||
void reset(){ m_startKey++; m_startNode = 0;}
|
void reset(){
|
||||||
|
m_startKey++;
|
||||||
|
m_startNode = 0;
|
||||||
|
m_gsn = RNIL;
|
||||||
|
m_nodes.clearWaitingFor();
|
||||||
|
}
|
||||||
Uint32 m_startKey;
|
Uint32 m_startKey;
|
||||||
Uint32 m_startNode;
|
Uint32 m_startNode;
|
||||||
Uint64 m_startTimeout;
|
Uint64 m_startTimeout;
|
||||||
|
|
||||||
Uint32 m_gsn;
|
Uint32 m_gsn;
|
||||||
SignalCounter m_nodes;
|
SignalCounter m_nodes;
|
||||||
} c_start;
|
Uint32 m_latest_gci;
|
||||||
|
|
||||||
|
Uint32 m_start_type;
|
||||||
|
NdbNodeBitmask m_skip_nodes;
|
||||||
|
NdbNodeBitmask m_starting_nodes;
|
||||||
|
NdbNodeBitmask m_starting_nodes_w_log;
|
||||||
|
|
||||||
|
Uint16 m_president_candidate;
|
||||||
|
Uint32 m_president_candidate_gci;
|
||||||
|
Uint16 m_regReqReqSent;
|
||||||
|
Uint16 m_regReqReqRecv;
|
||||||
|
} c_start;
|
||||||
|
|
||||||
NdbNodeBitmask c_definedNodes; // DB nodes in config
|
NdbNodeBitmask c_definedNodes; // DB nodes in config
|
||||||
NdbNodeBitmask c_clusterNodes; // DB nodes in cluster
|
NdbNodeBitmask c_clusterNodes; // DB nodes in cluster
|
||||||
NodeBitmask c_connectedNodes; // All kinds of connected nodes
|
NodeBitmask c_connectedNodes; // All kinds of connected nodes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nodes which we're checking for partitioned cluster
|
||||||
|
*
|
||||||
|
* i.e. nodes that connect to use, when we already have elected president
|
||||||
|
*/
|
||||||
|
NdbNodeBitmask c_readnodes_nodes;
|
||||||
|
|
||||||
Uint32 c_maxDynamicId;
|
Uint32 c_maxDynamicId;
|
||||||
|
|
||||||
// Records
|
// Records
|
||||||
@ -204,6 +230,7 @@ private:
|
|||||||
void execPRES_TOCONF(Signal* signal);
|
void execPRES_TOCONF(Signal* signal);
|
||||||
void execDISCONNECT_REP(Signal* signal);
|
void execDISCONNECT_REP(Signal* signal);
|
||||||
void execSYSTEM_ERROR(Signal* signal);
|
void execSYSTEM_ERROR(Signal* signal);
|
||||||
|
void execSTOP_REQ(Signal* signal);
|
||||||
|
|
||||||
// Received signals
|
// Received signals
|
||||||
void execDUMP_STATE_ORD(Signal* signal);
|
void execDUMP_STATE_ORD(Signal* signal);
|
||||||
@ -218,7 +245,12 @@ private:
|
|||||||
void execREAD_NODESREQ(Signal* signal);
|
void execREAD_NODESREQ(Signal* signal);
|
||||||
void execSET_VAR_REQ(Signal* signal);
|
void execSET_VAR_REQ(Signal* signal);
|
||||||
|
|
||||||
|
void execREAD_NODESREF(Signal* signal);
|
||||||
|
void execREAD_NODESCONF(Signal* signal);
|
||||||
|
|
||||||
|
void execDIH_RESTARTREF(Signal* signal);
|
||||||
|
void execDIH_RESTARTCONF(Signal* signal);
|
||||||
|
|
||||||
void execAPI_VERSION_REQ(Signal* signal);
|
void execAPI_VERSION_REQ(Signal* signal);
|
||||||
void execAPI_BROADCAST_REP(Signal* signal);
|
void execAPI_BROADCAST_REP(Signal* signal);
|
||||||
|
|
||||||
@ -234,6 +266,9 @@ private:
|
|||||||
void execARBIT_STOPREP(Signal* signal);
|
void execARBIT_STOPREP(Signal* signal);
|
||||||
|
|
||||||
// Statement blocks
|
// Statement blocks
|
||||||
|
void check_readnodes_reply(Signal* signal, Uint32 nodeId, Uint32 gsn);
|
||||||
|
Uint32 check_startup(Signal* signal);
|
||||||
|
|
||||||
void node_failed(Signal* signal, Uint16 aFailedNode);
|
void node_failed(Signal* signal, Uint16 aFailedNode);
|
||||||
void checkStartInterface(Signal* signal);
|
void checkStartInterface(Signal* signal);
|
||||||
void failReport(Signal* signal,
|
void failReport(Signal* signal,
|
||||||
@ -251,8 +286,9 @@ private:
|
|||||||
|
|
||||||
// Generated statement blocks
|
// Generated statement blocks
|
||||||
void startphase1(Signal* signal);
|
void startphase1(Signal* signal);
|
||||||
void electionWon();
|
void electionWon(Signal* signal);
|
||||||
void cmInfoconf010Lab(Signal* signal);
|
void cmInfoconf010Lab(Signal* signal);
|
||||||
|
|
||||||
void apiHbHandlingLab(Signal* signal);
|
void apiHbHandlingLab(Signal* signal);
|
||||||
void timerHandlingLab(Signal* signal);
|
void timerHandlingLab(Signal* signal);
|
||||||
void hbReceivedLab(Signal* signal);
|
void hbReceivedLab(Signal* signal);
|
||||||
@ -354,12 +390,12 @@ private:
|
|||||||
/* Status flags ----------------------------------*/
|
/* Status flags ----------------------------------*/
|
||||||
|
|
||||||
Uint32 c_restartPartialTimeout;
|
Uint32 c_restartPartialTimeout;
|
||||||
|
Uint32 c_restartPartionedTimeout;
|
||||||
|
Uint32 c_restartFailureTimeout;
|
||||||
|
Uint64 c_start_election_time;
|
||||||
|
|
||||||
Uint16 creadyDistCom;
|
Uint16 creadyDistCom;
|
||||||
Uint16 c_regReqReqSent;
|
|
||||||
Uint16 c_regReqReqRecv;
|
|
||||||
Uint64 c_stopElectionTime;
|
|
||||||
Uint16 cpresidentCandidate;
|
|
||||||
Uint16 cdelayRegreq;
|
Uint16 cdelayRegreq;
|
||||||
Uint16 cpresidentAlive;
|
Uint16 cpresidentAlive;
|
||||||
Uint16 cnoFailedNodes;
|
Uint16 cnoFailedNodes;
|
||||||
@ -387,7 +423,9 @@ private:
|
|||||||
Uint16 cfailedNodes[MAX_NDB_NODES];
|
Uint16 cfailedNodes[MAX_NDB_NODES];
|
||||||
Uint16 cprepFailedNodes[MAX_NDB_NODES];
|
Uint16 cprepFailedNodes[MAX_NDB_NODES];
|
||||||
Uint16 ccommitFailedNodes[MAX_NDB_NODES];
|
Uint16 ccommitFailedNodes[MAX_NDB_NODES];
|
||||||
|
|
||||||
|
StopReq c_stopReq;
|
||||||
|
bool check_multi_node_shutdown(Signal* signal);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,9 +35,8 @@ void Qmgr::initData()
|
|||||||
|
|
||||||
Uint32 hbDBAPI = 500;
|
Uint32 hbDBAPI = 500;
|
||||||
setHbApiDelay(hbDBAPI);
|
setHbApiDelay(hbDBAPI);
|
||||||
|
|
||||||
c_connectedNodes.clear();
|
|
||||||
c_connectedNodes.set(getOwnNodeId());
|
c_connectedNodes.set(getOwnNodeId());
|
||||||
|
c_stopReq.senderRef = 0;
|
||||||
}//Qmgr::initData()
|
}//Qmgr::initData()
|
||||||
|
|
||||||
void Qmgr::initRecords()
|
void Qmgr::initRecords()
|
||||||
@ -52,6 +51,7 @@ Qmgr::Qmgr(const class Configuration & conf)
|
|||||||
|
|
||||||
// Transit signals
|
// Transit signals
|
||||||
addRecSignal(GSN_DUMP_STATE_ORD, &Qmgr::execDUMP_STATE_ORD);
|
addRecSignal(GSN_DUMP_STATE_ORD, &Qmgr::execDUMP_STATE_ORD);
|
||||||
|
addRecSignal(GSN_STOP_REQ, &Qmgr::execSTOP_REQ);
|
||||||
addRecSignal(GSN_DEBUG_SIG, &Qmgr::execDEBUG_SIG);
|
addRecSignal(GSN_DEBUG_SIG, &Qmgr::execDEBUG_SIG);
|
||||||
addRecSignal(GSN_CONTINUEB, &Qmgr::execCONTINUEB);
|
addRecSignal(GSN_CONTINUEB, &Qmgr::execCONTINUEB);
|
||||||
addRecSignal(GSN_CM_HEARTBEAT, &Qmgr::execCM_HEARTBEAT);
|
addRecSignal(GSN_CM_HEARTBEAT, &Qmgr::execCM_HEARTBEAT);
|
||||||
@ -96,6 +96,12 @@ Qmgr::Qmgr(const class Configuration & conf)
|
|||||||
addRecSignal(GSN_ARBIT_CHOOSEREF, &Qmgr::execARBIT_CHOOSEREF);
|
addRecSignal(GSN_ARBIT_CHOOSEREF, &Qmgr::execARBIT_CHOOSEREF);
|
||||||
addRecSignal(GSN_ARBIT_STOPREP, &Qmgr::execARBIT_STOPREP);
|
addRecSignal(GSN_ARBIT_STOPREP, &Qmgr::execARBIT_STOPREP);
|
||||||
|
|
||||||
|
addRecSignal(GSN_READ_NODESREF, &Qmgr::execREAD_NODESREF);
|
||||||
|
addRecSignal(GSN_READ_NODESCONF, &Qmgr::execREAD_NODESCONF);
|
||||||
|
|
||||||
|
addRecSignal(GSN_DIH_RESTARTREF, &Qmgr::execDIH_RESTARTREF);
|
||||||
|
addRecSignal(GSN_DIH_RESTARTCONF, &Qmgr::execDIH_RESTARTCONF);
|
||||||
|
|
||||||
initData();
|
initData();
|
||||||
}//Qmgr::Qmgr()
|
}//Qmgr::Qmgr()
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -55,6 +55,12 @@ enum ndbd_options {
|
|||||||
NDB_STD_OPTS_VARS;
|
NDB_STD_OPTS_VARS;
|
||||||
// XXX should be my_bool ???
|
// XXX should be my_bool ???
|
||||||
static int _daemon, _no_daemon, _foreground, _initial, _no_start;
|
static int _daemon, _no_daemon, _foreground, _initial, _no_start;
|
||||||
|
static int _initialstart;
|
||||||
|
static const char* _nowait_nodes;
|
||||||
|
|
||||||
|
extern Uint32 g_start_type;
|
||||||
|
extern NdbNodeBitmask g_nowait_nodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments to NDB process
|
* Arguments to NDB process
|
||||||
*/
|
*/
|
||||||
@ -82,6 +88,14 @@ static struct my_option my_long_options[] =
|
|||||||
" (implies --nodaemon)",
|
" (implies --nodaemon)",
|
||||||
(gptr*) &_foreground, (gptr*) &_foreground, 0,
|
(gptr*) &_foreground, (gptr*) &_foreground, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
{ "nowait-nodes", NO_ARG,
|
||||||
|
"Nodes that will not be waited for during start",
|
||||||
|
(gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0,
|
||||||
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
{ "initial-start", NO_ARG,
|
||||||
|
"Perform initial start",
|
||||||
|
(gptr*) &_initialstart, (gptr*) &_initialstart, 0,
|
||||||
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
static void short_usage_sub(void)
|
static void short_usage_sub(void)
|
||||||
@ -150,6 +164,37 @@ Configuration::init(int argc, char** argv)
|
|||||||
|
|
||||||
globalData.ownId= 0;
|
globalData.ownId= 0;
|
||||||
|
|
||||||
|
if (_nowait_nodes)
|
||||||
|
{
|
||||||
|
BaseString str(_nowait_nodes);
|
||||||
|
Vector<BaseString> arr;
|
||||||
|
str.split(arr, ",");
|
||||||
|
for (Uint32 i = 0; i<arr.size(); i++)
|
||||||
|
{
|
||||||
|
char *endptr = 0;
|
||||||
|
long val = strtol(arr[i].c_str(), &endptr, 10);
|
||||||
|
if (*endptr)
|
||||||
|
{
|
||||||
|
ndbout_c("Unable to parse nowait-nodes argument: %s : %s",
|
||||||
|
arr[i].c_str(), _nowait_nodes);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if (! (val > 0 && val < MAX_NDB_NODES))
|
||||||
|
{
|
||||||
|
ndbout_c("Invalid nodeid specified in nowait-nodes: %d : %s",
|
||||||
|
val, _nowait_nodes);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
g_nowait_nodes.set(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_initialstart)
|
||||||
|
{
|
||||||
|
_initialStart = true;
|
||||||
|
g_start_type |= (1 << NodeState::ST_INITIAL_START);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mgmapi.h>
|
#include <mgmapi.h>
|
||||||
|
#include <util/BaseString.hpp>
|
||||||
|
|
||||||
class MgmtSrvr;
|
class MgmtSrvr;
|
||||||
|
|
||||||
@ -70,6 +71,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr);
|
void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr);
|
||||||
|
|
||||||
|
void executeCommand(Vector<BaseString> &command_list,
|
||||||
|
unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes);
|
||||||
/**
|
/**
|
||||||
* Parse the block specification part of the LOG* commands,
|
* Parse the block specification part of the LOG* commands,
|
||||||
* things after LOG*: [BLOCK = {ALL|<blockName>+}]
|
* things after LOG*: [BLOCK = {ALL|<blockName>+}]
|
||||||
@ -104,10 +108,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void executeStop(int processId, const char* parameters, bool all);
|
void executeStop(int processId, const char* parameters, bool all);
|
||||||
|
void executeStop(Vector<BaseString> &command_list, unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes);
|
||||||
void executeEnterSingleUser(char* parameters);
|
void executeEnterSingleUser(char* parameters);
|
||||||
void executeExitSingleUser(char* parameters);
|
void executeExitSingleUser(char* parameters);
|
||||||
void executeStart(int processId, const char* parameters, bool all);
|
void executeStart(int processId, const char* parameters, bool all);
|
||||||
void executeRestart(int processId, const char* parameters, bool all);
|
void executeRestart(int processId, const char* parameters, bool all);
|
||||||
|
void executeRestart(Vector<BaseString> &command_list, unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes);
|
||||||
void executeLogLevel(int processId, const char* parameters, bool all);
|
void executeLogLevel(int processId, const char* parameters, bool all);
|
||||||
void executeError(int processId, const char* parameters, bool all);
|
void executeError(int processId, const char* parameters, bool all);
|
||||||
void executeLog(int processId, const char* parameters, bool all);
|
void executeLog(int processId, const char* parameters, bool all);
|
||||||
@ -643,9 +651,16 @@ CommandInterpreter::execute_impl(const char *_line)
|
|||||||
}
|
}
|
||||||
} while (do_continue);
|
} while (do_continue);
|
||||||
// if there is anything in the line proceed
|
// if there is anything in the line proceed
|
||||||
|
Vector<BaseString> command_list;
|
||||||
|
{
|
||||||
|
BaseString tmp(line);
|
||||||
|
tmp.split(command_list);
|
||||||
|
for (unsigned i= 0; i < command_list.size();)
|
||||||
|
command_list[i].c_str()[0] ? i++ : (command_list.erase(i),0);
|
||||||
|
}
|
||||||
char* firstToken = strtok(line, " ");
|
char* firstToken = strtok(line, " ");
|
||||||
char* allAfterFirstToken = strtok(NULL, "");
|
char* allAfterFirstToken = strtok(NULL, "");
|
||||||
|
|
||||||
if (strcasecmp(firstToken, "HELP") == 0 ||
|
if (strcasecmp(firstToken, "HELP") == 0 ||
|
||||||
strcasecmp(firstToken, "?") == 0) {
|
strcasecmp(firstToken, "?") == 0) {
|
||||||
executeHelp(allAfterFirstToken);
|
executeHelp(allAfterFirstToken);
|
||||||
@ -723,22 +738,45 @@ CommandInterpreter::execute_impl(const char *_line)
|
|||||||
analyseAfterFirstToken(-1, allAfterFirstToken);
|
analyseAfterFirstToken(-1, allAfterFirstToken);
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
* First token should be a digit, node ID
|
* First tokens should be digits, node ID's
|
||||||
*/
|
*/
|
||||||
int nodeId;
|
int node_ids[MAX_NODES];
|
||||||
|
unsigned pos;
|
||||||
if (! convert(firstToken, nodeId)) {
|
for (pos= 0; pos < command_list.size(); pos++)
|
||||||
|
{
|
||||||
|
int node_id;
|
||||||
|
if (convert(command_list[pos].c_str(), node_id))
|
||||||
|
{
|
||||||
|
if (node_id <= 0) {
|
||||||
|
ndbout << "Invalid node ID: " << command_list[pos].c_str()
|
||||||
|
<< "." << endl;
|
||||||
|
DBUG_RETURN(true);
|
||||||
|
}
|
||||||
|
node_ids[pos]= node_id;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int no_of_nodes= pos;
|
||||||
|
if (no_of_nodes == 0)
|
||||||
|
{
|
||||||
|
/* No digit found */
|
||||||
invalid_command(_line);
|
invalid_command(_line);
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
}
|
}
|
||||||
|
if (pos == command_list.size())
|
||||||
if (nodeId <= 0) {
|
{
|
||||||
ndbout << "Invalid node ID: " << firstToken << "." << endl;
|
/* No command found */
|
||||||
|
invalid_command(_line);
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
}
|
}
|
||||||
|
if (no_of_nodes == 1)
|
||||||
analyseAfterFirstToken(nodeId, allAfterFirstToken);
|
{
|
||||||
|
analyseAfterFirstToken(node_ids[0], allAfterFirstToken);
|
||||||
|
DBUG_RETURN(true);
|
||||||
|
}
|
||||||
|
executeCommand(command_list, pos, node_ids, no_of_nodes);
|
||||||
|
DBUG_RETURN(true);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
}
|
}
|
||||||
@ -808,6 +846,27 @@ CommandInterpreter::analyseAfterFirstToken(int processId,
|
|||||||
ndbout << endl;
|
ndbout << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandInterpreter::executeCommand(Vector<BaseString> &command_list,
|
||||||
|
unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes)
|
||||||
|
{
|
||||||
|
const char *cmd= command_list[command_pos].c_str();
|
||||||
|
if (strcasecmp("STOP", cmd) == 0)
|
||||||
|
{
|
||||||
|
executeStop(command_list, command_pos+1, node_ids, no_of_nodes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (strcasecmp("RESTART", cmd) == 0)
|
||||||
|
{
|
||||||
|
executeRestart(command_list, command_pos+1, node_ids, no_of_nodes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ndbout_c("Invalid command: '%s' after multi node id list. "
|
||||||
|
"Expected STOP or RESTART.", cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get next nodeid larger than the give node_id. node_id will be
|
* Get next nodeid larger than the give node_id. node_id will be
|
||||||
* set to the next node_id in the list. node_id should be set
|
* set to the next node_id in the list. node_id should be set
|
||||||
@ -1400,24 +1459,60 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
void
|
void
|
||||||
CommandInterpreter::executeStop(int processId, const char *, bool all)
|
CommandInterpreter::executeStop(int processId, const char *parameters,
|
||||||
|
bool all)
|
||||||
{
|
{
|
||||||
int result = 0;
|
Vector<BaseString> command_list;
|
||||||
if(all) {
|
if (parameters)
|
||||||
result = ndb_mgm_stop(m_mgmsrv, 0, 0);
|
{
|
||||||
} else {
|
BaseString tmp(parameters);
|
||||||
result = ndb_mgm_stop(m_mgmsrv, 1, &processId);
|
tmp.split(command_list);
|
||||||
|
for (unsigned i= 0; i < command_list.size();)
|
||||||
|
command_list[i].c_str()[0] ? i++ : (command_list.erase(i),0);
|
||||||
}
|
}
|
||||||
if (result < 0) {
|
if (all)
|
||||||
ndbout << "Shutdown failed." << endl;
|
executeStop(command_list, 0, 0, 0);
|
||||||
printError();
|
else
|
||||||
} else
|
executeStop(command_list, 0, &processId, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandInterpreter::executeStop(Vector<BaseString> &command_list,
|
||||||
|
unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes)
|
||||||
|
{
|
||||||
|
int abort= 0;
|
||||||
|
for (; command_pos < command_list.size(); command_pos++)
|
||||||
|
{
|
||||||
|
const char *item= command_list[command_pos].c_str();
|
||||||
|
if (strcasecmp(item, "-A") == 0)
|
||||||
{
|
{
|
||||||
if(all)
|
abort= 1;
|
||||||
ndbout << "NDB Cluster has shutdown." << endl;
|
continue;
|
||||||
else
|
|
||||||
ndbout << "Node " << processId << " has shutdown." << endl;
|
|
||||||
}
|
}
|
||||||
|
ndbout_c("Invalid option: %s. Expecting -A after STOP",
|
||||||
|
item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result= ndb_mgm_stop2(m_mgmsrv, no_of_nodes, node_ids, abort);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
ndbout_c("Shutdown failed.");
|
||||||
|
printError();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (node_ids == 0)
|
||||||
|
ndbout_c("NDB Cluster has shutdown.");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ndbout << "Node";
|
||||||
|
for (int i= 0; i < no_of_nodes; i++)
|
||||||
|
ndbout << " " << node_ids[i];
|
||||||
|
ndbout_c(" has shutdown.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1483,47 +1578,74 @@ CommandInterpreter::executeStart(int processId, const char* parameters,
|
|||||||
|
|
||||||
void
|
void
|
||||||
CommandInterpreter::executeRestart(int processId, const char* parameters,
|
CommandInterpreter::executeRestart(int processId, const char* parameters,
|
||||||
bool all)
|
bool all)
|
||||||
|
{
|
||||||
|
Vector<BaseString> command_list;
|
||||||
|
if (parameters)
|
||||||
|
{
|
||||||
|
BaseString tmp(parameters);
|
||||||
|
tmp.split(command_list);
|
||||||
|
for (unsigned i= 0; i < command_list.size();)
|
||||||
|
command_list[i].c_str()[0] ? i++ : (command_list.erase(i),0);
|
||||||
|
}
|
||||||
|
if (all)
|
||||||
|
executeRestart(command_list, 0, 0, 0);
|
||||||
|
else
|
||||||
|
executeRestart(command_list, 0, &processId, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandInterpreter::executeRestart(Vector<BaseString> &command_list,
|
||||||
|
unsigned command_pos,
|
||||||
|
int *node_ids, int no_of_nodes)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int nostart = 0;
|
int nostart= 0;
|
||||||
int initialstart = 0;
|
int initialstart= 0;
|
||||||
int abort = 0;
|
int abort= 0;
|
||||||
|
|
||||||
if(parameters != 0 && strlen(parameters) != 0){
|
for (; command_pos < command_list.size(); command_pos++)
|
||||||
char * tmpString = my_strdup(parameters,MYF(MY_WME));
|
{
|
||||||
My_auto_ptr<char> ap1(tmpString);
|
const char *item= command_list[command_pos].c_str();
|
||||||
char * tmpPtr = 0;
|
if (strcasecmp(item, "-N") == 0)
|
||||||
char * item = strtok_r(tmpString, " ", &tmpPtr);
|
{
|
||||||
while(item != NULL){
|
nostart= 1;
|
||||||
if(strcasecmp(item, "-N") == 0)
|
continue;
|
||||||
nostart = 1;
|
|
||||||
if(strcasecmp(item, "-I") == 0)
|
|
||||||
initialstart = 1;
|
|
||||||
if(strcasecmp(item, "-A") == 0)
|
|
||||||
abort = 1;
|
|
||||||
item = strtok_r(NULL, " ", &tmpPtr);
|
|
||||||
}
|
}
|
||||||
|
if (strcasecmp(item, "-I") == 0)
|
||||||
|
{
|
||||||
|
initialstart= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strcasecmp(item, "-A") == 0)
|
||||||
|
{
|
||||||
|
abort= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ndbout_c("Invalid option: %s. Expecting -A,-N or -I after RESTART",
|
||||||
|
item);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(all) {
|
result= ndb_mgm_restart2(m_mgmsrv, no_of_nodes, node_ids,
|
||||||
result = ndb_mgm_restart2(m_mgmsrv, 0, NULL, initialstart, nostart, abort);
|
initialstart, nostart, abort);
|
||||||
} else {
|
|
||||||
int v[1];
|
|
||||||
v[0] = processId;
|
|
||||||
result = ndb_mgm_restart2(m_mgmsrv, 1, v, initialstart, nostart, abort);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
ndbout.println("Restart failed.", result);
|
ndbout_c("Restart failed.");
|
||||||
printError();
|
printError();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (node_ids == 0)
|
||||||
|
ndbout_c("NDB Cluster is being restarted.");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(all)
|
ndbout << "Node";
|
||||||
ndbout << "NDB Cluster is being restarted." << endl;
|
for (int i= 0; i < no_of_nodes; i++)
|
||||||
else
|
ndbout << " " << node_ids[i];
|
||||||
ndbout_c("Node %d is being restarted.", processId);
|
ndbout_c(" is being restarted");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -294,6 +294,8 @@ static ErrorItem errorTable[] =
|
|||||||
{MgmtSrvr::SYSTEM_SHUTDOWN_IN_PROGRESS, "System shutdown in progress" },
|
{MgmtSrvr::SYSTEM_SHUTDOWN_IN_PROGRESS, "System shutdown in progress" },
|
||||||
{MgmtSrvr::NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH,
|
{MgmtSrvr::NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH,
|
||||||
"Node shutdown would cause system crash" },
|
"Node shutdown would cause system crash" },
|
||||||
|
{MgmtSrvr::UNSUPPORTED_NODE_SHUTDOWN,
|
||||||
|
"Unsupported multi node shutdown. Abort option required." },
|
||||||
{MgmtSrvr::NODE_NOT_API_NODE, "The specified node is not an API node." },
|
{MgmtSrvr::NODE_NOT_API_NODE, "The specified node is not an API node." },
|
||||||
{MgmtSrvr::OPERATION_NOT_ALLOWED_START_STOP,
|
{MgmtSrvr::OPERATION_NOT_ALLOWED_START_STOP,
|
||||||
"Operation not allowed while nodes are starting or stopping."},
|
"Operation not allowed while nodes are starting or stopping."},
|
||||||
@ -312,6 +314,9 @@ int MgmtSrvr::translateStopRef(Uint32 errCode)
|
|||||||
case StopRef::NodeShutdownWouldCauseSystemCrash:
|
case StopRef::NodeShutdownWouldCauseSystemCrash:
|
||||||
return NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH;
|
return NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH;
|
||||||
break;
|
break;
|
||||||
|
case StopRef::UnsupportedNodeShutdown:
|
||||||
|
return UNSUPPORTED_NODE_SHUTDOWN;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 4999;
|
return 4999;
|
||||||
}
|
}
|
||||||
@ -386,8 +391,9 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
|||||||
_ownReference(0),
|
_ownReference(0),
|
||||||
theSignalIdleList(NULL),
|
theSignalIdleList(NULL),
|
||||||
theWaitState(WAIT_SUBSCRIBE_CONF),
|
theWaitState(WAIT_SUBSCRIBE_CONF),
|
||||||
|
m_local_mgm_handle(0),
|
||||||
m_event_listner(this),
|
m_event_listner(this),
|
||||||
m_local_mgm_handle(0)
|
m_master_node(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
|
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
|
||||||
@ -677,23 +683,16 @@ MgmtSrvr::~MgmtSrvr()
|
|||||||
|
|
||||||
int MgmtSrvr::okToSendTo(NodeId nodeId, bool unCond)
|
int MgmtSrvr::okToSendTo(NodeId nodeId, bool unCond)
|
||||||
{
|
{
|
||||||
if(nodeId == 0)
|
if(nodeId == 0 || getNodeType(nodeId) != NDB_MGM_NODE_TYPE_NDB)
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (getNodeType(nodeId) != NDB_MGM_NODE_TYPE_NDB)
|
|
||||||
return WRONG_PROCESS_TYPE;
|
return WRONG_PROCESS_TYPE;
|
||||||
|
|
||||||
// Check if we have contact with it
|
// Check if we have contact with it
|
||||||
if(unCond){
|
if(unCond){
|
||||||
if(theFacade->theClusterMgr->getNodeInfo(nodeId).connected)
|
if(theFacade->theClusterMgr->getNodeInfo(nodeId).connected)
|
||||||
return 0;
|
return 0;
|
||||||
return NO_CONTACT_WITH_PROCESS;
|
|
||||||
}
|
}
|
||||||
if (theFacade->get_node_alive(nodeId) == 0) {
|
else if (theFacade->get_node_alive(nodeId) == true)
|
||||||
return NO_CONTACT_WITH_PROCESS;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
return NO_CONTACT_WITH_PROCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void report_unknown_signal(SimpleSignal *signal)
|
void report_unknown_signal(SimpleSignal *signal)
|
||||||
@ -935,7 +934,7 @@ int MgmtSrvr::sendStopMgmd(NodeId nodeId,
|
|||||||
* distributed communication up.
|
* distributed communication up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
|
||||||
NodeBitmask &stoppedNodes,
|
NodeBitmask &stoppedNodes,
|
||||||
Uint32 singleUserNodeId,
|
Uint32 singleUserNodeId,
|
||||||
bool abort,
|
bool abort,
|
||||||
@ -945,6 +944,12 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
bool initialStart)
|
bool initialStart)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
DBUG_ENTER("MgmtSrvr::sendSTOP_REQ");
|
||||||
|
DBUG_PRINT("enter", ("no of nodes: %d singleUseNodeId: %d "
|
||||||
|
"abort: %d stop: %d restart: %d "
|
||||||
|
"nostart: %d initialStart: %d",
|
||||||
|
node_ids.size(), singleUserNodeId,
|
||||||
|
abort, stop, restart, nostart, initialStart));
|
||||||
|
|
||||||
stoppedNodes.clear();
|
stoppedNodes.clear();
|
||||||
|
|
||||||
@ -982,36 +987,49 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
|
|
||||||
// send the signals
|
// send the signals
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
if (nodeId)
|
NodeId nodeId= 0;
|
||||||
|
int use_master_node= 0;
|
||||||
|
int do_send= 0;
|
||||||
|
int do_stop_self= 0;
|
||||||
|
NdbNodeBitmask nodes_to_stop;
|
||||||
{
|
{
|
||||||
if(nodeId==getOwnNodeId())
|
for (unsigned i= 0; i < node_ids.size(); i++)
|
||||||
{
|
{
|
||||||
if(restart)
|
nodeId= node_ids[i];
|
||||||
g_RestartServer= true;
|
if (getNodeType(nodeId) != NDB_MGM_NODE_TYPE_MGM)
|
||||||
g_StopServer= true;
|
nodes_to_stop.set(nodeId);
|
||||||
return 0;
|
else if (nodeId != getOwnNodeId())
|
||||||
|
{
|
||||||
|
error= sendStopMgmd(nodeId, abort, stop, restart,
|
||||||
|
nostart, initialStart);
|
||||||
|
if (error == 0)
|
||||||
|
stoppedNodes.set(nodeId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
do_stop_self= 1;;
|
||||||
}
|
}
|
||||||
if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
|
}
|
||||||
|
int no_of_nodes_to_stop= nodes_to_stop.count();
|
||||||
|
if (node_ids.size())
|
||||||
|
{
|
||||||
|
if (no_of_nodes_to_stop)
|
||||||
{
|
{
|
||||||
int r;
|
do_send= 1;
|
||||||
if((r= okToSendTo(nodeId, true)) != 0)
|
if (no_of_nodes_to_stop == 1)
|
||||||
return r;
|
{
|
||||||
if (ss.sendSignal(nodeId, &ssig) != SEND_OK)
|
nodeId= nodes_to_stop.find(0);
|
||||||
return SEND_OR_RECEIVE_FAILED;
|
}
|
||||||
|
else // multi node stop, send to master
|
||||||
|
{
|
||||||
|
use_master_node= 1;
|
||||||
|
nodes_to_stop.copyto(NdbNodeBitmask::Size, stopReq->nodes);
|
||||||
|
StopReq::setStopNodes(stopReq->requestInfo, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
|
|
||||||
{
|
|
||||||
error= sendStopMgmd(nodeId, abort, stop, restart, nostart, initialStart);
|
|
||||||
if(error==0)
|
|
||||||
stoppedNodes.set(nodeId);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return WRONG_PROCESS_TYPE;
|
|
||||||
nodes.set(nodeId);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
nodeId= 0;
|
||||||
while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
|
while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
|
||||||
{
|
{
|
||||||
if(okToSendTo(nodeId, true) == 0)
|
if(okToSendTo(nodeId, true) == 0)
|
||||||
@ -1032,8 +1050,30 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now wait for the replies
|
// now wait for the replies
|
||||||
while (!nodes.isclear())
|
while (!nodes.isclear() || do_send)
|
||||||
{
|
{
|
||||||
|
if (do_send)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
assert(nodes.count() == 0);
|
||||||
|
if (use_master_node)
|
||||||
|
nodeId= m_master_node;
|
||||||
|
if ((r= okToSendTo(nodeId, true)) != 0)
|
||||||
|
{
|
||||||
|
bool next;
|
||||||
|
if (!use_master_node)
|
||||||
|
DBUG_RETURN(r);
|
||||||
|
m_master_node= nodeId= 0;
|
||||||
|
while((next= getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
|
||||||
|
(r= okToSendTo(nodeId, true)) != 0);
|
||||||
|
if (!next)
|
||||||
|
DBUG_RETURN(NO_CONTACT_WITH_DB_NODES);
|
||||||
|
}
|
||||||
|
if (ss.sendSignal(nodeId, &ssig) != SEND_OK)
|
||||||
|
DBUG_RETURN(SEND_OR_RECEIVE_FAILED);
|
||||||
|
nodes.set(nodeId);
|
||||||
|
do_send= 0;
|
||||||
|
}
|
||||||
SimpleSignal *signal = ss.waitFor();
|
SimpleSignal *signal = ss.waitFor();
|
||||||
int gsn = signal->readSignalNumber();
|
int gsn = signal->readSignalNumber();
|
||||||
switch (gsn) {
|
switch (gsn) {
|
||||||
@ -1045,6 +1085,13 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
#endif
|
#endif
|
||||||
assert(nodes.get(nodeId));
|
assert(nodes.get(nodeId));
|
||||||
nodes.clear(nodeId);
|
nodes.clear(nodeId);
|
||||||
|
if (ref->errorCode == StopRef::MultiNodeShutdownNotMaster)
|
||||||
|
{
|
||||||
|
assert(use_master_node);
|
||||||
|
m_master_node= ref->masterNodeId;
|
||||||
|
do_send= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
error = translateStopRef(ref->errorCode);
|
error = translateStopRef(ref->errorCode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1055,9 +1102,16 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
ndbout_c("Node %d single user mode", nodeId);
|
ndbout_c("Node %d single user mode", nodeId);
|
||||||
#endif
|
#endif
|
||||||
assert(nodes.get(nodeId));
|
assert(nodes.get(nodeId));
|
||||||
assert(singleUserNodeId != 0);
|
if (singleUserNodeId != 0)
|
||||||
|
{
|
||||||
|
stoppedNodes.set(nodeId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert(no_of_nodes_to_stop > 1);
|
||||||
|
stoppedNodes.bitOR(nodes_to_stop);
|
||||||
|
}
|
||||||
nodes.clear(nodeId);
|
nodes.clear(nodeId);
|
||||||
stoppedNodes.set(nodeId);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSN_NF_COMPLETEREP:{
|
case GSN_NF_COMPLETEREP:{
|
||||||
@ -1096,17 +1150,24 @@ int MgmtSrvr::sendSTOP_REQ(NodeId nodeId,
|
|||||||
#ifdef VM_TRACE
|
#ifdef VM_TRACE
|
||||||
ndbout_c("Unknown signal %d", gsn);
|
ndbout_c("Unknown signal %d", gsn);
|
||||||
#endif
|
#endif
|
||||||
return SEND_OR_RECEIVE_FAILED;
|
DBUG_RETURN(SEND_OR_RECEIVE_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error;
|
if (!error && do_stop_self)
|
||||||
|
{
|
||||||
|
if (restart)
|
||||||
|
g_RestartServer= true;
|
||||||
|
g_StopServer= true;
|
||||||
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stop one node
|
* Stop one nodes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int MgmtSrvr::stopNode(int nodeId, bool abort)
|
int MgmtSrvr::stopNodes(const Vector<NodeId> &node_ids,
|
||||||
|
int *stopCount, bool abort)
|
||||||
{
|
{
|
||||||
if (!abort)
|
if (!abort)
|
||||||
{
|
{
|
||||||
@ -1121,14 +1182,17 @@ int MgmtSrvr::stopNode(int nodeId, bool abort)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
return sendSTOP_REQ(nodeId,
|
int ret= sendSTOP_REQ(node_ids,
|
||||||
nodes,
|
nodes,
|
||||||
0,
|
0,
|
||||||
abort,
|
abort,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
|
if (stopCount)
|
||||||
|
*stopCount= nodes.count();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1138,7 +1202,8 @@ int MgmtSrvr::stopNode(int nodeId, bool abort)
|
|||||||
int MgmtSrvr::stop(int * stopCount, bool abort)
|
int MgmtSrvr::stop(int * stopCount, bool abort)
|
||||||
{
|
{
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
int ret = sendSTOP_REQ(0,
|
Vector<NodeId> node_ids;
|
||||||
|
int ret = sendSTOP_REQ(node_ids,
|
||||||
nodes,
|
nodes,
|
||||||
0,
|
0,
|
||||||
abort,
|
abort,
|
||||||
@ -1169,7 +1234,8 @@ int MgmtSrvr::enterSingleUser(int * stopCount, Uint32 singleUserNodeId)
|
|||||||
return OPERATION_NOT_ALLOWED_START_STOP;
|
return OPERATION_NOT_ALLOWED_START_STOP;
|
||||||
}
|
}
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
int ret = sendSTOP_REQ(0,
|
Vector<NodeId> node_ids;
|
||||||
|
int ret = sendSTOP_REQ(node_ids,
|
||||||
nodes,
|
nodes,
|
||||||
singleUserNodeId,
|
singleUserNodeId,
|
||||||
false,
|
false,
|
||||||
@ -1186,18 +1252,22 @@ int MgmtSrvr::enterSingleUser(int * stopCount, Uint32 singleUserNodeId)
|
|||||||
* Perform node restart
|
* Perform node restart
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int MgmtSrvr::restartNode(int nodeId, bool nostart, bool initialStart,
|
int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
|
||||||
bool abort)
|
int * stopCount, bool nostart,
|
||||||
|
bool initialStart, bool abort)
|
||||||
{
|
{
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
return sendSTOP_REQ(nodeId,
|
int ret= sendSTOP_REQ(node_ids,
|
||||||
nodes,
|
nodes,
|
||||||
0,
|
0,
|
||||||
abort,
|
abort,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
nostart,
|
nostart,
|
||||||
initialStart);
|
initialStart);
|
||||||
|
if (stopCount)
|
||||||
|
*stopCount = nodes.count();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1208,7 +1278,8 @@ int MgmtSrvr::restart(bool nostart, bool initialStart,
|
|||||||
bool abort, int * stopCount )
|
bool abort, int * stopCount )
|
||||||
{
|
{
|
||||||
NodeBitmask nodes;
|
NodeBitmask nodes;
|
||||||
int ret = sendSTOP_REQ(0,
|
Vector<NodeId> node_ids;
|
||||||
|
int ret = sendSTOP_REQ(node_ids,
|
||||||
nodes,
|
nodes,
|
||||||
0,
|
0,
|
||||||
abort,
|
abort,
|
||||||
@ -2135,12 +2206,16 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
|
|||||||
SignalSender ss(theFacade);
|
SignalSender ss(theFacade);
|
||||||
ss.lock(); // lock will be released on exit
|
ss.lock(); // lock will be released on exit
|
||||||
|
|
||||||
bool next;
|
NodeId nodeId = m_master_node;
|
||||||
NodeId nodeId = 0;
|
if (okToSendTo(nodeId, false) != 0)
|
||||||
while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
|
{
|
||||||
theFacade->get_node_alive(nodeId) == false);
|
bool next;
|
||||||
|
nodeId = m_master_node = 0;
|
||||||
if(!next) return NO_CONTACT_WITH_DB_NODES;
|
while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
|
||||||
|
okToSendTo(nodeId, false) != 0);
|
||||||
|
if(!next)
|
||||||
|
return NO_CONTACT_WITH_DB_NODES;
|
||||||
|
}
|
||||||
|
|
||||||
SimpleSignal ssig;
|
SimpleSignal ssig;
|
||||||
BackupReq* req = CAST_PTR(BackupReq, ssig.getDataPtrSend());
|
BackupReq* req = CAST_PTR(BackupReq, ssig.getDataPtrSend());
|
||||||
@ -2208,7 +2283,7 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
|
|||||||
const BackupRef * const ref =
|
const BackupRef * const ref =
|
||||||
CAST_CONSTPTR(BackupRef, signal->getDataPtr());
|
CAST_CONSTPTR(BackupRef, signal->getDataPtr());
|
||||||
if(ref->errorCode == BackupRef::IAmNotMaster){
|
if(ref->errorCode == BackupRef::IAmNotMaster){
|
||||||
nodeId = refToNode(ref->masterRef);
|
m_master_node = nodeId = refToNode(ref->masterRef);
|
||||||
#ifdef VM_TRACE
|
#ifdef VM_TRACE
|
||||||
ndbout_c("I'm not master resending to %d", nodeId);
|
ndbout_c("I'm not master resending to %d", nodeId);
|
||||||
#endif
|
#endif
|
||||||
|
@ -176,6 +176,7 @@ public:
|
|||||||
STATIC_CONST( NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH = 5028 );
|
STATIC_CONST( NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH = 5028 );
|
||||||
|
|
||||||
STATIC_CONST( NO_CONTACT_WITH_DB_NODES = 5030 );
|
STATIC_CONST( NO_CONTACT_WITH_DB_NODES = 5030 );
|
||||||
|
STATIC_CONST( UNSUPPORTED_NODE_SHUTDOWN = 5031 );
|
||||||
|
|
||||||
STATIC_CONST( NODE_NOT_API_NODE = 5062 );
|
STATIC_CONST( NODE_NOT_API_NODE = 5062 );
|
||||||
STATIC_CONST( OPERATION_NOT_ALLOWED_START_STOP = 5063 );
|
STATIC_CONST( OPERATION_NOT_ALLOWED_START_STOP = 5063 );
|
||||||
@ -252,7 +253,7 @@ public:
|
|||||||
* @param processId: Id of the DB process to stop
|
* @param processId: Id of the DB process to stop
|
||||||
* @return 0 if succeeded, otherwise: as stated above, plus:
|
* @return 0 if succeeded, otherwise: as stated above, plus:
|
||||||
*/
|
*/
|
||||||
int stopNode(int nodeId, bool abort = false);
|
int stopNodes(const Vector<NodeId> &node_ids, int *stopCount, bool abort);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the system
|
* Stop the system
|
||||||
@ -286,11 +287,12 @@ public:
|
|||||||
int start(int processId);
|
int start(int processId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart a node
|
* Restart nodes
|
||||||
* @param processId: Id of the DB process to start
|
* @param processId: Id of the DB process to start
|
||||||
*/
|
*/
|
||||||
int restartNode(int processId, bool nostart, bool initialStart,
|
int restartNodes(const Vector<NodeId> &node_ids,
|
||||||
bool abort = false);
|
int *stopCount, bool nostart,
|
||||||
|
bool initialStart, bool abort);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart the system
|
* Restart the system
|
||||||
@ -494,7 +496,7 @@ private:
|
|||||||
bool nostart,
|
bool nostart,
|
||||||
bool initialStart);
|
bool initialStart);
|
||||||
|
|
||||||
int sendSTOP_REQ(NodeId nodeId,
|
int sendSTOP_REQ(const Vector<NodeId> &node_ids,
|
||||||
NodeBitmask &stoppedNodes,
|
NodeBitmask &stoppedNodes,
|
||||||
Uint32 singleUserNodeId,
|
Uint32 singleUserNodeId,
|
||||||
bool abort,
|
bool abort,
|
||||||
@ -653,6 +655,8 @@ private:
|
|||||||
friend class Ndb_mgmd_event_service;
|
friend class Ndb_mgmd_event_service;
|
||||||
Ndb_mgmd_event_service m_event_listner;
|
Ndb_mgmd_event_service m_event_listner;
|
||||||
|
|
||||||
|
NodeId m_master_node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the thread wich upon a 'Node is started' event will
|
* Handles the thread wich upon a 'Node is started' event will
|
||||||
* set the node's previous loglevel settings.
|
* set the node's previous loglevel settings.
|
||||||
|
@ -866,14 +866,11 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int restarted = 0;
|
int restarted = 0;
|
||||||
int result = 0;
|
int result= m_mgmsrv.restartNodes(nodes,
|
||||||
|
&restarted,
|
||||||
for(size_t i = 0; i < nodes.size(); i++)
|
nostart != 0,
|
||||||
if((result = m_mgmsrv.restartNode(nodes[i],
|
initialstart != 0,
|
||||||
nostart != 0,
|
abort != 0);
|
||||||
initialstart != 0,
|
|
||||||
abort != 0)) == 0)
|
|
||||||
restarted++;
|
|
||||||
|
|
||||||
m_output->println("restart reply");
|
m_output->println("restart reply");
|
||||||
if(result != 0){
|
if(result != 0){
|
||||||
@ -998,7 +995,12 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
|
|||||||
|
|
||||||
args.get("node", (const char **)&nodes_str);
|
args.get("node", (const char **)&nodes_str);
|
||||||
if(nodes_str == NULL)
|
if(nodes_str == NULL)
|
||||||
|
{
|
||||||
|
m_output->println("stop reply");
|
||||||
|
m_output->println("result: empty node list");
|
||||||
|
m_output->println("");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
args.get("abort", &abort);
|
args.get("abort", &abort);
|
||||||
|
|
||||||
char *p, *last;
|
char *p, *last;
|
||||||
@ -1008,29 +1010,10 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
|
|||||||
nodes.push_back(atoi(p));
|
nodes.push_back(atoi(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
int stop_self= 0;
|
int stopped= 0;
|
||||||
size_t i;
|
int result= 0;
|
||||||
|
if (nodes.size())
|
||||||
for(i=0; i < nodes.size(); i++) {
|
result= m_mgmsrv.stopNodes(nodes, &stopped, abort != 0);
|
||||||
if (nodes[i] == m_mgmsrv.getOwnNodeId()) {
|
|
||||||
stop_self= 1;
|
|
||||||
if (i != nodes.size()-1) {
|
|
||||||
m_output->println("stop reply");
|
|
||||||
m_output->println("result: server must be stopped last");
|
|
||||||
m_output->println("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int stopped = 0, result = 0;
|
|
||||||
|
|
||||||
for(i=0; i < nodes.size(); i++)
|
|
||||||
if (nodes[i] != m_mgmsrv.getOwnNodeId()) {
|
|
||||||
if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0)
|
|
||||||
stopped++;
|
|
||||||
} else
|
|
||||||
stopped++;
|
|
||||||
|
|
||||||
m_output->println("stop reply");
|
m_output->println("stop reply");
|
||||||
if(result != 0)
|
if(result != 0)
|
||||||
@ -1039,9 +1022,6 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
|
|||||||
m_output->println("result: Ok");
|
m_output->println("result: Ok");
|
||||||
m_output->println("stopped: %d", stopped);
|
m_output->println("stopped: %d", stopped);
|
||||||
m_output->println("");
|
m_output->println("");
|
||||||
|
|
||||||
if (stop_self)
|
|
||||||
g_StopServer= true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1109,9 +1109,14 @@ NdbDictInterface::getTable(const BaseString& name, bool fullyQualifiedNames)
|
|||||||
|
|
||||||
// Copy name to m_buffer to get a word sized buffer
|
// Copy name to m_buffer to get a word sized buffer
|
||||||
m_buffer.clear();
|
m_buffer.clear();
|
||||||
m_buffer.grow(namelen_words*4);
|
m_buffer.grow(namelen_words*4+4);
|
||||||
m_buffer.append(name.c_str(), namelen);
|
m_buffer.append(name.c_str(), namelen);
|
||||||
|
|
||||||
|
#ifndef IGNORE_VALGRIND_WARNINGS
|
||||||
|
Uint32 pad = 0;
|
||||||
|
m_buffer.append(&pad, 4);
|
||||||
|
#endif
|
||||||
|
|
||||||
LinearSectionPtr ptr[1];
|
LinearSectionPtr ptr[1];
|
||||||
ptr[0].p= (Uint32*)m_buffer.get_data();
|
ptr[0].p= (Uint32*)m_buffer.get_data();
|
||||||
ptr[0].sz= namelen_words;
|
ptr[0].sz= namelen_words;
|
||||||
|
@ -427,19 +427,26 @@ NdbLinHash<C>::getNext(NdbElement_t<C> * curr){
|
|||||||
return curr->next;
|
return curr->next;
|
||||||
|
|
||||||
int dir = 0, seg = 0;
|
int dir = 0, seg = 0;
|
||||||
|
int counts;
|
||||||
if(curr != 0){
|
if(curr != 0)
|
||||||
|
{
|
||||||
getBucket(curr->hash, &dir, &seg);
|
getBucket(curr->hash, &dir, &seg);
|
||||||
|
counts = seg + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
counts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int countd = dir; countd < DIRECTORYSIZE;countd++ ){
|
for(int countd = dir; countd < DIRECTORYSIZE;countd++ ){
|
||||||
if (directory[countd] != 0) {
|
if (directory[countd] != 0) {
|
||||||
for(int counts = seg + 1; counts < SEGMENTSIZE; counts++ ){
|
for(; counts < SEGMENTSIZE; counts++ ){
|
||||||
if (directory[countd]->elements[counts] != 0) {
|
if (directory[countd]->elements[counts] != 0) {
|
||||||
return directory[countd]->elements[counts];
|
return directory[countd]->elements[counts];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
counts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <NdbRestarts.hpp>
|
#include <NdbRestarts.hpp>
|
||||||
#include <Vector.hpp>
|
#include <Vector.hpp>
|
||||||
#include <signaldata/DumpStateOrd.hpp>
|
#include <signaldata/DumpStateOrd.hpp>
|
||||||
|
#include <Bitmask.hpp>
|
||||||
|
|
||||||
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
|
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
|
|
||||||
@ -669,6 +669,206 @@ err:
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
runBug18612(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
|
|
||||||
|
// Assume two replicas
|
||||||
|
NdbRestarter restarter;
|
||||||
|
if (restarter.getNumDbNodes() < 2)
|
||||||
|
{
|
||||||
|
ctx->stopTest();
|
||||||
|
return NDBT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 cnt = restarter.getNumDbNodes();
|
||||||
|
|
||||||
|
for(int loop = 0; loop < ctx->getNumLoops(); loop++)
|
||||||
|
{
|
||||||
|
int partition0[256];
|
||||||
|
int partition1[256];
|
||||||
|
bzero(partition0, sizeof(partition0));
|
||||||
|
bzero(partition1, sizeof(partition1));
|
||||||
|
Bitmask<4> nodesmask;
|
||||||
|
|
||||||
|
Uint32 node1 = restarter.getDbNodeId(rand()%cnt);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());
|
||||||
|
if (tmp == -1)
|
||||||
|
break;
|
||||||
|
node1 = tmp;
|
||||||
|
} while(nodesmask.get(node1));
|
||||||
|
|
||||||
|
partition0[i] = node1;
|
||||||
|
partition1[i] = restarter.getRandomNodeSameNodeGroup(node1, rand());
|
||||||
|
|
||||||
|
ndbout_c("nodes %d %d", node1, partition1[i]);
|
||||||
|
|
||||||
|
assert(!nodesmask.get(node1));
|
||||||
|
assert(!nodesmask.get(partition1[i]));
|
||||||
|
nodesmask.set(node1);
|
||||||
|
nodesmask.set(partition1[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ndbout_c("done");
|
||||||
|
|
||||||
|
int dump[255];
|
||||||
|
dump[0] = DumpStateOrd::NdbcntrStopNodes;
|
||||||
|
memcpy(dump + 1, partition0, sizeof(int)*cnt/2);
|
||||||
|
|
||||||
|
Uint32 master = restarter.getMasterNodeId();
|
||||||
|
|
||||||
|
if (restarter.dumpStateOneNode(master, dump, 1+cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitNodesNoStart(partition0, cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
|
||||||
|
|
||||||
|
if (restarter.dumpStateAllNodes(val2, 2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.insertErrorInAllNodes(932))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
dump[0] = 9000;
|
||||||
|
memcpy(dump + 1, partition0, sizeof(int)*cnt/2);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateOneNode(partition1[i], dump, 1+cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
dump[0] = 9000;
|
||||||
|
memcpy(dump + 1, partition1, sizeof(int)*cnt/2);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateOneNode(partition0[i], dump, 1+cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.startNodes(partition0, cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitNodesStartPhase(partition0, cnt/2, 2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
dump[0] = 9001;
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateAllNodes(dump, 2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitNodesNoStart(partition0, cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.restartOneDbNode(partition0[i], true, true, true))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitNodesNoStart(partition0, cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.startAll())
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitClusterStarted())
|
||||||
|
return NDBT_FAILED;
|
||||||
|
}
|
||||||
|
return NDBT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
runBug18612SR(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
|
|
||||||
|
// Assume two replicas
|
||||||
|
NdbRestarter restarter;
|
||||||
|
if (restarter.getNumDbNodes() < 2)
|
||||||
|
{
|
||||||
|
ctx->stopTest();
|
||||||
|
return NDBT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 cnt = restarter.getNumDbNodes();
|
||||||
|
|
||||||
|
for(int loop = 0; loop < ctx->getNumLoops(); loop++)
|
||||||
|
{
|
||||||
|
int partition0[256];
|
||||||
|
int partition1[256];
|
||||||
|
bzero(partition0, sizeof(partition0));
|
||||||
|
bzero(partition1, sizeof(partition1));
|
||||||
|
Bitmask<4> nodesmask;
|
||||||
|
|
||||||
|
Uint32 node1 = restarter.getDbNodeId(rand()%cnt);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());
|
||||||
|
if (tmp == -1)
|
||||||
|
break;
|
||||||
|
node1 = tmp;
|
||||||
|
} while(nodesmask.get(node1));
|
||||||
|
|
||||||
|
partition0[i] = node1;
|
||||||
|
partition1[i] = restarter.getRandomNodeSameNodeGroup(node1, rand());
|
||||||
|
|
||||||
|
ndbout_c("nodes %d %d", node1, partition1[i]);
|
||||||
|
|
||||||
|
assert(!nodesmask.get(node1));
|
||||||
|
assert(!nodesmask.get(partition1[i]));
|
||||||
|
nodesmask.set(node1);
|
||||||
|
nodesmask.set(partition1[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ndbout_c("done");
|
||||||
|
|
||||||
|
if (restarter.restartAll(false, true, false))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
int dump[255];
|
||||||
|
dump[0] = 9000;
|
||||||
|
memcpy(dump + 1, partition0, sizeof(int)*cnt/2);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateOneNode(partition1[i], dump, 1+cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
dump[0] = 9000;
|
||||||
|
memcpy(dump + 1, partition1, sizeof(int)*cnt/2);
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateOneNode(partition0[i], dump, 1+cnt/2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
|
||||||
|
|
||||||
|
if (restarter.dumpStateAllNodes(val2, 2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.insertErrorInAllNodes(932))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.startAll())
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitClusterStartPhase(2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
dump[0] = 9001;
|
||||||
|
for (Uint32 i = 0; i<cnt/2; i++)
|
||||||
|
if (restarter.dumpStateAllNodes(dump, 2))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitClusterNoStart(30))
|
||||||
|
if (restarter.waitNodesNoStart(partition0, cnt/2, 10))
|
||||||
|
if (restarter.waitNodesNoStart(partition1, cnt/2, 10))
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.startAll())
|
||||||
|
return NDBT_FAILED;
|
||||||
|
|
||||||
|
if (restarter.waitClusterStarted())
|
||||||
|
return NDBT_FAILED;
|
||||||
|
}
|
||||||
|
return NDBT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NDBT_TESTSUITE(testNodeRestart);
|
NDBT_TESTSUITE(testNodeRestart);
|
||||||
TESTCASE("NoLoad",
|
TESTCASE("NoLoad",
|
||||||
"Test that one node at a time can be stopped and then restarted "\
|
"Test that one node at a time can be stopped and then restarted "\
|
||||||
@ -963,6 +1163,18 @@ TESTCASE("Bug18414",
|
|||||||
STEP(runBug18414);
|
STEP(runBug18414);
|
||||||
FINALIZER(runClearTable);
|
FINALIZER(runClearTable);
|
||||||
}
|
}
|
||||||
|
TESTCASE("Bug18612",
|
||||||
|
"Test bug with partitioned clusters"){
|
||||||
|
INITIALIZER(runLoadTable);
|
||||||
|
STEP(runBug18612);
|
||||||
|
FINALIZER(runClearTable);
|
||||||
|
}
|
||||||
|
TESTCASE("Bug18612SR",
|
||||||
|
"Test bug with partitioned clusters"){
|
||||||
|
INITIALIZER(runLoadTable);
|
||||||
|
STEP(runBug18612SR);
|
||||||
|
FINALIZER(runClearTable);
|
||||||
|
}
|
||||||
NDBT_TESTSUITE_END(testNodeRestart);
|
NDBT_TESTSUITE_END(testNodeRestart);
|
||||||
|
|
||||||
int main(int argc, const char** argv){
|
int main(int argc, const char** argv){
|
||||||
|
@ -433,10 +433,18 @@ args: -n Bug16772 T1
|
|||||||
#cmd: testSystemRestart
|
#cmd: testSystemRestart
|
||||||
#args: -n Bug18385 T1
|
#args: -n Bug18385 T1
|
||||||
#
|
#
|
||||||
max-time: 500
|
max-time: 1000
|
||||||
cmd: testNodeRestart
|
cmd: testNodeRestart
|
||||||
args: -n Bug18414 T1
|
args: -n Bug18414 T1
|
||||||
|
|
||||||
|
max-time: 1000
|
||||||
|
cmd: testNodeRestart
|
||||||
|
args: -n Bug18612 T1
|
||||||
|
|
||||||
|
max-time: 1000
|
||||||
|
cmd: testNodeRestart
|
||||||
|
args: -n Bug18612SR T1
|
||||||
|
|
||||||
# OLD FLEX
|
# OLD FLEX
|
||||||
max-time: 500
|
max-time: 500
|
||||||
cmd: flexBench
|
cmd: flexBench
|
||||||
|
@ -445,8 +445,7 @@ int twoNodeFailure(NdbRestarter& _restarter,
|
|||||||
<< ") secs " << endl;
|
<< ") secs " << endl;
|
||||||
NdbSleep_SecSleep(seconds);
|
NdbSleep_SecSleep(seconds);
|
||||||
|
|
||||||
randomId = (rand() % _restarter.getNumDbNodes());
|
nodeId = _restarter.getRandomNodeOtherNodeGroup(nodeId, rand());
|
||||||
nodeId = _restarter.getDbNodeId(randomId);
|
|
||||||
g_info << _restart->m_name << ": node = "<< nodeId << endl;
|
g_info << _restart->m_name << ": node = "<< nodeId << endl;
|
||||||
|
|
||||||
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
|
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
|
||||||
|
53
sql/field.cc
53
sql/field.cc
@ -7942,9 +7942,10 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
|||||||
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg,
|
enum utype unireg_check_arg, const char *field_name_arg,
|
||||||
struct st_table *table_arg)
|
struct st_table *table_arg)
|
||||||
: Field(ptr_arg, len_arg >> 3, null_ptr_arg, null_bit_arg,
|
: Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||||
unireg_check_arg, field_name_arg, table_arg),
|
unireg_check_arg, field_name_arg, table_arg),
|
||||||
bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7)
|
bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
|
||||||
|
bytes_in_rec(len_arg / 8)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Ensure that Field::eq() can distinguish between two different bit fields.
|
Ensure that Field::eq() can distinguish between two different bit fields.
|
||||||
@ -7980,14 +7981,14 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||||||
int delta;
|
int delta;
|
||||||
|
|
||||||
for (; length && !*from; from++, length--); // skip left 0's
|
for (; length && !*from; from++, length--); // skip left 0's
|
||||||
delta= field_length - length;
|
delta= bytes_in_rec - length;
|
||||||
|
|
||||||
if (delta < -1 ||
|
if (delta < -1 ||
|
||||||
(delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) ||
|
(delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) ||
|
||||||
(!bit_len && delta < 0))
|
(!bit_len && delta < 0))
|
||||||
{
|
{
|
||||||
set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
|
set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
|
||||||
memset(ptr, 0xff, field_length);
|
memset(ptr, 0xff, bytes_in_rec);
|
||||||
if (table->in_use->really_abort_on_warning())
|
if (table->in_use->really_abort_on_warning())
|
||||||
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
|
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
|
||||||
else
|
else
|
||||||
@ -8015,7 +8016,7 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||||||
set_rec_bits((uchar) *from, bit_ptr, bit_ofs, bit_len);
|
set_rec_bits((uchar) *from, bit_ptr, bit_ofs, bit_len);
|
||||||
from++;
|
from++;
|
||||||
}
|
}
|
||||||
memcpy(ptr, from, field_length);
|
memcpy(ptr, from, bytes_in_rec);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -8056,10 +8057,10 @@ longlong Field_bit::val_int(void)
|
|||||||
if (bit_len)
|
if (bit_len)
|
||||||
{
|
{
|
||||||
bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
|
bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
|
||||||
bits<<= (field_length * 8);
|
bits<<= (bytes_in_rec * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (field_length) {
|
switch (bytes_in_rec) {
|
||||||
case 0: return bits;
|
case 0: return bits;
|
||||||
case 1: return bits | (ulonglong) (uchar) ptr[0];
|
case 1: return bits | (ulonglong) (uchar) ptr[0];
|
||||||
case 2: return bits | mi_uint2korr(ptr);
|
case 2: return bits | mi_uint2korr(ptr);
|
||||||
@ -8068,7 +8069,7 @@ longlong Field_bit::val_int(void)
|
|||||||
case 5: return bits | mi_uint5korr(ptr);
|
case 5: return bits | mi_uint5korr(ptr);
|
||||||
case 6: return bits | mi_uint6korr(ptr);
|
case 6: return bits | mi_uint6korr(ptr);
|
||||||
case 7: return bits | mi_uint7korr(ptr);
|
case 7: return bits | mi_uint7korr(ptr);
|
||||||
default: return mi_uint8korr(ptr + field_length - sizeof(longlong));
|
default: return mi_uint8korr(ptr + bytes_in_rec - sizeof(longlong));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8121,7 +8122,7 @@ int Field_bit::cmp_offset(uint row_offset)
|
|||||||
if ((flag= (int) (bits_a - bits_b)))
|
if ((flag= (int) (bits_a - bits_b)))
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
return memcmp(ptr, ptr + row_offset, field_length);
|
return memcmp(ptr, ptr + row_offset, bytes_in_rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8133,7 +8134,7 @@ void Field_bit::get_key_image(char *buff, uint length, imagetype type)
|
|||||||
*buff++= bits;
|
*buff++= bits;
|
||||||
length--;
|
length--;
|
||||||
}
|
}
|
||||||
memcpy(buff, ptr, min(length, field_length));
|
memcpy(buff, ptr, min(length, bytes_in_rec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8141,22 +8142,22 @@ void Field_bit::sql_type(String &res) const
|
|||||||
{
|
{
|
||||||
CHARSET_INFO *cs= res.charset();
|
CHARSET_INFO *cs= res.charset();
|
||||||
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||||
"bit(%d)",
|
"bit(%d)", (int) field_length);
|
||||||
(int) field_length * 8 + bit_len);
|
|
||||||
res.length((uint) length);
|
res.length((uint) length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *Field_bit::pack(char *to, const char *from, uint max_length)
|
char *Field_bit::pack(char *to, const char *from, uint max_length)
|
||||||
{
|
{
|
||||||
uint length= min(field_length + (bit_len > 0), max_length);
|
DBUG_ASSERT(max_length);
|
||||||
|
uint length;
|
||||||
if (bit_len)
|
if (bit_len)
|
||||||
{
|
{
|
||||||
uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
|
uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
|
||||||
*to++= bits;
|
*to++= bits;
|
||||||
length--;
|
|
||||||
}
|
}
|
||||||
memcpy(to, from, length);
|
length= min(bytes_in_rec, max_length - (bit_len > 0));
|
||||||
|
memcpy(to, from, length);
|
||||||
return to + length;
|
return to + length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8168,8 +8169,8 @@ const char *Field_bit::unpack(char *to, const char *from)
|
|||||||
set_rec_bits(*from, bit_ptr, bit_ofs, bit_len);
|
set_rec_bits(*from, bit_ptr, bit_ofs, bit_len);
|
||||||
from++;
|
from++;
|
||||||
}
|
}
|
||||||
memcpy(to, from, field_length);
|
memcpy(to, from, bytes_in_rec);
|
||||||
return from + field_length;
|
return from + bytes_in_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8183,26 +8184,25 @@ Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg,
|
|||||||
const char *field_name_arg,
|
const char *field_name_arg,
|
||||||
struct st_table *table_arg)
|
struct st_table *table_arg)
|
||||||
: Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0,
|
: Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0,
|
||||||
0, unireg_check_arg, field_name_arg, table_arg),
|
0, unireg_check_arg, field_name_arg, table_arg)
|
||||||
create_length(len_arg)
|
|
||||||
{
|
{
|
||||||
bit_len= 0;
|
bit_len= 0;
|
||||||
field_length= ((len_arg + 7) & ~7) / 8;
|
bytes_in_rec= (len_arg + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
int delta;
|
int delta;
|
||||||
uchar bits= create_length & 7;
|
uchar bits= field_length & 7;
|
||||||
|
|
||||||
for (; length && !*from; from++, length--); // skip left 0's
|
for (; length && !*from; from++, length--); // skip left 0's
|
||||||
delta= field_length - length;
|
delta= bytes_in_rec - length;
|
||||||
|
|
||||||
if (delta < 0 ||
|
if (delta < 0 ||
|
||||||
(delta == 0 && bits && (uint) (uchar) *from >= (uint) (1 << bits)))
|
(delta == 0 && bits && (uint) (uchar) *from >= (uint) (1 << bits)))
|
||||||
{
|
{
|
||||||
memset(ptr, 0xff, field_length);
|
memset(ptr, 0xff, bytes_in_rec);
|
||||||
if (bits)
|
if (bits)
|
||||||
*ptr&= ((1 << bits) - 1); /* set first byte */
|
*ptr&= ((1 << bits) - 1); /* set first byte */
|
||||||
if (table->in_use->really_abort_on_warning())
|
if (table->in_use->really_abort_on_warning())
|
||||||
@ -8221,7 +8221,7 @@ void Field_bit_as_char::sql_type(String &res) const
|
|||||||
{
|
{
|
||||||
CHARSET_INFO *cs= res.charset();
|
CHARSET_INFO *cs= res.charset();
|
||||||
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||||
"bit(%d)", (int) create_length);
|
"bit(%d)", (int) field_length);
|
||||||
res.length((uint) length);
|
res.length((uint) length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8947,11 +8947,6 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
geom_type= ((Field_geom*)old_field)->geom_type;
|
geom_type= ((Field_geom*)old_field)->geom_type;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case FIELD_TYPE_BIT:
|
|
||||||
length= (old_field->key_type() == HA_KEYTYPE_BIT) ?
|
|
||||||
((Field_bit *) old_field)->bit_len + length * 8 :
|
|
||||||
((Field_bit_as_char *) old_field)->create_length;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
14
sql/field.h
14
sql/field.h
@ -1312,17 +1312,18 @@ public:
|
|||||||
uchar *bit_ptr; // position in record where 'uneven' bits store
|
uchar *bit_ptr; // position in record where 'uneven' bits store
|
||||||
uchar bit_ofs; // offset to 'uneven' high bits
|
uchar bit_ofs; // offset to 'uneven' high bits
|
||||||
uint bit_len; // number of 'uneven' high bits
|
uint bit_len; // number of 'uneven' high bits
|
||||||
|
uint bytes_in_rec;
|
||||||
Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||||
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg,
|
enum utype unireg_check_arg, const char *field_name_arg,
|
||||||
struct st_table *table_arg);
|
struct st_table *table_arg);
|
||||||
enum_field_types type() const { return FIELD_TYPE_BIT; }
|
enum_field_types type() const { return FIELD_TYPE_BIT; }
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
|
||||||
uint32 key_length() const { return (uint32) field_length + (bit_len > 0); }
|
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
|
||||||
uint32 max_length() { return (uint32) field_length * 8 + bit_len; }
|
uint32 max_length() { return field_length; }
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
Item_result result_type () const { return INT_RESULT; }
|
Item_result result_type () const { return INT_RESULT; }
|
||||||
void reset(void) { bzero(ptr, field_length); }
|
void reset(void) { bzero(ptr, bytes_in_rec); }
|
||||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
@ -1344,9 +1345,8 @@ public:
|
|||||||
{ Field_bit::store(buff, length, &my_charset_bin); }
|
{ Field_bit::store(buff, length, &my_charset_bin); }
|
||||||
void sort_string(char *buff, uint length)
|
void sort_string(char *buff, uint length)
|
||||||
{ get_key_image(buff, length, itRAW); }
|
{ get_key_image(buff, length, itRAW); }
|
||||||
uint32 pack_length() const
|
uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
|
||||||
{ return (uint32) field_length + (bit_len > 0); }
|
uint32 pack_length_in_rec() const { return bytes_in_rec; }
|
||||||
uint32 pack_length_in_rec() const { return field_length; }
|
|
||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
char *pack(char *to, const char *from, uint max_length=~(uint) 0);
|
char *pack(char *to, const char *from, uint max_length=~(uint) 0);
|
||||||
const char *unpack(char* to, const char *from);
|
const char *unpack(char* to, const char *from);
|
||||||
@ -1363,13 +1363,11 @@ public:
|
|||||||
|
|
||||||
class Field_bit_as_char: public Field_bit {
|
class Field_bit_as_char: public Field_bit {
|
||||||
public:
|
public:
|
||||||
uchar create_length;
|
|
||||||
Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||||
uchar null_bit_arg,
|
uchar null_bit_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg,
|
enum utype unireg_check_arg, const char *field_name_arg,
|
||||||
struct st_table *table_arg);
|
struct st_table *table_arg);
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||||
uint32 max_length() { return (uint32) create_length; }
|
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||||
int store(double nr) { return Field_bit::store(nr); }
|
int store(double nr) { return Field_bit::store(nr); }
|
||||||
|
@ -3959,7 +3959,7 @@ static int create_ndb_column(NDBCOL &col,
|
|||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
{
|
{
|
||||||
int no_of_bits= field->field_length*8 + ((Field_bit *) field)->bit_len;
|
int no_of_bits= field->field_length;
|
||||||
col.setType(NDBCOL::Bit);
|
col.setType(NDBCOL::Bit);
|
||||||
if (!no_of_bits)
|
if (!no_of_bits)
|
||||||
col.setLength(1);
|
col.setLength(1);
|
||||||
|
@ -3054,6 +3054,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
|
|||||||
int found_match_degree= 0;
|
int found_match_degree= 0;
|
||||||
Item_ident *cur_field;
|
Item_ident *cur_field;
|
||||||
int cur_match_degree= 0;
|
int cur_match_degree= 0;
|
||||||
|
char name_buff[NAME_LEN+1];
|
||||||
|
|
||||||
if (find_item->type() == Item::FIELD_ITEM ||
|
if (find_item->type() == Item::FIELD_ITEM ||
|
||||||
find_item->type() == Item::REF_ITEM)
|
find_item->type() == Item::REF_ITEM)
|
||||||
@ -3065,6 +3066,14 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
|
|||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (db_name && lower_case_table_names)
|
||||||
|
{
|
||||||
|
/* Convert database to lower case for comparison */
|
||||||
|
strmake(name_buff, db_name, sizeof(name_buff)-1);
|
||||||
|
my_casedn_str(files_charset_info, name_buff);
|
||||||
|
db_name= name_buff;
|
||||||
|
}
|
||||||
|
|
||||||
DBUG_ASSERT(field_name != 0);
|
DBUG_ASSERT(field_name != 0);
|
||||||
|
|
||||||
for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
|
for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
|
||||||
|
@ -55,8 +55,8 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
|
|||||||
bool all_constant= TRUE;
|
bool all_constant= TRUE;
|
||||||
|
|
||||||
/* If the first argument is a FIELD_ITEM, pull out the field. */
|
/* If the first argument is a FIELD_ITEM, pull out the field. */
|
||||||
if (items[0]->type() == Item::FIELD_ITEM)
|
if (items[0]->real_item()->type() == Item::FIELD_ITEM)
|
||||||
field=((Item_field *)items[0])->field;
|
field=((Item_field *)(items[0]->real_item()))->field;
|
||||||
/* But if it can't be compared as a longlong, we don't really care. */
|
/* But if it can't be compared as a longlong, we don't really care. */
|
||||||
if (field && !field->can_be_compared_as_longlong())
|
if (field && !field->can_be_compared_as_longlong())
|
||||||
field= NULL;
|
field= NULL;
|
||||||
|
@ -2213,7 +2213,7 @@ longlong Item_extract::val_int()
|
|||||||
switch (int_type) {
|
switch (int_type) {
|
||||||
case INTERVAL_YEAR: return ltime.year;
|
case INTERVAL_YEAR: return ltime.year;
|
||||||
case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month;
|
case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month;
|
||||||
case INTERVAL_QUARTER: return ltime.month/3 + 1;
|
case INTERVAL_QUARTER: return (ltime.month+2)/3;
|
||||||
case INTERVAL_MONTH: return ltime.month;
|
case INTERVAL_MONTH: return ltime.month;
|
||||||
case INTERVAL_WEEK:
|
case INTERVAL_WEEK:
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,8 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
|
|||||||
Field_bit *field= (Field_bit *) (key_part->field);
|
Field_bit *field= (Field_bit *) (key_part->field);
|
||||||
if (field->bit_len)
|
if (field->bit_len)
|
||||||
{
|
{
|
||||||
uchar bits= *(from_key + key_part->length - field->field_length -1);
|
uchar bits= *(from_key + key_part->length -
|
||||||
|
field->pack_length_in_rec() - 1);
|
||||||
set_rec_bits(bits, to_record + key_part->null_offset +
|
set_rec_bits(bits, to_record + key_part->null_offset +
|
||||||
(key_part->null_bit == 128),
|
(key_part->null_bit == 128),
|
||||||
field->bit_ofs, field->bit_len);
|
field->bit_ofs, field->bit_len);
|
||||||
|
@ -1882,7 +1882,11 @@ DBUG_skip_commit:
|
|||||||
rotate binlog, if necessary.
|
rotate binlog, if necessary.
|
||||||
*/
|
*/
|
||||||
if (commit_event->get_type_code() == XID_EVENT)
|
if (commit_event->get_type_code() == XID_EVENT)
|
||||||
thread_safe_increment(prepared_xids, &LOCK_prep_xids);
|
{
|
||||||
|
pthread_mutex_lock(&LOCK_prep_xids);
|
||||||
|
prepared_xids++;
|
||||||
|
pthread_mutex_unlock(&LOCK_prep_xids);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
|
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
|
||||||
}
|
}
|
||||||
|
@ -5531,7 +5531,7 @@ log and this option does nothing anymore.",
|
|||||||
"Sets the maximum number of threads allowed inside InnoDB. Value 0"
|
"Sets the maximum number of threads allowed inside InnoDB. Value 0"
|
||||||
" will disable the thread throttling.",
|
" will disable the thread throttling.",
|
||||||
(gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
|
(gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
|
||||||
0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
|
0, GET_LONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0},
|
||||||
{"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
|
{"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
|
||||||
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
|
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
|
||||||
" disable a sleep",
|
" disable a sleep",
|
||||||
|
@ -830,6 +830,11 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
|
|||||||
flags.sql_mode,
|
flags.sql_mode,
|
||||||
flags.max_sort_length,
|
flags.max_sort_length,
|
||||||
flags.group_concat_max_len));
|
flags.group_concat_max_len));
|
||||||
|
/*
|
||||||
|
Make InnoDB to release the adaptive hash index latch before
|
||||||
|
acquiring the query cache mutex.
|
||||||
|
*/
|
||||||
|
ha_release_temporary_latches(thd);
|
||||||
STRUCT_LOCK(&structure_guard_mutex);
|
STRUCT_LOCK(&structure_guard_mutex);
|
||||||
|
|
||||||
if (query_cache_size == 0)
|
if (query_cache_size == 0)
|
||||||
|
@ -919,14 +919,12 @@ bool select_send::send_data(List<Item> &items)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_INNOBASE_DB
|
|
||||||
/*
|
/*
|
||||||
We may be passing the control from mysqld to the client: release the
|
We may be passing the control from mysqld to the client: release the
|
||||||
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
||||||
by thd
|
by thd
|
||||||
*/
|
*/
|
||||||
ha_release_temporary_latches(thd);
|
ha_release_temporary_latches(thd);
|
||||||
#endif
|
|
||||||
|
|
||||||
List_iterator_fast<Item> li(items);
|
List_iterator_fast<Item> li(items);
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
@ -956,12 +954,10 @@ bool select_send::send_data(List<Item> &items)
|
|||||||
|
|
||||||
bool select_send::send_eof()
|
bool select_send::send_eof()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INNOBASE_DB
|
|
||||||
/* We may be passing the control from mysqld to the client: release the
|
/* We may be passing the control from mysqld to the client: release the
|
||||||
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
||||||
by thd */
|
by thd */
|
||||||
ha_release_temporary_latches(thd);
|
ha_release_temporary_latches(thd);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Unlock tables before sending packet to gain some speed */
|
/* Unlock tables before sending packet to gain some speed */
|
||||||
if (thd->lock)
|
if (thd->lock)
|
||||||
|
@ -445,9 +445,8 @@ Sensitive_cursor::fetch(ulong num_rows)
|
|||||||
if (error == NESTED_LOOP_CURSOR_LIMIT)
|
if (error == NESTED_LOOP_CURSOR_LIMIT)
|
||||||
join->resume_nested_loop= TRUE;
|
join->resume_nested_loop= TRUE;
|
||||||
|
|
||||||
#ifdef USING_TRANSACTIONS
|
|
||||||
ha_release_temporary_latches(thd);
|
ha_release_temporary_latches(thd);
|
||||||
#endif
|
|
||||||
/* Grab free_list here to correctly free it in close */
|
/* Grab free_list here to correctly free it in close */
|
||||||
thd->restore_active_arena(this, &backup_arena);
|
thd->restore_active_arena(this, &backup_arena);
|
||||||
|
|
||||||
|
@ -466,6 +466,12 @@ impossible position";
|
|||||||
(rli->group_master_log_pos)
|
(rli->group_master_log_pos)
|
||||||
*/
|
*/
|
||||||
int4store((char*) packet->ptr()+LOG_POS_OFFSET+1, 0);
|
int4store((char*) packet->ptr()+LOG_POS_OFFSET+1, 0);
|
||||||
|
/*
|
||||||
|
if reconnect master sends FD event with `created' as 0
|
||||||
|
to avoid destroying temp tables.
|
||||||
|
*/
|
||||||
|
int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
|
||||||
|
ST_CREATED_OFFSET+1, (ulong) 0);
|
||||||
/* send it */
|
/* send it */
|
||||||
if (my_net_write(net, (char*)packet->ptr(), packet->length()))
|
if (my_net_write(net, (char*)packet->ptr(), packet->length()))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user