Commit 96b42c12 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
parents 93498bdf 4f1a696f
......@@ -97,10 +97,10 @@ undefine([AC_CV_NAME])dnl
AC_DEFUN([MYSQL_TYPE_ACCEPT],
[ac_save_CXXFLAGS="$CXXFLAGS"
AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_LANG_PUSH(C++)
if test "$ac_cv_prog_gxx" = "yes"
then
# Add -Werror, remove -fbranch-probabilities (Bug #268)
CXXFLAGS=`echo $CXXFLAGS -Werror | sed 's/-fbranch-probabilities//'`
fi
mysql_cv_btype_last_arg_accept=none
......@@ -127,7 +127,7 @@ fi
if test "$mysql_cv_btype_last_arg_accept" = "none"; then
mysql_cv_btype_last_arg_accept=int
fi)
AC_LANG_RESTORE
AC_LANG_POP(C++)
AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
[The base type of the last arg to accept])
CXXFLAGS="$ac_save_CXXFLAGS"
......@@ -153,6 +153,35 @@ then
fi
])
#---START: Figure out whether to use 'struct rlimit' or 'struct rlimit64'
AC_DEFUN([MYSQL_TYPE_STRUCT_RLIMIT],
[ac_save_CXXFLAGS="$CXXFLAGS"
AC_CACHE_CHECK([struct type to use with setrlimit], mysql_cv_btype_struct_rlimit,
AC_LANG_PUSH(C++)
if test "$ac_cv_prog_gxx" = "yes"
then
# Add -Werror, remove -fbranch-probabilities (Bug #268)
CXXFLAGS=`echo $CXXFLAGS -Werror | sed 's/-fbranch-probabilities//'`
fi
mysql_cv_btype_struct_rlimit=none
[AC_TRY_COMPILE([#if defined(inline)
#undef inline
#endif
#include <stdlib.h>
#include <sys/resource.h>
],
[struct rlimit64 rl; setrlimit(RLIMIT_CORE, &rl);],
mysql_cv_btype_struct_rlimit="struct rlimit64")]
if test "$mysql_cv_btype_struct_rlimit" = "none"; then
mysql_cv_btype_struct_rlimit="struct rlimit"
fi)
AC_LANG_POP(C++)
AC_DEFINE_UNQUOTED([STRUCT_RLIMIT], [$mysql_cv_btype_struct_rlimit],
[The struct rlimit type to use with setrlimit])
CXXFLAGS="$ac_save_CXXFLAGS"
])
#---END:
AC_DEFUN([MYSQL_TIMESPEC_TS],
[AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts,
[AC_TRY_COMPILE([#include <pthread.h>
......@@ -976,7 +1005,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INCLUDE" ; then
echo "Could not find an installation of OpenSSL"
if test -n "$OPENSSL_LIB" ; then
if test "$IS_LINUX" = "true"; then
if test "$TARGET_LINUX" = "true"; then
echo "Looks like you've forgotten to install OpenSSL development RPM"
fi
fi
......@@ -1940,8 +1969,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
'void exit (int);' \
'#include <stdlib.h>'
do
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h>
$ac_declaration],
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
@%:@include <stdlib.h>],
[exit (42);])],
[],
[continue])
......
......@@ -410,15 +410,16 @@ AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
then
MYSQLD_DEFAULT_SWITCHES="--skip-locking"
IS_LINUX="true"
AC_MSG_RESULT("yes");
TARGET_LINUX="true"
AC_MSG_RESULT("yes")
AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
else
MYSQLD_DEFAULT_SWITCHES=""
IS_LINUX="false"
AC_MSG_RESULT("no");
TARGET_LINUX="false"
AC_MSG_RESULT("no")
fi
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
AC_SUBST(IS_LINUX)
AC_SUBST(TARGET_LINUX)
dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln)
......@@ -607,7 +608,7 @@ AC_SUBST(NOINST_LDFLAGS)
# (this is true on the MySQL build machines to avoid NSS problems)
#
if test "$IS_LINUX" = "true" -a "$static_nss" = ""
if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
then
tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
if test -n "$tmp"
......@@ -841,7 +842,7 @@ struct request_info *req;
])
AC_SUBST(WRAPLIBS)
if test "$IS_LINUX" = "true"; then
if test "$TARGET_LINUX" = "true"; then
AC_MSG_CHECKING([for atomic operations])
atom_ops=
......@@ -885,7 +886,7 @@ int main()
[ USE_PSTACK=no ])
pstack_libs=
pstack_dirs=
if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
......@@ -1266,61 +1267,93 @@ esac
# We have to check libc last because else it fails on Solaris 2.6
with_posix_threads="no"
# Hack for DEC-UNIX (OSF1)
# Search thread lib on Linux
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then
# Look for LinuxThreads.
AC_MSG_CHECKING("LinuxThreads")
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
if test "$res" -gt 0
AC_MSG_CHECKING("Linux threads")
if test "$TARGET_LINUX" = "true"
then
AC_MSG_RESULT("Found")
AC_DEFINE([HAVE_LINUXTHREADS], [1],
[Whether we are using Xavier Leroy's LinuxThreads])
# Linux 2.0 sanity check
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
# RedHat 5.0 does not work with dynamic linking of this. -static also
# gives a speed increase in linux so it does not hurt on other systems.
with_named_thread="-lpthread"
else
AC_MSG_RESULT("Not found")
# If this is a linux machine we should barf
if test "$IS_LINUX" = "true"
then
AC_MSG_ERROR([This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used. Please install Linuxthreads
(or a new glibc) and try again. See the Installation chapter in the
Reference Manual for more information.])
else
AC_MSG_CHECKING("DEC threads")
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
then
with_named_thread="-lpthread -lmach -lexc"
CFLAGS="$CFLAGS -D_REENTRANT"
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
AC_DEFINE(HAVE_DEC_THREADS, [1],
[Whether we are using DEC threads])
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
AC_MSG_CHECKING("DEC 3.2 threads")
if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
then
with_named_thread="-lpthreads -lmach -lc_r"
AC_DEFINE(HAVE_DEC_THREADS, [1])
AC_DEFINE([HAVE_DEC_3_2_THREADS], [1],
[Whether we are using OSF1 DEC threads on 3.2])
with_osf32_threads="yes"
MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
AC_MSG_RESULT("starting")
# use getconf to check glibc contents
AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
NPTL* )
AC_MSG_RESULT("NPTL")
AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
with_named_thread="-lpthread"
;;
LINUXTHREADS* )
AC_MSG_RESULT("Linuxthreads")
AC_DEFINE([HAVE_LINUXTHREADS], [1],
[Whether we are using Xavier Leroy's LinuxThreads])
with_named_thread="-lpthread"
;;
* )
AC_MSG_RESULT("unknown")
;;
esac
if test "$with_named_thread" = "no"
then
# old method, check headers
# Look for LinuxThreads.
AC_MSG_CHECKING("LinuxThreads in header file comment")
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
if test "$res" -gt 0
then
AC_MSG_RESULT("Found")
AC_DEFINE([HAVE_LINUXTHREADS], [1],
[Whether we are using Xavier Leroy's LinuxThreads])
# Linux 2.0 sanity check
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
# RedHat 5.0 does not work with dynamic linking of this. -static also
# gives a speed increase in linux so it does not hurt on other systems.
with_named_thread="-lpthread"
else
AC_MSG_RESULT("Not found")
# If this is a linux machine we should barf
AC_MSG_ERROR([This is a Linux system without a working getconf,
and Linuxthreads was not found. Please install it (or a new glibc) and try again.
See the Installation chapter in the Reference Manual for more information.])
fi
fi
fi
fi
fi
else
AC_MSG_RESULT("no need to check headers")
fi
AC_MSG_CHECKING("for pthread_create in -lpthread");
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
AC_TRY_LINK( [#include <pthread.h>],
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
AC_MSG_RESULT("yes"),
[ AC_MSG_RESULT("no")
AC_MSG_ERROR([
This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
Please install one of these (or a new glibc) and try again.
See the Installation chapter in the Reference Manual for more information.]) ]
)
LIBS="$ac_save_LIBS"
else
AC_MSG_RESULT("no")
fi # "$TARGET_LINUX"
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
# Hack for DEC-UNIX (OSF1 -> Tru64)
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then
AC_MSG_CHECKING("DEC threads post OSF/1 3.2")
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
then
with_named_thread="-lpthread -lmach -lexc"
CFLAGS="$CFLAGS -D_REENTRANT"
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
AC_DEFINE(HAVE_DEC_THREADS, [1], [Whether we are using DEC threads])
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
fi # DEC threads
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
dnl This is needed because -lsocket has to come after the thread
......@@ -1738,7 +1771,7 @@ fi
AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags")
if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then
LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic")
......@@ -1795,6 +1828,8 @@ AC_C_BIGENDIAN
MYSQL_TYPE_ACCEPT
#---END:
# Figure out what type of struct rlimit to use with setrlimit
MYSQL_TYPE_STRUCT_RLIMIT
# Find where the stack goes
MYSQL_STACK_DIRECTION
# We want to skip alloca on irix unconditionally. It may work on some version..
......@@ -1955,7 +1990,7 @@ CFLAGS="$ORG_CFLAGS"
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
AC_CHECK_FUNC(fseeko,
[if test "$large_file_support" = no -a "$IS_LINUX" = "true";
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
then
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
fi]
......
......@@ -97,7 +97,7 @@
/* Fix problem with S_ISLNK() on Linux */
#if defined(HAVE_LINUXTHREADS)
#if defined(TARGET_OS_LINUX)
#undef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
......@@ -107,6 +107,7 @@
#undef THREAD
#undef HAVE_mit_thread
#undef HAVE_LINUXTHREADS
#undef HAVE_NPTL
#undef HAVE_UNIXWARE7_THREADS
#endif
......@@ -214,13 +215,13 @@ C_MODE_START int __cxa_pure_virtual() {\
#endif
/* In Linux-alpha we have atomic.h if we are using gcc */
#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
#if defined(TARGET_OS_LINUX) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
#define HAVE_ATOMIC_ADD
#define HAVE_ATOMIC_SUB
#endif
/* In Linux-ia64 including atomic.h will give us an error */
#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD)
#if (defined(TARGET_OS_LINUX) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD)
#undef HAVE_ATOMIC_ADD
#undef HAVE_ATOMIC_SUB
#endif
......@@ -755,7 +756,7 @@ typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
error "Neither int or long is of 4 bytes width"
#endif
#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC)
#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)
typedef unsigned long ulong; /* Short for unsigned long */
#endif
#ifndef longlong_defined
......
......@@ -197,7 +197,17 @@ FILE* dict_foreign_err_file = NULL;
mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign
and unique error buffers */
/**********************************************************************
Makes all characters in a NUL-terminated UTF-8 string lower case. */
void
dict_casedn_str(
/*============*/
char* a) /* in/out: string to put in lower case */
{
innobase_casedn_str(a);
}
/************************************************************************
Checks if the database name in two table names is the same. */
......
......@@ -25,6 +25,7 @@ Created 10/25/1995 Heikki Tuuri
#include "srv0start.h"
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "dict0dict.h"
/*
......@@ -2732,7 +2733,15 @@ fil_load_single_table_tablespace(
sprintf(filepath, "%s/%s/%s", fil_path_to_mysql_datadir, dbname,
filename);
srv_normalize_path_for_win(filepath);
#ifdef __WIN__
/* If lower_case_table_names is 0 or 2, then MySQL allows database
directory names with upper case letters. On Windows, all table and
database names in InnoDB are internally always in lower case. Put the
file path to lower case, so that we are consistent with InnoDB's
internal data dictionary. */
dict_casedn_str(filepath);
#endif
file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
OS_FILE_READ_ONLY, &success);
if (!success) {
......
......@@ -26,6 +26,13 @@ Created 1/8/1996 Heikki Tuuri
#include "ut0byte.h"
#include "trx0types.h"
/**********************************************************************
Makes all characters in a NUL-terminated UTF-8 string lower case. */
void
dict_casedn_str(
/*============*/
char* a); /* in/out: string to put in lower case */
/************************************************************************
Get the database name length in a table name. */
......
......@@ -88,7 +88,7 @@ SUFFIXES = .sh
-e 's!@''FIND_PROC''@!@FIND_PROC@!' \
-e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
-e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
-e 's!@''sysconfdir''@!@sysconfdir@!' \
......
......@@ -83,4 +83,43 @@ Full-text indexes are called collections
Only MyISAM tables support collections
select * from t1 where MATCH(a,b) AGAINST ("only");
a b
drop table if exists t1,t2;
reset master;
drop table t1,t2;
create table t1 (a int) engine=blackhole;
delete from t1 where a=10;
update t1 set a=11 where a=15;
insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
load data infile '../../std_data/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
insert into t1 select * from t3;
replace into t1 select * from t3;
select * from t1;
a
select * from t2;
a
select * from t3;
a
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 # Start 1 # Server ver: VERSION, Binlog ver: 3
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10
master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1)
master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Create_file 1 # db=test;table=t2;file_id=1;block_len=581
master-bin.000001 # Exec_load 1 # ;file_id=1
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
drop table if exists t1;
select floor(5.5),floor(-5.5);
floor(5.5) floor(-5.5)
5 -6
......@@ -126,3 +127,13 @@ Warnings:
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
select rand(rand);
ERROR 42S22: Unknown column 'rand' in 'field list'
create table t1 select round(1, 6);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`round(1, 6)` double(7,6) NOT NULL default '0.000000'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
round(1, 6)
1.000000
drop table t1;
......@@ -96,4 +96,32 @@ select * from t1 where MATCH(a,b) AGAINST ("indexes");
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
select * from t1 where MATCH(a,b) AGAINST ("only");
drop table if exists t1,t2;
# Test that every DML (except SELECT) and DDL gets into binlog
# so that blackhole can be used as "binlog propagator"
reset master;
drop table t1,t2;
create table t1 (a int) engine=blackhole;
delete from t1 where a=10;
update t1 set a=11 where a=15;
insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
load data infile '../../std_data/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
insert into t1 select * from t3;
replace into t1 select * from t3;
# Just to verify
select * from t1;
select * from t2;
select * from t3;
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events;
drop table t1,t2,t3;
......@@ -2,6 +2,10 @@
# Test of math functions
#
--disable_warnings
drop table if exists t1;
--enable_warnings
select floor(5.5),floor(-5.5);
explain extended select floor(5.5),floor(-5.5);
select ceiling(5.5),ceiling(-5.5);
......@@ -58,3 +62,12 @@ explain extended select degrees(pi()),radians(360);
--error 1054
select rand(rand);
#
# Bug #9837: problem with round()
#
create table t1 select round(1, 6);
show create table t1;
select * from t1;
drop table t1;
......@@ -17,7 +17,7 @@
/* This makes a wrapper for mutex handling to make it easier to debug mutex */
#include <my_global.h>
#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98)
#if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98)
#define __USE_UNIX98 /* To get rw locks under Linux */
#endif
#if defined(THREAD) && defined(SAFE_MUTEX)
......
......@@ -75,7 +75,7 @@ class DefineBackupRef {
friend bool printDEFINE_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 3 );
STATIC_CONST( SignalLength = 4 );
enum ErrorCode {
Undefined = 1340,
......@@ -92,6 +92,7 @@ private:
Uint32 backupId;
Uint32 backupPtr;
Uint32 errorCode;
Uint32 nodeId;
};
class DefineBackupConf {
......@@ -158,7 +159,7 @@ class StartBackupRef {
friend bool printSTART_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 4 );
STATIC_CONST( SignalLength = 5 );
enum ErrorCode {
FailedToAllocateTriggerRecord = 1
......@@ -168,6 +169,7 @@ private:
Uint32 backupPtr;
Uint32 signalNo;
Uint32 errorCode;
Uint32 nodeId;
};
class StartBackupConf {
......@@ -232,9 +234,8 @@ public:
private:
Uint32 backupId;
Uint32 backupPtr;
Uint32 tableId;
Uint32 fragmentNo;
Uint32 errorCode;
Uint32 nodeId;
};
class BackupFragmentConf {
......@@ -296,12 +297,13 @@ class StopBackupRef {
friend bool printSTOP_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 3 );
STATIC_CONST( SignalLength = 4 );
private:
Uint32 backupId;
Uint32 backupPtr;
Uint32 errorCode;
Uint32 nodeId;
};
class StopBackupConf {
......
......@@ -240,6 +240,9 @@ public:
FileOrScanError = 1325, // slave -> coordinator
BackupFailureDueToNodeFail = 1326, // slave -> slave
OkToClean = 1327 // master -> slave
,AbortScan = 1328
,IncompatibleVersions = 1329
};
private:
Uint32 requestType;
......
......@@ -90,10 +90,8 @@ printBACKUP_FRAGMENT_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
bool
printBACKUP_FRAGMENT_REF(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
BackupFragmentRef* sig = (BackupFragmentRef*)data;
fprintf(out, " backupPtr: %d backupId: %d\n",
sig->backupPtr, sig->backupId);
fprintf(out, " tableId: %d fragmentNo: %d errorCode: %d\n",
sig->tableId, sig->fragmentNo, sig->errorCode);
fprintf(out, " backupPtr: %d backupId: %d nodeId: %d errorCode: %d\n",
sig->backupPtr, sig->backupId, sig->nodeId, sig->errorCode);
return true;
}
......
This diff is collapsed.
......@@ -232,6 +232,7 @@ public:
*/
bool newScan();
bool scanConf(Uint32 noOfOps, Uint32 opLen);
bool closeScan();
/**
* Per record
......@@ -330,7 +331,7 @@ public:
Uint8 fileOpened;
Uint8 fileRunning;
Uint8 fileDone;
Uint8 fileClosing;
Uint8 scanRunning;
};
typedef Ptr<BackupFile> BackupFilePtr;
......@@ -403,13 +404,11 @@ public:
ArrayPool<TriggerRecord> & trp)
: slaveState(b, validSlaveTransitions, validSlaveTransitionsCount,1)
, tables(tp), triggers(trp), files(bp), pages(pp)
, masterData(b, validMasterTransitions, validMasterTransitionsCount)
, backup(b)
{
closingFiles = false;
okToCleanMaster = true;
}
, masterData(b), backup(b)
{
}
Uint32 m_gsn;
CompoundState slaveState;
Uint32 clientRef;
......@@ -420,9 +419,6 @@ public:
Uint32 errorCode;
NdbNodeBitmask nodes;
bool okToCleanMaster;
bool closingFiles;
Uint64 noOfBytes;
Uint64 noOfRecords;
Uint64 noOfLogBytes;
......@@ -444,15 +440,13 @@ public:
SimpleProperties props;// Used for (un)packing backup request
struct MasterData {
MasterData(Backup & b, const State valid[], Uint32 count)
: state(b, valid, count, 0)
{
}
MasterData(Backup & b)
{
}
MutexHandle2<BACKUP_DEFINE_MUTEX> m_defineBackupMutex;
MutexHandle2<DICT_COMMIT_TABLE_MUTEX> m_dictCommitTableMutex;
Uint32 gsn;
CompoundState state;
SignalCounter sendCounter;
Uint32 errorCode;
struct {
......@@ -557,7 +551,8 @@ public:
void stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId);
void defineBackupRef(Signal*, BackupRecordPtr, Uint32 errCode = 0);
void backupFragmentRef(Signal * signal, BackupFilePtr filePtr);
void nextFragment(Signal*, BackupRecordPtr);
void sendCreateTrig(Signal*, BackupRecordPtr ptr, TablePtr tabPtr);
......@@ -578,14 +573,14 @@ public:
void sendAbortBackupOrd(Signal* signal, BackupRecordPtr ptr, Uint32 errCode);
void sendAbortBackupOrdSlave(Signal* signal, BackupRecordPtr ptr,
Uint32 errCode);
void masterAbort(Signal*, BackupRecordPtr ptr, bool controlledAbort);
void masterAbort(Signal*, BackupRecordPtr ptr);
void masterSendAbortBackup(Signal*, BackupRecordPtr ptr);
void slaveAbort(Signal*, BackupRecordPtr ptr);
void abortFile(Signal* signal, BackupRecordPtr ptr, BackupFilePtr filePtr);
void abortFileHook(Signal* signal, BackupFilePtr filePtr, bool scanDone);
bool verifyNodesAlive(const NdbNodeBitmask& aNodeBitMask);
bool verifyNodesAlive(BackupRecordPtr, const NdbNodeBitmask& aNodeBitMask);
bool checkAbort(BackupRecordPtr ptr);
void checkNodeFail(Signal* signal,
BackupRecordPtr ptr,
......@@ -603,9 +598,8 @@ public:
void sendBackupRef(BlockReference ref, Signal *signal,
Uint32 senderData, Uint32 errorCode);
void dumpUsedResources();
void cleanupMasterResources(BackupRecordPtr ptr);
void cleanupSlaveResources(BackupRecordPtr ptr);
void cleanupFinalResources(BackupRecordPtr ptr);
void cleanup(Signal*, BackupRecordPtr ptr);
void abort_scan(Signal*, BackupRecordPtr ptr);
void removeBackup(Signal*, BackupRecordPtr ptr);
void sendSTTORRY(Signal*);
......
......@@ -341,3 +341,28 @@ start backup
(ERROR_INSERTED(10022))) {
if (ERROR_INSERTED(10029)) {
if(trigPtr.p->operation->noOfBytes > 123 && ERROR_INSERTED(10030)) {
----- XXX ---
DEFINE_BACKUP_REF ->
ABORT_BACKUP_ORD(no reply) when all DEFINE_BACKUP replies has arrived
START_BACKUP_REF
ABORT_BACKUP_ORD(no reply) when all START_BACKUP_ replies has arrived
BACKUP_FRAGMENT_REF
ABORT_BACKUP_ORD(reply) directly to all nodes running BACKUP_FRAGMENT
When all nodes has replied BACKUP_FRAGMENT
ABORT_BACKUP_ORD(no reply)
STOP_BACKUP_REF
ABORT_BACKUP_ORD(no reply) when all STOP_BACKUP_ replies has arrived
NF_COMPLETE_REP
slave dies
master sends OUTSTANDING_REF to self
slave does nothing
master dies
slave elects self as master and sets only itself as participant
......@@ -175,7 +175,7 @@ Backup::Backup(const Configuration & conf) :
addRecSignal(GSN_START_BACKUP_CONF, &Backup::execSTART_BACKUP_CONF);
addRecSignal(GSN_BACKUP_FRAGMENT_REQ, &Backup::execBACKUP_FRAGMENT_REQ);
//addRecSignal(GSN_BACKUP_FRAGMENT_REF, &Backup::execBACKUP_FRAGMENT_REF);
addRecSignal(GSN_BACKUP_FRAGMENT_REF, &Backup::execBACKUP_FRAGMENT_REF);
addRecSignal(GSN_BACKUP_FRAGMENT_CONF, &Backup::execBACKUP_FRAGMENT_CONF);
addRecSignal(GSN_STOP_BACKUP_REQ, &Backup::execSTOP_BACKUP_REQ);
......
......@@ -126,6 +126,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
}
setNodeInfo(getOwnNodeId()).m_connected = true;
setNodeInfo(getOwnNodeId()).m_version = ndbGetOwnVersion();
}
Cmvmi::~Cmvmi()
......
......@@ -1022,7 +1022,7 @@ private:
Uint32 placeReadInLockQueue(Signal* signal);
void placeSerialQueueRead(Signal* signal);
void checkOnlyReadEntry(Signal* signal);
void getNoParallelTransaction(Signal* signal);
Uint32 getNoParallelTransaction(const Operationrec*);
void moveLastParallelQueue(Signal* signal);
void moveLastParallelQueueWrite(Signal* signal);
Uint32 placeWriteInLockQueue(Signal* signal);
......@@ -1100,6 +1100,8 @@ private:
Uint32 executeNextOperation(Signal* signal);
void releaselock(Signal* signal);
void takeOutFragWaitQue(Signal* signal);
void check_lock_upgrade(Signal* signal, OperationrecPtr lock_owner,
OperationrecPtr release_op);
void allocOverflowPage(Signal* signal);
bool getrootfragmentrec(Signal* signal, RootfragmentrecPtr&, Uint32 fragId);
void insertLockOwnersList(Signal* signal, const OperationrecPtr&);
......@@ -1263,7 +1265,6 @@ private:
OperationrecPtr mlpqOperPtr;
OperationrecPtr queOperPtr;
OperationrecPtr readWriteOpPtr;
OperationrecPtr tgnptMainOpPtr;
Uint32 cfreeopRec;
Uint32 coprecsize;
/* --------------------------------------------------------------------------------- */
......@@ -1514,7 +1515,6 @@ private:
Uint32 turlIndex;
Uint32 tlfrTmp1;
Uint32 tlfrTmp2;
Uint32 tgnptNrTransaction;
Uint32 tudqeIndex;
Uint32 tscanTrid1;
Uint32 tscanTrid2;
......
This diff is collapsed.
......@@ -9811,11 +9811,20 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
requestType == BuildIndxReq::RT_ALTER_INDEX ||
requestType == BuildIndxReq::RT_SYSTEMRESTART) {
jam();
const bool isLocal = req->getRequestFlag() & RequestFlag::RF_LOCAL;
NdbNodeBitmask receiverNodes = c_aliveNodes;
if (isLocal) {
receiverNodes.clear();
receiverNodes.set(getOwnNodeId());
}
if (signal->getLength() == BuildIndxReq::SignalLength) {
jam();
if (getOwnNodeId() != c_masterNodeId) {
if (!isLocal && getOwnNodeId() != c_masterNodeId) {
jam();
releaseSections(signal);
OpBuildIndex opBad;
opPtr.p = &opBad;
......@@ -9828,9 +9837,9 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
}
// forward initial request plus operation key to all
req->setOpKey(++c_opRecordSequence);
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
NodeReceiverGroup rg(DBDICT, receiverNodes);
sendSignal(rg, GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength + 1, JBB);
signal, BuildIndxReq::SignalLength + 1, JBB);
return;
}
// seize operation record
......@@ -9853,7 +9862,7 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
}
c_opBuildIndex.add(opPtr);
// master expects to hear from all
opPtr.p->m_signalCounter = c_aliveNodes;
opPtr.p->m_signalCounter = receiverNodes;
buildIndex_sendReply(signal, opPtr, false);
return;
}
......@@ -10208,10 +10217,20 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr)
req->setConnectionPtr(opPtr.p->key);
req->setRequestType(opPtr.p->m_requestType);
req->addRequestFlag(opPtr.p->m_requestFlag);
opPtr.p->m_signalCounter = c_aliveNodes;
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
sendSignal(rg, GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
if(opPtr.p->m_requestFlag & RequestFlag::RF_LOCAL)
{
opPtr.p->m_signalCounter.clearWaitingFor();
opPtr.p->m_signalCounter.setWaitingFor(getOwnNodeId());
sendSignal(reference(), GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
}
else
{
opPtr.p->m_signalCounter = c_aliveNodes;
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
sendSignal(rg, GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
}
}
void
......
......@@ -968,7 +968,6 @@ public:
enum LcpState {
LCP_IDLE = 0,
LCP_STARTED = 1,
LCP_COMPLETED = 2,
LCP_WAIT_FRAGID = 3,
LCP_WAIT_TUP_PREPLCP = 4,
......@@ -2266,7 +2265,7 @@ private:
void sendCopyActiveConf(Signal* signal,Uint32 tableId);
void checkLcpCompleted(Signal* signal);
void checkLcpHoldop(Signal* signal);
void checkLcpStarted(Signal* signal);
bool checkLcpStarted(Signal* signal);
void checkLcpTupprep(Signal* signal);
void getNextFragForLcp(Signal* signal);
void initLcpLocAcc(Signal* signal, Uint32 fragId);
......
......@@ -10351,8 +10351,8 @@ void Dblqh::execTUP_LCPSTARTED(Signal* signal)
void Dblqh::lcpStartedLab(Signal* signal)
{
checkLcpStarted(signal);
if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) {
if (checkLcpStarted(signal))
{
jam();
/* ----------------------------------------------------------------------
* THE LOCAL CHECKPOINT HAS BEEN STARTED. IT IS NOW TIME TO
......@@ -10432,26 +10432,7 @@ void Dblqh::execLQH_RESTART_OP(Signal* signal)
lcpPtr.i = signal->theData[1];
ptrCheckGuard(lcpPtr, clcpFileSize, lcpRecord);
ndbrequire(fragptr.p->fragStatus == Fragrecord::BLOCKED);
if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) {
jam();
/***********************************************************************/
/* THIS SIGNAL CAN ONLY BE RECEIVED WHEN FRAGMENT IS BLOCKED AND
* THE LOCAL CHECKPOINT HAS BEEN STARTED. THE BLOCKING WILL BE
* REMOVED AS SOON AS ALL OPERATIONS HAVE BEEN STARTED.
***********************************************************************/
restartOperationsLab(signal);
} else if (lcpPtr.p->lcpState == LcpRecord::LCP_BLOCKED_COMP) {
jam();
/*******************************************************************>
* THE CHECKPOINT IS COMPLETED BUT HAS NOT YET STARTED UP
* ALL OPERATIONS AGAIN.
* WE PERFORM THIS START-UP BEFORE CONTINUING WITH THE NEXT
* FRAGMENT OF THE LOCAL CHECKPOINT TO AVOID ANY STRANGE ERRORS.
*******************************************************************> */
restartOperationsLab(signal);
} else {
ndbrequire(false);
}
restartOperationsLab(signal);
}//Dblqh::execLQH_RESTART_OP()
void Dblqh::restartOperationsLab(Signal* signal)
......@@ -11000,7 +10981,8 @@ void Dblqh::checkLcpHoldop(Signal* signal)
*
* SUBROUTINE SHORT NAME = CLS
* ========================================================================== */
void Dblqh::checkLcpStarted(Signal* signal)
bool
Dblqh::checkLcpStarted(Signal* signal)
{
LcpLocRecordPtr clsLcpLocptr;
......@@ -11010,7 +10992,7 @@ void Dblqh::checkLcpStarted(Signal* signal)
do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_WAIT_STARTED){
return;
return false;
}//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
i++;
......@@ -11021,12 +11003,13 @@ void Dblqh::checkLcpStarted(Signal* signal)
do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_WAIT_STARTED){
return;
return false;
}//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
i++;
} while (clsLcpLocptr.i != RNIL);
lcpPtr.p->lcpState = LcpRecord::LCP_STARTED;
return true;
}//Dblqh::checkLcpStarted()
/* ==========================================================================
......@@ -11187,20 +11170,12 @@ void Dblqh::sendAccContOp(Signal* signal)
do {
ptrCheckGuard(sacLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
sacLcpLocptr.p->accContCounter = 0;
if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_STARTED){
/* ------------------------------------------------------------------- */
/*SEND START OPERATIONS TO ACC AGAIN */
/* ------------------------------------------------------------------- */
signal->theData[0] = lcpPtr.p->lcpAccptr;
signal->theData[1] = sacLcpLocptr.p->locFragid;
sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
count++;
} else if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_COMPLETED){
signal->theData[0] = sacLcpLocptr.i;
sendSignal(reference(), GSN_ACC_CONTOPCONF, signal, 1, JBB);
} else {
ndbrequire(false);
}
/* ------------------------------------------------------------------- */
/*SEND START OPERATIONS TO ACC AGAIN */
/* ------------------------------------------------------------------- */
signal->theData[0] = lcpPtr.p->lcpAccptr;
signal->theData[1] = sacLcpLocptr.p->locFragid;
sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
sacLcpLocptr.i = sacLcpLocptr.p->nextLcpLoc;
} while (sacLcpLocptr.i != RNIL);
......@@ -11236,9 +11211,18 @@ void Dblqh::sendStartLcp(Signal* signal)
signal->theData[0] = stlLcpLocptr.i;
signal->theData[1] = cownref;
signal->theData[2] = stlLcpLocptr.p->tupRef;
sendSignal(fragptr.p->tupBlockref, GSN_TUP_LCPREQ, signal, 3, JBA);
if(ERROR_INSERTED(5077))
sendSignalWithDelay(fragptr.p->tupBlockref, GSN_TUP_LCPREQ,
signal, 5000, 3);
else
sendSignal(fragptr.p->tupBlockref, GSN_TUP_LCPREQ, signal, 3, JBA);
stlLcpLocptr.i = stlLcpLocptr.p->nextLcpLoc;
} while (stlLcpLocptr.i != RNIL);
if(ERROR_INSERTED(5077))
{
ndbout_c("Delayed TUP_LCPREQ with 5 sec");
}
}//Dblqh::sendStartLcp()
/* ------------------------------------------------------------------------- */
......
......@@ -82,8 +82,14 @@ inline bool OpenFiles::insert(AsyncFile* file, Uint16 id){
continue;
if(strcmp(m_files[i].m_file->theFileName.c_str(),
file->theFileName.c_str()) == 0){
ERROR_SET(fatal, AFS_ERROR_ALLREADY_OPEN,"","OpenFiles::insert()");
file->theFileName.c_str()) == 0)
{
BaseString names;
names.assfmt("open: >%s< existing: >%s<",
file->theFileName.c_str(),
m_files[i].m_file->theFileName.c_str());
ERROR_SET(fatal, AFS_ERROR_ALLREADY_OPEN, names.c_str(),
"OpenFiles::insert()");
}
}
......
......@@ -1565,9 +1565,9 @@ ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
{ // start backup can take some time, set timeout high
Uint64 old_timeout= handle->read_timeout;
if (wait_completed == 2)
handle->read_timeout= 30*60*1000; // 30 minutes
handle->read_timeout= 48*60*60*1000; // 48 hours
else if (wait_completed == 1)
handle->read_timeout= 5*60*1000; // 5 minutes
handle->read_timeout= 10*60*1000; // 10 minutes
reply = ndb_mgm_call(handle, start_backup_reply, "start backup", &args);
handle->read_timeout= old_timeout;
}
......
......@@ -791,7 +791,7 @@ MgmtSrvr::restartNode(int processId, bool nostart,
result = sendSignal(processId, NO_WAIT, signal, true);
}
if (result == -1) {
if (result == -1 && theWaitState != WAIT_NODEFAILURE) {
m_stopRec.inUse = false;
return SEND_OR_RECEIVE_FAILED;
}
......@@ -1920,6 +1920,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
#ifdef VM_TRACE
ndbout_c("I'm not master resending to %d", aNodeId);
#endif
theWaitNode= aNodeId;
NdbApiSignal aSignal(_ownReference);
BackupReq* req = CAST_PTR(BackupReq, aSignal.getDataPtrSend());
aSignal.set(TestOrd::TraceAPI, BACKUP, GSN_BACKUP_REQ,
......@@ -1947,6 +1948,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
event.Event = BackupEvent::BackupAborted;
event.Aborted.Reason = rep->reason;
event.Aborted.BackupId = rep->backupId;
event.Aborted.ErrorCode = rep->reason;
backupCallback(event);
}
break;
......@@ -2076,6 +2078,13 @@ MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
handleStopReply(nodeId, 0);
DBUG_VOID_RETURN;
}
if(theWaitNode == nodeId &&
theWaitState != NO_WAIT && theWaitState != WAIT_STOP)
{
theWaitState = WAIT_NODEFAILURE;
NdbCondition_Signal(theMgmtWaitForResponseCondPtr);
}
}
eventReport(_ownNodeId, theData);
......@@ -2427,7 +2436,7 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
int result;
if (waitCompleted == 2) {
result = sendRecSignal(nodeId, WAIT_BACKUP_COMPLETED,
signal, true, 30*60*1000 /*30 secs*/);
signal, true, 48*60*60*1000 /* 48 hours */);
}
else if (waitCompleted == 1) {
result = sendRecSignal(nodeId, WAIT_BACKUP_STARTED,
......@@ -2456,22 +2465,6 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
return -1;
break;
}
} else {
switch(m_lastBackupEvent.Event){
case BackupEvent::BackupCompleted:
backupId = m_lastBackupEvent.Completed.BackupId;
break;
case BackupEvent::BackupStarted:
backupId = m_lastBackupEvent.Started.BackupId;
break;
case BackupEvent::BackupFailedToStart:
return m_lastBackupEvent.FailedToStart.ErrorCode;
case BackupEvent::BackupAborted:
return m_lastBackupEvent.Aborted.ErrorCode;
default:
return -1;
break;
}
}
return 0;
......
......@@ -611,7 +611,8 @@ private:
WAIT_STOP,
WAIT_BACKUP_STARTED,
WAIT_BACKUP_COMPLETED,
WAIT_VERSION
WAIT_VERSION,
WAIT_NODEFAILURE
};
/**
......@@ -695,6 +696,7 @@ private:
NdbApiSignal* theSignalIdleList;
// List of unused signals
Uint32 theWaitNode;
WaitSignalType theWaitState;
// State denoting a set of signals we accept to recieve.
......
......@@ -108,6 +108,7 @@ MgmtSrvr::sendRecSignal(Uint16 aNodeId,
return -1;
}
theWaitState = aWaitState;
theWaitNode = aNodeId;
return receiveOptimisedResponse(waitTime);
}
......@@ -119,11 +120,12 @@ MgmtSrvr::receiveOptimisedResponse(int waitTime)
theFacade->checkForceSend(_blockNumber);
NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime;
while (theWaitState != NO_WAIT && waitTime > 0) {
while (theWaitState != NO_WAIT && theWaitState != WAIT_NODEFAILURE
&& waitTime > 0) {
NdbCondition_WaitTimeout(theMgmtWaitForResponseCondPtr,
theFacade->theMutexPtr,
waitTime);
if(theWaitState == NO_WAIT)
if(theWaitState == NO_WAIT || theWaitState == WAIT_NODEFAILURE)
break;
waitTime = (maxTime - NdbTick_CurrentMillisecond());
}//while
......
......@@ -453,7 +453,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tFirstDataPtr = int2void(tFirstData);
if(tFirstDataPtr != 0){
tOp = void2rec_op(tFirstDataPtr);
if (tOp->checkMagicNumber() == 0) {
if (tOp->checkMagicNumber(false) == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
if ((tCon->theSendStatus == NdbConnection::sendTC_OP) ||
......@@ -466,11 +466,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if
}//if
}//if
} else {
}
#ifdef VM_TRACE
ndbout_c("Recevied TCKEY_FAILREF wo/ operation");
ndbout_c("Recevied TCKEY_FAILREF wo/ operation");
#endif
}
return;
break;
}
case GSN_TCKEYREF:
......
......@@ -140,10 +140,10 @@ ErrorBundle ErrorCodes[] = {
{ 4008, UR, "Receive from NDB failed" },
{ 4009, UR, "Cluster Failure" },
{ 4012, UR,
"Time-out, most likely caused by simple read or cluster failure" },
"Request ndbd time-out, maybe due to high load or communication problems"},
{ 4024, UR,
"Time-out, most likely caused by simple read or cluster failure" },
"Time-out, most likely caused by simple read or cluster failure" },
/**
* TemporaryResourceError
*/
......@@ -348,7 +348,7 @@ ErrorBundle ErrorCodes[] = {
{ 1325, IE, "File or scan error" },
{ 1326, IE, "Backup abortet due to node failure" },
{ 1327, IE, "1327" },
{ 1340, IE, "Backup undefined error" },
{ 1342, AE, "Backup failed to allocate buffers (check configuration)" },
{ 1343, AE, "Backup failed to setup fs buffers (check configuration)" },
......@@ -358,7 +358,8 @@ ErrorBundle ErrorCodes[] = {
{ 1347, AE, "Backup failed to allocate table memory (check configuration)" },
{ 1348, AE, "Backup failed to allocate file record (check configuration)" },
{ 1349, AE, "Backup failed to allocate attribute record (check configuration)" },
{ 1329, AE, "Backup during software upgrade not supported" },
/**
* Still uncategorized
*/
......
......@@ -74,20 +74,20 @@ int runAbort(NDBT_Context* ctx, NDBT_Step* step){
if (testMaster) {
if (testSlave) {
if (backup.NFMasterAsSlave(restarter) == -1){
if (backup.NFMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
if (backup.NFMaster(restarter) == -1){
if (backup.NFMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
if (backup.NFSlave(restarter) == -1){
if (backup.NFSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
return NDBT_OK;
}
......@@ -108,16 +108,16 @@ int runFail(NDBT_Context* ctx, NDBT_Step* step){
if (testMaster) {
if (testSlave) {
if (backup.FailMasterAsSlave(restarter) == -1){
if (backup.FailMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
if (backup.FailMaster(restarter) == -1){
if (backup.FailMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
if (backup.FailSlave(restarter) == -1){
if (backup.FailSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
......
......@@ -1329,7 +1329,7 @@ TESTCASE("NFNR2_O",
INITIALIZER(runLoadTable);
STEP(runRestarts);
STEP(runTransactions2);
STEP(runTransactions2);
//STEP(runTransactions2);
FINALIZER(runVerifyIndex);
FINALIZER(createRandomIndex_Drop);
FINALIZER(createPkIndex_Drop);
......
......@@ -547,21 +547,64 @@ runLockUpgrade1(NDBT_Context* ctx, NDBT_Step* step){
do
{
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
if(ctx->getProperty("LOCK_UPGRADE", 1) == 1)
{
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
ctx->setProperty("READ_DONE", 1);
ctx->broadcast();
ndbout_c("wait 2");
ctx->getPropertyWait("READ_DONE", 2);
ndbout_c("wait 2 - done");
ctx->setProperty("READ_DONE", 1);
ctx->broadcast();
ndbout_c("wait 2");
ctx->getPropertyWait("READ_DONE", 2);
ndbout_c("wait 2 - done");
}
else
{
ctx->setProperty("READ_DONE", 1);
ctx->broadcast();
ctx->getPropertyWait("READ_DONE", 2);
ndbout_c("wait 2 - done");
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
}
if(ctx->getProperty("LU_OP", o_INS) == o_INS)
{
CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
CHECK(hugoOps.pkInsertRecord(pNdb, 0, 1, 2) == 0);
}
else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
{
CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
}
else
{
CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
}
ctx->setProperty("READ_DONE", 3);
ctx->broadcast();
ndbout_c("before update");
CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
ndbout_c("wait update");
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
CHECK(hugoOps.closeTransaction(pNdb));
CHECK(hugoOps.execute_Commit(pNdb) == 0);
CHECK(hugoOps.closeTransaction(pNdb) == 0);
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1) == 0);
int res= hugoOps.execute_Commit(pNdb);
if(ctx->getProperty("LU_OP", o_INS) == o_INS)
{
CHECK(res == 0);
CHECK(hugoOps.verifyUpdatesValue(2) == 0);
}
else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
{
CHECK(res == 0);
CHECK(hugoOps.verifyUpdatesValue(2) == 0);
}
else
{
CHECK(res == 626);
}
} while(0);
return result;
......@@ -592,10 +635,17 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
ndbout_c("wait 3 - done");
NdbSleep_MilliSleep(200);
CHECK(hugoOps.execute_Commit(pNdb) == 0);
if(ctx->getProperty("LU_COMMIT", (Uint32)0) == 0)
{
CHECK(hugoOps.execute_Commit(pNdb) == 0);
}
else
{
CHECK(hugoOps.execute_Rollback(pNdb) == 0);
}
} while(0);
return NDBT_FAILED;
return result;
}
int
......@@ -607,11 +657,17 @@ main(int argc, const char** argv){
NDBT_TestSuite ts("testOperations");
for(Uint32 i = 0; i < 12; i++)
{
BaseString name("bug_9749");
name.appfmt("_%d", i);
NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts,
name.c_str(), "");
pt->setProperty("LOCK_UPGRADE", 1 + (i & 1));
pt->setProperty("LU_OP", 1 + ((i >> 1) % 3));
pt->setProperty("LU_COMMIT", i / 6);
pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable",
runClearTable));
......
......@@ -2,6 +2,54 @@ max-time: 3600
cmd: atrt-mysql-test-run
args: --force
max-time: 600
cmd: atrt-testBackup
args: -n NFMaster T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n NFMasterAsSlave T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n NFSlave T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n FailMaster T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n FailMasterAsSlave T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n FailSlave T1
max-time: 600
cmd: testBasic
args: -n PkRead T1
max-time: 600
cmd: atrt-testBackup
args: -n BackupOne T1 T6 T3 I3
......
......@@ -244,7 +244,11 @@ NdbBackup::NFSlave(NdbRestarter& _restarter){
int
NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz, bool onMaster){
int nNodes = _restarter.getNumDbNodes();
{
if(nNodes == 1)
return NDBT_OK;
int nodeId = _restarter.getMasterNodeId();
CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0,
......@@ -255,15 +259,11 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
CHECK(_restarter.startNodes(&nodeId, 1) == 0,
"failed to start node");
NdbSleep_SecSleep(10);
}
CHECK(_restarter.waitClusterStarted() == 0,
"waitClusterStarted failed");
int nNodes = _restarter.getNumDbNodes();
myRandom48Init(NdbTick_CurrentMillisecond());
for(int i = 0; i<sz; i++){
......@@ -296,6 +296,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
"failed to set error insert");
g_info << "error inserted" << endl;
NdbSleep_SecSleep(1);
g_info << "starting backup" << endl;
int r = start(backupId);
......@@ -304,6 +305,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
if (r == 0) {
g_err << "Backup should have failed on error_insertion " << error << endl
<< "Master = " << masterNodeId << "Node = " << nodeId << endl;
return NDBT_FAILED;
}
CHECK(_restarter.waitNodesNoStart(&nodeId, 1) == 0,
......@@ -316,8 +318,6 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
return NDBT_FAILED;
}
NdbSleep_SecSleep(1);
g_info << "starting new backup" << endl;
CHECK(start(backupId) == 0,
"failed to start backup");
......@@ -331,8 +331,14 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
"waitClusterStarted failed");
g_info << "node started" << endl;
int val2[] = { 24, 2424 };
CHECK(_restarter.dumpStateAllNodes(val2, 2) == 0,
"failed to check backup resources RestartOnErrorInsert");
CHECK(_restarter.insertErrorInNode(nodeId, 10099) == 0,
"failed to set error insert");
NdbSleep_SecSleep(1);
}
return NDBT_OK;
......@@ -340,15 +346,8 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
int
FailS_codes[] = {
10023,
10024,
10025,
10026,
10027,
10028,
10029,
10030,
10031
10033
};
int
......@@ -359,9 +358,8 @@ FailM_codes[] = {
10026,
10027,
10028,
10029,
10030,
10031
10031,
10033
};
int
......@@ -426,13 +424,21 @@ NdbBackup::Fail(NdbRestarter& _restarter, int *Fail_codes, const int sz, bool on
if (r == 0) {
g_err << "Backup should have failed on error_insertion " << error << endl
<< "Master = " << masterNodeId << "Node = " << nodeId << endl;
return NDBT_FAILED;
}
CHECK(_restarter.waitClusterStarted() == 0,
"waitClusterStarted failed");
CHECK(_restarter.insertErrorInNode(nodeId, 10099) == 0,
"failed to set error insert");
NdbSleep_SecSleep(5);
int val2[] = { 24, 2424 };
CHECK(_restarter.dumpStateAllNodes(val2, 2) == 0,
"failed to check backup resources RestartOnErrorInsert");
}
return NDBT_OK;
......
......@@ -135,7 +135,7 @@ SUFFIXES = .sh
-e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
-e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
-e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
-e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \
......
......@@ -324,7 +324,7 @@ do
break
fi
if @IS_LINUX@ && test $KILL_MYSQLD -eq 1
if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1
then
# Test if one process was hanging.
# This is only a fix for Linux (running as base 3 mysqld processes)
......
......@@ -1072,6 +1072,8 @@ void Item_func_round::fix_length_and_dec()
decimals=0;
else
decimals=min(tmp,NOT_FIXED_DEC);
if ((tmp= decimals - args[0]->decimals) > 0)
max_length+= tmp;
}
}
......
......@@ -2000,7 +2000,7 @@ static void init_signals(void)
if (test_flags & TEST_CORE_ON_SIGNAL)
{
/* Change limits so that we will get a core file */
struct rlimit rl;
STRUCT_RLIMIT rl;
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
sql_print_warning("setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals");
......
......@@ -43,7 +43,7 @@ void safe_print_str(const char* name, const char* val, int max_len)
fputc('\n', stderr);
}
#ifdef HAVE_LINUXTHREADS
#ifdef TARGET_OS_LINUX
#define SIGRETURN_FRAME_COUNT 2
#if defined(__alpha__) && defined(__GNUC__)
......@@ -201,7 +201,7 @@ terribly wrong...\n");
stack trace is much more helpful in diagnosing the problem, so please do \n\
resolve it\n");
}
#endif /* HAVE_LINUXTHREADS */
#endif /* TARGET_OS_LINUX */
#endif /* HAVE_STACKTRACE */
/* Produce a core for the thread */
......
......@@ -18,7 +18,7 @@
extern "C" {
#endif
#ifdef HAVE_LINUXTHREADS
#ifdef TARGET_OS_LINUX
#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE
#define HAVE_STACKTRACE
......@@ -30,7 +30,7 @@ extern char* heap_start;
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* HAVE_LINUXTHREADS */
#endif /* TARGET_OS_LINUX */
/* Define empty prototypes for functions that are not implemented */
#ifndef HAVE_STACKTRACE
......
......@@ -90,7 +90,7 @@ SUFFIXES = .sh
-e 's!@''FIND_PROC''@!@FIND_PROC@!' \
-e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
-e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
-e 's!@''sysconfdir''@!@sysconfdir@!' \
......
......@@ -101,7 +101,7 @@ static CHARSET_INFO *cs= &my_charset_latin1;
set by the user
*/
#if defined(__i386__) && defined(HAVE_LINUXTHREADS)
#if defined(__i386__) && defined(TARGET_OS_LINUX)
#define DO_STACKTRACE 1
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment