Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f9b0b014
Commit
f9b0b014
authored
Mar 10, 2010
by
Alexander Nozdrin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge from mysql-next-mr-bugfixing.
parents
e8ef8a3e
d15dfba1
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
892 additions
and
131 deletions
+892
-131
cmake/build_configurations/mysql_release.cmake
cmake/build_configurations/mysql_release.cmake
+2
-2
cmake/os/Windows.cmake
cmake/os/Windows.cmake
+2
-2
include/mysql/psi/mysql_thread.h
include/mysql/psi/mysql_thread.h
+281
-1
libmysql_r/Makefile.am
libmysql_r/Makefile.am
+5
-3
mysql-test/lib/v1/mysql-test-run.pl
mysql-test/lib/v1/mysql-test-run.pl
+51
-64
mysql-test/r/type_timestamp.result
mysql-test/r/type_timestamp.result
+16
-0
mysql-test/suite/perfschema/r/dml_setup_instruments.result
mysql-test/suite/perfschema/r/dml_setup_instruments.result
+2
-1
mysql-test/suite/perfschema/r/pfs_upgrade.result
mysql-test/suite/perfschema/r/pfs_upgrade.result
+153
-0
mysql-test/suite/perfschema/t/pfs_upgrade.test
mysql-test/suite/perfschema/t/pfs_upgrade.test
+138
-0
mysql-test/t/type_timestamp.test
mysql-test/t/type_timestamp.test
+14
-0
plugin/Makefile.am
plugin/Makefile.am
+6
-1
scripts/mysql_system_tables.sql
scripts/mysql_system_tables.sql
+79
-5
scripts/mysqld_safe.sh
scripts/mysqld_safe.sh
+7
-1
sql/item.h
sql/item.h
+6
-5
sql/mdl.cc
sql/mdl.cc
+90
-37
sql/mdl.h
sql/mdl.h
+5
-5
storage/innobase/CMakeLists.txt
storage/innobase/CMakeLists.txt
+1
-1
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.cc
+21
-1
storage/perfschema/unittest/pfs-t.cc
storage/perfschema/unittest/pfs-t.cc
+13
-2
No files found.
cmake/build_configurations/mysql_release.cmake
View file @
f9b0b014
...
@@ -151,7 +151,7 @@ IF(UNIX)
...
@@ -151,7 +151,7 @@ IF(UNIX)
ENDIF
()
ENDIF
()
IF
(
CMAKE_C_COMPILER_ID MATCHES
"SunPro"
)
IF
(
CMAKE_C_COMPILER_ID MATCHES
"SunPro"
)
IF
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"i386"
)
IF
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"i386"
)
IF
(
CMAKE_SIZEOF_VOIDP EQUAL 4
)
IF
(
CMAKE_SIZEOF_VOID
_
P EQUAL 4
)
# Solaris x86
# Solaris x86
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"-g -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic"
)
"-g -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic"
)
...
@@ -165,7 +165,7 @@ IF(UNIX)
...
@@ -165,7 +165,7 @@ IF(UNIX)
"-g0 -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic"
)
"-g0 -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic"
)
ENDIF
()
ENDIF
()
ELSE
()
ELSE
()
IF
(
CMAKE_SIZEOF_VOIDP EQUAL 4
)
IF
(
CMAKE_SIZEOF_VOID
_
P EQUAL 4
)
# Solaris sparc 32 bit
# Solaris sparc 32 bit
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"-g -xO3 -Xa -xstrconst -mt -xarch=sparc"
)
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"-g -xO3 -Xa -xstrconst -mt -xarch=sparc"
)
SET
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-g0 -xO3 -noex -mt -xarch=sparc"
)
SET
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-g0 -xO3 -noex -mt -xarch=sparc"
)
...
...
cmake/os/Windows.cmake
View file @
f9b0b014
...
@@ -56,7 +56,7 @@ ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
...
@@ -56,7 +56,7 @@ ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
ADD_DEFINITIONS
(
"-DWIN32_LEAN_AND_MEAN"
)
ADD_DEFINITIONS
(
"-DWIN32_LEAN_AND_MEAN"
)
# Adjust compiler and linker flags
# Adjust compiler and linker flags
IF
(
MINGW AND CMAKE_SIZEOF_VOIDP EQUAL 4
)
IF
(
MINGW AND CMAKE_SIZEOF_VOID
_
P EQUAL 4
)
# mininal architecture flags, i486 enables GCC atomics
# mininal architecture flags, i486 enables GCC atomics
ADD_DEFINITIONS
(
-march=i486
)
ADD_DEFINITIONS
(
-march=i486
)
ENDIF
()
ENDIF
()
...
@@ -193,4 +193,4 @@ IF(NOT HAVE_SIZE_OF_SSIZE_T)
...
@@ -193,4 +193,4 @@ IF(NOT HAVE_SIZE_OF_SSIZE_T)
SET
(
ssize_t SSIZE_T
)
SET
(
ssize_t SSIZE_T
)
ENDIF
()
ENDIF
()
SET
(
FN_NO_CASE_SENSE 1
)
SET
(
FN_NO_CASE_SENSE 1
)
\ No newline at end of file
include/mysql/psi/mysql_thread.h
View file @
f9b0b014
...
@@ -106,6 +106,22 @@ struct st_mysql_rwlock
...
@@ -106,6 +106,22 @@ struct st_mysql_rwlock
struct
PSI_rwlock
*
m_psi
;
struct
PSI_rwlock
*
m_psi
;
};
};
/**
An instrumented prlock structure.
@sa mysql_prlock_t
*/
struct
st_mysql_prlock
{
/** The real prlock */
rw_pr_lock_t
m_prlock
;
/**
The instrumentation hook.
Note that this hook is not conditionally defined,
for binary compatibility of the @c mysql_rwlock_t interface.
*/
struct
PSI_rwlock
*
m_psi
;
};
/**
/**
Type of an instrumented rwlock.
Type of an instrumented rwlock.
@c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t.
@c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t.
...
@@ -119,6 +135,20 @@ struct st_mysql_rwlock
...
@@ -119,6 +135,20 @@ struct st_mysql_rwlock
*/
*/
typedef
struct
st_mysql_rwlock
mysql_rwlock_t
;
typedef
struct
st_mysql_rwlock
mysql_rwlock_t
;
/**
Type of an instrumented prlock.
A prlock is a read write lock that 'prefers readers' (pr).
@c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t.
@sa mysql_prlock_init
@sa mysql_prlock_rdlock
@sa mysql_prlock_tryrdlock
@sa mysql_prlock_wrlock
@sa mysql_prlock_trywrlock
@sa mysql_prlock_unlock
@sa mysql_prlock_destroy
*/
typedef
struct
st_mysql_prlock
mysql_prlock_t
;
/**
/**
An instrumented cond structure.
An instrumented cond structure.
@sa mysql_cond_t
@sa mysql_cond_t
...
@@ -162,6 +192,8 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -162,6 +192,8 @@ typedef struct st_mysql_cond mysql_cond_t;
on some platforms.
on some platforms.
The proper fix would be to cut these extra dependencies in the calling code.
The proper fix would be to cut these extra dependencies in the calling code.
DISABLE_MYSQL_THREAD_H is a work around to limit dependencies.
DISABLE_MYSQL_THREAD_H is a work around to limit dependencies.
DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically
the prlock wrappers.
*/
*/
#ifndef DISABLE_MYSQL_THREAD_H
#ifndef DISABLE_MYSQL_THREAD_H
...
@@ -281,6 +313,19 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -281,6 +313,19 @@ typedef struct st_mysql_cond mysql_cond_t;
#define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW)
#define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW)
#endif
#endif
/**
@def mysql_prlock_init(K, RW)
Instrumented rw_pr_init.
@c mysql_prlock_init is a replacement for @c rw_pr_init.
@param K The PSI_rwlock_key for this instrumented prlock
@param RW The prlock to initialize
*/
#ifdef HAVE_PSI_INTERFACE
#define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW)
#else
#define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW)
#endif
/**
/**
@def mysql_rwlock_destroy(RW)
@def mysql_rwlock_destroy(RW)
Instrumented rwlock_destroy.
Instrumented rwlock_destroy.
...
@@ -289,6 +334,14 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -289,6 +334,14 @@ typedef struct st_mysql_cond mysql_cond_t;
*/
*/
#define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW)
#define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW)
/**
@def mysql_prlock_destroy(RW)
Instrumented rw_pr_destroy.
@c mysql_prlock_destroy is a drop-in replacement
for @c rw_pr_destroy.
*/
#define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW)
/**
/**
@def mysql_rwlock_rdlock(RW)
@def mysql_rwlock_rdlock(RW)
Instrumented rwlock_rdlock.
Instrumented rwlock_rdlock.
...
@@ -303,6 +356,20 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -303,6 +356,20 @@ typedef struct st_mysql_cond mysql_cond_t;
inline_mysql_rwlock_rdlock(RW)
inline_mysql_rwlock_rdlock(RW)
#endif
#endif
/**
@def mysql_prlock_rdlock(RW)
Instrumented rw_pr_rdlock.
@c mysql_prlock_rdlock is a drop-in replacement
for @c rw_pr_rdlock.
*/
#ifdef HAVE_PSI_INTERFACE
#define mysql_prlock_rdlock(RW) \
inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__)
#else
#define mysql_prlock_rdlock(RW) \
inline_mysql_prlock_rdlock(RW)
#endif
/**
/**
@def mysql_rwlock_wrlock(RW)
@def mysql_rwlock_wrlock(RW)
Instrumented rwlock_wrlock.
Instrumented rwlock_wrlock.
...
@@ -317,6 +384,20 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -317,6 +384,20 @@ typedef struct st_mysql_cond mysql_cond_t;
inline_mysql_rwlock_wrlock(RW)
inline_mysql_rwlock_wrlock(RW)
#endif
#endif
/**
@def mysql_prlock_wrlock(RW)
Instrumented rw_pr_wrlock.
@c mysql_prlock_wrlock is a drop-in replacement
for @c rw_pr_wrlock.
*/
#ifdef HAVE_PSI_INTERFACE
#define mysql_prlock_wrlock(RW) \
inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__)
#else
#define mysql_prlock_wrlock(RW) \
inline_mysql_prlock_wrlock(RW)
#endif
/**
/**
@def mysql_rwlock_tryrdlock(RW)
@def mysql_rwlock_tryrdlock(RW)
Instrumented rwlock_tryrdlock.
Instrumented rwlock_tryrdlock.
...
@@ -331,6 +412,20 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -331,6 +412,20 @@ typedef struct st_mysql_cond mysql_cond_t;
inline_mysql_rwlock_tryrdlock(RW)
inline_mysql_rwlock_tryrdlock(RW)
#endif
#endif
/**
@def mysql_prlock_tryrdlock(RW)
Instrumented rw_pr_tryrdlock.
@c mysql_prlock_tryrdlock is a drop-in replacement
for @c rw_pr_tryrdlock.
*/
#ifdef HAVE_PSI_INTERFACE
#define mysql_prlock_tryrdlock(RW) \
inline_mysql_prlock_tryrdlock(RW, __FILE__, __LINE__)
#else
#define mysql_prlock_tryrdlock(RW) \
inline_mysql_prlock_tryrdlock(RW)
#endif
/**
/**
@def mysql_rwlock_trywrlock(RW)
@def mysql_rwlock_trywrlock(RW)
Instrumented rwlock_trywrlock.
Instrumented rwlock_trywrlock.
...
@@ -345,6 +440,20 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -345,6 +440,20 @@ typedef struct st_mysql_cond mysql_cond_t;
inline_mysql_rwlock_trywrlock(RW)
inline_mysql_rwlock_trywrlock(RW)
#endif
#endif
/**
@def mysql_prlock_trywrlock(RW)
Instrumented rw_pr_trywrlock.
@c mysql_prlock_trywrlock is a drop-in replacement
for @c rw_pr_trywrlock.
*/
#ifdef HAVE_PSI_INTERFACE
#define mysql_prlock_trywrlock(RW) \
inline_mysql_prlock_trywrlock(RW, __FILE__, __LINE__)
#else
#define mysql_prlock_trywrlock(RW) \
inline_mysql_prlock_trywrlock(RW)
#endif
/**
/**
@def mysql_rwlock_unlock(RW)
@def mysql_rwlock_unlock(RW)
Instrumented rwlock_unlock.
Instrumented rwlock_unlock.
...
@@ -353,9 +462,17 @@ typedef struct st_mysql_cond mysql_cond_t;
...
@@ -353,9 +462,17 @@ typedef struct st_mysql_cond mysql_cond_t;
*/
*/
#define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW)
#define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW)
/**
@def mysql_prlock_unlock(RW)
Instrumented rw_pr_unlock.
@c mysql_prlock_unlock is a drop-in replacement
for @c rw_pr_unlock.
*/
#define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW)
/**
/**
@def mysql_cond_init(K, C, A)
@def mysql_cond_init(K, C, A)
Instrumented
rwlock
_init.
Instrumented
cond
_init.
@c mysql_cond_init is a replacement for @c pthread_cond_init.
@c mysql_cond_init is a replacement for @c pthread_cond_init.
@param C The cond to initialize
@param C The cond to initialize
@param K The PSI_cond_key for this instrumented cond
@param K The PSI_cond_key for this instrumented cond
...
@@ -599,6 +716,23 @@ static inline int inline_mysql_rwlock_init(
...
@@ -599,6 +716,23 @@ static inline int inline_mysql_rwlock_init(
return
my_rwlock_init
(
&
that
->
m_rwlock
,
NULL
);
return
my_rwlock_init
(
&
that
->
m_rwlock
,
NULL
);
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_init
(
#ifdef HAVE_PSI_INTERFACE
PSI_rwlock_key
key
,
#endif
mysql_prlock_t
*
that
)
{
#ifdef HAVE_PSI_INTERFACE
that
->
m_psi
=
(
PSI_server
?
PSI_server
->
init_rwlock
(
key
,
&
that
->
m_prlock
)
:
NULL
);
#else
that
->
m_psi
=
NULL
;
#endif
return
rw_pr_init
(
&
that
->
m_prlock
);
}
#endif
static
inline
int
inline_mysql_rwlock_destroy
(
static
inline
int
inline_mysql_rwlock_destroy
(
mysql_rwlock_t
*
that
)
mysql_rwlock_t
*
that
)
{
{
...
@@ -612,6 +746,21 @@ static inline int inline_mysql_rwlock_destroy(
...
@@ -612,6 +746,21 @@ static inline int inline_mysql_rwlock_destroy(
return
rwlock_destroy
(
&
that
->
m_rwlock
);
return
rwlock_destroy
(
&
that
->
m_rwlock
);
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_destroy
(
mysql_prlock_t
*
that
)
{
#ifdef HAVE_PSI_INTERFACE
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
PSI_server
->
destroy_rwlock
(
that
->
m_psi
);
that
->
m_psi
=
NULL
;
}
#endif
return
rw_pr_destroy
(
&
that
->
m_prlock
);
}
#endif
static
inline
int
inline_mysql_rwlock_rdlock
(
static
inline
int
inline_mysql_rwlock_rdlock
(
mysql_rwlock_t
*
that
mysql_rwlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_INTERFACE
...
@@ -638,6 +787,34 @@ static inline int inline_mysql_rwlock_rdlock(
...
@@ -638,6 +787,34 @@ static inline int inline_mysql_rwlock_rdlock(
return
result
;
return
result
;
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_rdlock
(
mysql_prlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
,
const
char
*
src_file
,
uint
src_line
#endif
)
{
int
result
;
#ifdef HAVE_PSI_INTERFACE
struct
PSI_rwlock_locker
*
locker
=
NULL
;
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
locker
=
PSI_server
->
get_thread_rwlock_locker
(
that
->
m_psi
,
PSI_RWLOCK_READLOCK
);
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
start_rwlock_rdwait
(
locker
,
src_file
,
src_line
);
}
#endif
result
=
rw_pr_rdlock
(
&
that
->
m_prlock
);
#ifdef HAVE_PSI_INTERFACE
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
end_rwlock_rdwait
(
locker
,
result
);
#endif
return
result
;
}
#endif
static
inline
int
inline_mysql_rwlock_wrlock
(
static
inline
int
inline_mysql_rwlock_wrlock
(
mysql_rwlock_t
*
that
mysql_rwlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_INTERFACE
...
@@ -664,6 +841,34 @@ static inline int inline_mysql_rwlock_wrlock(
...
@@ -664,6 +841,34 @@ static inline int inline_mysql_rwlock_wrlock(
return
result
;
return
result
;
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_wrlock
(
mysql_prlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
,
const
char
*
src_file
,
uint
src_line
#endif
)
{
int
result
;
#ifdef HAVE_PSI_INTERFACE
struct
PSI_rwlock_locker
*
locker
=
NULL
;
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
locker
=
PSI_server
->
get_thread_rwlock_locker
(
that
->
m_psi
,
PSI_RWLOCK_WRITELOCK
);
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
start_rwlock_wrwait
(
locker
,
src_file
,
src_line
);
}
#endif
result
=
rw_pr_wrlock
(
&
that
->
m_prlock
);
#ifdef HAVE_PSI_INTERFACE
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
end_rwlock_wrwait
(
locker
,
result
);
#endif
return
result
;
}
#endif
static
inline
int
inline_mysql_rwlock_tryrdlock
(
static
inline
int
inline_mysql_rwlock_tryrdlock
(
mysql_rwlock_t
*
that
mysql_rwlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_INTERFACE
...
@@ -690,6 +895,34 @@ static inline int inline_mysql_rwlock_tryrdlock(
...
@@ -690,6 +895,34 @@ static inline int inline_mysql_rwlock_tryrdlock(
return
result
;
return
result
;
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_tryrdlock
(
mysql_prlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
,
const
char
*
src_file
,
uint
src_line
#endif
)
{
int
result
;
#ifdef HAVE_PSI_INTERFACE
struct
PSI_rwlock_locker
*
locker
=
NULL
;
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
locker
=
PSI_server
->
get_thread_rwlock_locker
(
that
->
m_psi
,
PSI_RWLOCK_TRYREADLOCK
);
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
start_rwlock_rdwait
(
locker
,
src_file
,
src_line
);
}
#endif
result
=
rw_pr_tryrdlock
(
&
that
->
m_prlock
);
#ifdef HAVE_PSI_INTERFACE
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
end_rwlock_rdwait
(
locker
,
result
);
#endif
return
result
;
}
#endif
static
inline
int
inline_mysql_rwlock_trywrlock
(
static
inline
int
inline_mysql_rwlock_trywrlock
(
mysql_rwlock_t
*
that
mysql_rwlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_INTERFACE
...
@@ -716,6 +949,34 @@ static inline int inline_mysql_rwlock_trywrlock(
...
@@ -716,6 +949,34 @@ static inline int inline_mysql_rwlock_trywrlock(
return
result
;
return
result
;
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_trywrlock
(
mysql_prlock_t
*
that
#ifdef HAVE_PSI_INTERFACE
,
const
char
*
src_file
,
uint
src_line
#endif
)
{
int
result
;
#ifdef HAVE_PSI_INTERFACE
struct
PSI_rwlock_locker
*
locker
=
NULL
;
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
locker
=
PSI_server
->
get_thread_rwlock_locker
(
that
->
m_psi
,
PSI_RWLOCK_TRYWRITELOCK
);
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
start_rwlock_wrwait
(
locker
,
src_file
,
src_line
);
}
#endif
result
=
rw_pr_trywrlock
(
&
that
->
m_prlock
);
#ifdef HAVE_PSI_INTERFACE
if
(
likely
(
locker
!=
NULL
))
PSI_server
->
end_rwlock_wrwait
(
locker
,
result
);
#endif
return
result
;
}
#endif
static
inline
int
inline_mysql_rwlock_unlock
(
static
inline
int
inline_mysql_rwlock_unlock
(
mysql_rwlock_t
*
that
)
mysql_rwlock_t
*
that
)
{
{
...
@@ -733,6 +994,25 @@ static inline int inline_mysql_rwlock_unlock(
...
@@ -733,6 +994,25 @@ static inline int inline_mysql_rwlock_unlock(
return
result
;
return
result
;
}
}
#ifndef DISABLE_MYSQL_PRLOCK_H
static
inline
int
inline_mysql_prlock_unlock
(
mysql_prlock_t
*
that
)
{
int
result
;
#ifdef HAVE_PSI_INTERFACE
struct
PSI_thread
*
thread
;
if
(
likely
(
PSI_server
&&
that
->
m_psi
))
{
thread
=
PSI_server
->
get_thread
();
if
(
likely
(
thread
!=
NULL
))
PSI_server
->
unlock_rwlock
(
thread
,
that
->
m_psi
);
}
#endif
result
=
rw_pr_unlock
(
&
that
->
m_prlock
);
return
result
;
}
#endif
static
inline
int
inline_mysql_cond_init
(
static
inline
int
inline_mysql_cond_init
(
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_INTERFACE
PSI_cond_key
key
,
PSI_cond_key
key
,
...
...
libmysql_r/Makefile.am
View file @
f9b0b014
...
@@ -20,9 +20,11 @@
...
@@ -20,9 +20,11 @@
#
#
# This file is public domain and comes with NO WARRANTY of any kind
# This file is public domain and comes with NO WARRANTY of any kind
target
=
libmysqlclient_r.la
target
=
libmysqlclient_r.la
target_defs
=
-DDONT_USE_RAID
-DMYSQL_CLIENT
@LIB_EXTRA_CCFLAGS@
target_defs
=
-DDISABLE_MYSQL_PRLOCK_H
-DDONT_USE_RAID
\
LIBS
=
@LIBS@ @ZLIB_LIBS@ @openssl_libs@
-DMYSQL_CLIENT
@LIB_EXTRA_CCFLAGS@
LIBS
=
@LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES
=
-I
$(top_builddir)
/include
-I
$(top_srcdir)
/include
\
INCLUDES
=
-I
$(top_builddir)
/include
-I
$(top_srcdir)
/include
\
$(openssl_includes)
@ZLIB_INCLUDES@
$(openssl_includes)
@ZLIB_INCLUDES@
...
...
mysql-test/lib/v1/mysql-test-run.pl
View file @
f9b0b014
...
@@ -109,6 +109,7 @@ our $glob_use_embedded_server= 0;
...
@@ -109,6 +109,7 @@ our $glob_use_embedded_server= 0;
our
@glob_test_mode
;
our
@glob_test_mode
;
our
$glob_basedir
;
our
$glob_basedir
;
our
$glob_bindir
;
our
$path_charsetsdir
;
our
$path_charsetsdir
;
our
$path_client_bindir
;
our
$path_client_bindir
;
...
@@ -157,7 +158,6 @@ our $exe_mysqltest;
...
@@ -157,7 +158,6 @@ our $exe_mysqltest;
our
$exe_ndbd
;
our
$exe_ndbd
;
our
$exe_ndb_mgmd
;
our
$exe_ndb_mgmd
;
our
$exe_slave_mysqld
;
our
$exe_slave_mysqld
;
our
$exe_im
;
our
$exe_my_print_defaults
;
our
$exe_my_print_defaults
;
our
$exe_perror
;
our
$exe_perror
;
our
$lib_udf_example
;
our
$lib_udf_example
;
...
@@ -720,13 +720,21 @@ sub command_line_setup () {
...
@@ -720,13 +720,21 @@ sub command_line_setup () {
$glob_mysql_test_dir
=
`
cygpath -m "
$glob_mysql_test_dir
"
`;
$glob_mysql_test_dir
=
`
cygpath -m "
$glob_mysql_test_dir
"
`;
chomp
(
$glob_mysql_test_dir
);
chomp
(
$glob_mysql_test_dir
);
}
}
$default_vardir
=
"
$glob_mysql_test_dir
/var
";
if
(
defined
$ENV
{
MTR_BINDIR
})
{
$default_vardir
=
"
$ENV
{MTR_BINDIR}/mysql-test/var
";
}
else
{
$default_vardir
=
"
$glob_mysql_test_dir
/var
";
}
# In most cases, the base directory we find everything relative to,
# In most cases, the base directory we find everything relative to,
# is the parent directory of the "mysql-test" directory. For source
# is the parent directory of the "mysql-test" directory. For source
# distributions, TAR binary distributions and some other packages.
# distributions, TAR binary distributions and some other packages.
$glob_basedir
=
dirname
(
$glob_mysql_test_dir
);
$glob_basedir
=
dirname
(
$glob_mysql_test_dir
);
$glob_bindir
=
$ENV
{'
MTR_BINDIR
'}
||
$glob_basedir
;
# In the RPM case, binaries and libraries are installed in the
# In the RPM case, binaries and libraries are installed in the
# default system locations, instead of having our own private base
# default system locations, instead of having our own private base
# directory. And we install "/usr/share/mysql-test". Moving up one
# directory. And we install "/usr/share/mysql-test". Moving up one
...
@@ -792,36 +800,37 @@ sub command_line_setup () {
...
@@ -792,36 +800,37 @@ sub command_line_setup () {
}
}
else
else
{
{
$path_client_bindir
=
mtr_path_exists
("
$glob_b
ase
dir
/client_release
",
$path_client_bindir
=
mtr_path_exists
("
$glob_b
in
dir
/client_release
",
"
$glob_b
ase
dir
/client_debug
",
"
$glob_b
in
dir
/client_debug
",
vs_config_dirs
('
client
',
''),
vs_config_dirs
('
client
',
''),
"
$glob_b
ase
dir
/client
",
"
$glob_b
in
dir
/client
",
"
$glob_b
ase
dir
/bin
");
"
$glob_b
in
dir
/bin
");
}
}
# Look for language files and charsetsdir, use same share
# Look for language files and charsetsdir, use same share
$path_share
=
mtr_path_exists
("
$glob_b
ase
dir
/share/mysql
",
$path_share
=
mtr_path_exists
("
$glob_b
in
dir
/share/mysql
",
"
$glob_b
ase
dir
/sql/share
",
"
$glob_b
in
dir
/sql/share
",
"
$glob_b
ase
dir
/share
");
"
$glob_b
in
dir
/share
");
$path_language
=
mtr_path_exists
("
$path_share
");
$path_language
=
mtr_path_exists
("
$path_share
");
$path_charsetsdir
=
mtr_path_exists
("
$path_share
/charsets
");
$path_charsetsdir
=
mtr_path_exists
("
$glob_basedir
/share/mysql/charsets
",
"
$glob_basedir
/sql/share/charsets
",
"
$glob_basedir
/share/charsets
");
if
(
!
$opt_extern
)
if
(
!
$opt_extern
)
{
{
$exe_mysqld
=
mtr_exe_exists
(
vs_config_dirs
('
sql
',
'
mysqld
'),
$exe_mysqld
=
mtr_exe_exists
(
vs_config_dirs
('
sql
',
'
mysqld
'),
vs_config_dirs
('
sql
',
'
mysqld-debug
'),
vs_config_dirs
('
sql
',
'
mysqld-debug
'),
"
$glob_b
ase
dir
/sql/mysqld
",
"
$glob_b
in
dir
/sql/mysqld
",
"
$path_client_bindir
/mysqld-max-nt
",
"
$path_client_bindir
/mysqld-max-nt
",
"
$path_client_bindir
/mysqld-max
",
"
$path_client_bindir
/mysqld-max
",
"
$path_client_bindir
/mysqld-nt
",
"
$path_client_bindir
/mysqld-nt
",
"
$path_client_bindir
/mysqld
",
"
$path_client_bindir
/mysqld
",
"
$path_client_bindir
/mysqld-debug
",
"
$path_client_bindir
/mysqld-debug
",
"
$path_client_bindir
/mysqld-max
",
"
$path_client_bindir
/mysqld-max
",
"
$glob_b
ase
dir
/libexec/mysqld
",
"
$glob_b
in
dir
/libexec/mysqld
",
"
$glob_b
ase
dir
/bin/mysqld
",
"
$glob_b
in
dir
/bin/mysqld
",
"
$glob_b
ase
dir
/sbin/mysqld
");
"
$glob_b
in
dir
/sbin/mysqld
");
# Use the mysqld found above to find out what features are available
# Use the mysqld found above to find out what features are available
collect_mysqld_features
();
collect_mysqld_features
();
...
@@ -1563,37 +1572,24 @@ sub collect_mysqld_features_from_running_server ()
...
@@ -1563,37 +1572,24 @@ sub collect_mysqld_features_from_running_server ()
}
}
}
}
sub
executable_setup_im
()
{
# Look for instance manager binary - mysqlmanager
$exe_im
=
mtr_exe_maybe_exists
(
"
$glob_basedir
/server-tools/instance-manager/mysqlmanager
",
"
$glob_basedir
/libexec/mysqlmanager
",
"
$glob_basedir
/bin/mysqlmanager
",
"
$glob_basedir
/sbin/mysqlmanager
");
return
(
$exe_im
eq
"");
}
sub
executable_setup_ndb
()
{
sub
executable_setup_ndb
()
{
# Look for ndb tols and binaries
# Look for ndb tols and binaries
my
$ndb_path
=
mtr_file_exists
("
$glob_b
ase
dir
/ndb
",
my
$ndb_path
=
mtr_file_exists
("
$glob_b
in
dir
/ndb
",
"
$glob_b
ase
dir
/storage/ndb
",
"
$glob_b
in
dir
/storage/ndb
",
"
$glob_b
ase
dir
/bin
");
"
$glob_b
in
dir
/bin
");
$exe_ndbd
=
$exe_ndbd
=
mtr_exe_maybe_exists
("
$ndb_path
/src/kernel/ndbd
",
mtr_exe_maybe_exists
("
$ndb_path
/src/kernel/ndbd
",
"
$ndb_path
/ndbd
",
"
$ndb_path
/ndbd
",
"
$glob_b
ase
dir
/libexec/ndbd
");
"
$glob_b
in
dir
/libexec/ndbd
");
$exe_ndb_mgm
=
$exe_ndb_mgm
=
mtr_exe_maybe_exists
("
$ndb_path
/src/mgmclient/ndb_mgm
",
mtr_exe_maybe_exists
("
$ndb_path
/src/mgmclient/ndb_mgm
",
"
$ndb_path
/ndb_mgm
");
"
$ndb_path
/ndb_mgm
");
$exe_ndb_mgmd
=
$exe_ndb_mgmd
=
mtr_exe_maybe_exists
("
$ndb_path
/src/mgmsrv/ndb_mgmd
",
mtr_exe_maybe_exists
("
$ndb_path
/src/mgmsrv/ndb_mgmd
",
"
$ndb_path
/ndb_mgmd
",
"
$ndb_path
/ndb_mgmd
",
"
$glob_b
ase
dir
/libexec/ndb_mgmd
");
"
$glob_b
in
dir
/libexec/ndb_mgmd
");
$exe_ndb_waiter
=
$exe_ndb_waiter
=
mtr_exe_maybe_exists
("
$ndb_path
/tools/ndb_waiter
",
mtr_exe_maybe_exists
("
$ndb_path
/tools/ndb_waiter
",
"
$ndb_path
/ndb_waiter
");
"
$ndb_path
/ndb_waiter
");
...
@@ -1636,11 +1632,11 @@ sub executable_setup () {
...
@@ -1636,11 +1632,11 @@ sub executable_setup () {
$exe_my_print_defaults
=
$exe_my_print_defaults
=
mtr_exe_exists
(
vs_config_dirs
('
extra
',
'
my_print_defaults
'),
mtr_exe_exists
(
vs_config_dirs
('
extra
',
'
my_print_defaults
'),
"
$path_client_bindir
/my_print_defaults
",
"
$path_client_bindir
/my_print_defaults
",
"
$glob_b
ase
dir
/extra/my_print_defaults
");
"
$glob_b
in
dir
/extra/my_print_defaults
");
# Look for perror
# Look for perror
$exe_perror
=
mtr_exe_exists
(
vs_config_dirs
('
extra
',
'
perror
'),
$exe_perror
=
mtr_exe_exists
(
vs_config_dirs
('
extra
',
'
perror
'),
"
$glob_b
ase
dir
/extra/perror
",
"
$glob_b
in
dir
/extra/perror
",
"
$path_client_bindir
/perror
");
"
$path_client_bindir
/perror
");
# Look for the client binaries
# Look for the client binaries
...
@@ -1697,23 +1693,15 @@ sub executable_setup () {
...
@@ -1697,23 +1693,15 @@ sub executable_setup () {
}
}
}
}
if
(
!
$opt_skip_im
and
executable_setup_im
())
{
mtr_warning
("
Could not find all required instance manager binaries,
"
.
"
all im tests will fail, use --skip-im to
"
.
"
continue without instance manager
");
$instance_manager
->
{"
executable_setup_failed
"}
=
1
;
}
# Look for the udf_example library
# Look for the udf_example library
$lib_udf_example
=
$lib_udf_example
=
mtr_file_exists
(
vs_config_dirs
('
sql
',
'
udf_example.dll
'),
mtr_file_exists
(
vs_config_dirs
('
sql
',
'
udf_example.dll
'),
"
$glob_b
ase
dir
/sql/.libs/udf_example.so
",);
"
$glob_b
in
dir
/sql/.libs/udf_example.so
",);
# Look for the ha_example library
# Look for the ha_example library
$lib_example_plugin
=
$lib_example_plugin
=
mtr_file_exists
(
vs_config_dirs
('
storage/example
',
'
ha_example.dll
'),
mtr_file_exists
(
vs_config_dirs
('
storage/example
',
'
ha_example.dll
'),
"
$glob_b
ase
dir
/storage/example/.libs/ha_example.so
",);
"
$glob_b
in
dir
/storage/example/.libs/ha_example.so
",);
}
}
...
@@ -1722,7 +1710,7 @@ sub executable_setup () {
...
@@ -1722,7 +1710,7 @@ sub executable_setup () {
{
{
$exe_mysqltest
=
$exe_mysqltest
=
mtr_exe_exists
(
vs_config_dirs
('
libmysqld/examples
','
mysqltest_embedded
'),
mtr_exe_exists
(
vs_config_dirs
('
libmysqld/examples
','
mysqltest_embedded
'),
"
$glob_b
ase
dir
/libmysqld/examples/mysqltest_embedded
",
"
$glob_b
in
dir
/libmysqld/examples/mysqltest_embedded
",
"
$path_client_bindir
/mysqltest_embedded
");
"
$path_client_bindir
/mysqltest_embedded
");
}
}
else
else
...
@@ -1737,21 +1725,21 @@ sub executable_setup () {
...
@@ -1737,21 +1725,21 @@ sub executable_setup () {
$exe_mysql_client_test
=
$exe_mysql_client_test
=
mtr_exe_maybe_exists
(
mtr_exe_maybe_exists
(
vs_config_dirs
('
libmysqld/examples
',
'
mysql_client_test_embedded
'),
vs_config_dirs
('
libmysqld/examples
',
'
mysql_client_test_embedded
'),
"
$glob_b
ase
dir
/libmysqld/examples/mysql_client_test_embedded
");
"
$glob_b
in
dir
/libmysqld/examples/mysql_client_test_embedded
");
}
}
else
else
{
{
$exe_mysql_client_test
=
$exe_mysql_client_test
=
mtr_exe_maybe_exists
(
vs_config_dirs
('
tests
',
'
mysql_client_test
'),
mtr_exe_maybe_exists
(
vs_config_dirs
('
tests
',
'
mysql_client_test
'),
"
$glob_b
ase
dir
/tests/mysql_client_test
",
"
$glob_b
in
dir
/tests/mysql_client_test
",
"
$glob_b
ase
dir
/bin/mysql_client_test
");
"
$glob_b
in
dir
/bin/mysql_client_test
");
}
}
# Look for bug25714 executable which may _not_ exist in
# Look for bug25714 executable which may _not_ exist in
# some versions, test using it should be skipped
# some versions, test using it should be skipped
$exe_bug25714
=
$exe_bug25714
=
mtr_exe_maybe_exists
(
vs_config_dirs
('
tests
',
'
bug25714
'),
mtr_exe_maybe_exists
(
vs_config_dirs
('
tests
',
'
bug25714
'),
"
$glob_b
ase
dir
/tests/bug25714
");
"
$glob_b
in
dir
/tests/bug25714
");
}
}
...
@@ -1860,13 +1848,13 @@ sub environment_setup () {
...
@@ -1860,13 +1848,13 @@ sub environment_setup () {
# are used in favor of the system installed ones
# are used in favor of the system installed ones
if
(
$source_dist
)
if
(
$source_dist
)
{
{
push
(
@ld_library_paths
,
"
$glob_b
ase
dir
/libmysql/.libs/
",
push
(
@ld_library_paths
,
"
$glob_b
in
dir
/libmysql/.libs/
",
"
$glob_b
ase
dir
/libmysql_r/.libs/
",
"
$glob_b
in
dir
/libmysql_r/.libs/
",
"
$glob_b
ase
dir
/zlib.libs/
");
"
$glob_b
in
dir
/zlib.libs/
");
}
}
else
else
{
{
push
(
@ld_library_paths
,
"
$glob_b
ase
dir
/lib
");
push
(
@ld_library_paths
,
"
$glob_b
in
dir
/lib
");
}
}
}
}
...
@@ -1875,7 +1863,7 @@ sub environment_setup () {
...
@@ -1875,7 +1863,7 @@ sub environment_setup () {
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
if
(
$glob_ndbcluster_supported
)
if
(
$glob_ndbcluster_supported
)
{
{
push
(
@ld_library_paths
,
"
$glob_b
ase
dir
/storage/ndb/src/.libs
");
push
(
@ld_library_paths
,
"
$glob_b
in
dir
/storage/ndb/src/.libs
");
}
}
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
...
@@ -1993,7 +1981,6 @@ sub environment_setup () {
...
@@ -1993,7 +1981,6 @@ sub environment_setup () {
# ----------------------------------------------------
# ----------------------------------------------------
if
(
!
$opt_skip_im
)
if
(
!
$opt_skip_im
)
{
{
$ENV
{'
IM_EXE
'}
=
$exe_im
;
$ENV
{'
IM_PATH_PID
'}
=
$instance_manager
->
{
path_pid
};
$ENV
{'
IM_PATH_PID
'}
=
$instance_manager
->
{
path_pid
};
$ENV
{'
IM_PATH_ANGEL_PID
'}
=
$instance_manager
->
{
path_angel_pid
};
$ENV
{'
IM_PATH_ANGEL_PID
'}
=
$instance_manager
->
{
path_angel_pid
};
$ENV
{'
IM_PORT
'}
=
$instance_manager
->
{
port
};
$ENV
{'
IM_PORT
'}
=
$instance_manager
->
{
port
};
...
@@ -2190,14 +2177,14 @@ sub environment_setup () {
...
@@ -2190,14 +2177,14 @@ sub environment_setup () {
vs_config_dirs
('
storage/myisam
',
'
myisamchk
'),
vs_config_dirs
('
storage/myisam
',
'
myisamchk
'),
vs_config_dirs
('
myisam
',
'
myisamchk
'),
vs_config_dirs
('
myisam
',
'
myisamchk
'),
"
$path_client_bindir
/myisamchk
",
"
$path_client_bindir
/myisamchk
",
"
$glob_b
ase
dir
/storage/myisam/myisamchk
",
"
$glob_b
in
dir
/storage/myisam/myisamchk
",
"
$glob_b
ase
dir
/myisam/myisamchk
"));
"
$glob_b
in
dir
/myisam/myisamchk
"));
$ENV
{'
MYISAMPACK
'}
=
mtr_native_path
(
mtr_exe_exists
(
$ENV
{'
MYISAMPACK
'}
=
mtr_native_path
(
mtr_exe_exists
(
vs_config_dirs
('
storage/myisam
',
'
myisampack
'),
vs_config_dirs
('
storage/myisam
',
'
myisampack
'),
vs_config_dirs
('
myisam
',
'
myisampack
'),
vs_config_dirs
('
myisam
',
'
myisampack
'),
"
$path_client_bindir
/myisampack
",
"
$path_client_bindir
/myisampack
",
"
$glob_b
ase
dir
/storage/myisam/myisampack
",
"
$glob_b
in
dir
/storage/myisam/myisampack
",
"
$glob_b
ase
dir
/myisam/myisampack
"));
"
$glob_b
in
dir
/myisam/myisampack
"));
# ----------------------------------------------------
# ----------------------------------------------------
# We are nice and report a bit about our settings
# We are nice and report a bit about our settings
...
@@ -2548,12 +2535,12 @@ sub vs_config_dirs ($$) {
...
@@ -2548,12 +2535,12 @@ sub vs_config_dirs ($$) {
if
(
$opt_vs_config
)
if
(
$opt_vs_config
)
{
{
return
("
$glob_b
ase
dir
/
$path_part
/
$opt_vs_config
/
$exe
");
return
("
$glob_b
in
dir
/
$path_part
/
$opt_vs_config
/
$exe
");
}
}
return
("
$glob_b
ase
dir
/
$path_part
/release/
$exe
",
return
("
$glob_b
in
dir
/
$path_part
/release/
$exe
",
"
$glob_b
ase
dir
/
$path_part
/relwithdebinfo/
$exe
",
"
$glob_b
in
dir
/
$path_part
/relwithdebinfo/
$exe
",
"
$glob_b
ase
dir
/
$path_part
/debug/
$exe
");
"
$glob_b
in
dir
/
$path_part
/debug/
$exe
");
}
}
##############################################################################
##############################################################################
...
...
mysql-test/r/type_timestamp.result
View file @
f9b0b014
...
@@ -503,3 +503,19 @@ f1 f2-f3
...
@@ -503,3 +503,19 @@ f1 f2-f3
5 0
5 0
DROP TABLE t1;
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
Bug#50888 valgrind warnings in Field_timestamp::val_str
SET TIMESTAMP=0;
CREATE TABLE t1(a timestamp);
INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02');
FLUSH TABLES t1;
SELECT MAX(a) FROM t1;
MAX(a)
2010-03-05 11:08:02
SELECT a FROM t1;
a
2008-02-23 09:23:45
2010-03-05 11:08:02
DROP TABLE t1;
End of Bug#50888
mysql-test/suite/perfschema/r/dml_setup_instruments.result
View file @
f9b0b014
...
@@ -25,9 +25,10 @@ wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES
...
@@ -25,9 +25,10 @@ wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES
wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES
wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES
wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES
wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES
wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES
wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES
wait/synch/rwlock/sql/MDL_context::waiting_for_lock YES YES
wait/synch/rwlock/sql/MDL_lock::rwlock YES YES
wait/synch/rwlock/sql/Query_cache_query::lock YES YES
wait/synch/rwlock/sql/Query_cache_query::lock YES YES
wait/synch/rwlock/sql/THR_LOCK_servers YES YES
wait/synch/rwlock/sql/THR_LOCK_servers YES YES
wait/synch/rwlock/sql/THR_LOCK_udf YES YES
select * from performance_schema.SETUP_INSTRUMENTS
select * from performance_schema.SETUP_INSTRUMENTS
where name like 'Wait/Synch/Cond/sql/%'
where name like 'Wait/Synch/Cond/sql/%'
and name not in (
and name not in (
...
...
mysql-test/suite/perfschema/r/pfs_upgrade.result
0 → 100644
View file @
f9b0b014
drop table if exists test.user_table;
drop procedure if exists test.user_proc;
drop function if exists test.user_func;
drop event if exists test.user_event;
"Testing mysql_upgrade with TABLE performance_schema.user_table"
create table test.user_table(a int);
use performance_schema;
show tables like "user_table";
Tables_in_performance_schema (user_table)
user_table
ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema database.
ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 233: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 247: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
ERROR 1050 (42S01) at line 281: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 302: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 323: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 340: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 379: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 396: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 414: Table 'PERFORMANCE_TIMERS' already exists
ERROR 1050 (42S01) at line 431: Table 'PROCESSLIST' already exists
ERROR 1050 (42S01) at line 449: Table 'RWLOCK_INSTANCES' already exists
ERROR 1050 (42S01) at line 465: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 502: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 518: Table 'SETUP_TIMERS' already exists
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
user_table
use test;
drop table test.user_table;
"Testing mysql_upgrade with VIEW performance_schema.user_view"
create view test.user_view as select "Not supposed to be here";
use performance_schema;
show tables like "user_view";
Tables_in_performance_schema (user_view)
user_view
ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema database.
ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 233: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 247: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
ERROR 1050 (42S01) at line 281: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 302: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 323: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 340: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 379: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 396: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 414: Table 'PERFORMANCE_TIMERS' already exists
ERROR 1050 (42S01) at line 431: Table 'PROCESSLIST' already exists
ERROR 1050 (42S01) at line 449: Table 'RWLOCK_INSTANCES' already exists
ERROR 1050 (42S01) at line 465: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 502: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 518: Table 'SETUP_TIMERS' already exists
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
user_view
use test;
drop view test.user_view;
"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
create procedure test.user_proc()
select "Not supposed to be here";
update mysql.proc set db='performance_schema' where name='user_proc';
ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema database.
ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 233: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 247: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
ERROR 1050 (42S01) at line 281: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 302: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 323: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 340: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 379: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 396: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 414: Table 'PERFORMANCE_TIMERS' already exists
ERROR 1050 (42S01) at line 431: Table 'PROCESSLIST' already exists
ERROR 1050 (42S01) at line 449: Table 'RWLOCK_INSTANCES' already exists
ERROR 1050 (42S01) at line 465: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 502: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 518: Table 'SETUP_TIMERS' already exists
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
user_proc
update mysql.proc set db='test' where name='user_proc';
drop procedure test.user_proc;
"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
create function test.user_func() returns integer
return 0;
update mysql.proc set db='performance_schema' where name='user_func';
ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema database.
ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 233: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 247: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
ERROR 1050 (42S01) at line 281: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 302: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 323: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 340: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 379: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 396: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 414: Table 'PERFORMANCE_TIMERS' already exists
ERROR 1050 (42S01) at line 431: Table 'PROCESSLIST' already exists
ERROR 1050 (42S01) at line 449: Table 'RWLOCK_INSTANCES' already exists
ERROR 1050 (42S01) at line 465: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 502: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 518: Table 'SETUP_TIMERS' already exists
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
user_func
update mysql.proc set db='test' where name='user_func';
drop function test.user_func;
"Testing mysql_upgrade with EVENT performance_schema.user_event"
create event test.user_event on schedule every 1 day do
select "not supposed to be here";
update mysql.event set db='performance_schema' where name='user_event';
ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema database.
ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 233: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 247: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
ERROR 1050 (42S01) at line 281: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 302: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 323: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 340: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 379: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 396: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 414: Table 'PERFORMANCE_TIMERS' already exists
ERROR 1050 (42S01) at line 431: Table 'PROCESSLIST' already exists
ERROR 1050 (42S01) at line 449: Table 'RWLOCK_INSTANCES' already exists
ERROR 1050 (42S01) at line 465: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 502: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 518: Table 'SETUP_TIMERS' already exists
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
user_event
update mysql.event set db='test' where name='user_event';
drop event test.user_event;
mysql-test/suite/perfschema/t/pfs_upgrade.test
0 → 100644
View file @
f9b0b014
# Copyright (C) 2010 Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# 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
# Tests for PERFORMANCE_SCHEMA
# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
# database.
#
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_perfschema
.
inc
--
source
include
/
have_lowercase0
.
inc
--
disable_warnings
drop
table
if
exists
test
.
user_table
;
drop
procedure
if
exists
test
.
user_proc
;
drop
function
if
exists
test
.
user_func
;
drop
event
if
exists
test
.
user_event
;
--
enable_warnings
--
echo
"Testing mysql_upgrade with TABLE performance_schema.user_table"
create
table
test
.
user_table
(
a
int
);
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
user_table
.
frm
$MYSQLD_DATADIR
/
performance_schema
/
user_table
.
frm
# Make sure the table is visible
use
performance_schema
;
show
tables
like
"user_table"
;
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
2
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Make sure the table is still visible
show
tables
like
"user_table"
;
use
test
;
--
remove_file
$MYSQLD_DATADIR
/
performance_schema
/
user_table
.
frm
drop
table
test
.
user_table
;
--
echo
"Testing mysql_upgrade with VIEW performance_schema.user_view"
create
view
test
.
user_view
as
select
"Not supposed to be here"
;
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
user_view
.
frm
$MYSQLD_DATADIR
/
performance_schema
/
user_view
.
frm
# Make sure the view is visible
use
performance_schema
;
show
tables
like
"user_view"
;
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
2
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Make sure the view is still visible
show
tables
like
"user_view"
;
use
test
;
--
remove_file
$MYSQLD_DATADIR
/
performance_schema
/
user_view
.
frm
drop
view
test
.
user_view
;
--
echo
"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
create
procedure
test
.
user_proc
()
select
"Not supposed to be here"
;
update
mysql
.
proc
set
db
=
'performance_schema'
where
name
=
'user_proc'
;
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
2
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
select
name
from
mysql
.
proc
where
db
=
'performance_schema'
;
update
mysql
.
proc
set
db
=
'test'
where
name
=
'user_proc'
;
drop
procedure
test
.
user_proc
;
--
echo
"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
create
function
test
.
user_func
()
returns
integer
return
0
;
update
mysql
.
proc
set
db
=
'performance_schema'
where
name
=
'user_func'
;
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
2
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
select
name
from
mysql
.
proc
where
db
=
'performance_schema'
;
update
mysql
.
proc
set
db
=
'test'
where
name
=
'user_func'
;
drop
function
test
.
user_func
;
--
echo
"Testing mysql_upgrade with EVENT performance_schema.user_event"
create
event
test
.
user_event
on
schedule
every
1
day
do
select
"not supposed to be here"
;
update
mysql
.
event
set
db
=
'performance_schema'
where
name
=
'user_event'
;
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
2
>
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
select
name
from
mysql
.
event
where
db
=
'performance_schema'
;
update
mysql
.
event
set
db
=
'test'
where
name
=
'user_event'
;
drop
event
test
.
user_event
;
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
out
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
pfs_upgrade
.
err
mysql-test/t/type_timestamp.test
View file @
f9b0b014
...
@@ -346,3 +346,17 @@ SELECT f1,f2-f3 FROM t1;
...
@@ -346,3 +346,17 @@ SELECT f1,f2-f3 FROM t1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
--
echo
--
echo
Bug
#50888 valgrind warnings in Field_timestamp::val_str
--
echo
SET
TIMESTAMP
=
0
;
CREATE
TABLE
t1
(
a
timestamp
);
INSERT
INTO
t1
VALUES
(
'2008-02-23 09:23:45'
),
(
'2010-03-05 11:08:02'
);
FLUSH
TABLES
t1
;
SELECT
MAX
(
a
)
FROM
t1
;
SELECT
a
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
Bug
#50888
plugin/Makefile.am
View file @
f9b0b014
# Copyright (
C) 2005-2006 MySQL AB
# Copyright (
c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
...
@@ -24,5 +24,10 @@ EXTRA_DIST = fulltext/configure.in
...
@@ -24,5 +24,10 @@ EXTRA_DIST = fulltext/configure.in
SUBDIRS
=
@mysql_pg_dirs@
SUBDIRS
=
@mysql_pg_dirs@
DIST_SUBDIRS
=
@mysql_pg_distdirs@
DIST_SUBDIRS
=
@mysql_pg_distdirs@
# As of 5.5.3-m3, we want to include the plugin files of a debug build in the package
install-exec-hook
:
$(mkinstalldirs)
$(DESTDIR)$(pkglibdir)
$(DESTDIR)$(pkglibdir)
/plugin
test
!
-d
debug
||
$(TAR)
cf - debug |
(
cd
$(DESTDIR)$(pkglibdir)
&&
$(TAR)
xvf -
)
# Don't update the files from bitkeeper
# Don't update the files from bitkeeper
%
::
SCCS/s.%
%
::
SCCS/s.%
scripts/mysql_system_tables.sql
View file @
f9b0b014
-- Copyright (C) 2008
-2009 Sun Microsystems, Inc
-- Copyright (C) 2008
, 2010 Oracle and/or its affiliates. All rights reserved.
--
--
-- This program is free software; you can redistribute it and/or modify
-- 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
-- it under the terms of the GNU General Public License as published by
...
@@ -100,18 +100,92 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
...
@@ -100,18 +100,92 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE
TABLE
IF
NOT
EXISTS
ndb_binlog_index
(
Position
BIGINT
UNSIGNED
NOT
NULL
,
File
VARCHAR
(
255
)
NOT
NULL
,
epoch
BIGINT
UNSIGNED
NOT
NULL
,
inserts
BIGINT
UNSIGNED
NOT
NULL
,
updates
BIGINT
UNSIGNED
NOT
NULL
,
deletes
BIGINT
UNSIGNED
NOT
NULL
,
schemaops
BIGINT
UNSIGNED
NOT
NULL
,
PRIMARY
KEY
(
epoch
))
ENGINE
=
MYISAM
;
CREATE
TABLE
IF
NOT
EXISTS
ndb_binlog_index
(
Position
BIGINT
UNSIGNED
NOT
NULL
,
File
VARCHAR
(
255
)
NOT
NULL
,
epoch
BIGINT
UNSIGNED
NOT
NULL
,
inserts
BIGINT
UNSIGNED
NOT
NULL
,
updates
BIGINT
UNSIGNED
NOT
NULL
,
deletes
BIGINT
UNSIGNED
NOT
NULL
,
schemaops
BIGINT
UNSIGNED
NOT
NULL
,
PRIMARY
KEY
(
epoch
))
ENGINE
=
MYISAM
;
--
-- PERFORMANCE SCHEMA INSTALLATION
-- Note that this script is also reused by mysql_upgrade,
-- so we have to be very careful here to not destroy any
-- existing database named 'performance_schema' if it
-- can contain user data.
-- In case of downgrade, it's ok to drop unknown tables
-- from a future version, as long as they belong to the
-- performance schema engine.
--
set
@
have_old_pfs
=
(
select
count
(
*
)
from
information_schema
.
schemata
where
schema_name
=
'performance_schema'
);
SET
@
l1
=
"SET @broken_tables = (select count(*) from information_schema.tables"
;
SET
@
l2
=
" where engine !=
\'
PERFORMANCE_SCHEMA
\'
and table_schema=
\'
performance_schema
\'
)"
;
SET
@
cmd
=
concat
(
@
l1
,
@
l2
);
-- Work around for bug#49542
SET
@
str
=
IF
(
@
have_old_pfs
=
1
,
@
cmd
,
'SET @broken_tables = 0'
);
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
DROP
PREPARE
stmt
;
SET
@
l1
=
"SET @broken_views = (select count(*) from information_schema.views"
;
SET
@
l2
=
" where table_schema='performance_schema')"
;
SET
@
cmd
=
concat
(
@
l1
,
@
l2
);
-- Work around for bug#49542
SET
@
str
=
IF
(
@
have_old_pfs
=
1
,
@
cmd
,
'SET @broken_views = 0'
);
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
DROP
PREPARE
stmt
;
SET
@
broken_routines
=
(
select
count
(
*
)
from
mysql
.
proc
where
db
=
'performance_schema'
);
SET
@
broken_events
=
(
select
count
(
*
)
from
mysql
.
event
where
db
=
'performance_schema'
);
SET
@
broken_pfs
=
(
select
@
broken_tables
+
@
broken_views
+
@
broken_routines
+
@
broken_events
);
--
--
-- The performance schema database.
-- The performance schema database.
-- This database is always created, even in --without-perfschema builds,
-- Only drop and create the database if this is safe (no broken_pfs).
-- This database is created, even in --without-perfschema builds,
-- so that the database name is always reserved by the MySQL implementation.
-- so that the database name is always reserved by the MySQL implementation.
--
--
set
@
have_pfs
=
(
select
count
(
engine
)
from
information_schema
.
engines
where
engine
=
'PERFORMANCE_SCHEMA'
and
support
!=
'NO'
);
SET
@
cmd
=
"DROP DATABASE IF EXISTS performance_schema"
;
SET
@
str
=
IF
(
@
broken_pfs
=
0
,
@
cmd
,
'SET @dummy = 0'
);
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
DROP
PREPARE
stmt
;
DROP
DATABASE
IF
EXISTS
performance_schema
;
SET
@
cmd
=
"CREATE DATABASE performance_schema character set utf8"
;
CREATE
DATABASE
performance_schema
character
set
utf8
;
SET
@
str
=
IF
(
@
broken_pfs
=
0
,
@
cmd
,
'SET @dummy = 0'
);
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
DROP
PREPARE
stmt
;
--
-- Unlike 'performance_schema', the 'mysql' database is reserved already,
-- so no user procedure is supposed to be there
--
drop
procedure
if
exists
mysql
.
die
;
create
procedure
mysql
.
die
()
signal
sqlstate
'HY000'
set
message_text
=
'Unexpected content found in the performance_schema database.'
;
--
-- For broken upgrades, SIGNAL the error
--
SET
@
cmd
=
"call mysql.die()"
;
SET
@
str
=
IF
(
@
broken_pfs
>
0
,
@
cmd
,
'SET @dummy = 0'
);
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
DROP
PREPARE
stmt
;
drop
procedure
mysql
.
die
;
--
-- From this point, only create the performance schema tables
-- if the server is build with performance schema
--
set
@
have_pfs
=
(
select
count
(
engine
)
from
information_schema
.
engines
where
engine
=
'PERFORMANCE_SCHEMA'
and
support
!=
'NO'
);
--
--
-- TABLE COND_INSTANCES
-- TABLE COND_INSTANCES
...
...
scripts/mysqld_safe.sh
View file @
f9b0b014
...
@@ -54,6 +54,8 @@ Usage: $0 [OPTIONS]
...
@@ -54,6 +54,8 @@ Usage: $0 [OPTIONS]
--mysqld=FILE Use the specified file as mysqld
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
--nice=NICE Set the scheduling priority of mysqld
--plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if
VERSION is given
--skip-kill-mysqld Don't try to kill stray mysqld processes
--skip-kill-mysqld Don't try to kill stray mysqld processes
--syslog Log messages to syslog with 'logger'
--syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log (default)
--skip-syslog Log messages to error log (default)
...
@@ -172,6 +174,7 @@ parse_arguments() {
...
@@ -172,6 +174,7 @@ parse_arguments() {
--basedir
=
*
)
MY_BASEDIR_VERSION
=
"
$val
"
;;
--basedir
=
*
)
MY_BASEDIR_VERSION
=
"
$val
"
;;
--datadir
=
*
)
DATADIR
=
"
$val
"
;;
--datadir
=
*
)
DATADIR
=
"
$val
"
;;
--pid-file
=
*
)
pid_file
=
"
$val
"
;;
--pid-file
=
*
)
pid_file
=
"
$val
"
;;
--plugin-dir
=
*
)
PLUGIN_DIR
=
"
$val
"
;;
--user
=
*
)
user
=
"
$val
"
;
SET_USER
=
1
;;
--user
=
*
)
user
=
"
$val
"
;
SET_USER
=
1
;;
# these might have been set in a [mysqld_safe] section of my.cnf
# these might have been set in a [mysqld_safe] section of my.cnf
...
@@ -189,6 +192,7 @@ parse_arguments() {
...
@@ -189,6 +192,7 @@ parse_arguments() {
if
test
-n
"
$val
"
if
test
-n
"
$val
"
then
then
MYSQLD
=
"mysqld-
$val
"
MYSQLD
=
"mysqld-
$val
"
PLUGIN_VARIANT
=
"/
$val
"
else
else
MYSQLD
=
"mysqld"
MYSQLD
=
"mysqld"
fi
fi
...
@@ -695,8 +699,10 @@ fi
...
@@ -695,8 +699,10 @@ fi
cmd
=
"
`
mysqld_ld_preload_text
`
$NOHUP_NICENESS
"
cmd
=
"
`
mysqld_ld_preload_text
`
$NOHUP_NICENESS
"
plugin_dir
=
"
${
PLUGIN_DIR
:-
@PLUGINDIR@
}${
PLUGIN_VARIANT
}
"
for
i
in
"
$ledir
/
$MYSQLD
"
"
$defaults
"
"--basedir=
$MY_BASEDIR_VERSION
"
\
for
i
in
"
$ledir
/
$MYSQLD
"
"
$defaults
"
"--basedir=
$MY_BASEDIR_VERSION
"
\
"--datadir=
$DATADIR
"
"
$USER_OPTION
"
"--datadir=
$DATADIR
"
"
--plugin-dir=
$plugin_dir
"
"
$USER_OPTION
"
do
do
cmd
=
"
$cmd
"
`
shell_quote_string
"
$i
"
`
cmd
=
"
$cmd
"
`
shell_quote_string
"
$i
"
`
done
done
...
...
sql/item.h
View file @
f9b0b014
...
@@ -3122,14 +3122,16 @@ protected:
...
@@ -3122,14 +3122,16 @@ protected:
bool
value_cached
;
bool
value_cached
;
public:
public:
Item_cache
()
:
Item_cache
()
:
example
(
0
),
used_table_map
(
0
),
cached_field
(
0
),
cached_field_type
(
MYSQL_TYPE_STRING
),
example
(
0
),
used_table_map
(
0
),
cached_field
(
0
),
cached_field_type
(
MYSQL_TYPE_STRING
),
value_cached
(
0
)
value_cached
(
0
)
{
{
fixed
=
1
;
fixed
=
1
;
null_value
=
1
;
null_value
=
1
;
}
}
Item_cache
(
enum_field_types
field_type_arg
)
:
Item_cache
(
enum_field_types
field_type_arg
)
:
example
(
0
),
used_table_map
(
0
),
cached_field
(
0
),
cached_field_type
(
field_type_arg
),
example
(
0
),
used_table_map
(
0
),
cached_field
(
0
),
cached_field_type
(
field_type_arg
),
value_cached
(
0
)
value_cached
(
0
)
{
{
fixed
=
1
;
fixed
=
1
;
...
@@ -3233,10 +3235,9 @@ class Item_cache_str: public Item_cache
...
@@ -3233,10 +3235,9 @@ class Item_cache_str: public Item_cache
public:
public:
Item_cache_str
(
const
Item
*
item
)
:
Item_cache_str
(
const
Item
*
item
)
:
Item_cache
(),
value
(
0
),
Item_cache
(
item
->
field_type
()
),
value
(
0
),
is_varbinary
(
item
->
type
()
==
FIELD_ITEM
&&
is_varbinary
(
item
->
type
()
==
FIELD_ITEM
&&
((
const
Item_field
*
)
item
)
->
field
->
type
()
==
cached_field_type
==
MYSQL_TYPE_VARCHAR
&&
MYSQL_TYPE_VARCHAR
&&
!
((
const
Item_field
*
)
item
)
->
field
->
has_charset
())
!
((
const
Item_field
*
)
item
)
->
field
->
has_charset
())
{}
{}
double
val_real
();
double
val_real
();
...
...
sql/mdl.cc
View file @
f9b0b014
...
@@ -19,6 +19,54 @@
...
@@ -19,6 +19,54 @@
#include <hash.h>
#include <hash.h>
#include <mysqld_error.h>
#include <mysqld_error.h>
#ifdef HAVE_PSI_INTERFACE
static
PSI_mutex_key
key_MDL_map_mutex
;
static
PSI_mutex_key
key_MDL_context_signal_mutex
;
static
PSI_mutex_info
all_mdl_mutexes
[]
=
{
{
&
key_MDL_map_mutex
,
"MDL_map::mutex"
,
PSI_FLAG_GLOBAL
},
{
&
key_MDL_context_signal_mutex
,
"MDL_context::signal"
,
0
}
};
static
PSI_rwlock_key
key_MDL_lock_rwlock
;
static
PSI_rwlock_key
key_MDL_context_waiting_for_rwlock
;
static
PSI_rwlock_info
all_mdl_rwlocks
[]
=
{
{
&
key_MDL_lock_rwlock
,
"MDL_lock::rwlock"
,
0
},
{
&
key_MDL_context_waiting_for_rwlock
,
"MDL_context::waiting_for_lock"
,
0
}
};
static
PSI_cond_key
key_MDL_context_signal_cond
;
static
PSI_cond_info
all_mdl_conds
[]
=
{
{
&
key_MDL_context_signal_cond
,
"MDL_context::signal"
,
0
}
};
/**
Initialise all the performance schema instrumentation points
used by the MDL subsystem.
*/
static
void
init_mdl_psi_keys
(
void
)
{
const
char
*
category
=
"sql"
;
int
count
;
if
(
PSI_server
==
NULL
)
return
;
count
=
array_elements
(
all_mdl_mutexes
);
PSI_server
->
register_mutex
(
category
,
all_mdl_mutexes
,
count
);
count
=
array_elements
(
all_mdl_rwlocks
);
PSI_server
->
register_rwlock
(
category
,
all_mdl_rwlocks
,
count
);
count
=
array_elements
(
all_mdl_conds
);
PSI_server
->
register_cond
(
category
,
all_mdl_conds
,
count
);
}
#endif
/* HAVE_PSI_INTERFACE */
void
notify_shared_lock
(
THD
*
thd
,
MDL_ticket
*
conflicting_ticket
);
void
notify_shared_lock
(
THD
*
thd
,
MDL_ticket
*
conflicting_ticket
);
...
@@ -178,7 +226,7 @@ public:
...
@@ -178,7 +226,7 @@ public:
If m_wrlock prefers readers (actually ignoring pending writers is
If m_wrlock prefers readers (actually ignoring pending writers is
enough) ctxA and ctxB will continue and no deadlock will occur.
enough) ctxA and ctxB will continue and no deadlock will occur.
*/
*/
rw_pr_
lock_t
m_rwlock
;
mysql_pr
lock_t
m_rwlock
;
bool
is_empty
()
const
bool
is_empty
()
const
{
{
...
@@ -240,12 +288,12 @@ public:
...
@@ -240,12 +288,12 @@ public:
m_ref_release
(
0
),
m_ref_release
(
0
),
m_is_destroyed
(
FALSE
)
m_is_destroyed
(
FALSE
)
{
{
rw_pr_init
(
&
m_rwlock
);
mysql_prlock_init
(
key_MDL_lock_rwlock
,
&
m_rwlock
);
}
}
virtual
~
MDL_lock
()
virtual
~
MDL_lock
()
{
{
rw_pr
_destroy
(
&
m_rwlock
);
mysql_prlock
_destroy
(
&
m_rwlock
);
}
}
inline
static
void
destroy
(
MDL_lock
*
lock
);
inline
static
void
destroy
(
MDL_lock
*
lock
);
public:
public:
...
@@ -368,6 +416,11 @@ void mdl_init()
...
@@ -368,6 +416,11 @@ void mdl_init()
{
{
DBUG_ASSERT
(
!
mdl_initialized
);
DBUG_ASSERT
(
!
mdl_initialized
);
mdl_initialized
=
TRUE
;
mdl_initialized
=
TRUE
;
#ifdef HAVE_PSI_INTERFACE
init_mdl_psi_keys
();
#endif
mdl_locks
.
init
();
mdl_locks
.
init
();
}
}
...
@@ -393,7 +446,7 @@ void mdl_destroy()
...
@@ -393,7 +446,7 @@ void mdl_destroy()
void
MDL_map
::
init
()
void
MDL_map
::
init
()
{
{
mysql_mutex_init
(
NULL
/* pfs key */
,
&
m_mutex
,
NULL
);
mysql_mutex_init
(
key_MDL_map_mutex
,
&
m_mutex
,
NULL
);
my_hash_init
(
&
m_locks
,
&
my_charset_bin
,
16
/* FIXME */
,
0
,
0
,
my_hash_init
(
&
m_locks
,
&
my_charset_bin
,
16
/* FIXME */
,
0
,
0
,
mdl_locks_key
,
0
,
0
);
mdl_locks_key
,
0
,
0
);
}
}
...
@@ -507,7 +560,7 @@ bool MDL_map::move_from_hash_to_lock_mutex(MDL_lock *lock)
...
@@ -507,7 +560,7 @@ bool MDL_map::move_from_hash_to_lock_mutex(MDL_lock *lock)
lock
->
m_ref_usage
++
;
lock
->
m_ref_usage
++
;
mysql_mutex_unlock
(
&
m_mutex
);
mysql_mutex_unlock
(
&
m_mutex
);
rw_pr
_wrlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_wrlock
(
&
lock
->
m_rwlock
);
lock
->
m_ref_release
++
;
lock
->
m_ref_release
++
;
if
(
unlikely
(
lock
->
m_is_destroyed
))
if
(
unlikely
(
lock
->
m_is_destroyed
))
{
{
...
@@ -522,7 +575,7 @@ bool MDL_map::move_from_hash_to_lock_mutex(MDL_lock *lock)
...
@@ -522,7 +575,7 @@ bool MDL_map::move_from_hash_to_lock_mutex(MDL_lock *lock)
*/
*/
uint
ref_usage
=
lock
->
m_ref_usage
;
uint
ref_usage
=
lock
->
m_ref_usage
;
uint
ref_release
=
lock
->
m_ref_release
;
uint
ref_release
=
lock
->
m_ref_release
;
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
if
(
ref_usage
==
ref_release
)
if
(
ref_usage
==
ref_release
)
MDL_lock
::
destroy
(
lock
);
MDL_lock
::
destroy
(
lock
);
return
TRUE
;
return
TRUE
;
...
@@ -565,7 +618,7 @@ void MDL_map::remove(MDL_lock *lock)
...
@@ -565,7 +618,7 @@ void MDL_map::remove(MDL_lock *lock)
lock
->
m_is_destroyed
=
TRUE
;
lock
->
m_is_destroyed
=
TRUE
;
ref_usage
=
lock
->
m_ref_usage
;
ref_usage
=
lock
->
m_ref_usage
;
ref_release
=
lock
->
m_ref_release
;
ref_release
=
lock
->
m_ref_release
;
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
mysql_mutex_unlock
(
&
m_mutex
);
mysql_mutex_unlock
(
&
m_mutex
);
if
(
ref_usage
==
ref_release
)
if
(
ref_usage
==
ref_release
)
MDL_lock
::
destroy
(
lock
);
MDL_lock
::
destroy
(
lock
);
...
@@ -586,9 +639,9 @@ MDL_context::MDL_context()
...
@@ -586,9 +639,9 @@ MDL_context::MDL_context()
m_deadlock_weight
(
0
),
m_deadlock_weight
(
0
),
m_signal
(
NO_WAKE_UP
)
m_signal
(
NO_WAKE_UP
)
{
{
rw_pr_init
(
&
m_waiting_for_lock
);
mysql_prlock_init
(
key_MDL_context_waiting_for_rwlock
,
&
m_waiting_for_lock
);
mysql_mutex_init
(
NULL
/* pfs key */
,
&
m_signal_lock
,
NULL
);
mysql_mutex_init
(
key_MDL_context_signal_mutex
,
&
m_signal_lock
,
NULL
);
mysql_cond_init
(
NULL
/* pfs key */
,
&
m_signal_cond
,
NULL
);
mysql_cond_init
(
key_MDL_context_signal_mutex
,
&
m_signal_cond
,
NULL
);
}
}
...
@@ -608,7 +661,7 @@ void MDL_context::destroy()
...
@@ -608,7 +661,7 @@ void MDL_context::destroy()
{
{
DBUG_ASSERT
(
m_tickets
.
is_empty
());
DBUG_ASSERT
(
m_tickets
.
is_empty
());
rw_pr
_destroy
(
&
m_waiting_for_lock
);
mysql_prlock
_destroy
(
&
m_waiting_for_lock
);
mysql_mutex_destroy
(
&
m_signal_lock
);
mysql_mutex_destroy
(
&
m_signal_lock
);
mysql_cond_destroy
(
&
m_signal_cond
);
mysql_cond_destroy
(
&
m_signal_cond
);
}
}
...
@@ -1098,7 +1151,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
...
@@ -1098,7 +1151,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
void
MDL_lock
::
remove_ticket
(
Ticket_list
MDL_lock
::*
list
,
MDL_ticket
*
ticket
)
void
MDL_lock
::
remove_ticket
(
Ticket_list
MDL_lock
::*
list
,
MDL_ticket
*
ticket
)
{
{
rw_pr
_wrlock
(
&
m_rwlock
);
mysql_prlock
_wrlock
(
&
m_rwlock
);
(
this
->*
list
).
remove_ticket
(
ticket
);
(
this
->*
list
).
remove_ticket
(
ticket
);
if
(
is_empty
())
if
(
is_empty
())
mdl_locks
.
remove
(
this
);
mdl_locks
.
remove
(
this
);
...
@@ -1109,7 +1162,7 @@ void MDL_lock::remove_ticket(Ticket_list MDL_lock::*list, MDL_ticket *ticket)
...
@@ -1109,7 +1162,7 @@ void MDL_lock::remove_ticket(Ticket_list MDL_lock::*list, MDL_ticket *ticket)
which now might be able to do it. Wake them up!
which now might be able to do it. Wake them up!
*/
*/
wake_up_waiters
();
wake_up_waiters
();
rw_pr
_unlock
(
&
m_rwlock
);
mysql_prlock
_unlock
(
&
m_rwlock
);
}
}
}
}
...
@@ -1129,9 +1182,9 @@ bool MDL_lock::has_pending_conflicting_lock(enum_mdl_type type)
...
@@ -1129,9 +1182,9 @@ bool MDL_lock::has_pending_conflicting_lock(enum_mdl_type type)
mysql_mutex_assert_not_owner
(
&
LOCK_open
);
mysql_mutex_assert_not_owner
(
&
LOCK_open
);
rw_pr
_rdlock
(
&
m_rwlock
);
mysql_prlock
_rdlock
(
&
m_rwlock
);
result
=
(
m_waiting
.
bitmap
()
&
incompatible_granted_types_bitmap
()[
type
]);
result
=
(
m_waiting
.
bitmap
()
&
incompatible_granted_types_bitmap
()[
type
]);
rw_pr
_unlock
(
&
m_rwlock
);
mysql_prlock
_unlock
(
&
m_rwlock
);
return
result
;
return
result
;
}
}
...
@@ -1325,7 +1378,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
...
@@ -1325,7 +1378,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
{
{
ticket
->
m_lock
=
lock
;
ticket
->
m_lock
=
lock
;
lock
->
m_granted
.
add_ticket
(
ticket
);
lock
->
m_granted
.
add_ticket
(
ticket
);
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
m_tickets
.
push_front
(
ticket
);
m_tickets
.
push_front
(
ticket
);
...
@@ -1335,7 +1388,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
...
@@ -1335,7 +1388,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
{
{
/* We can't get here if we allocated a new lock. */
/* We can't get here if we allocated a new lock. */
DBUG_ASSERT
(
!
lock
->
is_empty
());
DBUG_ASSERT
(
!
lock
->
is_empty
());
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
MDL_ticket
::
destroy
(
ticket
);
MDL_ticket
::
destroy
(
ticket
);
}
}
...
@@ -1376,9 +1429,9 @@ MDL_context::clone_ticket(MDL_request *mdl_request)
...
@@ -1376,9 +1429,9 @@ MDL_context::clone_ticket(MDL_request *mdl_request)
ticket
->
m_lock
=
mdl_request
->
ticket
->
m_lock
;
ticket
->
m_lock
=
mdl_request
->
ticket
->
m_lock
;
mdl_request
->
ticket
=
ticket
;
mdl_request
->
ticket
=
ticket
;
rw_pr
_wrlock
(
&
ticket
->
m_lock
->
m_rwlock
);
mysql_prlock
_wrlock
(
&
ticket
->
m_lock
->
m_rwlock
);
ticket
->
m_lock
->
m_granted
.
add_ticket
(
ticket
);
ticket
->
m_lock
->
m_granted
.
add_ticket
(
ticket
);
rw_pr
_unlock
(
&
ticket
->
m_lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
ticket
->
m_lock
->
m_rwlock
);
m_tickets
.
push_front
(
ticket
);
m_tickets
.
push_front
(
ticket
);
...
@@ -1484,7 +1537,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
...
@@ -1484,7 +1537,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
if
(
ticket
->
is_upgradable_or_exclusive
())
if
(
ticket
->
is_upgradable_or_exclusive
())
lock
->
notify_shared_locks
(
this
);
lock
->
notify_shared_locks
(
this
);
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
set_deadlock_weight
(
mdl_request
->
get_deadlock_weight
());
set_deadlock_weight
(
mdl_request
->
get_deadlock_weight
());
will_wait_for
(
ticket
);
will_wait_for
(
ticket
);
...
@@ -1519,7 +1572,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
...
@@ -1519,7 +1572,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
my_error
(
ER_LOCK_WAIT_TIMEOUT
,
MYF
(
0
));
my_error
(
ER_LOCK_WAIT_TIMEOUT
,
MYF
(
0
));
return
TRUE
;
return
TRUE
;
}
}
rw_pr
_wrlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_wrlock
(
&
lock
->
m_rwlock
);
}
}
lock
->
m_waiting
.
remove_ticket
(
ticket
);
lock
->
m_waiting
.
remove_ticket
(
ticket
);
...
@@ -1529,7 +1582,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
...
@@ -1529,7 +1582,7 @@ bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
(
*
lock
->
cached_object_release_hook
)(
lock
->
cached_object
);
(
*
lock
->
cached_object_release_hook
)(
lock
->
cached_object
);
lock
->
cached_object
=
NULL
;
lock
->
cached_object
=
NULL
;
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
m_tickets
.
push_front
(
ticket
);
m_tickets
.
push_front
(
ticket
);
...
@@ -1674,7 +1727,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
...
@@ -1674,7 +1727,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
is_new_ticket
=
!
has_lock
(
mdl_svp
,
mdl_xlock_request
.
ticket
);
is_new_ticket
=
!
has_lock
(
mdl_svp
,
mdl_xlock_request
.
ticket
);
/* Merge the acquired and the original lock. @todo: move to a method. */
/* Merge the acquired and the original lock. @todo: move to a method. */
rw_pr
_wrlock
(
&
mdl_ticket
->
m_lock
->
m_rwlock
);
mysql_prlock
_wrlock
(
&
mdl_ticket
->
m_lock
->
m_rwlock
);
if
(
is_new_ticket
)
if
(
is_new_ticket
)
mdl_ticket
->
m_lock
->
m_granted
.
remove_ticket
(
mdl_xlock_request
.
ticket
);
mdl_ticket
->
m_lock
->
m_granted
.
remove_ticket
(
mdl_xlock_request
.
ticket
);
/*
/*
...
@@ -1686,7 +1739,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
...
@@ -1686,7 +1739,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
mdl_ticket
->
m_type
=
MDL_EXCLUSIVE
;
mdl_ticket
->
m_type
=
MDL_EXCLUSIVE
;
mdl_ticket
->
m_lock
->
m_granted
.
add_ticket
(
mdl_ticket
);
mdl_ticket
->
m_lock
->
m_granted
.
add_ticket
(
mdl_ticket
);
rw_pr
_unlock
(
&
mdl_ticket
->
m_lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
mdl_ticket
->
m_lock
->
m_rwlock
);
if
(
is_new_ticket
)
if
(
is_new_ticket
)
{
{
...
@@ -1704,7 +1757,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
...
@@ -1704,7 +1757,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
MDL_ticket
*
ticket
;
MDL_ticket
*
ticket
;
bool
result
=
FALSE
;
bool
result
=
FALSE
;
rw_pr
_rdlock
(
&
m_rwlock
);
mysql_prlock
_rdlock
(
&
m_rwlock
);
Ticket_iterator
granted_it
(
m_granted
);
Ticket_iterator
granted_it
(
m_granted
);
Ticket_iterator
waiting_it
(
m_waiting
);
Ticket_iterator
waiting_it
(
m_waiting
);
...
@@ -1756,7 +1809,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
...
@@ -1756,7 +1809,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
}
}
end:
end:
rw_pr
_unlock
(
&
m_rwlock
);
mysql_prlock
_unlock
(
&
m_rwlock
);
return
result
;
return
result
;
}
}
...
@@ -1765,7 +1818,7 @@ bool MDL_context::find_deadlock(Deadlock_detection_context *deadlock_ctx)
...
@@ -1765,7 +1818,7 @@ bool MDL_context::find_deadlock(Deadlock_detection_context *deadlock_ctx)
{
{
bool
result
=
FALSE
;
bool
result
=
FALSE
;
rw_pr
_rdlock
(
&
m_waiting_for_lock
);
mysql_prlock
_rdlock
(
&
m_waiting_for_lock
);
if
(
m_waiting_for
)
if
(
m_waiting_for
)
{
{
...
@@ -1794,14 +1847,14 @@ bool MDL_context::find_deadlock(Deadlock_detection_context *deadlock_ctx)
...
@@ -1794,14 +1847,14 @@ bool MDL_context::find_deadlock(Deadlock_detection_context *deadlock_ctx)
deadlock_ctx
->
victim
=
this
;
deadlock_ctx
->
victim
=
this
;
else
if
(
deadlock_ctx
->
victim
->
m_deadlock_weight
>=
m_deadlock_weight
)
else
if
(
deadlock_ctx
->
victim
->
m_deadlock_weight
>=
m_deadlock_weight
)
{
{
rw_pr
_unlock
(
&
deadlock_ctx
->
victim
->
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
deadlock_ctx
->
victim
->
m_waiting_for_lock
);
deadlock_ctx
->
victim
=
this
;
deadlock_ctx
->
victim
=
this
;
}
}
else
else
rw_pr
_unlock
(
&
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
m_waiting_for_lock
);
}
}
else
else
rw_pr
_unlock
(
&
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
m_waiting_for_lock
);
return
result
;
return
result
;
}
}
...
@@ -1827,7 +1880,7 @@ bool MDL_context::find_deadlock()
...
@@ -1827,7 +1880,7 @@ bool MDL_context::find_deadlock()
if
(
deadlock_ctx
.
victim
!=
this
)
if
(
deadlock_ctx
.
victim
!=
this
)
{
{
deadlock_ctx
.
victim
->
awake
(
VICTIM_WAKE_UP
);
deadlock_ctx
.
victim
->
awake
(
VICTIM_WAKE_UP
);
rw_pr
_unlock
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
);
/*
/*
After adding new arc to waiting graph we found that it participates
After adding new arc to waiting graph we found that it participates
in some loop (i.e. there is a deadlock). We decided to destroy this
in some loop (i.e. there is a deadlock). We decided to destroy this
...
@@ -1840,7 +1893,7 @@ bool MDL_context::find_deadlock()
...
@@ -1840,7 +1893,7 @@ bool MDL_context::find_deadlock()
else
else
{
{
DBUG_ASSERT
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
==
&
m_waiting_for_lock
);
DBUG_ASSERT
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
==
&
m_waiting_for_lock
);
rw_pr
_unlock
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
deadlock_ctx
.
victim
->
m_waiting_for_lock
);
return
TRUE
;
return
TRUE
;
}
}
}
}
...
@@ -1897,14 +1950,14 @@ MDL_context::wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
...
@@ -1897,14 +1950,14 @@ MDL_context::wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
if
(
lock
->
can_grant_lock
(
mdl_request
->
type
,
this
))
if
(
lock
->
can_grant_lock
(
mdl_request
->
type
,
this
))
{
{
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
return
FALSE
;
return
FALSE
;
}
}
MDL_ticket
*
pending_ticket
;
MDL_ticket
*
pending_ticket
;
if
(
!
(
pending_ticket
=
MDL_ticket
::
create
(
this
,
mdl_request
->
type
)))
if
(
!
(
pending_ticket
=
MDL_ticket
::
create
(
this
,
mdl_request
->
type
)))
{
{
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1913,7 +1966,7 @@ MDL_context::wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
...
@@ -1913,7 +1966,7 @@ MDL_context::wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
lock
->
m_waiting
.
add_ticket
(
pending_ticket
);
lock
->
m_waiting
.
add_ticket
(
pending_ticket
);
wait_reset
();
wait_reset
();
rw_pr
_unlock
(
&
lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
lock
->
m_rwlock
);
set_deadlock_weight
(
MDL_DEADLOCK_WEIGHT_DML
);
set_deadlock_weight
(
MDL_DEADLOCK_WEIGHT_DML
);
will_wait_for
(
pending_ticket
);
will_wait_for
(
pending_ticket
);
...
@@ -2064,7 +2117,7 @@ void MDL_ticket::downgrade_exclusive_lock(enum_mdl_type type)
...
@@ -2064,7 +2117,7 @@ void MDL_ticket::downgrade_exclusive_lock(enum_mdl_type type)
if
(
m_type
!=
MDL_EXCLUSIVE
)
if
(
m_type
!=
MDL_EXCLUSIVE
)
return
;
return
;
rw_pr
_wrlock
(
&
m_lock
->
m_rwlock
);
mysql_prlock
_wrlock
(
&
m_lock
->
m_rwlock
);
/*
/*
To update state of MDL_lock object correctly we need to temporarily
To update state of MDL_lock object correctly we need to temporarily
exclude ticket from the granted queue and then include it back.
exclude ticket from the granted queue and then include it back.
...
@@ -2073,7 +2126,7 @@ void MDL_ticket::downgrade_exclusive_lock(enum_mdl_type type)
...
@@ -2073,7 +2126,7 @@ void MDL_ticket::downgrade_exclusive_lock(enum_mdl_type type)
m_type
=
type
;
m_type
=
type
;
m_lock
->
m_granted
.
add_ticket
(
this
);
m_lock
->
m_granted
.
add_ticket
(
this
);
m_lock
->
wake_up_waiters
();
m_lock
->
wake_up_waiters
();
rw_pr
_unlock
(
&
m_lock
->
m_rwlock
);
mysql_prlock
_unlock
(
&
m_lock
->
m_rwlock
);
}
}
...
...
sql/mdl.h
View file @
f9b0b014
...
@@ -628,7 +628,7 @@ private:
...
@@ -628,7 +628,7 @@ private:
important as deadlock detector won't work correctly
important as deadlock detector won't work correctly
otherwise. @sa Comment for MDL_lock::m_rwlock.
otherwise. @sa Comment for MDL_lock::m_rwlock.
*/
*/
rw_pr_
lock_t
m_waiting_for_lock
;
mysql_pr
lock_t
m_waiting_for_lock
;
MDL_ticket
*
m_waiting_for
;
MDL_ticket
*
m_waiting_for
;
uint
m_deadlock_weight
;
uint
m_deadlock_weight
;
/**
/**
...
@@ -652,9 +652,9 @@ private:
...
@@ -652,9 +652,9 @@ private:
void
will_wait_for
(
MDL_ticket
*
pending_ticket
)
void
will_wait_for
(
MDL_ticket
*
pending_ticket
)
{
{
rw_pr
_wrlock
(
&
m_waiting_for_lock
);
mysql_prlock
_wrlock
(
&
m_waiting_for_lock
);
m_waiting_for
=
pending_ticket
;
m_waiting_for
=
pending_ticket
;
rw_pr
_unlock
(
&
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
m_waiting_for_lock
);
}
}
void
set_deadlock_weight
(
uint
weight
)
void
set_deadlock_weight
(
uint
weight
)
...
@@ -670,9 +670,9 @@ private:
...
@@ -670,9 +670,9 @@ private:
void
stop_waiting
()
void
stop_waiting
()
{
{
rw_pr
_wrlock
(
&
m_waiting_for_lock
);
mysql_prlock
_wrlock
(
&
m_waiting_for_lock
);
m_waiting_for
=
NULL
;
m_waiting_for
=
NULL
;
rw_pr
_unlock
(
&
m_waiting_for_lock
);
mysql_prlock
_unlock
(
&
m_waiting_for_lock
);
}
}
void
wait_reset
()
void
wait_reset
()
...
...
storage/innobase/CMakeLists.txt
View file @
f9b0b014
...
@@ -196,7 +196,7 @@ ENDIF()
...
@@ -196,7 +196,7 @@ ENDIF()
# Removing compiler optimizations for innodb/mem/* files on 64-bit Windows
# Removing compiler optimizations for innodb/mem/* files on 64-bit Windows
# due to 64-bit compiler error, See MySQL Bug #19424, #36366, #34297
# due to 64-bit compiler error, See MySQL Bug #19424, #36366, #34297
IF
(
MSVC AND CMAKE_SIZEOF_VOIDP EQUAL 8
)
IF
(
MSVC AND CMAKE_SIZEOF_VOID
_
P EQUAL 8
)
SET_SOURCE_FILES_PROPERTIES
(
mem/mem0mem.c mem/mem0pool.c
SET_SOURCE_FILES_PROPERTIES
(
mem/mem0mem.c mem/mem0pool.c
PROPERTIES COMPILE_FLAGS -Od
)
PROPERTIES COMPILE_FLAGS -Od
)
ENDIF
()
ENDIF
()
...
...
storage/perfschema/pfs_instr.cc
View file @
f9b0b014
...
@@ -746,6 +746,26 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
...
@@ -746,6 +746,26 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
}
}
}
}
char
safe_buffer
[
FN_REFLEN
];
const
char
*
safe_filename
;
if
(
len
>=
FN_REFLEN
)
{
/*
The instrumented code uses file names that exceeds FN_REFLEN.
This could be legal for instrumentation on non mysys APIs,
so we support it.
Truncate the file name so that:
- it fits into pfs->m_filename
- it is safe to use mysys apis to normalize the file name.
*/
memcpy
(
safe_buffer
,
filename
,
FN_REFLEN
-
2
);
safe_buffer
[
FN_REFLEN
-
1
]
=
0
;
safe_filename
=
safe_buffer
;
}
else
safe_filename
=
filename
;
/*
/*
Normalize the file name to avoid duplicates when using aliases:
Normalize the file name to avoid duplicates when using aliases:
- absolute or relative paths
- absolute or relative paths
...
@@ -759,7 +779,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
...
@@ -759,7 +779,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
Ignore errors, the file may not exist.
Ignore errors, the file may not exist.
my_realpath always provide a best effort result in buffer.
my_realpath always provide a best effort result in buffer.
*/
*/
(
void
)
my_realpath
(
buffer
,
filename
,
MYF
(
0
));
(
void
)
my_realpath
(
buffer
,
safe_
filename
,
MYF
(
0
));
normalized_filename
=
buffer
;
normalized_filename
=
buffer
;
normalized_length
=
strlen
(
normalized_filename
);
normalized_length
=
strlen
(
normalized_filename
);
...
...
storage/perfschema/unittest/pfs-t.cc
View file @
f9b0b014
...
@@ -37,14 +37,25 @@ PFS_file* lookup_file_by_name(const char* name)
...
@@ -37,14 +37,25 @@ PFS_file* lookup_file_by_name(const char* name)
uint
i
;
uint
i
;
PFS_file
*
pfs
;
PFS_file
*
pfs
;
uint
len
=
strlen
(
name
);
uint
len
=
strlen
(
name
);
size_t
dirlen
;
const
char
*
filename
;
uint
filename_length
;;
for
(
i
=
0
;
i
<
file_max
;
i
++
)
for
(
i
=
0
;
i
<
file_max
;
i
++
)
{
{
pfs
=
&
file_array
[
i
];
pfs
=
&
file_array
[
i
];
if
(
pfs
->
m_lock
.
is_populated
())
if
(
pfs
->
m_lock
.
is_populated
())
{
{
if
((
len
==
pfs
->
m_filename_length
)
&&
/*
(
strncmp
(
name
,
pfs
->
m_filename
,
pfs
->
m_filename_length
)
==
0
))
When a file "foo" is instrumented, the name is normalized
to "/path/to/current/directory/foo", so we remove the
directory name here to find it back.
*/
dirlen
=
dirname_length
(
pfs
->
m_filename
);
filename
=
pfs
->
m_filename
+
dirlen
;
filename_length
=
pfs
->
m_filename_length
-
dirlen
;
if
((
len
==
filename_length
)
&&
(
strncmp
(
name
,
filename
,
filename_length
)
==
0
))
return
pfs
;
return
pfs
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment