summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VC++Files/mysql.sln39
-rw-r--r--configure.in14
-rw-r--r--include/config-win.h4
-rw-r--r--include/my_pthread.h31
-rw-r--r--include/my_sys.h1
-rwxr-xr-xmysql-test/mysql-test-run.pl23
-rw-r--r--mysql-test/t/mysqlslap.test1
-rw-r--r--mysys/thr_mutex.c77
-rw-r--r--sql/ha_ndbcluster.cc20
-rw-r--r--sql/item.cc2
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sql_trigger.cc14
12 files changed, 172 insertions, 56 deletions
diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln
index c11d0f43bcc..3ec40a14f82 100644
--- a/VC++Files/mysql.sln
+++ b/VC++Files/mysql.sln
@@ -172,14 +172,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlshow", "client\mysqlsh
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlshow", "client\mysqlslap.vcproj", "{3737BFE2-EF25-464F-994D-BD28A9F84529}"
- ProjectSection(ProjectDependencies) = postProject
- {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
- {26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
- {8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
- {44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yassl", "extra\yassl\yassl.vcproj", "{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}"
ProjectSection(ProjectDependencies) = postProject
{DB28DE80-837F-4497-9AA9-CC0A20584C98} = {DB28DE80-837F-4497-9AA9-CC0A20584C98}
@@ -964,37 +956,6 @@ Global
{3737BFE2-EF25-464F-994D-BD28A9F84528}.TLS.Build.0 = Release|Win32
{3737BFE2-EF25-464F-994D-BD28A9F84528}.TLS_DEBUG.ActiveCfg = Debug|Win32
{3737BFE2-EF25-464F-994D-BD28A9F84528}.TLS_DEBUG.Build.0 = Debug|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.classic.ActiveCfg = classic|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.classic.Build.0 = classic|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.classic nt.ActiveCfg = classic|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.classic nt.Build.0 = classic|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Debug.ActiveCfg = Debug|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Debug.Build.0 = Debug|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Embedded_Classic.ActiveCfg = classic|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Embedded_Debug.ActiveCfg = Debug|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Embedded_Pro.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Embedded_ProGPL.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Embedded_Release.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Max.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Max.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Max nt.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Max nt.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.nt.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.nt.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro gpl.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro gpl.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro gpl nt.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro gpl nt.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro nt.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.pro nt.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Release.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.Release.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.TLS.ActiveCfg = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.TLS.Build.0 = Release|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.TLS_DEBUG.ActiveCfg = Debug|Win32
- {3737BFE2-EF25-464F-994D-BD28A9F84529}.TLS_DEBUG.Build.0 = Debug|Win32
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}.classic.ActiveCfg = Release|Win32
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}.classic.Build.0 = Release|Win32
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}.classic nt.ActiveCfg = Release|Win32
diff --git a/configure.in b/configure.in
index b5d9b3267c6..3c9961e5c18 100644
--- a/configure.in
+++ b/configure.in
@@ -1574,6 +1574,20 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
fi
+if test "$with_debug" = "no"
+then
+ AC_ARG_WITH([fast-mutexes],
+ AC_HELP_STRING([--with-fast-mutexes],
+ [compile with fast mutexes (default is enabled)]),
+ [with_fast_mutexes=$withval], [with_fast_mutexes=yes])
+fi
+
+if test "$with_fast_mutexes" = "yes"
+then
+ AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1],
+ [Define to 1 if you want to use fast mutexes])
+fi
+
# Force static compilation to avoid linking problems/get more speed
AC_ARG_WITH(mysqld-ldflags,
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
diff --git a/include/config-win.h b/include/config-win.h
index 528bc8a8cdd..b825d34f1ee 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -61,6 +61,10 @@ functions */
#define __WIN__ /* To make it easier in VC++ */
#endif
+#ifndef MAX_INDEXES
+#define MAX_INDEXES 64
+#endif
+
/* File and lock constants */
#define O_SHARE 0x1000 /* Open file in sharing mode */
#ifdef __BORLANDC__
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 202e047dc4e..81100fe2b88 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -547,6 +547,37 @@ void safe_mutex_end(FILE *file);
#define safe_mutex_assert_not_owner(mp)
#endif /* SAFE_MUTEX */
+#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
+typedef struct st_my_pthread_fastmutex_t
+{
+ pthread_mutex_t mutex;
+ uint spins;
+} my_pthread_fastmutex_t;
+
+int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp,
+ const pthread_mutexattr_t *attr);
+int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
+
+#undef pthread_mutex_init
+#undef pthread_mutex_lock
+#undef pthread_mutex_unlock
+#undef pthread_mutex_destroy
+#undef pthread_mutex_wait
+#undef pthread_mutex_timedwait
+#undef pthread_mutex_t
+#undef pthread_cond_wait
+#undef pthread_cond_timedwait
+#undef pthread_mutex_trylock
+#define pthread_mutex_init(A,B) my_pthread_fastmutex_init((A),(B))
+#define pthread_mutex_lock(A) my_pthread_fastmutex_lock(A)
+#define pthread_mutex_unlock(A) pthread_mutex_unlock(&(A)->mutex)
+#define pthread_mutex_destroy(A) pthread_mutex_destroy(&(A)->mutex)
+#define pthread_cond_wait(A,B) pthread_cond_wait((A),&(B)->mutex)
+#define pthread_cond_timedwait(A,B,C) pthread_cond_timedwait((A),&(B)->mutex,(C))
+#define pthread_mutex_trylock(A) pthread_mutex_trylock(&(A)->mutex)
+#define pthread_mutex_t my_pthread_fastmutex_t
+#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */
+
/* READ-WRITE thread locking */
#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
diff --git a/include/my_sys.h b/include/my_sys.h
index 909aa942968..85cc8052555 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -841,6 +841,7 @@ my_bool my_gethwaddr(uchar *to);
/* not a complete set of mmap() flags, but only those that nesessary */
#define PROT_READ 1
#define PROT_WRITE 2
+#define MAP_NORESERVE 0
#define MAP_SHARED 0x0001
#define MAP_NOSYNC 0x0800
#define MAP_FAILED ((void *)-1)
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 26ddd0dd691..650c2b343f6 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -936,6 +936,7 @@ sub executable_setup () {
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client");
$exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld");
+ $exe_mysqlslap= mtr_exe_exists ("$path_client_bindir/mysqlslap");
$path_language= mtr_path_exists("$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/sql/share/charsets");
@@ -962,7 +963,6 @@ sub executable_setup () {
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
@@ -979,7 +979,6 @@ sub executable_setup () {
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
@@ -1005,6 +1004,7 @@ sub executable_setup () {
{
$exe_mysqld= mtr_exe_exists ("$glob_basedir/libexec/mysqld",
"$glob_basedir/bin/mysqld");
+ $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
$exe_im= mtr_exe_exists("$glob_basedir/libexec/mysqlmanager",
"$glob_basedir/bin/mysqlmanager");
@@ -2490,14 +2490,21 @@ sub run_mysqltest ($) {
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
}
- my $cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
+
+ my $cmdline_mysqlslap;
+
+ unless ( $glob_win32 )
+ {
+ $cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlslap .=
- " --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlslap .=
+ " --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
+ }
}
+
my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password=";
@@ -2559,7 +2566,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
+ $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32;
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test
index c9a53fe6d0a..2998a63b52e 100644
--- a/mysql-test/t/mysqlslap.test
+++ b/mysql-test/t/mysqlslap.test
@@ -1,5 +1,6 @@
# Can't run test of external client with embedded server
--source include/not_embedded.inc
+--source include/not_windows.inc
--exec $MYSQL_SLAP --silent --drop-schema --concurrency=5 --concurrency-load=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --number-rows=12 --auto-generate-sql
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 3326068d164..3dde1fd5bfa 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -356,3 +356,80 @@ void safe_mutex_end(FILE *file __attribute__((unused)))
}
#endif /* THREAD && SAFE_MUTEX */
+
+#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
+
+#include "mysys_priv.h"
+#include "my_static.h"
+#include <m_string.h>
+
+#include <m_ctype.h>
+#include <hash.h>
+#include <myisampack.h>
+#include <mysys_err.h>
+#include <my_sys.h>
+
+#undef pthread_mutex_t
+#undef pthread_mutex_init
+#undef pthread_mutex_lock
+#undef pthread_mutex_trylock
+#undef pthread_mutex_unlock
+#undef pthread_mutex_destroy
+#undef pthread_cond_wait
+#undef pthread_cond_timedwait
+
+ulong mutex_delay(ulong delayloops)
+{
+ ulong i;
+ volatile ulong j;
+
+ j = 0;
+
+ for (i = 0; i < delayloops * 50; i++)
+ j += i;
+
+ return(j);
+}
+
+#define MY_PTHREAD_FASTMUTEX_SPINS 8
+#define MY_PTHREAD_FASTMUTEX_DELAY 4
+
+int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp,
+ const pthread_mutexattr_t *attr)
+{
+ static int cpu_count= 0;
+#ifdef _SC_NPROCESSORS_CONF
+ if (!cpu_count && (attr == MY_MUTEX_INIT_FAST))
+ cpu_count= sysconf(_SC_NPROCESSORS_CONF);
+#endif
+
+ if ((cpu_count > 1) && (attr == MY_MUTEX_INIT_FAST))
+ mp->spins= MY_PTHREAD_FASTMUTEX_SPINS;
+ else
+ mp->spins= 0;
+ return pthread_mutex_init(&mp->mutex, attr);
+}
+
+int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp)
+{
+ int res;
+ uint i;
+ uint maxdelay= MY_PTHREAD_FASTMUTEX_DELAY;
+
+ for (i= 0; i < mp->spins; i++)
+ {
+ res= pthread_mutex_trylock(&mp->mutex);
+
+ if (res == 0)
+ return 0;
+
+ if (res != EBUSY)
+ return res;
+
+ mutex_delay(maxdelay);
+ maxdelay += ((double) random() / (double) RAND_MAX) *
+ MY_PTHREAD_FASTMUTEX_DELAY + 1;
+ }
+ return pthread_mutex_lock(&mp->mutex);
+}
+#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index fa432914477..050a6ea8af8 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -3014,6 +3014,26 @@ void ha_ndbcluster::position(const byte *record)
}
*buff++= 0;
}
+
+ size_t len = key_part->length;
+ const byte * ptr = record + key_part->offset;
+ Field *field = key_part->field;
+ if ((field->type() == MYSQL_TYPE_VARCHAR) &&
+ ((Field_varstring*)field)->length_bytes == 1)
+ {
+ /**
+ * Keys always use 2 bytes length
+ */
+ buff[0] = ptr[0];
+ buff[1] = 0;
+ memcpy(buff+2, ptr + 1, len);
+ len += 2;
+ }
+ else
+ {
+ memcpy(buff, ptr, len);
+ }
+ buff += len;
}
}
else
diff --git a/sql/item.cc b/sql/item.cc
index 77e5c25c4f8..bf5718bb54d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -949,7 +949,7 @@ void Item_splocal::print(String *str)
*****************************************************************************/
Item_case_expr::Item_case_expr(int case_expr_id)
- :Item_sp_variable(STRING_WITH_LEN("case_expr")),
+ :Item_sp_variable((char *) STRING_WITH_LEN("case_expr")),
m_case_expr_id(case_expr_id)
{
}
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 35b6b17efa4..aa5607c9f6a 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5726,4 +5726,4 @@ ER_PLUGIN_IS_NOT_LOADED
ER_WRONG_VALUE
eng "Incorrect %-.32s value: '%-.128s'"
ER_NO_PARTITION_FOR_GIVEN_VALUE
- eng "Table has no partition for value %d"
+ eng "Table has no partition for value %ld"
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 8016d5fde1c..e91736fd48b 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -21,7 +21,7 @@
#include "parse_file.h"
static const LEX_STRING triggers_file_type=
- {STRING_WITH_LEN("TRIGGERS")};
+ {(char *) STRING_WITH_LEN("TRIGGERS")};
const char * const triggers_file_ext= ".TRG";
@@ -34,17 +34,17 @@ const char * const triggers_file_ext= ".TRG";
static File_option triggers_file_parameters[]=
{
{
- {STRING_WITH_LEN("triggers") },
+ {(char *) STRING_WITH_LEN("triggers") },
offsetof(class Table_triggers_list, definitions_list),
FILE_OPTIONS_STRLIST
},
{
- {STRING_WITH_LEN("sql_modes") },
+ {(char *) STRING_WITH_LEN("sql_modes") },
offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
},
{
- {STRING_WITH_LEN("definers") },
+ {(char *) STRING_WITH_LEN("definers") },
offsetof(class Table_triggers_list, definers_list),
FILE_OPTIONS_STRLIST
},
@@ -71,7 +71,7 @@ struct st_trigname
};
static const LEX_STRING trigname_file_type=
- {STRING_WITH_LEN("TRIGGERNAME")};
+ {(char *) STRING_WITH_LEN("TRIGGERNAME")};
const char * const trigname_file_ext= ".TRN";
@@ -82,7 +82,7 @@ static File_option trigname_file_parameters[]=
FIXME: Length specified for "trigger_table" key is erroneous, problem
caused by this are reported as BUG#14090 and should be fixed ASAP.
*/
- {STRING_WITH_LEN("trigger_table")},
+ {(char *) STRING_WITH_LEN("trigger_table")},
offsetof(struct st_trigname, trigger_table),
FILE_OPTIONS_ESTRING
},
@@ -1236,7 +1236,7 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
(char *)path, "TRIGGER");
File_option sql_modes_parameters=
{
- {STRING_WITH_LEN("sql_modes") },
+ {(char *) STRING_WITH_LEN("sql_modes") },
offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
};