Commit 019446f0 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/data0/bk/mysql-5.1

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-marvel


client/client_priv.h:
  Auto merged
client/mysqlslap.c:
  Auto merged
sql/mysqld.cc:
  Auto merged
parents 940eb733 f4422bd4
......@@ -131,10 +131,10 @@ ADD_SUBDIRECTORY(dbug)
ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(storage/heap)
ADD_SUBDIRECTORY(storage/myisam)
ADD_SUBDIRECTORY(storage/myisammrg)
......
......@@ -147,6 +147,28 @@ test-force-full:
test-force-mem:
$(MAKE) force=--force mem=--mem test
test-bt:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=normal --force --timer \
--skip-ndbcluster --report-features
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=ps --force --timer \
--skip-ndbcluster --ps-protocol
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=normal+rowrepl --force --timer \
--skip-ndbcluster --mysqld=--binlog-format=row
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=ps+rowrepl+NDB --force --timer \
--ps-protocol --mysqld=--binlog-format=row
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=NDB --force --timer \
--with-ndbcluster-only
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
--skip-ndbcluster --skip-rpl --report-features
# Keep these for a while
test-pl: test
test-full-pl: test-full
......
......@@ -95,6 +95,7 @@ ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys yassl taocrypt zlib wsock32 dbug)
ADD_EXECUTABLE(echo echo.c)
......
......@@ -34,7 +34,7 @@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
client_priv.h
EXTRA_DIST = get_password.c CMakeLists.txt
EXTRA_DIST = get_password.c CMakeLists.txt echo.c
bin_PROGRAMS = mysql \
mysqladmin \
......@@ -76,6 +76,7 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqlshow_SOURCES= mysqlshow.c
mysqlslap_SOURCES= mysqlslap.c
mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
......@@ -96,7 +97,6 @@ DEFS = -DUNDEF_THREADS_HACK \
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
EXTRA_DIST = get_password.c CMakeLists.txt echo.c
link_sources:
for f in $(sql_src) ; do \
......
......@@ -49,7 +49,6 @@ enum options_client
OPT_TRIGGERS,
OPT_MYSQL_ONLY_PRINT,
OPT_MYSQL_LOCK_DIRECTORY,
OPT_MYSQL_SLAP_SLAVE,
OPT_USE_THREADS,
OPT_IMPORT_USE_THREADS,
OPT_MYSQL_NUMBER_OF_QUERY,
......@@ -58,6 +57,14 @@ enum options_client
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
OPT_SLAP_PRE_QUERY,
OPT_SLAP_POST_QUERY,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE
......
This diff is collapsed.
......@@ -2296,12 +2296,18 @@ AC_ARG_WITH(man,
[with_man=yes]
)
if test "$with_man" = "yes"
if test X"$with_man" = Xyes
then
man_dirs="man"
man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
if test X"$have_ndbcluster" = Xyes
then
man1_files=`ls $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
man8_files=`ls $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
else
man1_files=`ls $srcdir/man/*.1 | grep -v '/ndb' | sed -e 's;^.*man/;;'`
man8_files=`ls $srcdir/man/*.8 | grep -v '/ndb' | sed -e 's;^.*man/;;'`
fi
man1_files=`echo $man1_files`
man8_files=`ls -1 $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
man8_files=`echo $man8_files`
else
man_dirs=""
......
......@@ -425,14 +425,8 @@ inline double ulonglong2double(ulonglong value)
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
#ifdef CYBOZU
#define MYSQL_DEFAULT_CHARSET_NAME "utf8"
#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs"
#define HAVE_UTF8_GENERAL_CS 1
#else
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#endif
#define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1
......@@ -443,10 +437,8 @@ inline double ulonglong2double(ulonglong value)
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
#ifndef CYBOZU
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1
#endif
/* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */
/* #undef HAVE_CHARSET_cp1257 */
......@@ -455,33 +447,27 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */
#ifndef CYBOZU
#define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
#endif
/* #undef HAVE_CHARSET_greek */
/* #undef HAVE_CHARSET_hebrew */
/* #undef HAVE_CHARSET_hp8 */
/* #undef HAVE_CHARSET_keybcs2 */
/* #undef HAVE_CHARSET_koi8r */
/* #undef HAVE_CHARSET_koi8u */
#ifndef CYBOZU
#define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1
#endif
/* #undef HAVE_CHARSET_latin5 */
/* #undef HAVE_CHARSET_latin7 */
/* #undef HAVE_CHARSET_macce */
/* #undef HAVE_CHARSET_macroman */
#define HAVE_CHARSET_sjis 1
/* #undef HAVE_CHARSET_swe7 */
#ifndef CYBOZU
#define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1
#endif
#define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1
......@@ -701,6 +701,15 @@ extern uint my_thread_end_wait_time;
Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
*/
/* Which kind of thread library is in use */
#define THD_LIB_OTHER 1
#define THD_LIB_NPTL 2
#define THD_LIB_LT 4
extern uint thd_lib_detected;
/* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment
......
......@@ -24,11 +24,6 @@ extern "C" {
#ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
#endif
#ifdef HAVE_LINUXTHREADS
#define THR_CLIENT_ALARM SIGALRM
#else
#define THR_CLIENT_ALARM SIGUSR1
#endif
#ifdef HAVE_rts_threads
#undef USE_ONE_SIGNAL_HAND
#define USE_ALARM_THREAD
......@@ -90,6 +85,9 @@ typedef struct st_alarm {
my_bool malloced;
} ALARM;
extern uint thr_client_alarm;
extern pthread_t alarm_thread;
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
......
......@@ -1885,8 +1885,7 @@ sub environment_setup () {
mtr_native_path($exe_mysqlslap) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password= " .
"--lock-directory=$opt_tmpdir";
"--socket=$master->[0]->{'path_sock'} --password= ";
if ( $opt_debug )
{
......
......@@ -143,3 +143,27 @@ select * from t1;
select * from t2;
select * from t1;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
CREATE SCHEMA `mysqlslap`;
use mysqlslap;
set storage_engine=`heap`;
CREATE TABLE t1 (id int, name varchar(64));
create table t2(foo1 varchar(32), foo2 varchar(32));
INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
SHOW TABLES;
select * from t1;
SHOW TABLES;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
CREATE SCHEMA `mysqlslap`;
use mysqlslap;
set storage_engine=`myisam`;
CREATE TABLE t1 (id int, name varchar(64));
create table t2(foo1 varchar(32), foo2 varchar(32));
INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
SHOW TABLES;
select * from t1;
SHOW TABLES;
DROP SCHEMA IF EXISTS `mysqlslap`;
......@@ -4,7 +4,7 @@
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --use-threads
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
--exec $MYSQL_SLAP --only-print --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
......@@ -14,3 +14,25 @@
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')"
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env --auto-generate-sql-add-autoincrement
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=update
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update --auto-generate-sql-execute-number=5
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5 --auto-generate-sql-secondary-indexes=3
--exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES";
......@@ -61,7 +61,7 @@ fi
###########################################################################
client_args="--silent --socket=$socket_path --connect_timeout=1 "
client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 "
[ -n "$username" ] && client_args="$client_args --user=$username "
[ -n "$password" ] && client_args="$client_args --password=$password "
......
......@@ -31,6 +31,8 @@
uint thd_lib_detected= 0;
uint thd_lib_detected;
#ifndef my_pthread_setprio
void my_pthread_setprio(pthread_t thread_id,int prior)
{
......@@ -51,8 +53,6 @@ int my_pthread_getprio(pthread_t thread_id)
int policy;
if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param))
{
DBUG_PRINT("thread",("policy: %d priority: %d",
policy,tmp_sched_param.sched_priority));
return tmp_sched_param.sched_priority;
}
#endif
......@@ -314,8 +314,6 @@ void sigwait_handle_sig(int sig)
pthread_mutex_unlock(&LOCK_sigwait);
}
extern pthread_t alarm_thread;
void *sigwait_thread(void *set_arg)
{
sigset_t *set=(sigset_t*) set_arg;
......@@ -334,7 +332,9 @@ void *sigwait_thread(void *set_arg)
sigaction(i, &sact, (struct sigaction*) 0);
}
}
sigaddset(set,THR_CLIENT_ALARM);
/* Ensure that init_thr_alarm() is called */
DBUG_ASSERT(thr_client_alarm);
sigaddset(set, thr_client_alarm);
pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
alarm_thread=pthread_self(); /* For thr_alarm */
......
......@@ -20,6 +20,7 @@
#include "mysys_priv.h"
#include <m_string.h>
#include <signal.h>
#ifdef THREAD
#ifdef USE_TLS
......@@ -63,6 +64,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
#endif
static uint get_thread_lib(void);
/*
initialize thread environment
......@@ -76,6 +79,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
my_bool my_thread_global_init(void)
{
thd_lib_detected= get_thread_lib();
if (pthread_key_create(&THR_KEY_mysys,0))
{
fprintf(stderr,"Can't initialize threads: error %d\n",errno);
......@@ -395,4 +400,20 @@ const char *my_thread_name(void)
}
#endif /* DBUG_OFF */
static uint get_thread_lib(void)
{
#ifdef _CS_GNU_LIBPTHREAD_VERSION
char buff[64];
confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff));
if (!strncasecmp(buff, "NPTL", 4))
return THD_LIB_NPTL;
if (!strncasecmp(buff, "linuxthreads", 12))
return THD_LIB_LT;
#endif
return THD_LIB_OTHER;
}
#endif /* THREAD */
......@@ -34,6 +34,7 @@
#define ETIME ETIMEDOUT
#endif
uint thr_client_alarm;
static int alarm_aborted=1; /* No alarm thread */
my_bool thr_alarm_inited= 0;
volatile my_bool alarm_thread_running= 0;
......@@ -56,9 +57,7 @@ static void *alarm_handler(void *arg);
#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
#endif
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
static sig_handler thread_alarm(int sig __attribute__((unused)));
#endif
static int compare_ulong(void *not_used __attribute__((unused)),
byte *a_ptr,byte* b_ptr)
......@@ -77,9 +76,13 @@ void init_thr_alarm(uint max_alarms)
sigfillset(&full_signal_set); /* Neaded to block signals */
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_alarm,NULL);
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
my_sigset(THR_CLIENT_ALARM,thread_alarm);
thr_client_alarm= thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1;
#ifndef USE_ALARM_THREAD
if (thd_lib_detected != THD_LIB_LT)
#endif
{
my_sigset(thr_client_alarm, thread_alarm);
}
sigemptyset(&s);
sigaddset(&s, THR_SERVER_ALARM);
alarm_thread=pthread_self();
......@@ -97,10 +100,11 @@ void init_thr_alarm(uint max_alarms)
}
#elif defined(USE_ONE_SIGNAL_HAND)
pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
my_sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
if (thd_lib_detected == THD_LIB_LT)
{
my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
#endif
}
#else
my_sigset(THR_SERVER_ALARM, process_alarm);
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
......@@ -273,18 +277,17 @@ sig_handler process_alarm(int sig __attribute__((unused)))
This must be first as we can't call DBUG inside an alarm for a normal thread
*/
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
if (!pthread_equal(pthread_self(),alarm_thread))
if (thd_lib_detected == THD_LIB_LT &&
!pthread_equal(pthread_self(),alarm_thread))
{
#if defined(MAIN) && !defined(__bsdi__)
printf("thread_alarm in process_alarm\n"); fflush(stdout);
#endif
#ifdef DONT_REMEMBER_SIGNAL
my_sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */
#endif
return;
}
#endif
/*
We have to do do the handling of the alarm in a sub function,
......@@ -328,7 +331,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data=(ALARM*) queue_element(&alarm_queue,i);
alarm_data->alarmed=1; /* Info to thread */
if (pthread_equal(alarm_data->thread,alarm_thread) ||
pthread_kill(alarm_data->thread, THR_CLIENT_ALARM))
pthread_kill(alarm_data->thread, thr_client_alarm))
{
#ifdef MAIN
printf("Warning: pthread_kill couldn't find thread!!!\n");
......@@ -352,7 +355,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data->alarmed=1; /* Info to thread */
DBUG_PRINT("info",("sending signal to waiting thread"));
if (pthread_equal(alarm_data->thread,alarm_thread) ||
pthread_kill(alarm_data->thread, THR_CLIENT_ALARM))
pthread_kill(alarm_data->thread, thr_client_alarm))
{
#ifdef MAIN
printf("Warning: pthread_kill couldn't find thread!!!\n");
......@@ -488,7 +491,7 @@ void thr_alarm_info(ALARM_INFO *info)
ARGSUSED
*/
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
static sig_handler thread_alarm(int sig)
{
#ifdef MAIN
......@@ -498,7 +501,6 @@ static sig_handler thread_alarm(int sig)
my_sigset(sig,thread_alarm); /* int. thread system calls */
#endif
}
#endif
#ifdef HAVE_TIMESPEC_TS_SEC
......@@ -784,9 +786,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
sigaddset(&set,SIGINT);
sigaddset(&set,SIGQUIT);
sigaddset(&set,SIGTERM);
#if THR_CLIENT_ALARM != SIGHUP
sigaddset(&set,SIGHUP);
#endif
#ifdef SIGTSTP
sigaddset(&set,SIGTSTP);
#endif
......@@ -797,7 +797,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
puts("Starting signal handling thread");
#endif
printf("server alarm: %d thread alarm: %d\n",
THR_SERVER_ALARM,THR_CLIENT_ALARM);
THR_SERVER_ALARM, thr_client_alarm);
DBUG_PRINT("info",("Starting signal and alarm handling thread"));
for(;;)
{
......@@ -865,11 +865,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
sigaddset(&set,SIGTSTP);
#endif
sigaddset(&set,THR_SERVER_ALARM);
sigdelset(&set,THR_CLIENT_ALARM);
sigdelset(&set, thr_client_alarm);
(void) pthread_sigmask(SIG_SETMASK,&set,NULL);
#ifdef NOT_USED
sigemptyset(&set);
sigaddset(&set,THR_CLIENT_ALARM);
sigaddset(&set, thr_client_alarm);
VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0));
#endif
......
......@@ -66,6 +66,7 @@ struct show_table_authors_st show_table_authors[]= {
"Parser, port to OS/2, storage engines and some random stuff" },
{ "Yuri Dario", "", "OS/2 port" },
{ "Andrei Elkin", "Espoo, Finland", "Replication" },
{ "Patrick Galbraith", "Sharon, NH", "Federated Engine, mysqlslap" },
{ "Sergei Golubchik", "Kerpen, Germany",
"Full-text search, precision math" },
{ "Lenz Grimmer", "Hamburg, Germany",
......
......@@ -195,12 +195,6 @@ inline void reset_floating_point_exceptions()
} /* cplusplus */
#if defined(HAVE_LINUXTHREADS)
#define THR_KILL_SIGNAL SIGINT
#else
#define THR_KILL_SIGNAL SIGUSR2 // Can't use this with LinuxThreads
#endif
#define MYSQL_KILL_SIGNAL SIGTERM
#ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
......@@ -638,6 +632,7 @@ struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
#ifndef EMBEDDED_LIBRARY
struct passwd *user_info;
static pthread_t select_thread;
static uint thr_kill_signal;
#endif
/* OS specific variables */
......@@ -790,7 +785,7 @@ static void close_connections(void)
DBUG_PRINT("info",("Waiting for select thread"));
#ifndef DONT_USE_THR_ALARM
if (pthread_kill(select_thread,THR_CLIENT_ALARM))
if (pthread_kill(select_thread, thr_client_alarm))
break; // allready dead
#endif
set_timespec(abstime, 2);
......@@ -2296,7 +2291,9 @@ static void init_signals(void)
DBUG_ENTER("init_signals");
if (test_flags & TEST_SIGINT)
my_sigset(THR_KILL_SIGNAL,end_thread_signal);
{
my_sigset(thr_kill_signal, end_thread_signal);
}
my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
......@@ -2351,10 +2348,13 @@ static void init_signals(void)
#ifdef SIGTSTP
sigaddset(&set,SIGTSTP);
#endif
if (thd_lib_detected != THD_LIB_LT)
sigaddset(&set,THR_SERVER_ALARM);
if (test_flags & TEST_SIGINT)
sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT
sigdelset(&set,THR_CLIENT_ALARM); // For alarms
{
// May be SIGINT
sigdelset(&set, thr_kill_signal);
}
sigprocmask(SIG_SETMASK,&set,NULL);
pthread_sigmask(SIG_SETMASK,&set,NULL);
DBUG_VOID_RETURN;
......@@ -2417,23 +2417,19 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
*/
init_thr_alarm(thread_scheduler.max_threads +
global_system_variables.max_insert_delayed_threads + 10);
#if SIGINT != THR_KILL_SIGNAL
if (test_flags & TEST_SIGINT)
if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
{
(void) sigemptyset(&set); // Setup up SIGINT for debug
(void) sigaddset(&set,SIGINT); // For debugging
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
}
#endif
(void) sigemptyset(&set); // Setup up SIGINT for debug
#ifdef USE_ONE_SIGNAL_HAND
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms
#endif
#ifndef IGNORE_SIGHUP_SIGQUIT
(void) sigaddset(&set,SIGQUIT);
#if THR_CLIENT_ALARM != SIGHUP
(void) sigaddset(&set,SIGHUP);
#endif
#endif
(void) sigaddset(&set,SIGTERM);
(void) sigaddset(&set,SIGTSTP);
......@@ -3628,6 +3624,13 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); // init my_sys library & pthreads
/* nothing should come before this line ^^^ */
/* Set signal used to kill MySQL */
#if defined(SIGUSR2)
thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
#else
thr_kill_signal= SIGINT;
#endif
/*
Perform basic logger initialization logger. Should be called after
MY_INIT, as it initializes mutexes. Log tables are inited later.
......
......@@ -53,21 +53,6 @@ void safe_print_str(const char* name, const char* val, int max_len)
#define SIGRETURN_FRAME_OFFSET 23
#endif
static my_bool is_nptl;
/* Check if we are using NPTL or LinuxThreads on Linux */
void check_thread_lib(void)
{
char buf[5];
#ifdef _CS_GNU_LIBPTHREAD_VERSION
confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));
is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf));
#else
is_nptl = 0;
#endif
}
#if defined(__alpha__) && defined(__GNUC__)
/*
The only way to backtrace without a symbol table on alpha
......@@ -173,7 +158,7 @@ terribly wrong...\n");
#endif /* __alpha__ */
/* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
sigreturn_frame_count = is_nptl ? 1 : 2;
sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1;
while (fp < (uchar**) stack_bottom)
{
......
......@@ -27,11 +27,9 @@ extern char* heap_start;
#define init_stacktrace() do { \
heap_start = (char*) &__bss_start; \
check_thread_lib(); \
} while(0);
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
void check_thread_lib(void);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* TARGET_OS_LINUX */
......
......@@ -217,14 +217,13 @@ int main(int argc, char *argv[])
azclose(&writer_handle);
azclose(&reader_handle);
exit(0);
unlink(TEST_FILENAME);
/* Start size tests */
printf("About to run 2/4/8 gig tests now, you may want to hit CTRL-C\n");
size_test(TWOGIG, 2097152L);
size_test(FOURGIG, 4194304L);
size_test(EIGHTGIG, 8388608L);
size_test(TWOGIG, 2088992L);
size_test(FOURGIG, 4177984L);
size_test(EIGHTGIG, 8355968L);
return 0;
}
......@@ -234,6 +233,7 @@ int size_test(unsigned long long length, unsigned long long rows_to_test_for)
azio_stream writer_handle, reader_handle;
unsigned long long write_length;
unsigned long long read_length= 0;
unsigned long long count;
unsigned int ret;
char buffer[BUFFER_LEN];
int error;
......@@ -244,8 +244,10 @@ int size_test(unsigned long long length, unsigned long long rows_to_test_for)
return 0;
}
for (write_length= 0; write_length < length ; write_length+= ret)
for (count= 0, write_length= 0; write_length < length ;
write_length+= ret)
{
count++;
ret= azwrite(&writer_handle, test_string, BUFFER_LEN);
if (ret != BUFFER_LEN)
{
......@@ -257,7 +259,7 @@ int size_test(unsigned long long length, unsigned long long rows_to_test_for)
azflush(&writer_handle, Z_SYNC_FLUSH);
}
}
assert(write_length == length);
assert(write_length != count * BUFFER_LEN); /* Number of rows time BUFFER_LEN */
azflush(&writer_handle, Z_SYNC_FLUSH);
printf("Reading back data\n");
......@@ -279,7 +281,7 @@ int size_test(unsigned long long length, unsigned long long rows_to_test_for)
}
}
assert(read_length == length);
assert(read_length == write_length);
assert(writer_handle.rows == rows_to_test_for);
azclose(&writer_handle);
azclose(&reader_handle);
......
......@@ -55,8 +55,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
s->stream.zalloc = (alloc_func)0;
s->stream.zfree = (free_func)0;
s->stream.opaque = (voidpf)0;
memset(s->inbuf, 0, AZ_BUFSIZE);
memset(s->outbuf, 0, AZ_BUFSIZE);
memset(s->inbuf, 0, AZ_BUFSIZE_READ);
memset(s->outbuf, 0, AZ_BUFSIZE_WRITE);
s->stream.next_in = s->inbuf;
s->stream.next_out = s->outbuf;
s->stream.avail_in = s->stream.avail_out = 0;
......@@ -109,7 +109,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
return Z_NULL;
}
}
s->stream.avail_out = AZ_BUFSIZE;
s->stream.avail_out = AZ_BUFSIZE_WRITE;
errno = 0;
s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
......@@ -159,7 +159,7 @@ void write_header(azio_stream *s)
char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
char *ptr= buffer;
s->block_size= AZ_BUFSIZE;
s->block_size= AZ_BUFSIZE_WRITE;
s->version = (unsigned char)az_magic[1];
s->minor_version = (unsigned char)az_magic[2];
......@@ -224,7 +224,7 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
s->stream.avail_in = my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE, MYF(0));
s->stream.avail_in = my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
......@@ -260,7 +260,7 @@ void check_header(azio_stream *s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
len = (uInt)my_read(s->file, (byte *)s->inbuf + len, AZ_BUFSIZE >> len, MYF(0));
len = (uInt)my_read(s->file, (byte *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
if (len == 0) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
......@@ -455,7 +455,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
s->stream.avail_in = (uInt)my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE, MYF(0));
s->stream.avail_in = (uInt)my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
......@@ -522,12 +522,13 @@ unsigned int azwrite (azio_stream *s, voidpc buf, unsigned int len)
{
s->stream.next_out = s->outbuf;
if (my_write(s->file, (byte *)s->outbuf, AZ_BUFSIZE, MYF(0)) != AZ_BUFSIZE)
if (my_write(s->file, (byte *)s->outbuf, AZ_BUFSIZE_WRITE,
MYF(0)) != AZ_BUFSIZE_WRITE)
{
s->z_err = Z_ERRNO;
break;
}
s->stream.avail_out = AZ_BUFSIZE;
s->stream.avail_out = AZ_BUFSIZE_WRITE;
}
s->in += s->stream.avail_in;
s->out += s->stream.avail_out;
......@@ -563,7 +564,7 @@ int do_flush (azio_stream *s, int flush)
for (;;)
{
len = AZ_BUFSIZE - s->stream.avail_out;
len = AZ_BUFSIZE_WRITE - s->stream.avail_out;
if (len != 0)
{
......@@ -574,7 +575,7 @@ int do_flush (azio_stream *s, int flush)
return Z_ERRNO;
}
s->stream.next_out = s->outbuf;
s->stream.avail_out = AZ_BUFSIZE;
s->stream.avail_out = AZ_BUFSIZE_WRITE;
}
if (done) break;
s->out += s->stream.avail_out;
......@@ -675,8 +676,8 @@ my_off_t azseek (s, offset, whence)
/* There was a zmemzero here if inbuf was null -Brian */
while (offset > 0)
{
uInt size = AZ_BUFSIZE;
if (offset < AZ_BUFSIZE) size = (uInt)offset;
uInt size = AZ_BUFSIZE_WRITE;
if (offset < AZ_BUFSIZE_WRITE) size = (uInt)offset;
size = azwrite(s, s->inbuf, size);
if (size == 0) return -1L;
......@@ -719,8 +720,8 @@ my_off_t azseek (s, offset, whence)
}
while (offset > 0) {
int error;
unsigned int size = AZ_BUFSIZE;
if (offset < AZ_BUFSIZE) size = (int)offset;
unsigned int size = AZ_BUFSIZE_READ;
if (offset < AZ_BUFSIZE_READ) size = (int)offset;
size = azread(s, s->outbuf, size, &error);
if (error <= 0) return -1L;
......
......@@ -196,7 +196,8 @@ extern "C" {
/* The deflate compression method (the only one supported in this version) */
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
#define AZ_BUFSIZE 16384
#define AZ_BUFSIZE_READ 32768
#define AZ_BUFSIZE_WRITE 16384
typedef struct azio_stream {
......@@ -204,8 +205,8 @@ typedef struct azio_stream {
int z_err; /* error code for last stream operation */
int z_eof; /* set if end of input file */
File file; /* .gz file */
Byte inbuf[AZ_BUFSIZE]; /* input buffer */
Byte outbuf[AZ_BUFSIZE]; /* output buffer */
Byte inbuf[AZ_BUFSIZE_READ]; /* input buffer */
Byte outbuf[AZ_BUFSIZE_WRITE]; /* output buffer */
uLong crc; /* crc32 of uncompressed data */
char *msg; /* error message */
int transparent; /* 1 if input file is not a .gz file */
......
......@@ -81,6 +81,7 @@
TODO:
Allow users to set compression level.
Allow adjustable block size.
Implement versioning, should be easy.
Allow for errors, find a way to mark bad rows.
Add optional feature so that rows can be flushed at interval (which will cause less
......@@ -210,7 +211,8 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info);
/* The size of the offset value we will use for position() */
ref_length = sizeof(my_off_t);
ref_length= sizeof(my_off_t);
archive_reader_open= FALSE;
}
int archive_discover(handlerton *hton, THD* thd, const char *db,
......@@ -434,6 +436,29 @@ int ha_archive::init_archive_writer()
}
int ha_archive::init_archive_reader()
{
DBUG_ENTER("ha_archive::init_archive_reader");
/*
It is expensive to open and close the data files and since you can't have
a gzip file that can be both read and written we keep a writer open
that is shared amoung all open tables.
*/
if (!archive_reader_open)
{
if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY)))
{
DBUG_PRINT("ha_archive", ("Could not open archive read file"));
share->crashed= TRUE;
DBUG_RETURN(1);
}
archive_reader_open= TRUE;
}
DBUG_RETURN(0);
}
/*
We just implement one additional file extension.
*/
......@@ -477,7 +502,6 @@ int ha_archive::open(const char *name, int mode, uint open_options)
DBUG_ASSERT(share);
record_buffer= create_record_buffer(table->s->reclength +
ARCHIVE_ROW_HEADER_SIZE);
......@@ -489,14 +513,6 @@ int ha_archive::open(const char *name, int mode, uint open_options)
thr_lock_data_init(&share->lock, &lock, NULL);
DBUG_PRINT("ha_archive", ("archive data_file_name %s", share->data_file_name));
if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY)))
{
if (errno == EROFS || errno == EACCES)
DBUG_RETURN(my_errno= errno);
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
}
DBUG_PRINT("ha_archive", ("archive table was crashed %s",
rc == HA_ERR_CRASHED_ON_USAGE ? "yes" : "no"));
if (rc == HA_ERR_CRASHED_ON_USAGE && open_options & HA_OPEN_FOR_REPAIR)
......@@ -533,8 +549,11 @@ int ha_archive::close(void)
destroy_record_buffer(record_buffer);
/* First close stream */
if (archive_reader_open)
{
if (azclose(&archive))
rc= 1;
}
/* then also close share */
rc|= free_share();
......@@ -904,7 +923,7 @@ int ha_archive::index_read(byte *buf, const byte *key,
int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
uint key_len, enum ha_rkey_function find_flag)
{
int rc= 0;
int rc;
bool found= 0;
KEY *mkey= &table->s->key_info[index];
current_k_offset= mkey->key_part->offset;
......@@ -914,22 +933,10 @@ int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
DBUG_ENTER("ha_archive::index_read_idx");
/*
All of the buffer must be written out or we won't see all of the
data
*/
pthread_mutex_lock(&share->mutex);
azflush(&(share->archive_write), Z_SYNC_FLUSH);
pthread_mutex_unlock(&share->mutex);
rc= rnd_init(TRUE);
/*
Set the position of the local read thread to the beginning postion.
*/
if (read_data_header(&archive))
{
rc= HA_ERR_CRASHED_ON_USAGE;
if (rc)
goto error;
}
while (!(get_row(&archive, buf)))
{
......@@ -979,10 +986,11 @@ int ha_archive::rnd_init(bool scan)
if (share->crashed)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
init_archive_reader();
/* We rewind the file so that we can read from the beginning if scan */
if (scan)
{
scan_rows= share->rows_recorded;
DBUG_PRINT("info", ("archive will retrieve %llu rows",
(unsigned long long) scan_rows));
stats.records= 0;
......@@ -991,17 +999,18 @@ int ha_archive::rnd_init(bool scan)
If dirty, we lock, and then reset/flush the data.
I found that just calling azflush() doesn't always work.
*/
pthread_mutex_lock(&share->mutex);
scan_rows= share->rows_recorded;
if (share->dirty == TRUE)
{
pthread_mutex_lock(&share->mutex);
if (share->dirty == TRUE)
{
DBUG_PRINT("ha_archive", ("archive flushing out rows for scan"));
azflush(&(share->archive_write), Z_SYNC_FLUSH);
share->dirty= FALSE;
}
pthread_mutex_unlock(&share->mutex);
}
pthread_mutex_unlock(&share->mutex);
if (read_data_header(&archive))
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
......@@ -1283,6 +1292,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
azio_stream writer;
char writer_filename[FN_REFLEN];
init_archive_reader();
// now we close both our writer and our reader for the rename
if (share->archive_write_open)
{
......@@ -1475,6 +1486,7 @@ int ha_archive::info(uint flag)
if (flag & HA_STATUS_AUTO)
{
init_archive_reader();
azflush(&archive, Z_SYNC_FLUSH);
stats.auto_increment_value= archive.auto_increment;
}
......@@ -1557,6 +1569,8 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
Now we will rewind the archive file so that we are positioned at the
start of the file.
*/
init_archive_reader();
if (!rc)
read_data_header(&archive);
......
......@@ -71,6 +71,7 @@ class ha_archive: public handler
uint current_key_len;
uint current_k_offset;
archive_record_buffer *record_buffer;
bool archive_reader_open;
archive_record_buffer *create_record_buffer(unsigned int length);
void destroy_record_buffer(archive_record_buffer *r);
......@@ -119,6 +120,7 @@ class ha_archive: public handler
ARCHIVE_SHARE *get_share(const char *table_name, int *rc);
int free_share();
int init_archive_writer();
int init_archive_reader();
bool auto_repair() const { return 1; } // For the moment we just do this
int read_data_header(azio_stream *file_to_read);
void position(const byte *record);
......
......@@ -337,11 +337,7 @@ then
cp -fp mysql-debug-%{mysql_version}/config.log "$MYSQL_DEBUGCONFLOG_DEST"
fi
MTR_BUILD_THREAD=auto
export MTR_BUILD_THREAD
(cd mysql-debug-%{mysql_version}/mysql-test ; \
./mysql-test-run.pl --comment=debug --skip-rpl --skip-ndbcluster --force --report-features ; \
true)
(cd mysql-debug-%{mysql_version} ; make test-bt-debug)
##############################################################################
#
......@@ -370,15 +366,7 @@ then
cp -fp mysql-release-%{mysql_version}/config.log "$MYSQL_CONFLOG_DEST"
fi
MTR_BUILD_THREAD=auto
export MTR_BUILD_THREAD
cd mysql-release-%{mysql_version}/mysql-test
./mysql-test-run.pl --comment=normal --force --skip-ndbcluster --timer --report-features || true
./mysql-test-run.pl --comment=ps --ps-protocol --force --skip-ndbcluster --timer || true
./mysql-test-run.pl --comment=normal+rowrepl --mysqld=--binlog-format=row --force --skip-ndbcluster --timer || true
./mysql-test-run.pl --comment=ps+rowrepl+NDB --ps-protocol --mysqld=--binlog-format=row --force --timer || true
./mysql-test-run.pl --comment=NDB --with-ndbcluster-only --force --timer || true
cd ../..
(cd mysql-release-%{mysql_version} ; make test-bt)
##############################################################################
......
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