Merge mysql.com:/home/jonas/src/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0-ndb
This commit is contained in:
joreland@mysql.com 2005-01-28 08:11:56 +01:00
commit 97a778d88a
49 changed files with 448 additions and 377 deletions

View file

@ -6,12 +6,15 @@ then
exit 1
fi
prefix_configs="--prefix=/usr/local/mysql"
just_print=
just_configure=
full_debug=
while test $# -gt 0
do
case "$1" in
--prefix=* ) prefix_configs="$1"; shift ;;
--with-debug=full ) full_debug="=full"; shift ;;
-c | --just-configure ) just_configure=1; shift ;;
-n | --just-print | --print ) just_print=1; shift ;;
-h | --help ) cat <<EOF; exit 0 ;;
@ -19,12 +22,11 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
Any other options will be passed directly to configure.
--with-debug=full Build with full debug.
--prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
EOF
--with-debug=full ) full_debug="=full"; shift ;;
* )
echo "Unknown option '$1'"
exit 1
@ -70,7 +72,7 @@ debug_extra_cflags="-O1 -Wuninitialized"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
amd64_cxxflags="-DBIG_TABLES"
base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
amd64_configs=""
alpha_configs="" # Not used yet

View file

@ -156,7 +156,7 @@ $ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread*2;
$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
$ndbcluster_port= 9350 + $opt_build_thread*2;
$ndbcluster_port= 9350 + $opt_build_thread*4;
$manager_port=$mysql_tcp_port+1;
$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20";

View file

@ -42,8 +42,8 @@ RSC=rc.exe
# PROP Output_Dir ".\debug"
# PROP Intermediate_Dir ".\debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE CPP /nologo /MTd /I "../extra" /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../extra" /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "_DEBUG"
@ -67,8 +67,8 @@ LINK32=link.exe
# PROP Output_Dir ".\classic"
# PROP Intermediate_Dir ".\classic"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD BASE CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG"
@ -92,8 +92,8 @@ LINK32=link.exe
# PROP Output_Dir ".\release"
# PROP Intermediate_Dir ".\release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG"

View file

