summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-06-20 15:25:02 +0300
committerunknown <monty@hundin.mysql.fi>2002-06-20 15:25:02 +0300
commit950df73713d6eca34de8be1f9771d40a8abeadc4 (patch)
tree7eee86ca5c680d305ade1203f3945cee038dbd46
parentccf18acc242f33fffca016c1e28c99e6e4e443b7 (diff)
downloadmariadb-git-950df73713d6eca34de8be1f9771d40a8abeadc4.tar.gz
Fixed some bugs after last merge
Added semaphore support to MIT-pthreads. Docs/manual.texi: Updated benchmark data configure.in: Portability fix for compiling MIT-pthreads with gcc 3.0.x (Still not perfect) include/my_semaphore.h: Cleanup mit-pthreads/Changes-mysql: Added semaphore support mit-pthreads/include/Makefile.inc: Added semaphore support mit-pthreads/include/pthread/ac-types.h: Added semaphore support mit-pthreads/pthreads/GNUmakefile.inc: Added semaphore support mit-pthreads/pthreads/Makefile.inc: Added semaphore support mit-pthreads/stdio/xprintf.c: Added semaphore support mysql-test/r/rpl_alter.result: Fixed test results after merge with 3.23 sql/ha_isam.cc: Fixed core dump after merge sql/ha_isam.h: Fixed core dump after merge sql/mini_client.cc: P
-rw-r--r--Docs/manual.texi4
-rw-r--r--configure.in17
-rw-r--r--include/my_semaphore.h21
-rw-r--r--mit-pthreads/Changes-mysql6
-rw-r--r--mit-pthreads/include/Makefile.inc2
-rw-r--r--mit-pthreads/include/pthread/ac-types.h4
-rw-r--r--mit-pthreads/include/semaphore.h20
-rw-r--r--mit-pthreads/pthreads/GNUmakefile.inc2
-rw-r--r--mit-pthreads/pthreads/Makefile.inc3
-rw-r--r--mit-pthreads/pthreads/semaphore.c84
-rw-r--r--mit-pthreads/stdio/xprintf.c24
-rw-r--r--mysql-test/r/rpl_alter.result17
-rw-r--r--sql/ha_isam.cc2
-rw-r--r--sql/ha_isam.h15
-rw-r--r--sql/mini_client.cc15
15 files changed, 189 insertions, 47 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 76cad308d6a..09d0fa6e6aa 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -27363,6 +27363,10 @@ If you connect using TCP/IP from another computer over a 100M Ethernet,
things will be 8-11 % slower.
@item
+When running our benchmark with secure connections (all data encrypted
+with internal ssl support) things where 55 % slower.
+
+@item
If you compile with @code{--with-debug=full}, then you will loose 20 %
for most queries, but some queries may take substantially longer (The
MySQL benchmarks ran 35 % slower)
diff --git a/configure.in b/configure.in
index 970336af518..08e8918b0df 100644
--- a/configure.in
+++ b/configure.in
@@ -524,6 +524,13 @@ AC_ARG_WITH(mit-threads,
if test "$with_mit_threads" = "yes"
then
enable_largefile="no" # Will not work on Linux.
+ if test "$GXX" = "yes"
+ then
+ # Needed for gcc 3.0
+ CCLD=g++
+ export CCLD
+ AC_SUBST(CCLD)
+ fi
fi
# Set flags if we want to force to use pthreads
@@ -1596,13 +1603,17 @@ ac_save_CXXFLAGS="$CXXFLAGS"
AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
-# Do not treat warnings as errors if we are linking agaist other libc
+
+# Do not treat warnings as errors if we are linking against other libc
# this is to work around gcc not being permissive on non-system includes
# with respect to ANSI C++
-if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
+# We also remove the -fbranch-probabilities option as this will give warnings
+# about not profiled code, which confuses configure
+if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
then
- CXXFLAGS="$CXXFLAGS -Werror"
+ CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'`
fi
+
AC_TRY_COMPILE(
[#undef inline
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
diff --git a/include/my_semaphore.h b/include/my_semaphore.h
index 484423150f7..36c4b1a4740 100644
--- a/include/my_semaphore.h
+++ b/include/my_semaphore.h
@@ -31,21 +31,22 @@
#ifndef _my_semaphore_h_
#define _my_semaphore_h_
+C_MODE_START
+
#ifndef __WIN__
#include <semaphore.h>
#else
-C_MODE_START
-
typedef HANDLE sem_t;
-int sem_init (sem_t * sem, int pshared, unsigned int value);
-int sem_destroy (sem_t * sem);
-int sem_trywait (sem_t * sem);
-int sem_wait (sem_t * sem);
-int sem_post (sem_t * sem);
-int sem_post_multiple (sem_t * sem,int count);
-int sem_getvalue (sem_t * sem, int * sval);
+int sem_init(sem_t * sem, int pshared, unsigned int value);
+int sem_destroy(sem_t * sem);
+int sem_trywait(sem_t * sem);
+int sem_wait(sem_t * sem);
+int sem_post(sem_t * sem);
+int sem_post_multiple(sem_t * sem,int count);
+int sem_getvalue(sem_t * sem, int * sval);
-C_MODE_END
#endif /* __WIN__ */
+
+C_MODE_END
#endif /* !_my_semaphore_h_ */
diff --git a/mit-pthreads/Changes-mysql b/mit-pthreads/Changes-mysql
index da30f66fdec..06336abaecb 100644
--- a/mit-pthreads/Changes-mysql
+++ b/mit-pthreads/Changes-mysql
@@ -1,4 +1,8 @@
-Changes done to this distrubtion (pthreads-1_60_beta6) by Monty (monty@mysql.com)
+Changes done to this distrubtion (pthreads-1_60_beta6) by Monty
+(monty@mysql.com)
+
+02.06.20
+- Added support for semaphores.
02.05.07
- Hacked some files to get it to compile (not work) with glibc 2.2
diff --git a/mit-pthreads/include/Makefile.inc b/mit-pthreads/include/Makefile.inc
index b7fe59d5f0d..72554b638d2 100644
--- a/mit-pthreads/include/Makefile.inc
+++ b/mit-pthreads/include/Makefile.inc
@@ -7,7 +7,7 @@
FILES= cond.h copyright.h fd.h fd_pipe.h kernel.h mutex.h posix.h \
- pthread.h pthread_attr.h queue.h util.h
+ pthread.h pthread_attr.h queue.h util.h semaphore.h
# Machine dependent header file
MFILE= ${.CURDIR}/arch/${MACHINE}/machdep.h
diff --git a/mit-pthreads/include/pthread/ac-types.h b/mit-pthreads/include/pthread/ac-types.h
index 7fa4568817f..4dd20a6f748 100644
--- a/mit-pthreads/include/pthread/ac-types.h
+++ b/mit-pthreads/include/pthread/ac-types.h
@@ -6,5 +6,7 @@
#define pthread_ssize_t int
#define pthread_time_t long
#define pthread_off_t long
-#define pthread_va_list void *
+#ifdef NOT_USED /* Removed by monty becasue of conflicts on Linux */
+#define pthread_va_list char *
+#endif
#endif
diff --git a/mit-pthreads/include/semaphore.h b/mit-pthreads/include/semaphore.h
new file mode 100644
index 00000000000..7a593287bc4
--- /dev/null
+++ b/mit-pthreads/include/semaphore.h
@@ -0,0 +1,20 @@
+/*
+ This is written by Sergei Golubchik for MySQL AB and is in public domain.
+
+ Simple implementation of semaphores, needed to compile MySQL with
+ MIT-pthreads.
+*/
+
+typedef struct {
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ uint count;
+} sem_t;
+
+int sem_init(sem_t * sem, int pshared, uint value);
+int sem_destroy(sem_t * sem);
+int sem_wait(sem_t * sem);
+int sem_trywait(sem_t * sem);
+int sem_post (sem_t * sem);
+int sem_post_multiple(sem_t * sem, uint count);
+int sem_getvalue (sem_t * sem, uint *sval);
diff --git a/mit-pthreads/pthreads/GNUmakefile.inc b/mit-pthreads/pthreads/GNUmakefile.inc
index c8621495bac..b3019364a1d 100644
--- a/mit-pthreads/pthreads/GNUmakefile.inc
+++ b/mit-pthreads/pthreads/GNUmakefile.inc
@@ -9,7 +9,7 @@ SRCS:= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c fd_sysv.c file.c globals.c \
specific.c process.c wait.c errno.c schedparam.c _exit.c prio_queue.c \
pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \
dump_state.c pthread_kill.c stat.c readv.c writev.c condattr.c \
- pthread_cancel.c panic.c $(SRCS)
+ pthread_cancel.c panic.c semaphore.c $(SRCS)
ifeq ($(HAVE_SYSCALL_TEMPLATE),yes)
SYSCALL_FILTER_RULE= for s in $(AVAILABLE_SYSCALLS) ; do \
diff --git a/mit-pthreads/pthreads/Makefile.inc b/mit-pthreads/pthreads/Makefile.inc
index 3939d57de6e..68d970f17d8 100644
--- a/mit-pthreads/pthreads/Makefile.inc
+++ b/mit-pthreads/pthreads/Makefile.inc
@@ -8,7 +8,8 @@ SRCS+= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c \
pthread_join.c pthread_detach.c pthread_once.c sleep.c specific.c \
process.c wait.c errno.c schedparam.c _exit.c prio_queue.c \
pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \
- dump_state.c pthread_kill.c condattr.c pthread_cancel.c panic.c
+ dump_state.c pthread_kill.c condattr.c pthread_cancel.c panic.c \
+ semaphore.c
.if $(HAVE_SYSCALL_TEMPLATE) == yes
OBJS+= syscalls.o
diff --git a/mit-pthreads/pthreads/semaphore.c b/mit-pthreads/pthreads/semaphore.c
new file mode 100644
index 00000000000..5516af1f4e3
--- /dev/null
+++ b/mit-pthreads/pthreads/semaphore.c
@@ -0,0 +1,84 @@
+/*
+ This is written by Sergei Golubchik for MySQL AB and is in public domain.
+
+ Simple implementation of semaphores, needed to compile MySQL with
+ MIT-pthreads.
+*/
+
+#include <pthread.h>
+#include <errno.h>
+#include <semaphore.h>
+
+int sem_init(sem_t * sem, int pshared, uint value)
+{
+ sem->count=value;
+ pthread_cond_init(&sem->cond, 0);
+ pthread_mutex_init(&sem->mutex, 0);
+ return 0;
+}
+
+int sem_destroy(sem_t * sem)
+{
+ int err1,err2;
+ err1=pthread_cond_destroy(&sem->cond);
+ err2=pthread_mutex_destroy(&sem->mutex);
+ if (err1 || err2)
+ {
+ errno=err1 ? err1 : err2;
+ return -1;
+ }
+ return 0;
+}
+
+int sem_wait(sem_t * sem)
+{
+ while ((errno=pthread_mutex_lock(&sem->mutex)) || !sem->count)
+ pthread_cond_wait(&sem->cond, &sem->mutex);
+ if (errno)
+ return -1;
+ sem->count--; /* mutex is locked here */
+ pthread_mutex_unlock(&sem->mutex);
+ return 0;
+}
+
+int sem_trywait(sem_t * sem)
+{
+ if ((errno=pthread_mutex_lock(&sem->mutex)))
+ return -1;
+ if (sem->count)
+ sem->count--;
+ else
+ errno=EAGAIN;
+ pthread_mutex_unlock(&sem->mutex);
+ return errno ? -1 : 0;
+}
+
+
+int sem_post(sem_t * sem)
+{
+ if ((errno=pthread_mutex_lock(&sem->mutex)))
+ return -1;
+ sem->count++;
+ pthread_mutex_unlock(&sem->mutex); /* does it really matter what to do */
+ pthread_cond_signal(&sem->cond); /* first: x_unlock or x_signal ? */
+ return 0;
+}
+
+int sem_post_multiple(sem_t * sem, uint count)
+{
+ if ((errno=pthread_mutex_lock(&sem->mutex)))
+ return -1;
+ sem->count+=count;
+ pthread_mutex_unlock(&sem->mutex); /* does it really matter what to do */
+ pthread_cond_broadcast(&sem->cond); /* first: x_unlock or x_broadcast ? */
+ return 0;
+}
+
+int sem_getvalue(sem_t * sem, uint *sval)
+{
+ if ((errno=pthread_mutex_lock(&sem->mutex)))
+ return -1;
+ *sval=sem->count;
+ pthread_mutex_unlock(&sem->mutex);
+ return 0;
+}
diff --git a/mit-pthreads/stdio/xprintf.c b/mit-pthreads/stdio/xprintf.c
index 668e8bc0605..d2cec36c835 100644
--- a/mit-pthreads/stdio/xprintf.c
+++ b/mit-pthreads/stdio/xprintf.c
@@ -217,7 +217,7 @@ static int vxprintf(func,arg,format,ap)
void (*func)(char*,int,void*);
void *arg;
const char *format;
- va_list ap;
+ pthread_va_list ap;
{
register const char *fmt; /* The format string. */
register int c; /* Next character in the format string */
@@ -673,7 +673,7 @@ int xprintf(
const char *format,
...
){
- va_list ap;
+ pthread_va_list ap;
va_start(ap,format);
return vxprintf(func,arg,format,ap);
}
@@ -715,7 +715,7 @@ static void sout(txt,amt,arg)
int sprintf(char *buf, const char *fmt, ...){
int rc;
- va_list ap;
+ pthread_va_list ap;
struct s_strargument arg;
va_start(ap,fmt);
@@ -725,7 +725,7 @@ int sprintf(char *buf, const char *fmt, ...){
rc = vxprintf(sout,&arg,fmt,ap);
va_end(ap);
}
-int vsprintf(char *buf,const char *fmt,va_list ap){
+int vsprintf(char *buf,const char *fmt, pthread_va_list ap){
struct s_strargument arg;
arg.next = buf;
arg.last = 0;
@@ -734,7 +734,7 @@ int vsprintf(char *buf,const char *fmt,va_list ap){
}
int snprintf(char *buf, size_t n, const char *fmt, ...){
int rc;
- va_list ap;
+ pthread_va_list ap;
struct s_strargument arg;
va_start(ap,fmt);
@@ -744,7 +744,7 @@ int snprintf(char *buf, size_t n, const char *fmt, ...){
rc = vxprintf(sout,&arg,fmt,ap);
va_end(ap);
}
-int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap){
+int vsnprintf(char *buf, size_t n, const char *fmt, pthread_va_list ap){
struct s_strargument arg;
arg.next = buf;
arg.last = &buf[n-1];
@@ -798,7 +798,7 @@ static void mout(zNewText,nNewChar,arg)
** routine naming conventions.
*/
char *mprintf(const char *zFormat, ...){
- va_list ap;
+ pthread_va_list ap;
struct sgMprintf sMprintf;
char *zNew;
char zBuf[200];
@@ -825,7 +825,7 @@ char *mprintf(const char *zFormat, ...){
** The name is changed to TclVMPrintf() to conform with Tcl naming
** conventions.
*/
-char *vmprintf(const char *zFormat,va_list ap){
+char *vmprintf(const char *zFormat,pthread_va_list ap){
struct sgMprintf sMprintf;
char zBuf[200];
sMprintf.nChar = 0;
@@ -858,7 +858,7 @@ static void fout(zNewText,nNewChar,arg)
/* The public interface routines */
int fprintf(FILE *pOut, const char *zFormat, ...){
- va_list ap;
+ pthread_va_list ap;
int retc;
va_start(ap,zFormat);
@@ -866,11 +866,11 @@ int fprintf(FILE *pOut, const char *zFormat, ...){
va_end(ap);
return retc;
}
-int vfprintf(FILE *pOut, const char *zFormat, va_list ap){
+int vfprintf(FILE *pOut, const char *zFormat, pthread_va_list ap){
return vxprintf(fout,pOut,zFormat,ap);
}
int printf(const char *zFormat, ...){
- va_list ap;
+ pthread_va_list ap;
int retc;
va_start(ap,zFormat);
@@ -878,6 +878,6 @@ int printf(const char *zFormat, ...){
va_end(ap);
return retc;
}
-int vprintf(const char *zFormat, va_list ap){
+int vprintf(const char *zFormat, pthread_va_list ap){
return vxprintf(fout,stdout,zFormat,ap);
}
diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result
index 7883e725e3a..2e42177c140 100644
--- a/mysql-test/r/rpl_alter.result
+++ b/mysql-test/r/rpl_alter.result
@@ -1,4 +1,21 @@
+slave stop;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+use test;
+drop database if exists d1;
+create database d1;
+create table d1.t1 ( n int);
+alter table d1.t1 add m int;
+insert into d1.t1 values (1,2);
+create table d1.t2 (n int);
+insert into d1.t2 values (45);
+rename table d1.t2 to d1.t3, d1.t1 to d1.t2;
+select * from d1.t2;
n m
1 2
+select * from d1.t3;
n
45
+drop database d1;
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index b83dabd86b1..55d24f5edb9 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -51,6 +51,8 @@ int ha_isam::open(const char *name, int mode, uint test_if_locked)
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
(void) nisam_extra(file,HA_EXTRA_WAIT_LOCK);
+ if (!table->db_record_offset)
+ int_table_flags|=HA_REC_NOT_IN_SEQ;
return (0);
}
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 135424892f5..82a243ef5c0 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -26,20 +26,21 @@
class ha_isam: public handler
{
N_INFO *file;
+ /* We need this as table_flags() may change after open() */
+ ulong int_table_flags;
public:
- ha_isam(TABLE *table): handler(table), file(0)
+ ha_isam(TABLE *table)
+ :handler(table), file(0),
+ int_table_flags(HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
+ HA_KEY_READ_WRONG_STR | HA_DUPP_POS |
+ HA_NOT_DELETE_WITH_CACHE)
{}
~ha_isam() {}
const char *table_type() const { return "ISAM"; }
const char *index_type(uint key_number) { return "BTREE"; }
const char **bas_ext() const;
- ulong table_flags() const
- {
- return (HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
- HA_KEY_READ_WRONG_STR | HA_DUPP_POS | HA_NOT_DELETE_WITH_CACHE |
- ((table->db_record_offset) ? 0 : HA_REC_NOT_IN_SEQ));
- }
+ ulong table_flags() const { return int_table_flags; }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return N_MAXKEY; }
uint max_key_parts() const { return N_MAXKEY_SEG; }
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 19e94054272..f8c930a2154 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -27,13 +27,12 @@
#define net_write_timeout net_write_timeout1
#endif
-#if defined(__WIN__)
-#include <winsock.h>
-#include <odbcinst.h> /* QQ: Is this really needed ? */
-#define DONT_USE_THR_ALARM
-#endif
-
#include <my_global.h>
+/* my_pthread must be included early to be able to fix things */
+#if defined(THREAD)
+#include <my_pthread.h> /* because of signal() */
+#endif
+#include <thr_alarm.h>
#include <mysql_embed.h>
#include <mysql_com.h>
#include <violite.h>
@@ -75,10 +74,6 @@ extern "C" { // Because of SCO 3.2V4.2
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
-#if defined(THREAD)
-#include <my_pthread.h> /* because of signal() */
-#endif
-#include <thr_alarm.h>
#ifndef INADDR_NONE
#define INADDR_NONE -1
#endif