@ -1531,14 +1531,11 @@ then
fi
fi
TOOLS_LIBS="$NON_THREADED_CLIENT_LIBS"
# Should we use named pthread library ?
AC_MSG_CHECKING("named thread libs:")
if test "$with_named_thread" != "no"
then
LIBS="$with_named_thread $LIBS $with_named_thread"
TOOLS_LIBS="$with_named_thread $TOOLS_LIBS $with_named_thread"
with_posix_threads="yes"
with_mit_threads="no"
AC_MSG_RESULT("$with_named_thread")
@ -1557,9 +1554,7 @@ else
then
AC_MSG_CHECKING("for pthread_create in -lpthread");
ac_save_LIBS="$LIBS"
ac_save_TOOLS_LIBS="$TOOLS_LIBS"
LIBS="$LIBS -lpthread"
TOOLS_LIBS="$TOOLS_LIBS -lpthread"
AC_TRY_LINK(
[#include <pthread.h>],
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
@ -1568,7 +1563,6 @@ else
if test "$with_posix_threads" = "no"
then
LIBS=" $ac_save_LIBS -lpthreads"
TOOLS_LIBS=" $ac_save_TOOLS_LIBS -lpthreads"
AC_MSG_CHECKING("for pthread_create in -lpthreads");
AC_TRY_LINK(
[#include <pthread.h>],
@ -1579,7 +1573,6 @@ else
then
# This is for FreeBSD
LIBS="$ac_save_LIBS -pthread"
TOOLS_LIBS="$ac_save_TOOLS_LIBS -pthread"
AC_MSG_CHECKING("for pthread_create in -pthread");
AC_TRY_LINK(
[#include <pthread.h>],
@ -1590,7 +1583,6 @@ else
then
with_mit_threads="yes"
LIBS="$ac_save_LIBS"
TOOLS_LIBS="$ac_save_TOOLS_LIBS"
fi
fi
fi
@ -2656,8 +2648,6 @@ AC_SUBST(sql_union_dirs)
# Some usefull subst
AC_SUBST(CC)
AC_SUBST(GXX)
#Remove TOOLS_LIBS, because this is included in LIBRARIES
#AC_SUBST(TOOLS_LIBS)
# Set configuration options for make_binary_distribution
case $SYSTEM_TYPE in

View file

@ -530,7 +530,11 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_LEN 256 /* Max file name len */
#define FN_HEADLEN 253 /* Max length of filepart of file name */
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
#ifdef PATH_MAX
#define FN_REFLEN PATH_MAX/* Max length of full path-name */
#else
#define FN_REFLEN 512 /* Max length of full path-name */
#endif
#define FN_EXTCHAR '.'
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */

View file

@ -15,6 +15,13 @@ Created 10/21/1995 Heikki Tuuri
#include "fil0fil.h"
#include "buf0buf.h"
#if defined(UNIV_HOTBACKUP) && defined(__WIN__)
/* Add includes for the _stat() call to compile on Windows */
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#endif /* UNIV_HOTBACKUP */
#undef HAVE_FDATASYNC
#ifdef POSIX_ASYNC_IO

View file

@ -88,7 +88,9 @@ ut_malloc_low(
"InnoDB: Check if you should increase the swap file or\n"
"InnoDB: ulimits of your operating system.\n"
"InnoDB: On FreeBSD check you have compiled the OS with\n"
"InnoDB: a big enough maximum process size.\n",
"InnoDB: a big enough maximum process size.\n"
"InnoDB: Note that in most 32-bit computers the process\n"
"InnoDB: memory space is limited to 2 GB or 4 GB.\n",
(ulong) n, (ulong) ut_total_allocated_memory,
#ifdef __WIN__
(ulong) GetLastError()

View file

@ -571,8 +571,11 @@ where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE
SCHEMATA TEMPORARY MyISAM
TABLES TEMPORARY MyISAM
show tables from information_schema like "t%";
Tables_in_information_schema (t%)
show tables from information_schema like "T%";
Tables_in_information_schema (T%)
TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS
create database information_schema;
ERROR HY000: Can't create database 'information_schema'; database exists
use information_schema;

View file

@ -638,3 +638,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
CREATE TABLE t1 (
ID int(11) NOT NULL auto_increment,
NO int(11) NOT NULL default '0',
SEQ int(11) NOT NULL default '0',
PRIMARY KEY (ID),
KEY t1$NO (SEQ,NO)
) ENGINE=MyISAM;
INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
ID NO SEQ
1 1 1
drop table t1;

View file

@ -1,4 +1,4 @@
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
CREATE TABLE T1 (a int);
@ -131,13 +131,13 @@ show tables like 't1%';
Tables_in_test (t1%)
t1
drop table t1;
create temporary table tT(a int(11), b varchar(8));
insert into tT values (1, 'abc');
select * from tT;
create temporary table T1(a int(11), b varchar(8));
insert into T1 values (1, 'abc');
select * from T1;
a b
1 abc
alter table tT add index (a);
select * from tT;
alter table T1 add index (a);
select * from T1;
a b
1 abc
drop table tT;
drop table T1;

View file

@ -1,6 +1,6 @@
#
# Simple test for archive example
# Taken fromm the select test
# Taken from the select test
#
-- source include/have_archive.inc

View file

@ -281,7 +281,7 @@ drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
where table_schema='information_schema' limit 2;
show tables from information_schema like "t%";
show tables from information_schema like "T%";
--error 1007
create database information_schema;

View file

@ -180,3 +180,18 @@ insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2
select * from t2;
drop table t1, t2;
#
# BUG#6034 - Error code 124: Wrong medium type
#
CREATE TABLE t1 (
ID int(11) NOT NULL auto_increment,
NO int(11) NOT NULL default '0',
SEQ int(11) NOT NULL default '0',
PRIMARY KEY (ID),
KEY t1$NO (SEQ,NO)
) ENGINE=MyISAM;
INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
drop table t1;

View file

@ -10,7 +10,7 @@ show variables like "lower_case_table_names";
enable_query_log;
--disable_warnings
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
--enable_warnings
@ -105,9 +105,9 @@ drop table t1;
# Bug #7261: Alter table loses temp table
#
create temporary table tT(a int(11), b varchar(8));
insert into tT values (1, 'abc');
select * from tT;
alter table tT add index (a);
select * from tT;
drop table tT;
create temporary table T1(a int(11), b varchar(8));
insert into T1 values (1, 'abc');
select * from T1;
alter table T1 add index (a);
select * from T1;
drop table T1;

View file

@ -9,6 +9,7 @@ ndb_version.h
ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbTransaction.hpp \

View file

@ -121,6 +121,7 @@
#define CFG_SHM_CHECKSUM 501
#define CFG_SHM_KEY 502
#define CFG_SHM_BUFFER_MEM 503
#define CFG_SHM_SIGNUM 504
#define CFG_SCI_HOST1_ID_0 550
#define CFG_SCI_HOST1_ID_1 551

View file

@ -0,0 +1,27 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_OPT_DEFAULTS_H
#define NDB_OPT_DEFAULTS_H
#ifdef SIGRTMIN
#define OPT_NDB_SHM_SIGNUM_DEFAULT SIGRTMIN+2
#else
#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
#endif
#define OPT_NDB_SHM_DEFAULT 0
#endif

View file

@ -77,6 +77,7 @@ struct SHM_TransporterConfiguration {
Uint32 shmKey;
Uint32 shmSize;
int signum;
};
/**

View file

@ -22,24 +22,16 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
#include <ndb_opt_defaults.h>
#define NDB_STD_OPTS_VARS \
const char *opt_connect_str= 0;\
my_bool opt_ndb_shm;\
my_bool opt_ndb_optimized_node_selection
#define NDB_STD_OPTS_OPTIONS \
OPT_NDB_SHM= 256,\
OPT_NDB_OPTIMIZED_NODE_SELECTION
my_bool opt_ndb_shm;
#define OPT_NDB_CONNECTSTRING 'c'
#if defined(NOT_ENOUGH_TESTED) && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
#endif
#define NDB_STD_OPTS_COMMON \
{ "usage", '?', "Display this help and exit.", \
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
@ -75,4 +67,51 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
#endif
static void ndb_std_print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage();
enum ndb_std_options {
OPT_NDB_SHM= 256,
OPT_NDB_SHM_SIGNUM,
OPT_NDB_OPTIMIZED_NODE_SELECTION,
NDB_STD_OPTIONS_LAST /* should always be last in this enum */
};
static my_bool
ndb_std_get_one_option(int optid,
const struct my_option *opt __attribute__((unused)),
const char *argument)
{
switch (optid) {
case '#':
if (argument)
{
DBUG_PUSH(argument);
}
break;
case 'V':
ndb_std_print_version();
exit(0);
case '?':
usage();
exit(0);
case OPT_NDB_SHM:
if (opt_ndb_shm)
{
#ifndef NDB_SHM_TRANSPORTER
printf("Warning: binary not compiled with shared memory support,\n"
"Tcp connections will now be used instead\n");
opt_ndb_shm= 0;
#endif
}
break;
}
return 0;
}
#endif /*_NDB_OPTS_H */

View file

@ -14,7 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "IPCConfig.hpp"
#include <ndb_global.h>
#include <ndb_opt_defaults.h>
#include <IPCConfig.hpp>
#include <NdbOut.hpp>
#include <NdbHost.h>
@ -381,7 +383,12 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_SHM_KEY, &conf.shmKey)) break;
if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break;
{
Uint32 tmp;
if(iter.get(CFG_SHM_SIGNUM, &tmp)) break;
conf.signum= tmp;
}
conf.port= server_port;
conf.localHostName = localHostName;
conf.remoteHostName = remoteHostName;

View file

@ -24,6 +24,10 @@
/*#define USE_PTHREAD_EXTRAS*/
#ifdef NDB_SHM_TRANSPORTER
int g_ndb_shm_signum= 0;
#endif
struct NdbThread
{
pthread_t thread;
@ -35,16 +39,21 @@ struct NdbThread
static
void*
ndb_thread_wrapper(void* _ss){
DBUG_ENTER("ndb_thread_wrapper");
void * ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
#ifdef NDB_SHM_TRANSPORTER
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, 0);
if (g_ndb_shm_signum)
{
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
#endif
ret= (* ss->func)(ss->object);
return ret;
DBUG_RETURN(ret);
}

View file

@ -26,6 +26,8 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
extern int g_ndb_shm_signum;
SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
const char *lHostName,
const char *rHostName,
@ -62,7 +64,9 @@ SHM_Transporter::~SHM_Transporter(){
bool
SHM_Transporter::initTransporter(){
return true;
if (g_ndb_shm_signum)
return true;
return false;
}
void
@ -355,6 +359,6 @@ SHM_Transporter::doSend()
if(m_last_signal)
{
m_last_signal = 0;
kill(m_remote_pid, SIGUSR1);
kill(m_remote_pid, g_ndb_shm_signum);
}
}

View file

@ -38,6 +38,7 @@
#ifdef NDB_SHM_TRANSPORTER
#include "SHM_Transporter.hpp"
extern int g_ndb_shm_signum;
#endif
#include "TransporterCallback.hpp"
@ -152,22 +153,13 @@ TransporterRegistry::disconnectAll(){
bool
TransporterRegistry::init(NodeId nodeId) {
DBUG_ENTER("TransporterRegistry::init");
nodeIdSpecified = true;
localNodeId = nodeId;
DEBUG("TransporterRegistry started node: " << localNodeId);
#ifdef NDB_SHM_TRANSPORTER
/**
* Make sure to block SIGUSR1
* TransporterRegistry::init is run from "main" thread
*/
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, 0);
#endif
return true;
DBUG_RETURN(true);
}
bool
@ -406,6 +398,7 @@ TransporterRegistry::createTransporter(SCI_TransporterConfiguration *config) {
bool
TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
DBUG_ENTER("TransporterRegistry::createTransporter SHM");
#ifdef NDB_SHM_TRANSPORTER
if(!nodeIdSpecified){
init(config->localNodeId);
@ -414,6 +407,22 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
if(config->localNodeId != localNodeId)
return false;
if (!g_ndb_shm_signum) {
g_ndb_shm_signum= config->signum;
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
/**
* Make sure to block g_ndb_shm_signum
* TransporterRegistry::init is run from "main" thread
*/
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
if(config->signum != g_ndb_shm_signum)
return false;
if(theTransporters[config->remoteNodeId] != NULL)
return false;
@ -443,9 +452,9 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
nTransporters++;
nSHMTransporters++;
return true;
DBUG_RETURN(true);
#else
return false;
DBUG_RETURN(false);
#endif
}
@ -1337,6 +1346,7 @@ shm_sig_handler(int signo)
void
TransporterRegistry::startReceiving()
{
DBUG_ENTER("TransporterRegistry::startReceiving");
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->createPhantom();
@ -1355,26 +1365,34 @@ TransporterRegistry::startReceiving()
#ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid();
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, SIGUSR1);
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
sa.sa_handler = shm_sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
int ret;
while((ret = sigaction(SIGUSR1, &sa, 0)) == -1 && errno == EINTR);
if(ret != 0)
if (g_ndb_shm_signum)
{
g_eventLogger.error("Failed to install signal handler for SHM transporter"
" errno: %d (%s)", errno,
DBUG_PRINT("info",("Install signal handler for signum %d",
g_ndb_shm_signum));
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, g_ndb_shm_signum);
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
sa.sa_handler = shm_sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
int ret;
while((ret = sigaction(g_ndb_shm_signum, &sa, 0)) == -1 && errno == EINTR);
if(ret != 0)
{
DBUG_PRINT("error",("Install failed"));
g_eventLogger.error("Failed to install signal handler for"
" SHM transporter errno: %d (%s)", errno,
#ifdef HAVE_STRERROR
strerror(errno));
strerror(errno)
#else
"");
""
#endif
);
}
}
#endif
#endif // NDB_SHM_TRANSPORTER
DBUG_VOID_RETURN;
}
void

View file

@ -15,7 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> /* Needed for mkdir(2) */
#include <ndb_opts.h>
#include <my_sys.h>
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
#include "CPCD.hpp"
#include "APIService.hpp"

View file

@ -47,8 +47,7 @@ extern "C" {
extern EventLogger g_eventLogger;
enum ndbd_options {
NDB_STD_OPTS_OPTIONS,
OPT_INITIAL,
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
OPT_NODAEMON
};
@ -82,14 +81,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -97,18 +92,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndbd.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt,
argument ? argument : "d:t:O,/tmp/ndbd.trace");
}
bool

View file

@ -56,9 +56,6 @@ handler(int sig){
}
}
enum ndb_mgm_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char default_prompt[]= "ndb_mgm> ";
@ -83,14 +80,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [hostname [port]]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -98,18 +91,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgm.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgm.trace");
}
static int

View file

@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
#include "ConfigInfo.hpp"
@ -1765,6 +1766,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_SHM_SIGNUM,
"Signum",
"SHM",
"Signum to be used for signalling",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
UNDEFINED,
"0",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_CONNECTION_NODE_1,
"NodeId1",
@ -3190,18 +3203,27 @@ bool
fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
Uint32 id1= 0, id2= 0, key= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
if(ctx.m_currentSection->get("ShmKey", &key))
{
DBUG_RETURN(true);
Uint32 signum;
if(!ctx.m_currentSection->get("Signum", &signum))
{
signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
ctx.m_currentSection->put("Signum", signum);
DBUG_PRINT("info",("Added Signum=%u", signum));
}
}
{
Uint32 id1= 0, id2= 0, key= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
if(!ctx.m_currentSection->get("ShmKey", &key))
{
require(ctx.m_userProperties.get("ShmUniqueId", &key));
key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
ctx.m_currentSection->put("ShmKey", key);
DBUG_PRINT("info",("Added ShmKey=0x%x", key));
}
}
require(ctx.m_userProperties.get("ShmUniqueId", &key));
key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
ctx.m_currentSection->put("ShmKey", key);
DBUG_PRINT("info",("Added ShmKey=0x%x", key));
DBUG_RETURN(true);
}

View file

@ -134,8 +134,7 @@ extern EventLogger g_eventLogger;
extern int global_mgmt_server_check;
enum ndb_mgmd_options {
NDB_STD_OPTS_OPTIONS,
OPT_INTERACTIVE,
OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
OPT_NO_NODEID_CHECKS,
OPT_NO_DAEMON
};
@ -169,14 +168,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -184,25 +179,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgmd.trace");
break;
case 'V':
print_version();
exit(0);
case OPT_NDB_SHM:
#ifndef NDB_SHM_TRANSPORTER
printf("Warning: binary not compiled with shared memory support,\n"
"use configure option --with-ndb-shm to enable support.\n"
"Tcp connections will now be used instead\n");
opt_ndb_shm= 0;
#endif
break;
case '?':
usage();
exit(0);
}
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgmd.trace");
return 0;
}

View file

@ -24,9 +24,6 @@
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
enum ndb_delete_all {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -38,16 +35,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_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 print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will delete all records in the specified table using scan delete.\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_delete_all.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_delete_all.trace");
}
int main(int argc, char** argv){

View file

@ -19,9 +19,6 @@
#include <NDBT.hpp>
#include <NdbApi.hpp>
enum ndb_desc_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -37,17 +34,13 @@ static struct my_option my_long_options[] =
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}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
" ex: desc T1 T2 T4\n";
print_version();
" ex: desc T1 T2 T4\n";
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_desc.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_desc.trace");
}
int main(int argc, char** argv){

View file

@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
enum ndb_drop_index_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_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 print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"<indexname>+\n"\
"This program will drop index(es) in Ndb\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_index.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_index.trace");
}
int main(int argc, char** argv){

View file

@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
enum ndb_drop_table_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_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 print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will drop one table in Ndb\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){

View file

@ -161,9 +161,6 @@ list(const char * tabname,
}
}
enum ndb_show_tables_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -186,20 +183,16 @@ static struct my_option my_long_options[] =
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}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all system objects in NDB Cluster.\n"\
"Type of objects to display can be limited with -t option\n"\
" ex: list_tables -t 2 would show all UserTables\n"\
" ex: ndb_show_tables -t 2 would show all UserTables\n"\
"To show all indexes for a table write table name as final argument\n"\
" ex: list_tables T1\n";
print_version();
" ex: ndb_show_tables T1\n";
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -207,18 +200,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_show_tables.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_show_tables.trace");
}
int main(int argc, char** argv){

View file

@ -36,9 +36,6 @@ static Vector<class BackupConsumer *> g_consumers;
static const char* ga_backupPath = "." DIR_SEPARATOR;
enum ndb_restore_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
/**
@ -101,14 +98,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [<path to backup files>]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -116,13 +109,9 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_restore.trace");
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_restore.trace");
break;
case 'V':
print_version();
exit(0);
case 'n':
if (ga_nodeId == 0)
{
@ -137,9 +126,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1);
}
break;
case '?':
usage();
exit(0);
}
return 0;
}

View file

@ -36,9 +36,6 @@ int scanReadRecords(Ndb*,
bool orderby,
bool descending);
enum ndb_select_all_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -75,10 +72,6 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_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 print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
@ -88,7 +81,7 @@ static void usage()
"(It only print error messages if it encounters a permanent error.)\n"\
"It can also be used to dump the content of a table to file \n"\
" ex: select_all --no-header --delimiter=';' T4 > T4.data\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -96,18 +89,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_all.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_all.trace");
}
int main(int argc, char** argv){

View file

@ -32,9 +32,6 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int* count_rows,
NdbOperation::LockMode lock);
enum ndb_select_count_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@ -54,16 +51,12 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_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 print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname1 ... tabnameN\n"\
"This program will count the number of records in tables\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@ -71,18 +64,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_count.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_count.trace");
}
int main(int argc, char** argv){

View file

@ -31,8 +31,7 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
NDB_STD_OPTS_OPTIONS,
OPT_WAIT_STATUS_NOT_STARTED
OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST
};
NDB_STD_OPTS_VARS;
@ -53,32 +52,20 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){

View file

@ -117,7 +117,6 @@
/* Variables for archive share methods */
pthread_mutex_t archive_mutex;
static HASH archive_open_tables;
static int archive_init= 0;
/* The file extension */
#define ARZ ".ARZ" // The data file
@ -143,6 +142,46 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
return (byte*) share->table_name;
}
/*
Initialize the archive handler.
SYNOPSIS
archive_db_init()
void
RETURN
FALSE OK
TRUE Error
*/
bool archive_db_init()
{
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
(hash_get_key) archive_get_key, 0, 0));
}
/*
Release the archive handler.
SYNOPSIS
archive_db_end()
void
RETURN
FALSE OK
*/
bool archive_db_end()
{
hash_free(&archive_open_tables);
VOID(pthread_mutex_destroy(&archive_mutex));
return FALSE;
}
/*
This method reads the header of a datafile and returns whether or not it was successful.
*/
@ -269,23 +308,6 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
uint length;
char *tmp_name;
if (!archive_init)
{
/* Hijack a mutex for init'ing the storage engine */
pthread_mutex_lock(&LOCK_mysql_create_db);
if (!archive_init)
{
VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST));
if (hash_init(&archive_open_tables,system_charset_info,32,0,0,
(hash_get_key) archive_get_key,0,0))
{
pthread_mutex_unlock(&LOCK_mysql_create_db);
return NULL;
}
archive_init++;
}
pthread_mutex_unlock(&LOCK_mysql_create_db);
}
pthread_mutex_lock(&archive_mutex);
length=(uint) strlen(table_name);
@ -371,6 +393,7 @@ int ha_archive::free_share(ARCHIVE_SHARE *share)
(void)write_meta_file(share->meta_file, share->rows_recorded, FALSE);
if (gzclose(share->archive_write) == Z_ERRNO)
rc= 1;
my_close(share->meta_file,MYF(0));
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
@ -787,6 +810,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
goto error;
}
(void)write_meta_file(meta_file, rows_recorded, TRUE);
my_close(meta_file,MYF(0));
rc= 0;
}

View file

@ -105,3 +105,7 @@ public:
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
};
bool archive_db_init(void);
bool archive_db_end(void);

View file

@ -372,6 +372,16 @@ int ha_init()
else
opt_using_transactions=1;
}
#endif
#ifdef HAVE_ARCHIVE_DB
if (have_archive_db == SHOW_OPTION_YES)
{
if (archive_db_init())
{
have_archive_db= SHOW_OPTION_DISABLED;
error= 1;
}
}
#endif
return error;
}
@ -403,6 +413,10 @@ int ha_panic(enum ha_panic_function flag)
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
error|=ndbcluster_end();
#endif
#ifdef HAVE_ARCHIVE_DB
if (have_archive_db == SHOW_OPTION_YES)
error|= archive_db_end();
#endif
if (ha_finish_errors())
error= 1;

View file

@ -2134,7 +2134,6 @@ String *Item_char_typecast::val_str(String *str)
String *res;
uint32 length;
#if 0
if (!charset_conversion)
{
if (!(res= args[0]->val_str(str)))
@ -2144,7 +2143,6 @@ String *Item_char_typecast::val_str(String *str)
}
}
else
#endif
{
// Convert character set if differ
uint dummy_errors;
@ -2182,9 +2180,18 @@ String *Item_char_typecast::val_str(String *str)
void Item_char_typecast::fix_length_and_dec()
{
uint32 char_length;
charset_conversion= !my_charset_same(args[0]->collation.collation, cast_cs) &&
args[0]->collation.collation != &my_charset_bin &&
cast_cs != &my_charset_bin;
/*
We always force character set conversion if cast_cs
is a multi-byte character set. It garantees that the
result of CAST is a well-formed string.
For single-byte character sets we allow just to copy
from the argument. A single-byte character sets string
is always well-formed.
*/
charset_conversion= (cast_cs->mbmaxlen > 1) ||
!my_charset_same(args[0]->collation.collation, cast_cs) &&
args[0]->collation.collation != &my_charset_bin &&
cast_cs != &my_charset_bin;
collation.set(cast_cs, DERIVATION_IMPLICIT);
char_length= (cast_length >= 0) ? cast_length :
args[0]->max_length/args[0]->collation.collation->mbmaxlen;

View file

@ -982,7 +982,7 @@ extern Gt_creator gt_creator;
extern Lt_creator lt_creator;
extern Ge_creator ge_creator;
extern Le_creator le_creator;
extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern char language[FN_REFLEN], reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN];

View file

@ -351,7 +351,7 @@ char *default_tz_name;
char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
char* log_error_file_ptr= log_error_file;
char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
*mysqld_user,*mysqld_chroot, *opt_init_file,
*opt_init_connect, *opt_init_slave,
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];

View file

@ -28,7 +28,7 @@
- If the variable is thread specific, add it to 'system_variables' struct.
If not, add it to mysqld.cc and an declaration in 'mysql_priv.h'
- If the variable should be changed from the command line, add a definition
of it in the my_option structure list in mysqld.dcc
of it in the my_option structure list in mysqld.cc
- Don't forget to initialize new fields in global_system_variables and
max_system_variables!
- If the variable should show up in 'show variables' add it to the
@ -584,6 +584,7 @@ sys_var *sys_variables[]=
&sys_max_tmp_tables,
&sys_max_user_connections,
&sys_max_write_lock_count,
&sys_multi_range_count,
&sys_myisam_data_pointer_size,
&sys_myisam_max_extra_sort_file_size,
&sys_myisam_max_sort_file_size,
@ -828,6 +829,7 @@ struct show_var_st init_vars[]= {
{sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS},
{sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS},
{sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS},
{sys_multi_range_count.name, (char*) &sys_multi_range_count, SHOW_SYS},
{sys_myisam_data_pointer_size.name, (char*) &sys_myisam_data_pointer_size, SHOW_SYS},
{sys_myisam_max_extra_sort_file_size.name,
(char*) &sys_myisam_max_extra_sort_file_size,

View file

@ -1280,6 +1280,7 @@ public:
unit= u;
return 0;
}
virtual int prepare2(void) { return 0; }
/*
Because of peculiarities of prepared statements protocol
we need to know number of columns in the result set (if
@ -1379,6 +1380,7 @@ class select_insert :public select_result_interceptor {
enum_duplicates duplic, bool ignore);
~select_insert();
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
int prepare2(void);
bool send_data(List<Item> &items);
virtual void store_values(List<Item> &values);
void send_error(uint errcode,const char *err);

View file

@ -1802,13 +1802,22 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
thd->lex->current_select->options|= OPTION_BUFFER_RESULT;
thd->lex->current_select->join->select_options|= OPTION_BUFFER_RESULT;
}
else
{
/*
We must not yet prepare the result table if it is the same as one of the
source tables (INSERT SELECT). The preparation may disable
indexes on the result table, which may be used during the select, if it
is the same table (Bug #6034). Do the preparation after the select phase
in select_insert::prepare2().
*/
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
thd->no_trans_update= 0;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
@ -1819,6 +1828,36 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
/*
Finish the preparation of the result table.
SYNOPSIS
select_insert::prepare2()
void
DESCRIPTION
If the result table is the same as one of the source tables (INSERT SELECT),
the result table is not finally prepared at the join prepair phase.
Do the final preparation now.
RETURN
0 OK
*/
int select_insert::prepare2(void)
{
DBUG_ENTER("select_insert::prepare2");
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
{
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
return 0;
}
void select_insert::cleanup()
{
/* select_insert/select_create are never re-used in prepared statement */

View file

@ -5339,6 +5339,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->table_name, information_schema_name.str);
DBUG_RETURN(0);
}
ptr->schema_table_name= ptr->table_name;
ptr->schema_table= schema_table;
}
ptr->select_lex= lex->current_select;

View file

@ -1164,6 +1164,7 @@ JOIN::exec()
DBUG_VOID_RETURN;
}
}
(void) result->prepare2(); // Currently, this cannot fail.
if (!tables_list)
{ // Only test of functions
@ -13149,7 +13150,8 @@ bool JOIN::change_result(select_result *res)
{
DBUG_ENTER("JOIN::change_result");
result= res;
if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
if (!procedure && (result->prepare(fields_list, select_lex->master_unit()) ||
result->prepare2()))
{
DBUG_RETURN(TRUE);
}

View file

@ -1802,7 +1802,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db,
show_table_list->table_name))
show_table_list->alias))
{
DBUG_RETURN(1);
}
@ -1911,7 +1911,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
show_table_list->lock_type= lock_type;
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, table,
res, base_name, file_name))
res, base_name,
show_table_list->alias))
{
DBUG_RETURN(1);
}
@ -3183,8 +3184,16 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
}
table->s->tmp_table= TMP_TABLE;
table->grant.privilege= SELECT_ACL;
table->alias_name_used= 0;
table_list->schema_table_name= table_list->table_name;
/*
This test is necessary to make
case insensitive file systems +
upper case table names(information schema tables) +
views
working correctly
*/
table->alias_name_used= my_strcasecmp(table_alias_charset,
table_list->schema_table_name,
table_list->alias);
table_list->table_name= (char*) table->s->table_name;
table_list->table= table;
table->next= thd->derived_tables;