3609 Vasil Dimov 2011-04-28 [merge]
Merge mysql-trunk -> mysql-trunk-innodb
modified:
.bzrignore
cmake/maintainer.cmake
cmd-line-utils/libedit/vi.c
include/m_ctype.h
include/mysql/psi/mysql_file.h
include/mysql/psi/mysql_stage.h
include/mysql/psi/mysql_statement.h
include/mysql/psi/mysql_table.h
include/mysql/psi/mysql_thread.h
include/mysql/psi/psi.h
mysql-test/collections/default.experimental
mysql-test/extra/rpl_tests/rpl_extra_col_slave.test
mysql-test/include/join_cache.inc
mysql-test/r/func_time.result
mysql-test/r/grant.result
mysql-test/r/having.result
mysql-test/r/join_cache_jcl1.result
mysql-test/r/join_cache_jcl2.result
mysql-test/r/join_cache_jcl3.result
mysql-test/r/join_cache_jcl4.result
mysql-test/r/join_cache_jcl5.result
mysql-test/r/join_cache_jcl6.result
mysql-test/r/join_cache_jcl7.result
mysql-test/r/join_cache_jcl8.result
mysql-test/r/loaddata.result
mysql-test/suite/binlog/r/binlog_bug23533.result
mysql-test/suite/binlog/t/binlog_bug23533.test
mysql-test/suite/parts/inc/partition_check_drop.inc
mysql-test/suite/parts/inc/partition_layout_check1.inc
mysql-test/suite/parts/inc/partition_layout_check2.inc
mysql-test/t/func_time.test
mysql-test/t/grant.test
mysql-test/t/having.test
mysql-test/t/loaddata.test
mysql-test/t/mysqlbinlog_raw_mode.test
mysys/default.c
mysys/my_init.c
plugin/semisync/semisync_master_plugin.cc
sql-common/my_time.c
sql/debug_sync.cc
sql/events.cc
sql/ha_ndbcluster.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/item_cmpfunc.cc
sql/item_func.cc
sql/item_timefunc.cc
sql/mdl.cc
sql/mysqld.cc
sql/mysqld.h
sql/opt_range.cc
sql/rpl_master.cc
sql/rpl_slave.cc
sql/sp.cc
sql/sp.h
sql/sp_cache.cc
sql/sql_acl.cc
sql/sql_audit.cc
sql/sql_base.cc
sql/sql_base.h
sql/sql_class.cc
sql/sql_db.cc
sql/sql_join_cache.cc
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_plugin.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_servers.cc
sql/sql_udf.cc
sql/structs.h
sql/table.cc
sql/tztime.cc
storage/archive/ha_archive.cc
storage/blackhole/ha_blackhole.cc
storage/csv/ha_tina.cc
storage/example/ha_example.cc
storage/federated/ha_federated.cc
storage/heap/ha_heap.cc
storage/heap/ha_heap.h
storage/heap/hp_static.c
storage/innobase/handler/ha_innodb.cc
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisam/mi_static.c
storage/myisammrg/ha_myisammrg.cc
storage/myisammrg/ha_myisammrg.h
storage/myisammrg/myrg_static.c
3608 kevin.lewis@stripped 2011-04-27
Copyright Notice changes for the files associated with rb::645
Use current FSF address and approved copyright language.
Also some whitespace cleanup.
Asked by Marko in rb::645 to put this into a separate patch.
modified:
storage/innobase/btr/btr0cur.c
storage/innobase/dict/dict0boot.c
storage/innobase/dict/dict0crea.c
storage/innobase/dict/dict0load.c
storage/innobase/dict/dict0mem.c
storage/innobase/fil/fil0fil.c
storage/innobase/fsp/fsp0fsp.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/i_s.cc
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0dict.ic
storage/innobase/include/dict0mem.h
storage/innobase/include/fsp0fsp.h
storage/innobase/include/fsp0fsp.ic
storage/innobase/include/ha_prototypes.h
storage/innobase/include/page0types.h
storage/innobase/include/page0zip.ic
storage/innobase/include/trx0purge.h
storage/innobase/include/trx0sys.ic
storage/innobase/include/univ.i
storage/innobase/include/ut0bh.ic
storage/innobase/mtr/mtr0log.c
storage/innobase/page/page0zip.c
storage/innobase/row/row0mysql.c
storage/innobase/row/row0row.c
storage/innobase/srv/srv0srv.c
storage/innobase/sync/sync0rw.c
storage/innobase/ut/ut0bh.c
storage/innobase/ut/ut0ut.c
=== modified file '.bzrignore'
--- a/.bzrignore revid:kevin.lewis@stripped
+++ b/.bzrignore revid:vasil.dimov@stripped
@@ -44,6 +44,10 @@
*.vcxproj
*.vcxproj.filters
*/*.dir/*
+*.dir
+Debug
+MySql.sdf
+Win32
*/*_pure_*warnings
*/.deps
*/.libs/*
@@ -616,6 +620,7 @@ include/mysql_h.ic
include/mysql_version.h
include/mysqld_ername.h
include/mysqld_error.h
+include/mysqld_error.h.rule
include/openssl
include/probes_mysql_dtrace.h
include/readline
@@ -1899,7 +1904,9 @@ scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql
+scripts/mysql_fix_privilege_tables.sql.rule
scripts/mysql_fix_privilege_tables_sql.c
+scripts/mysql_fix_privilege_tables_sql.c.rule
scripts/mysql_install_db
scripts/mysql_secure_installation
scripts/mysql_setpermission
@@ -2140,6 +2147,7 @@ sql/handlerton.cc
sql/html
sql/latex
sql/lex_hash.h
+sql/lex_hash.h.rule
sql/link_sources
sql/max/*
sql/message.h
@@ -2171,6 +2179,7 @@ sql/sql_builtin.cc
sql/sql_select.cc.orig
sql/sql_yacc.cc
sql/sql_yacc.h
+sql/sql_yacc.h.rule
sql/sql_yacc.output
sql/sql_yacc.yy.orig
sql/test_time
=== modified file 'cmake/maintainer.cmake'
--- a/cmake/maintainer.cmake revid:kevin.lewis@stripped
+++ b/cmake/maintainer.cmake revid:vasil.dimov@stripped
@@ -35,7 +35,7 @@ ENDMACRO()
# Setup G++ (GNU C++ compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
SET(MY_MAINTAINER_CXX_WARNINGS
- "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter"
+ "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual"
CACHE STRING "C++ warning options used in maintainer builds.")
ENDMACRO()
=== modified file 'cmd-line-utils/libedit/vi.c'
--- a/cmd-line-utils/libedit/vi.c revid:kevin.lewis@stripped
+++ b/cmd-line-utils/libedit/vi.c revid:vasil.dimov@stripped
@@ -1012,8 +1012,10 @@ vi_histedit(EditLine *el, int c __attrib
if (fd < 0)
return CC_ERROR;
cp = el->el_line.buffer;
- write(fd, cp, el->el_line.lastchar - cp +0u);
- write(fd, "\n", 1);
+ if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1)
+ goto error;
+ if (write(fd, "\n", 1) == -1)
+ goto error;
pid = fork();
switch (pid) {
case -1:
@@ -1041,6 +1043,12 @@ vi_histedit(EditLine *el, int c __attrib
unlink(tempfile);
/* return CC_REFRESH; */
return ed_newline(el, 0);
+
+/* XXXMYSQL: Avoid compiler warnings. */
+error:
+ close(fd);
+ unlink(tempfile);
+ return CC_ERROR;
}
/* vi_history_word():
=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h revid:kevin.lewis@stripped
+++ b/include/m_ctype.h revid:vasil.dimov@stripped
@@ -465,7 +465,7 @@ extern CHARSET_INFO my_charset_utf32_bin
extern CHARSET_INFO my_charset_utf32_general_ci;
extern CHARSET_INFO my_charset_utf32_unicode_ci;
-extern CHARSET_INFO my_charset_utf8_general_ci;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf8_tolower_ci;
extern CHARSET_INFO my_charset_utf8_unicode_ci;
extern CHARSET_INFO my_charset_utf8_bin;
=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/mysql_file.h revid:vasil.dimov@stripped
@@ -50,11 +50,18 @@
*/
/**
+ @def mysql_file_register(P1, P2, P3)
+ File registration.
+*/
+#define mysql_file_register(P1, P2, P3) \
+ inline_mysql_file_register(P1, P2, P3)
+
+/**
@def mysql_file_fgets(P1, P2, F)
Instrumented fgets.
@c mysql_file_fgets is a replacement for @c fgets.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fgets(P1, P2, F) \
inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F)
#else
@@ -67,7 +74,7 @@
Instrumented fgetc.
@c mysql_file_fgetc is a replacement for @c fgetc.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F)
#else
#define mysql_file_fgetc(F) inline_mysql_file_fgetc(F)
@@ -78,7 +85,7 @@
Instrumented fputs.
@c mysql_file_fputs is a replacement for @c fputs.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fputs(P1, F) \
inline_mysql_file_fputs(__FILE__, __LINE__, P1, F)
#else
@@ -91,7 +98,7 @@
Instrumented fputc.
@c mysql_file_fputc is a replacement for @c fputc.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fputc(P1, F) \
inline_mysql_file_fputc(__FILE__, __LINE__, P1, F)
#else
@@ -111,7 +118,7 @@
Instrumented vfprintf.
@c mysql_file_vfprintf is a replacement for @c vfprintf.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_vfprintf(F, P1, P2) \
inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2)
#else
@@ -124,7 +131,7 @@
Instrumented fflush.
@c mysql_file_fflush is a replacement for @c fflush.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fflush(F) \
inline_mysql_file_fflush(__FILE__, __LINE__, F)
#else
@@ -144,7 +151,7 @@
Instrumented fstat.
@c mysql_file_fstat is a replacement for @c my_fstat.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fstat(FN, S, FL) \
inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL)
#else
@@ -157,7 +164,7 @@
Instrumented stat.
@c mysql_file_stat is a replacement for @c my_stat.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_stat(K, FN, S, FL) \
inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL)
#else
@@ -170,7 +177,7 @@
Instrumented chsize.
@c mysql_file_chsize is a replacement for @c my_chsize.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_chsize(F, P1, P2, P3) \
inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3)
#else
@@ -183,7 +190,7 @@
Instrumented fopen.
@c mysql_file_fopen is a replacement for @c my_fopen.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fopen(K, N, F1, F2) \
inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2)
#else
@@ -203,7 +210,7 @@
@code DBUG_ASSERT(file != NULL) @endcode,
since doing so could introduce regressions.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fclose(FD, FL) \
inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL)
#else
@@ -216,7 +223,7 @@
Instrumented fread.
@c mysql_file_fread is a replacement for @c my_fread.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fread(FD, P1, P2, P3) \
inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3)
#else
@@ -229,7 +236,7 @@
Instrumented fwrite.
@c mysql_file_fwrite is a replacement for @c my_fwrite.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fwrite(FD, P1, P2, P3) \
inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3)
#else
@@ -242,7 +249,7 @@
Instrumented fseek.
@c mysql_file_fseek is a replacement for @c my_fseek.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_fseek(FD, P, W, F) \
inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F)
#else
@@ -255,7 +262,7 @@
Instrumented ftell.
@c mysql_file_ftell is a replacement for @c my_ftell.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_ftell(FD, F) \
inline_mysql_file_ftell(__FILE__, __LINE__, FD, F)
#else
@@ -268,7 +275,7 @@
Instrumented create.
@c mysql_file_create is a replacement for @c my_create.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_create(K, N, F1, F2, F3) \
inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3)
#else
@@ -281,7 +288,7 @@
Instrumented create_temp_file.
@c mysql_file_create_temp is a replacement for @c create_temp_file.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_create_temp(K, T, D, P, M, F) \
inline_mysql_file_create_temp(K, T, D, P, M, F)
#else
@@ -294,7 +301,7 @@
Instrumented open.
@c mysql_file_open is a replacement for @c my_open.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_open(K, N, F1, F2) \
inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2)
#else
@@ -307,7 +314,7 @@
Instrumented close.
@c mysql_file_close is a replacement for @c my_close.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_close(FD, F) \
inline_mysql_file_close(__FILE__, __LINE__, FD, F)
#else
@@ -320,7 +327,7 @@
Instrumented read.
@c mysql_read is a replacement for @c my_read.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_read(FD, B, S, F) \
inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F)
#else
@@ -333,7 +340,7 @@
Instrumented write.
@c mysql_file_write is a replacement for @c my_write.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_write(FD, B, S, F) \
inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F)
#else
@@ -346,7 +353,7 @@
Instrumented pread.
@c mysql_pread is a replacement for @c my_pread.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_pread(FD, B, S, O, F) \
inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F)
#else
@@ -359,7 +366,7 @@
Instrumented pwrite.
@c mysql_file_pwrite is a replacement for @c my_pwrite.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_pwrite(FD, B, S, O, F) \
inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F)
#else
@@ -372,7 +379,7 @@
Instrumented seek.
@c mysql_file_seek is a replacement for @c my_seek.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_seek(FD, P, W, F) \
inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F)
#else
@@ -385,7 +392,7 @@
Instrumented tell.
@c mysql_file_tell is a replacement for @c my_tell.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_tell(FD, F) \
inline_mysql_file_tell(__FILE__, __LINE__, FD, F)
#else
@@ -398,7 +405,7 @@
Instrumented delete.
@c mysql_file_delete is a replacement for @c my_delete.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_delete(K, P1, P2) \
inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2)
#else
@@ -411,7 +418,7 @@
Instrumented rename.
@c mysql_file_rename is a replacement for @c my_rename.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_rename(K, P1, P2, P3) \
inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3)
#else
@@ -425,7 +432,7 @@
@c mysql_file_create_with_symlink is a replacement
for @c my_create_with_symlink.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \
P1, P2, P3, P4, P5)
@@ -440,7 +447,7 @@
@c mysql_file_delete_with_symlink is a replacement
for @c my_delete_with_symlink.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_delete_with_symlink(K, P1, P2) \
inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
#else
@@ -454,7 +461,7 @@
@c mysql_file_rename_with_symlink is a replacement
for @c my_rename_with_symlink.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_rename_with_symlink(K, P1, P2, P3) \
inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
#else
@@ -467,7 +474,7 @@
Instrumented file sync.
@c mysql_file_sync is a replacement for @c my_sync.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_sync(P1, P2) \
inline_mysql_file_sync(__FILE__, __LINE__, P1, P2)
#else
@@ -498,15 +505,33 @@ struct st_mysql_file
*/
typedef struct st_mysql_file MYSQL_FILE;
+static inline void inline_mysql_file_register(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *category,
+ PSI_file_info *info,
+ int count
+#else
+ const char *category __attribute__ ((unused)),
+ void *info __attribute__ ((unused)),
+ int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_FILE_INTERFACE
+ if (likely(PSI_server != NULL))
+ PSI_server->register_file(category, info, count);
+#endif
+}
+
static inline char *
inline_mysql_file_fgets(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
char *str, int size, MYSQL_FILE *file)
{
char *result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -518,7 +543,7 @@ inline_mysql_file_fgets(
}
#endif
result= fgets(str, size, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, result ? strlen(result) : 0);
#endif
@@ -527,13 +552,13 @@ inline_mysql_file_fgets(
static inline int
inline_mysql_file_fgetc(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -545,7 +570,7 @@ inline_mysql_file_fgetc(
}
#endif
result= fgetc(file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 1);
#endif
@@ -554,13 +579,13 @@ inline_mysql_file_fgetc(
static inline int
inline_mysql_file_fputs(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
const char *str, MYSQL_FILE *file)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
size_t bytes= 0;
@@ -576,7 +601,7 @@ inline_mysql_file_fputs(
}
#endif
result= fputs(str, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, bytes);
#endif
@@ -585,13 +610,13 @@ inline_mysql_file_fputs(
static inline int
inline_mysql_file_fputc(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
char c, MYSQL_FILE *file)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -603,7 +628,7 @@ inline_mysql_file_fputc(
}
#endif
result= fputc(c, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 1);
#endif
@@ -618,7 +643,7 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
*/
int result;
va_list args;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -632,7 +657,7 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
va_start(args, format);
result= vfprintf(file->m_file, format, args);
va_end(args);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) result);
#endif
@@ -641,13 +666,13 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
static inline int
inline_mysql_file_vfprintf(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, const char *format, va_list args)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -659,7 +684,7 @@ inline_mysql_file_vfprintf(
}
#endif
result= vfprintf(file->m_file, format, args);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) result);
#endif
@@ -668,13 +693,13 @@ inline_mysql_file_vfprintf(
static inline int
inline_mysql_file_fflush(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -686,7 +711,7 @@ inline_mysql_file_fflush(
}
#endif
result= fflush(file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -701,13 +726,13 @@ static inline int inline_mysql_file_feof
static inline int
inline_mysql_file_fstat(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
int filenr, MY_STAT *stat_area, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -719,7 +744,7 @@ inline_mysql_file_fstat(
}
#endif
result= my_fstat(filenr, stat_area, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -728,13 +753,13 @@ inline_mysql_file_fstat(
static inline MY_STAT *
inline_mysql_file_stat(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *path, MY_STAT *stat_area, myf flags)
{
MY_STAT *result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -747,7 +772,7 @@ inline_mysql_file_stat(
}
#endif
result= my_stat(path, stat_area, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -756,13 +781,13 @@ inline_mysql_file_stat(
static inline int
inline_mysql_file_chsize(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, my_off_t newlength, int filler, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -775,7 +800,7 @@ inline_mysql_file_chsize(
}
#endif
result= my_chsize(file, newlength, filler, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) newlength);
#endif
@@ -784,7 +809,7 @@ inline_mysql_file_chsize(
static inline MYSQL_FILE*
inline_mysql_file_fopen(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *filename, int flags, myf myFlags)
@@ -795,7 +820,7 @@ inline_mysql_file_fopen(
{
that->m_psi= NULL;
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -808,7 +833,7 @@ inline_mysql_file_fopen(
}
#endif
that->m_file= my_fopen(filename, flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_open_wait(locker);
#endif
@@ -824,7 +849,7 @@ inline_mysql_file_fopen(
static inline int
inline_mysql_file_fclose(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, myf flags)
@@ -832,7 +857,7 @@ inline_mysql_file_fclose(
int result= 0;
if (likely(file != NULL))
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
DBUG_ASSERT(file != NULL);
@@ -845,7 +870,7 @@ inline_mysql_file_fclose(
}
#endif
result= my_fclose(file->m_file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -856,13 +881,13 @@ inline_mysql_file_fclose(
static inline size_t
inline_mysql_file_fread(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, uchar *buffer, size_t count, myf flags)
{
size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -874,7 +899,7 @@ inline_mysql_file_fread(
}
#endif
result= my_fread(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_read;
@@ -890,13 +915,13 @@ inline_mysql_file_fread(
static inline size_t
inline_mysql_file_fwrite(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags)
{
size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -908,7 +933,7 @@ inline_mysql_file_fwrite(
}
#endif
result= my_fwrite(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_written;
@@ -924,13 +949,13 @@ inline_mysql_file_fwrite(
static inline my_off_t
inline_mysql_file_fseek(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, my_off_t pos, int whence, myf flags)
{
my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -942,7 +967,7 @@ inline_mysql_file_fseek(
}
#endif
result= my_fseek(file->m_file, pos, whence, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -951,13 +976,13 @@ inline_mysql_file_fseek(
static inline my_off_t
inline_mysql_file_ftell(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_FILE *file, myf flags)
{
my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
@@ -969,7 +994,7 @@ inline_mysql_file_ftell(
}
#endif
result= my_ftell(file->m_file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -978,13 +1003,13 @@ inline_mysql_file_ftell(
static inline File
inline_mysql_file_create(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *filename, int create_flags, int access_flags, myf myFlags)
{
File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -996,7 +1021,7 @@ inline_mysql_file_create(
}
#endif
file= my_create(filename, create_flags, access_flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
#endif
@@ -1005,7 +1030,7 @@ inline_mysql_file_create(
static inline File
inline_mysql_file_create_temp(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key,
#endif
char *to, const char *dir, const char *pfx, int mode, myf myFlags)
@@ -1017,7 +1042,7 @@ inline_mysql_file_create_temp(
before the create_temp_file call.
*/
file= create_temp_file(to, dir, pfx, mode, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(PSI_server != NULL))
PSI_server->create_file(key, to, file);
#endif
@@ -1026,13 +1051,13 @@ inline_mysql_file_create_temp(
static inline File
inline_mysql_file_open(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *filename, int flags, myf myFlags)
{
File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1044,7 +1069,7 @@ inline_mysql_file_open(
}
#endif
file= my_open(filename, flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
#endif
@@ -1053,13 +1078,13 @@ inline_mysql_file_open(
static inline int
inline_mysql_file_close(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1071,7 +1096,7 @@ inline_mysql_file_close(
}
#endif
result= my_close(file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1080,13 +1105,13 @@ inline_mysql_file_close(
static inline size_t
inline_mysql_file_read(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, uchar *buffer, size_t count, myf flags)
{
size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1098,7 +1123,7 @@ inline_mysql_file_read(
}
#endif
result= my_read(file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_read;
@@ -1114,13 +1139,13 @@ inline_mysql_file_read(
static inline size_t
inline_mysql_file_write(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, const uchar *buffer, size_t count, myf flags)
{
size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1132,7 +1157,7 @@ inline_mysql_file_write(
}
#endif
result= my_write(file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_written;
@@ -1148,13 +1173,13 @@ inline_mysql_file_write(
static inline size_t
inline_mysql_file_pread(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, uchar *buffer, size_t count, my_off_t offset, myf flags)
{
size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1165,7 +1190,7 @@ inline_mysql_file_pread(
}
#endif
result= my_pread(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_read;
@@ -1181,13 +1206,13 @@ inline_mysql_file_pread(
static inline size_t
inline_mysql_file_pwrite(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, const uchar *buffer, size_t count, my_off_t offset, myf flags)
{
size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1199,7 +1224,7 @@ inline_mysql_file_pwrite(
}
#endif
result= my_pwrite(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
{
size_t bytes_written;
@@ -1215,13 +1240,13 @@ inline_mysql_file_pwrite(
static inline my_off_t
inline_mysql_file_seek(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, my_off_t pos, int whence, myf flags)
{
my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1232,7 +1257,7 @@ inline_mysql_file_seek(
}
#endif
result= my_seek(file, pos, whence, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1241,13 +1266,13 @@ inline_mysql_file_seek(
static inline my_off_t
inline_mysql_file_tell(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File file, myf flags)
{
my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1258,7 +1283,7 @@ inline_mysql_file_tell(
}
#endif
result= my_tell(file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1267,13 +1292,13 @@ inline_mysql_file_tell(
static inline int
inline_mysql_file_delete(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *name, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1285,7 +1310,7 @@ inline_mysql_file_delete(
}
#endif
result= my_delete(name, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1294,13 +1319,13 @@ inline_mysql_file_delete(
static inline int
inline_mysql_file_rename(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *from, const char *to, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1312,7 +1337,7 @@ inline_mysql_file_rename(
}
#endif
result= my_rename(from, to, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1321,14 +1346,14 @@ inline_mysql_file_rename(
static inline File
inline_mysql_file_create_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *linkname, const char *filename, int create_flags,
int access_flags, myf flags)
{
File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1341,7 +1366,7 @@ inline_mysql_file_create_with_symlink(
#endif
file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
#endif
@@ -1350,13 +1375,13 @@ inline_mysql_file_create_with_symlink(
static inline int
inline_mysql_file_delete_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *name, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1368,7 +1393,7 @@ inline_mysql_file_delete_with_symlink(
}
#endif
result= my_delete_with_symlink(name, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1377,13 +1402,13 @@ inline_mysql_file_delete_with_symlink(
static inline int
inline_mysql_file_rename_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *from, const char *to, myf flags)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1395,7 +1420,7 @@ inline_mysql_file_rename_with_symlink(
}
#endif
result= my_rename_with_symlink(from, to, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
@@ -1404,13 +1429,13 @@ inline_mysql_file_rename_with_symlink(
static inline int
inline_mysql_file_sync(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
const char *src_file, uint src_line,
#endif
File fd, myf flags)
{
int result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
@@ -1421,7 +1446,7 @@ inline_mysql_file_sync(
}
#endif
result= my_sync(fd, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
=== modified file 'include/mysql/psi/mysql_stage.h'
--- a/include/mysql/psi/mysql_stage.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/mysql_stage.h revid:vasil.dimov@stripped
@@ -29,7 +29,19 @@
@{
*/
-#ifdef HAVE_PSI_INTERFACE
+/**
+ @def mysql_stage_register(P1, P2, P3)
+ Stage registration.
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_register(P1, P2, P3) \
+ inline_mysql_stage_register(P1, P2, P3)
+#else
+#define mysql_stage_register(P1, P2, P3) \
+ do {} while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
#define MYSQL_SET_STAGE(K, F, L) \
inline_mysql_set_stage(K, F, L)
#else
@@ -37,7 +49,16 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_register(
+ const char *category, PSI_stage_info **info, int count)
+{
+ if (likely(PSI_server != NULL))
+ PSI_server->register_stage(category, info, count);
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_set_stage(PSI_stage_key key,
const char *src_file, int src_line)
=== modified file 'include/mysql/psi/mysql_statement.h'
--- a/include/mysql/psi/mysql_statement.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/mysql_statement.h revid:vasil.dimov@stripped
@@ -29,7 +29,19 @@
@{
*/
-#ifdef HAVE_PSI_INTERFACE
+/**
+ @def mysql_statement_register(P1, P2, P3)
+ Statement registration.
+*/
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define mysql_statement_register(P1, P2, P3) \
+ inline_mysql_statement_register(P1, P2, P3)
+#else
+#define mysql_statement_register(P1, P2, P3) \
+ do {} while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
#else
@@ -37,7 +49,7 @@
NULL
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
inline_mysql_refine_statement(LOCKER, K)
#else
@@ -45,7 +57,7 @@
NULL
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
inline_mysql_set_statement_text(LOCKER, P1, P2)
#else
@@ -53,7 +65,7 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
inline_mysql_set_statement_lock_time(LOCKER, P1)
#else
@@ -61,7 +73,7 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
inline_mysql_set_statement_rows_sent(LOCKER, P1)
#else
@@ -69,7 +81,7 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
inline_mysql_set_statement_rows_examined(LOCKER, P1)
#else
@@ -77,7 +89,7 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_END_STATEMENT(LOCKER, DA) \
inline_mysql_end_statement(LOCKER, DA)
#else
@@ -85,7 +97,14 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+static inline void inline_mysql_statement_register(
+ const char *category, PSI_statement_info *info, int count)
+{
+ if (likely(PSI_server != NULL))
+ PSI_server->register_statement(category, info, count);
+}
+
static inline struct PSI_statement_locker *
inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
=== modified file 'include/mysql/psi/mysql_table.h'
--- a/include/mysql/psi/mysql_table.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/mysql_table.h revid:vasil.dimov@stripped
@@ -41,7 +41,7 @@
@sa MYSQL_START_TABLE_LOCK_WAIT.
@sa MYSQL_END_TABLE_LOCK_WAIT.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
struct PSI_table_locker* LOCKER; \
PSI_table_locker_state STATE;
@@ -61,7 +61,7 @@
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_WAIT.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_START_TABLE_IO_WAIT(LOCKER, STATE, PSI, OP, INDEX, FLAGS) \
LOCKER= inline_mysql_start_table_io_wait(STATE, PSI, \
OP, INDEX, __FILE__, __LINE__)
@@ -77,7 +77,7 @@
@param LOCKER the locker
@sa MYSQL_START_TABLE_IO_WAIT.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_END_TABLE_IO_WAIT(LOCKER) \
inline_mysql_end_table_io_wait(LOCKER)
#else
@@ -85,7 +85,7 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
/**
Instrumentation calls for MYSQL_START_TABLE_IO_WAIT.
@sa MYSQL_END_TABLE_IO_WAIT.
@@ -130,7 +130,7 @@ inline_mysql_end_table_io_wait(struct PS
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_LOCK_WAIT.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
OP, FLAGS, __FILE__, __LINE__)
@@ -146,7 +146,7 @@ inline_mysql_end_table_io_wait(struct PS
@param LOCKER the locker
@sa MYSQL_START_TABLE_LOCK_WAIT.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
inline_mysql_end_table_lock_wait(LOCKER)
#else
@@ -154,7 +154,7 @@ inline_mysql_end_table_io_wait(struct PS
do {} while (0)
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
/**
Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
@sa MYSQL_END_TABLE_LOCK_WAIT.
=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/mysql_thread.h revid:vasil.dimov@stripped
@@ -222,6 +222,13 @@ typedef struct st_mysql_cond mysql_cond_
rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
/**
+ @def mysql_mutex_register(P1, P2, P3)
+ Mutex registration.
+*/
+#define mysql_mutex_register(P1, P2, P3) \
+ inline_mysql_mutex_register(P1, P2, P3)
+
+/**
@def mysql_mutex_init(K, M, A)
Instrumented mutex_init.
@c mysql_mutex_init is a replacement for @c pthread_mutex_init.
@@ -230,7 +237,7 @@ typedef struct st_mysql_cond mysql_cond_
@param A Mutex attributes
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
#ifdef SAFE_MUTEX
#define mysql_mutex_init(K, M, A) \
inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__)
@@ -269,7 +276,7 @@ typedef struct st_mysql_cond mysql_cond_
@param M The mutex to lock
*/
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
#define mysql_mutex_lock(M) \
inline_mysql_mutex_lock(M, __FILE__, __LINE__)
#else
@@ -284,7 +291,7 @@ typedef struct st_mysql_cond mysql_cond_
for @c pthread_mutex_trylock.
*/
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
#define mysql_mutex_trylock(M) \
inline_mysql_mutex_trylock(M, __FILE__, __LINE__)
#else
@@ -306,6 +313,13 @@ typedef struct st_mysql_cond mysql_cond_
#endif
/**
+ @def mysql_rwlock_register(P1, P2, P3)
+ Rwlock registration.
+*/
+#define mysql_rwlock_register(P1, P2, P3) \
+ inline_mysql_rwlock_register(P1, P2, P3)
+
+/**
@def mysql_rwlock_init(K, RW)
Instrumented rwlock_init.
@c mysql_rwlock_init is a replacement for @c pthread_rwlock_init.
@@ -313,7 +327,7 @@ typedef struct st_mysql_cond mysql_cond_
@param K The PSI_rwlock_key for this instrumented rwlock
@param RW The rwlock to initialize
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW)
#else
#define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW)
@@ -326,7 +340,7 @@ typedef struct st_mysql_cond mysql_cond_
@param K The PSI_rwlock_key for this instrumented prlock
@param RW The prlock to initialize
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_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)
@@ -354,7 +368,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_rwlock_rdlock is a drop-in replacement
for @c pthread_rwlock_rdlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_rwlock_rdlock(RW) \
inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__)
#else
@@ -368,7 +382,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_prlock_rdlock is a drop-in replacement
for @c rw_pr_rdlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_prlock_rdlock(RW) \
inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__)
#else
@@ -382,7 +396,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_rwlock_wrlock is a drop-in replacement
for @c pthread_rwlock_wrlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_rwlock_wrlock(RW) \
inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__)
#else
@@ -396,7 +410,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_prlock_wrlock is a drop-in replacement
for @c rw_pr_wrlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_prlock_wrlock(RW) \
inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__)
#else
@@ -410,7 +424,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_rwlock_tryrdlock is a drop-in replacement
for @c pthread_rwlock_tryrdlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_rwlock_tryrdlock(RW) \
inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__)
#else
@@ -424,7 +438,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_rwlock_trywrlock is a drop-in replacement
for @c pthread_rwlock_trywrlock.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
#define mysql_rwlock_trywrlock(RW) \
inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__)
#else
@@ -449,6 +463,13 @@ typedef struct st_mysql_cond mysql_cond_
#define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW)
/**
+ @def mysql_cond_register(P1, P2, P3)
+ Cond registration.
+*/
+#define mysql_cond_register(P1, P2, P3) \
+ inline_mysql_cond_register(P1, P2, P3)
+
+/**
@def mysql_cond_init(K, C, A)
Instrumented cond_init.
@c mysql_cond_init is a replacement for @c pthread_cond_init.
@@ -456,7 +477,7 @@ typedef struct st_mysql_cond mysql_cond_
@param K The PSI_cond_key for this instrumented cond
@param A Condition attributes
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
#define mysql_cond_init(K, C, A) inline_mysql_cond_init(K, C, A)
#else
#define mysql_cond_init(K, C, A) inline_mysql_cond_init(C, A)
@@ -474,7 +495,7 @@ typedef struct st_mysql_cond mysql_cond_
Instrumented cond_wait.
@c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
#define mysql_cond_wait(C, M) \
inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
#else
@@ -488,7 +509,7 @@ typedef struct st_mysql_cond mysql_cond_
@c mysql_cond_timedwait is a drop-in replacement
for @c pthread_cond_timedwait.
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
#define mysql_cond_timedwait(C, M, W) \
inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
#else
@@ -511,6 +532,12 @@ typedef struct st_mysql_cond mysql_cond_
*/
#define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C)
+/**
+ @def mysql_thread_register(P1, P2, P3)
+ Thread registration.
+*/
+#define mysql_thread_register(P1, P2, P3) \
+ inline_mysql_thread_register(P1, P2, P3)
/**
@def mysql_thread_create(K, P1, P2, P3, P4)
@@ -529,7 +556,7 @@ typedef struct st_mysql_cond mysql_cond_
@param P3 pthread_create parameter 3
@param P4 pthread_create parameter 4
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
#define mysql_thread_create(K, P1, P2, P3, P4) \
inline_mysql_thread_create(K, P1, P2, P3, P4)
#else
@@ -542,14 +569,32 @@ typedef struct st_mysql_cond mysql_cond_
Set the thread indentifier for the instrumentation.
@param I The thread identifier
*/
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
#define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I)
#else
#define mysql_thread_set_psi_id(I) do {} while (0)
#endif
+static inline void inline_mysql_mutex_register(
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ const char *category,
+ PSI_mutex_info *info,
+ int count
+#else
+ const char *category __attribute__ ((unused)),
+ void *info __attribute__ ((unused)),
+ int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ if (likely(PSI_server != NULL))
+ PSI_server->register_mutex(category, info, count);
+#endif
+}
+
static inline int inline_mysql_mutex_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
PSI_mutex_key key,
#endif
mysql_mutex_t *that,
@@ -559,7 +604,7 @@ static inline int inline_mysql_mutex_ini
#endif
)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
that->m_psi= PSI_server ? PSI_server->init_mutex(key, &that->m_mutex)
: NULL;
#else
@@ -579,7 +624,7 @@ static inline int inline_mysql_mutex_des
#endif
)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
if (likely(PSI_server && that->m_psi))
{
PSI_server->destroy_mutex(that->m_psi);
@@ -595,13 +640,13 @@ static inline int inline_mysql_mutex_des
static inline int inline_mysql_mutex_lock(
mysql_mutex_t *that
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
struct PSI_mutex_locker *locker= NULL;
PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -616,7 +661,7 @@ static inline int inline_mysql_mutex_loc
#else
result= pthread_mutex_lock(&that->m_mutex);
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
if (likely(locker != NULL))
PSI_server->end_mutex_wait(locker, result);
#endif
@@ -625,13 +670,13 @@ static inline int inline_mysql_mutex_loc
static inline int inline_mysql_mutex_trylock(
mysql_mutex_t *that
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
struct PSI_mutex_locker *locker= NULL;
PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -646,7 +691,7 @@ static inline int inline_mysql_mutex_try
#else
result= pthread_mutex_trylock(&that->m_mutex);
#endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
if (likely(locker != NULL))
PSI_server->end_mutex_wait(locker, result);
#endif
@@ -661,7 +706,7 @@ static inline int inline_mysql_mutex_unl
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
if (likely(PSI_server && that->m_psi))
PSI_server->unlock_mutex(that->m_psi);
#endif
@@ -673,13 +718,31 @@ static inline int inline_mysql_mutex_unl
return result;
}
+static inline void inline_mysql_rwlock_register(
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ const char *category,
+ PSI_rwlock_info *info,
+ int count
+#else
+ const char *category __attribute__ ((unused)),
+ void *info __attribute__ ((unused)),
+ int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (likely(PSI_server != NULL))
+ PSI_server->register_rwlock(category, info, count);
+#endif
+}
+
static inline int inline_mysql_rwlock_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
PSI_rwlock_key key,
#endif
mysql_rwlock_t *that)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_rwlock)
: NULL);
#else
@@ -693,12 +756,12 @@ static inline int inline_mysql_rwlock_in
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
PSI_rwlock_key key,
#endif
mysql_prlock_t *that)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_prlock)
: NULL);
#else
@@ -711,7 +774,7 @@ static inline int inline_mysql_prlock_in
static inline int inline_mysql_rwlock_destroy(
mysql_rwlock_t *that)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(PSI_server && that->m_psi))
{
PSI_server->destroy_rwlock(that->m_psi);
@@ -725,7 +788,7 @@ static inline int inline_mysql_rwlock_de
static inline int inline_mysql_prlock_destroy(
mysql_prlock_t *that)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(PSI_server && that->m_psi))
{
PSI_server->destroy_rwlock(that->m_psi);
@@ -738,13 +801,13 @@ static inline int inline_mysql_prlock_de
static inline int inline_mysql_rwlock_rdlock(
mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -756,7 +819,7 @@ static inline int inline_mysql_rwlock_rd
}
#endif
result= rw_rdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_rdwait(locker, result);
#endif
@@ -766,13 +829,13 @@ static inline int inline_mysql_rwlock_rd
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_rdlock(
mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -784,7 +847,7 @@ static inline int inline_mysql_prlock_rd
}
#endif
result= rw_pr_rdlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_rdwait(locker, result);
#endif
@@ -794,13 +857,13 @@ static inline int inline_mysql_prlock_rd
static inline int inline_mysql_rwlock_wrlock(
mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -812,7 +875,7 @@ static inline int inline_mysql_rwlock_wr
}
#endif
result= rw_wrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_wrwait(locker, result);
#endif
@@ -822,13 +885,13 @@ static inline int inline_mysql_rwlock_wr
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_wrlock(
mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -840,7 +903,7 @@ static inline int inline_mysql_prlock_wr
}
#endif
result= rw_pr_wrlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_wrwait(locker, result);
#endif
@@ -850,13 +913,13 @@ static inline int inline_mysql_prlock_wr
static inline int inline_mysql_rwlock_tryrdlock(
mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -868,7 +931,7 @@ static inline int inline_mysql_rwlock_tr
}
#endif
result= rw_tryrdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_rdwait(locker, result);
#endif
@@ -877,13 +940,13 @@ static inline int inline_mysql_rwlock_tr
static inline int inline_mysql_rwlock_trywrlock(
mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -895,7 +958,7 @@ static inline int inline_mysql_rwlock_tr
}
#endif
result= rw_trywrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(locker != NULL))
PSI_server->end_rwlock_wrwait(locker, result);
#endif
@@ -906,7 +969,7 @@ static inline int inline_mysql_rwlock_un
mysql_rwlock_t *that)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(PSI_server && that->m_psi))
PSI_server->unlock_rwlock(that->m_psi);
#endif
@@ -919,7 +982,7 @@ static inline int inline_mysql_prlock_un
mysql_prlock_t *that)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (likely(PSI_server && that->m_psi))
PSI_server->unlock_rwlock(that->m_psi);
#endif
@@ -928,14 +991,32 @@ static inline int inline_mysql_prlock_un
}
#endif
+static inline void inline_mysql_cond_register(
+#ifdef HAVE_PSI_COND_INTERFACE
+ const char *category,
+ PSI_cond_info *info,
+ int count
+#else
+ const char *category __attribute__ ((unused)),
+ void *info __attribute__ ((unused)),
+ int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (likely(PSI_server != NULL))
+ PSI_server->register_cond(category, info, count);
+#endif
+}
+
static inline int inline_mysql_cond_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
PSI_cond_key key,
#endif
mysql_cond_t *that,
const pthread_condattr_t *attr)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
that->m_psi= (PSI_server ? PSI_server->init_cond(key, &that->m_cond)
: NULL);
#else
@@ -947,7 +1028,7 @@ static inline int inline_mysql_cond_init
static inline int inline_mysql_cond_destroy(
mysql_cond_t *that)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
if (likely(PSI_server && that->m_psi))
{
PSI_server->destroy_cond(that->m_psi);
@@ -960,13 +1041,13 @@ static inline int inline_mysql_cond_dest
static inline int inline_mysql_cond_wait(
mysql_cond_t *that,
mysql_mutex_t *mutex
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
struct PSI_cond_locker *locker= NULL;
PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -978,7 +1059,7 @@ static inline int inline_mysql_cond_wait
}
#endif
result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
if (likely(locker != NULL))
PSI_server->end_cond_wait(locker, result);
#endif
@@ -989,13 +1070,13 @@ static inline int inline_mysql_cond_time
mysql_cond_t *that,
mysql_mutex_t *mutex,
struct timespec *abstime
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
, const char *src_file, uint src_line
#endif
)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
struct PSI_cond_locker *locker= NULL;
PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
@@ -1007,7 +1088,7 @@ static inline int inline_mysql_cond_time
}
#endif
result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
if (likely(locker != NULL))
PSI_server->end_cond_wait(locker, result);
#endif
@@ -1018,7 +1099,7 @@ static inline int inline_mysql_cond_sign
mysql_cond_t *that)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
if (likely(PSI_server && that->m_psi))
PSI_server->signal_cond(that->m_psi);
#endif
@@ -1030,7 +1111,7 @@ static inline int inline_mysql_cond_broa
mysql_cond_t *that)
{
int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
if (likely(PSI_server && that->m_psi))
PSI_server->broadcast_cond(that->m_psi);
#endif
@@ -1038,7 +1119,25 @@ static inline int inline_mysql_cond_broa
return result;
}
-#ifdef HAVE_PSI_INTERFACE
+static inline void inline_mysql_thread_register(
+#ifdef HAVE_PSI_THREAD__INTERFACE
+ const char *category,
+ PSI_thread_info *info,
+ int count
+#else
+ const char *category __attribute__ ((unused)),
+ void *info __attribute__ ((unused)),
+ int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ if (likely(PSI_server != NULL))
+ PSI_server->register_thread(category, info, count);
+#endif
+}
+
+#ifdef HAVE_PSI_THREAD_INTERFACE
static inline int inline_mysql_thread_create(
PSI_thread_key key,
pthread_t *thread, const pthread_attr_t *attr,
=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h revid:kevin.lewis@stripped
+++ b/include/mysql/psi/psi.h revid:vasil.dimov@stripped
@@ -116,6 +116,90 @@ struct PSI_bootstrap
#ifdef HAVE_PSI_INTERFACE
/**
+ @def DISABLE_PSI_MUTEX
+ Compiling option to disable the mutex instrumentation.
+ This option is mostly intended to be used during development,
+ when doing special builds with only a subset of the performance schema instrumentation,
+ for code analysis / profiling / performance tuning of a specific instrumentation alone.
+ For this reason, DISABLE_PSI_MUTEX is not advertised in the cmake general options.
+ To disable mutexes, add -DDISABLE_PSI_MUTEX to CFLAGS.
+ @sa DISABLE_PSI_RWLOCK
+ @sa DISABLE_PSI_COND
+ @sa DISABLE_PSI_FILE
+ @sa DISABLE_PSI_TABLE
+ @sa DISABLE_PSI_STAGE
+ @sa DISABLE_PSI_STATEMENT
+*/
+
+#ifndef DISABLE_PSI_MUTEX
+#define HAVE_PSI_MUTEX_INTERFACE
+#endif
+
+/**
+ @def DISABLE_PSI_RWLOCK
+ Compiling option to disable the rwlock instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_RWLOCK
+#define HAVE_PSI_RWLOCK_INTERFACE
+#endif
+
+/**
+ @def DISABLE_PSI_COND
+ Compiling option to disable the cond instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_COND
+#define HAVE_PSI_COND_INTERFACE
+#endif
+
+/**
+ @def DISABLE_PSI_FILE
+ Compiling option to disable the file instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_FILE
+#define HAVE_PSI_FILE_INTERFACE
+#endif
+
+/* No flag to disable the thread instrumentation. */
+
+#define HAVE_PSI_THREAD_INTERFACE
+
+/**
+ @def DISABLE_PSI_TABLE
+ Compiling option to disable the table instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_TABLE
+#define HAVE_PSI_TABLE_INTERFACE
+#endif
+
+/**
+ @def DISABLE_PSI_STAGE
+ Compiling option to disable the stage instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STAGE
+#define HAVE_PSI_STAGE_INTERFACE
+#endif
+
+/**
+ @def DISABLE_PSI_STATEMENT
+ Compiling option to disable the statement instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STATEMENT
+#define HAVE_PSI_STATEMENT_INTERFACE
+#endif
+
+/**
@def PSI_VERSION_1
Performance Schema Interface number for version 1.
This version is supported.
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental revid:kevin.lewis@stripped
+++ b/mysql-test/collections/default.experimental revid:vasil.dimov@stripped
@@ -19,6 +19,7 @@ main.type_float @freebsd
main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_checksum # BUG#12370830 2011-04-18 sven rpl_checksum failed on pb2 (server crash)
+rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically
rpl.rpl_innodb_bug28430 # Bug#46029
rpl.rpl_row_sp011 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
rpl.rpl_delayed_slave # BUG#57514 rpl_delayed_slave fails sporadically in pb
=== modified file 'mysql-test/extra/rpl_tests/rpl_extra_col_slave.test'
--- a/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test revid:kevin.lewis@stripped
+++ b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test revid:vasil.dimov@stripped
@@ -396,7 +396,7 @@ sync_slave_with_master;
# Error reaction is up to sql_mode of the slave sql (bug#38173)
#--echo *** Create t9 on slave ***
# Please, check BUG#47741 to see why you are not testing NDB.
-if ($engine_type != NDB)
+if (`SELECT UPPER(LEFT($engine_type, 3)) != 'NDB'`)
{
STOP SLAVE;
RESET SLAVE;
@@ -440,12 +440,13 @@ if ($engine_type != NDB)
#--let $slave_skip_counter= 2
#--let $show_slave_sql_error= 1
#--source include/wait_for_slave_sql_error_and_skip.inc
-}
-#--echo *** Drop t9 ***
-connection master;
-DROP TABLE t9;
-sync_slave_with_master;
+ #--echo *** Drop t9 ***
+ connection master;
+ DROP TABLE t9;
+ sync_slave_with_master;
+
+}
############################################
# More columns in slave at middle of table #
=== modified file 'mysql-test/include/join_cache.inc'
--- a/mysql-test/include/join_cache.inc revid:kevin.lewis@stripped
+++ b/mysql-test/include/join_cache.inc revid:vasil.dimov@stripped
@@ -1577,3 +1577,74 @@ eval explain $query;
eval $query;
drop table t1,t2;
+
+--echo
+--echo # Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+--echo # WITH JOIN_CACHE_LEVEL=3"
+--echo
+
+CREATE TABLE t1 (
+ b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+
+CREATE TABLE t4 (
+ col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+
+CREATE TABLE t6 (
+ col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+
+CREATE TABLE t7 (
+ col319 timestamp NOT NULL,
+ UNIQUE KEY idx263 (col319)
+) ;
+# zero rows would do, if there was no const-table optimization
+insert into t7 values("2000-01-01"),("2000-01-02");
+
+CREATE TABLE t3 (
+ col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+# one single row would do, if there was no const-table optimization
+INSERT INTO t3 VALUES ('cymej'),('spb');
+
+CREATE TABLE t5 (
+ col712 time
+) ;
+# zero rows would do, if there was no const-table optimization
+insert into t5 values(0),(0);
+
+CREATE TABLE t8 (
+ col804 char(169),
+ col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+
+CREATE TABLE t2 (
+ col841 varchar(10)
+) ;
+# one single row would do, if there was no const-table optimization
+INSERT INTO t2 VALUES (''),('');
+
+# Small buffer, to trigger "full buffer" in both caches of t8 and t6.
+# Setting to 1 will actually set to the smallest allowed value,
+# with a "rounding" warning message.
+set join_buffer_size=1;
+select @@join_buffer_size;
+
+--disable_warnings
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+--enable_warnings
+
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+
+set @@join_buffer_size=default;
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/func_time.result revid:vasil.dimov@stripped
@@ -1377,6 +1377,18 @@ NULL
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
NULL
+#
+# Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
+#
+SELECT DATE_FORMAT('0000-00-11', '%W');
+DATE_FORMAT('0000-00-11', '%W')
+NULL
+SELECT DATE_FORMAT('0000-00-11', '%a');
+DATE_FORMAT('0000-00-11', '%a')
+NULL
+SELECT DATE_FORMAT('0000-00-11', '%w');
+DATE_FORMAT('0000-00-11', '%w')
+NULL
End of 5.1 tests
#
# BUG#43578 "MyISAM&Maria gives wrong rows with range access
=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/grant.result revid:vasil.dimov@stripped
@@ -1700,6 +1700,7 @@ Assigning privileges without procs_priv
CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
SELECT 1;
+CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
@@ -2536,3 +2537,25 @@ DROP USER mysqltest_u1@localhost;
# End of Bug#38347.
+#
+# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+# DIFFERENTLY'.
+#
+drop database if exists mysqltest_db1;
+create database mysqltest_db1;
+create user mysqltest_u1;
+# Both GRANT statements below should fail with the same error.
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
+# Let us show that GRANT behaviour for routines is consistent
+# with GRANT behaviour for tables. Attempt to grant privilege
+# on non-existent table also results in an error.
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
+show grants for mysqltest_u1;
+Grants for mysqltest_u1@%
+GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
+drop database mysqltest_db1;
+drop user mysqltest_u1;
=== modified file 'mysql-test/r/having.result'
--- a/mysql-test/r/having.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/having.result revid:vasil.dimov@stripped
@@ -547,6 +547,28 @@ FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
HAVING field1 < 7;
field1
DROP TABLE t1,t2;
+#
+# Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
+#
+CREATE TABLE t1 (f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1, 0), (2, 1), (3, 2);
+CREATE TABLE t2 (f1 INT, f2 INT);
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT f1, f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT 4, 2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+SELECT t1.f1
+FROM t1
+HAVING 2 IN (SELECT f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+DROP TABLE t1,t2;
End of 5.1 tests
#
# BUG#46077 "wrong result: HAVING + ORDER BY + MyISAM + ICP
=== modified file 'mysql-test/r/join_cache_jcl1.result'
--- a/mysql-test/r/join_cache_jcl1.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl1.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl2.result'
--- a/mysql-test/r/join_cache_jcl2.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl2.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl3.result'
--- a/mysql-test/r/join_cache_jcl3.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl3.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl4.result'
--- a/mysql-test/r/join_cache_jcl4.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl4.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl5.result'
--- a/mysql-test/r/join_cache_jcl5.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl5.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl6.result'
--- a/mysql-test/r/join_cache_jcl6.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl6.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl7.result'
--- a/mysql-test/r/join_cache_jcl7.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl7.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/join_cache_jcl8.result'
--- a/mysql-test/r/join_cache_jcl8.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/join_cache_jcl8.result revid:vasil.dimov@stripped
@@ -2250,5 +2250,60 @@ col_int_key col_datetime
0 2000-09-26 07:45:57
2 2003-02-11 21:19:41
drop table t1,t2;
+
+# Bug#11766522 "59651: ASSERTION `TABLE_REF->HAS_RECORD' FAILED
+# WITH JOIN_CACHE_LEVEL=3"
+
+CREATE TABLE t1 (
+b varchar(20)
+) ;
+INSERT INTO t1 VALUES ('1'),('1');
+CREATE TABLE t4 (
+col253 text
+) ;
+INSERT INTO t4 VALUES (''),('pf');
+CREATE TABLE t6 (
+col282 timestamp
+) ;
+INSERT INTO t6 VALUES ('2010-11-07 01:04:45'),('2010-12-13 01:36:32');
+CREATE TABLE t7 (
+col319 timestamp NOT NULL,
+UNIQUE KEY idx263 (col319)
+) ;
+insert into t7 values("2000-01-01"),("2000-01-02");
+CREATE TABLE t3 (
+col582 char(230) CHARACTER SET utf8 DEFAULT NULL
+) ;
+INSERT INTO t3 VALUES ('cymej'),('spb');
+CREATE TABLE t5 (
+col712 time
+) ;
+insert into t5 values(0),(0);
+CREATE TABLE t8 (
+col804 char(169),
+col805 varchar(51)
+) ;
+INSERT INTO t8 VALUES ('tmqcb','pwk');
+CREATE TABLE t2 (
+col841 varchar(10)
+) ;
+INSERT INTO t2 VALUES (''),('');
+set join_buffer_size=1;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '1'
+select @@join_buffer_size;
+@@join_buffer_size
+128
+select count(*) from
+(t1 join t2 join t3)
+left join t4 on 1
+left join t5 on 1 like t4.col253
+left join t6 on t5.col712 is null
+left join t7 on t1.b <=>t7.col319
+left join t8 on t3.col582 <= 1;
+count(*)
+32
+drop table t1,t2,t3,t4,t5,t6,t7,t8;
+set @@join_buffer_size=default;
set optimizer_join_cache_level = default;
set optimizer_switch = default;
=== modified file 'mysql-test/r/loaddata.result'
--- a/mysql-test/r/loaddata.result revid:kevin.lewis@stripped
+++ b/mysql-test/r/loaddata.result revid:vasil.dimov@stripped
@@ -539,4 +539,13 @@ CREATE TABLE t1(f1 INT);
SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
DROP TABLE t1;
+#
+# Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
+# WHEN ERROR OCCURS
+#
+SELECT '1\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt';
+create table t1(a point);
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
End of 5.1 tests
=== modified file 'mysql-test/suite/binlog/r/binlog_bug23533.result'
--- a/mysql-test/suite/binlog/r/binlog_bug23533.result revid:kevin.lewis@stripped
+++ b/mysql-test/suite/binlog/r/binlog_bug23533.result revid:vasil.dimov@stripped
@@ -3,8 +3,6 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INC
SELECT COUNT(*) FROM t1;
COUNT(*)
1000
-SET @saved_binlog_cache_size=@@binlog_cache_size;
-SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
SET GLOBAL binlog_cache_size=4096;
SET GLOBAL max_binlog_cache_size=4096;
START TRANSACTION;
@@ -14,6 +12,4 @@ COMMIT;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
-SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
-SET GLOBAL binlog_cache_size=@saved_binlog_cache_size;
DROP TABLE t1;
=== modified file 'mysql-test/suite/binlog/t/binlog_bug23533.test'
--- a/mysql-test/suite/binlog/t/binlog_bug23533.test revid:kevin.lewis@stripped
+++ b/mysql-test/suite/binlog/t/binlog_bug23533.test revid:vasil.dimov@stripped
@@ -24,11 +24,15 @@ while ($i)
SELECT COUNT(*) FROM t1;
# Set small value for max_binlog_cache_size
-SET @saved_binlog_cache_size=@@binlog_cache_size;
-SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
+let $saved_binlog_cache_size= query_get_value(SELECT @@binlog_cache_size AS Value, Value, 1);
+let $saved_max_binlog_cache_size= query_get_value(SELECT @@max_binlog_cache_size AS Value, Value, 1);
SET GLOBAL binlog_cache_size=4096;
SET GLOBAL max_binlog_cache_size=4096;
+# New value of max_binlog_cache_size will apply to new session
+disconnect default;
+connect(default,localhost,root,,test);
+
# Copied data from t1 into t2 large than max_binlog_cache_size
START TRANSACTION;
--error 1197
@@ -37,6 +41,10 @@ COMMIT;
SHOW TABLES LIKE 't%';
# 5.1 End of Test
-SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
-SET GLOBAL binlog_cache_size=@saved_binlog_cache_size;
+--disable_query_log
+eval SET GLOBAL max_binlog_cache_size=$saved_max_binlog_cache_size;
+eval SET GLOBAL binlog_cache_size=$saved_binlog_cache_size;
+--enable_query_log
DROP TABLE t1;
+disconnect default;
+connect(default,localhost,root,,test);
=== modified file 'mysql-test/suite/parts/inc/partition_check_drop.inc'
--- a/mysql-test/suite/parts/inc/partition_check_drop.inc revid:kevin.lewis@stripped
+++ b/mysql-test/suite/parts/inc/partition_check_drop.inc revid:vasil.dimov@stripped
@@ -37,7 +37,7 @@ if ($do_file_tests)
eval SET @aux = load_file('$ls_file');
# clean up
- remove_file $ls_file;
+ --remove_file $ls_file
}
if (!$do_file_tests)
{
=== modified file 'mysql-test/suite/parts/inc/partition_layout_check1.inc'
--- a/mysql-test/suite/parts/inc/partition_layout_check1.inc revid:kevin.lewis@stripped
+++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc revid:vasil.dimov@stripped
@@ -45,6 +45,9 @@ if ($do_file_tests)
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
}
eval SET @aux = load_file('$ls_file');
+
+ # clean up
+ --remove_file $ls_file
}
if (!$do_file_tests)
{
=== modified file 'mysql-test/suite/parts/inc/partition_layout_check2.inc'
--- a/mysql-test/suite/parts/inc/partition_layout_check2.inc revid:kevin.lewis@stripped
+++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc revid:vasil.dimov@stripped
@@ -43,6 +43,9 @@ if ($do_file_tests)
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
}
eval SET @aux = load_file('$ls_file');
+
+ # clean up
+ --remove_file $ls_file
}
if (!$do_file_tests)
{
=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test revid:kevin.lewis@stripped
+++ b/mysql-test/t/func_time.test revid:vasil.dimov@stripped
@@ -894,6 +894,14 @@ SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBA
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
+--echo #
+--echo # Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
+--echo #
+
+SELECT DATE_FORMAT('0000-00-11', '%W');
+SELECT DATE_FORMAT('0000-00-11', '%a');
+SELECT DATE_FORMAT('0000-00-11', '%w');
+
--echo End of 5.1 tests
--echo #
=== modified file 'mysql-test/t/grant.test'
--- a/mysql-test/t/grant.test revid:kevin.lewis@stripped
+++ b/mysql-test/t/grant.test revid:vasil.dimov@stripped
@@ -1676,6 +1676,7 @@ FLUSH PRIVILEGES;
CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
SELECT 1;
+CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
--error ER_NO_SUCH_TABLE
GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
@@ -2187,3 +2188,27 @@ DROP USER mysqltest_u1@localhost;
--echo
--echo # End of Bug#38347.
--echo
+
+
+--echo #
+--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+--echo # DIFFERENTLY'.
+--echo #
+--disable_warnings
+drop database if exists mysqltest_db1;
+--enable_warnings
+create database mysqltest_db1;
+create user mysqltest_u1;
+--echo # Both GRANT statements below should fail with the same error.
+--error ER_SP_DOES_NOT_EXIST
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+--error ER_SP_DOES_NOT_EXIST
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+--echo # Let us show that GRANT behaviour for routines is consistent
+--echo # with GRANT behaviour for tables. Attempt to grant privilege
+--echo # on non-existent table also results in an error.
+--error ER_NO_SUCH_TABLE
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+show grants for mysqltest_u1;
+drop database mysqltest_db1;
+drop user mysqltest_u1;
=== modified file 'mysql-test/t/having.test'
--- a/mysql-test/t/having.test revid:kevin.lewis@stripped
+++ b/mysql-test/t/having.test revid:vasil.dimov@stripped
@@ -564,6 +564,32 @@ HAVING field1 < 7;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
+--echo #
+
+CREATE TABLE t1 (f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1, 0), (2, 1), (3, 2);
+CREATE TABLE t2 (f1 INT, f2 INT);
+
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT f1, f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT 4, 2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+
+SELECT t1.f1
+FROM t1
+HAVING 2 IN (SELECT f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+
+DROP TABLE t1,t2;
+
+
--echo End of 5.1 tests
--echo #
=== modified file 'mysql-test/t/loaddata.test'
--- a/mysql-test/t/loaddata.test revid:kevin.lewis@stripped
+++ b/mysql-test/t/loaddata.test revid:vasil.dimov@stripped
@@ -615,4 +615,19 @@ DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.dat;
+--echo #
+--echo # Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
+--echo # WHEN ERROR OCCURS
+--echo #
+
+--let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT '1\n' INTO DUMPFILE '$file'
+
+create table t1(a point);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+--eval LOAD DATA INFILE '$file' INTO TABLE t1
+drop table t1;
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/mysqlbinlog_raw_mode.test'
--- a/mysql-test/t/mysqlbinlog_raw_mode.test revid:kevin.lewis@stripped
+++ b/mysql-test/t/mysqlbinlog_raw_mode.test revid:vasil.dimov@stripped
@@ -10,14 +10,35 @@ CREATE TABLE raw_mode_exit (exit_code IN
# Now jump some loops to have mysqlbinlog executed in the background
--write_file $MYSQL_TMP_DIR/mbl.sh
#!/bin/sh
-(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 ; [ $? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);") < /dev/null > /dev/null 2>&1 &
+(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQL_TMP_DIR/ master-bin.000001 ; [ $? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);") < /dev/null > /dev/null 2>&1 &
EOF
--chmod 0755 $MYSQL_TMP_DIR/mbl.sh
--exec $MYSQL_TMP_DIR/mbl.sh
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
--source include/wait_condition.inc
---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
+
+# Wait until creating binlog files by mysqlbinlog
+--perl
+$timeout= 30;
+$binlog= $ENV{'MYSQL_TMP_DIR'} . '/master-bin.000002';
+$binlog_exists= 0;
+while ($timeout > 0 && $binlog_exists == 0)
+{
+ if (-e $binlog)
+ {
+ $binlog_exists= 1;
+ }
+ sleep 1;
+ $timeout--;
+}
+if ($timeout == 0 && $binlog_exists == 0)
+{
+ print "Timeout reached but binlog file $binlog was not created";
+}
+EOF
+
+--diff_files $MYSQL_TMP_DIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+--diff_files $MYSQL_TMP_DIR/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
SELECT ((@id := id) - id) from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
# Test killing from mysql server
@@ -26,9 +47,9 @@ kill @id;
--source include/wait_condition.inc
DROP TABLE raw_mode_exit;
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
+--remove_file $MYSQL_TMP_DIR/master-bin.000001
+--remove_file $MYSQL_TMP_DIR/master-bin.000002
+--remove_file $MYSQL_TMP_DIR/master-bin.000003
--remove_file $MYSQL_TMP_DIR/mbl.sh
--echo End of tests
=== modified file 'mysys/default.c'
--- a/mysys/default.c revid:kevin.lewis@stripped
+++ b/mysys/default.c revid:vasil.dimov@stripped
@@ -1068,7 +1068,11 @@ void my_print_default_files(const char *
end= convert_dirname(name, pos, NullS);
if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
*end++= '.';
- strxmov(end, conf_file, *ext, " ", NullS);
+
+ if (my_defaults_extra_file == pos)
+ end[(strlen(end)-1)] = ' ';
+ else
+ strxmov(end, conf_file, *ext , " ", NullS);
fputs(name, stdout);
}
}
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c revid:kevin.lewis@stripped
+++ b/mysys/my_init.c revid:vasil.dimov@stripped
@@ -543,22 +543,19 @@ void my_init_mysys_psi_keys()
const char* category= "mysys";
int count;
- if (PSI_server == NULL)
- return;
-
count= sizeof(all_mysys_mutexes)/sizeof(all_mysys_mutexes[0]);
- PSI_server->register_mutex(category, all_mysys_mutexes, count);
+ mysql_mutex_register(category, all_mysys_mutexes, count);
count= sizeof(all_mysys_conds)/sizeof(all_mysys_conds[0]);
- PSI_server->register_cond(category, all_mysys_conds, count);
+ mysql_cond_register(category, all_mysys_conds, count);
#ifdef USE_ALARM_THREAD
count= sizeof(all_mysys_threads)/sizeof(all_mysys_threads[0]);
- PSI_server->register_thread(category, all_mysys_threads, count);
+ mysql_thread_register(category, all_mysys_threads, count);
#endif /* USE_ALARM_THREAD */
count= sizeof(all_mysys_files)/sizeof(all_mysys_files[0]);
- PSI_server->register_file(category, all_mysys_files, count);
+ mysql_file_register(category, all_mysys_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc revid:kevin.lewis@stripped
+++ b/plugin/semisync/semisync_master_plugin.cc revid:vasil.dimov@stripped
@@ -359,14 +359,11 @@ static void init_semisync_psi_keys(void)
const char* category= "semisync";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_semisync_mutexes);
- PSI_server->register_mutex(category, all_semisync_mutexes, count);
+ mysql_mutex_register(category, all_semisync_mutexes, count);
count= array_elements(all_semisync_conds);
- PSI_server->register_cond(category, all_semisync_conds, count);
+ mysql_cond_register(category, all_semisync_conds, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql-common/my_time.c'
--- a/sql-common/my_time.c revid:kevin.lewis@stripped
+++ b/sql-common/my_time.c revid:vasil.dimov@stripped
@@ -772,7 +772,7 @@ long calc_daynr(uint year,uint month,uin
int y= year; /* may be < 0 temporarily */
DBUG_ENTER("calc_daynr");
- if (y == 0 && month == 0 && day == 0)
+ if (y == 0 && month == 0)
DBUG_RETURN(0); /* Skip errors */
/* Cast to int to be able to handle month == 0 */
delsum= (long) (365 * y + 31 *((int) month - 1) + (int) day);
@@ -783,6 +783,7 @@ long calc_daynr(uint year,uint month,uin
temp=(int) ((y/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
y+(month <= 2),month,day,delsum+y/4-temp));
+ DBUG_ASSERT(delsum+(int) y/4-temp > 0);
DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */
=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc revid:kevin.lewis@stripped
+++ b/sql/debug_sync.cc revid:vasil.dimov@stripped
@@ -453,14 +453,11 @@ static void init_debug_sync_psi_keys(voi
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_debug_sync_mutexes);
- PSI_server->register_mutex(category, all_debug_sync_mutexes, count);
+ mysql_mutex_register(category, all_debug_sync_mutexes, count);
count= array_elements(all_debug_sync_conds);
- PSI_server->register_cond(category, all_debug_sync_conds, count);
+ mysql_cond_register(category, all_debug_sync_conds, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/events.cc'
--- a/sql/events.cc revid:kevin.lewis@stripped
+++ b/sql/events.cc revid:vasil.dimov@stripped
@@ -945,17 +945,14 @@ static void init_events_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_events_mutexes);
- PSI_server->register_mutex(category, all_events_mutexes, count);
+ mysql_mutex_register(category, all_events_mutexes, count);
count= array_elements(all_events_conds);
- PSI_server->register_cond(category, all_events_conds, count);
+ mysql_cond_register(category, all_events_conds, count);
count= array_elements(all_events_threads);
- PSI_server->register_thread(category, all_events_threads, count);
+ mysql_thread_register(category, all_events_threads, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc revid:kevin.lewis@stripped
+++ b/sql/ha_ndbcluster.cc revid:vasil.dimov@stripped
@@ -7532,20 +7532,17 @@ void init_ndbcluster_psi_keys()
const char* category= "ndbcluster";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_ndbcluster_mutexes);
- PSI_server->register_mutex(category, all_ndbcluster_mutexes, count);
+ mysql_mutex_register(category, all_ndbcluster_mutexes, count);
count= array_elements(all_ndbcluster_conds);
- PSI_server->register_cond(category, all_ndbcluster_conds, count);
+ mysql_cond_register(category, all_ndbcluster_conds, count);
count= array_elements(all_ndbcluster_threads);
- PSI_server->register_thread(category, all_ndbcluster_threads, count);
+ mysql_thread_register(category, all_ndbcluster_threads, count);
count= array_elements(all_ndbcluster_files);
- PSI_server->register_file(category, all_ndbcluster_files, count);
+ mysql_file_register(category, all_ndbcluster_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc revid:kevin.lewis@stripped
+++ b/sql/ha_partition.cc revid:vasil.dimov@stripped
@@ -164,8 +164,7 @@ const uint32 ha_partition::NO_CURRENT_PA
*/
ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share)
- :handler(hton, share), m_part_info(NULL), m_create_handler(FALSE),
- m_is_sub_partitioned(0)
+ :handler(hton, share)
{
DBUG_ENTER("ha_partition::ha_partition(table)");
init_handler_variables();
@@ -185,15 +184,44 @@ ha_partition::ha_partition(handlerton *h
*/
ha_partition::ha_partition(handlerton *hton, partition_info *part_info)
- :handler(hton, NULL), m_part_info(part_info), m_create_handler(TRUE),
- m_is_sub_partitioned(m_part_info->is_sub_partitioned())
+ :handler(hton, NULL)
{
DBUG_ENTER("ha_partition::ha_partition(part_info)");
+ DBUG_ASSERT(part_info);
init_handler_variables();
- DBUG_ASSERT(m_part_info);
+ m_part_info= part_info;
+ m_create_handler= TRUE;
+ m_is_sub_partitioned= m_part_info->is_sub_partitioned();
DBUG_VOID_RETURN;
}
+/**
+ ha_partition constructor method used by ha_partition::clone()
+
+ @param hton Handlerton (partition_hton)
+ @param share Table share object
+ @param part_info_arg partition_info to use
+ @param clone_arg ha_partition to clone
+ @param clme_mem_root_arg MEM_ROOT to use
+
+ @return New partition handler
+*/
+
+ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share,
+ partition_info *part_info_arg,
+ ha_partition *clone_arg,
+ MEM_ROOT *clone_mem_root_arg)
+ :handler(hton, share)
+{
+ DBUG_ENTER("ha_partition::ha_partition(clone)");
+ init_handler_variables();
+ m_part_info= part_info_arg;
+ m_create_handler= TRUE;
+ m_is_sub_partitioned= m_part_info->is_sub_partitioned();
+ m_is_clone_of= clone_arg;
+ m_clone_mem_root= clone_mem_root_arg;
+ DBUG_VOID_RETURN;
+}
/*
Initialize handler object
@@ -245,7 +273,6 @@ void ha_partition::init_handler_variable
m_rec0= 0;
m_curr_key_info[0]= NULL;
m_curr_key_info[1]= NULL;
- is_clone= FALSE,
m_part_func_monotonicity_info= NON_MONOTONIC;
auto_increment_lock= FALSE;
auto_increment_safe_stmt_log_lock= FALSE;
@@ -253,6 +280,11 @@ void ha_partition::init_handler_variable
this allows blackhole to work properly
*/
m_num_locks= 0;
+ m_part_info= NULL;
+ m_create_handler= FALSE;
+ m_is_sub_partitioned= 0;
+ m_is_clone_of= NULL;
+ m_clone_mem_root= NULL;
#ifdef DONT_HAVE_TO_BE_INITALIZED
m_start_key.flag= 0;
@@ -360,7 +392,8 @@ bool ha_partition::initialize_partition(
*/
DBUG_RETURN(0);
}
- else if (get_from_handler_file(table_share->normalized_path.str, mem_root))
+ else if (get_from_handler_file(table_share->normalized_path.str,
+ mem_root, false))
{
my_error(ER_FAILED_READ_FROM_PAR_FILE, MYF(0));
DBUG_RETURN(1);
@@ -572,7 +605,7 @@ int ha_partition::create(const char *nam
DBUG_RETURN(TRUE);
}
- if (get_from_handler_file(name, ha_thd()->mem_root))
+ if (get_from_handler_file(name, ha_thd()->mem_root, false))
DBUG_RETURN(TRUE);
DBUG_ASSERT(m_file_buffer);
DBUG_PRINT("enter", ("name: (%s)", name));
@@ -1956,7 +1989,7 @@ uint ha_partition::del_ren_table(const c
handler **file, **abort_file;
DBUG_ENTER("ha_partition::del_ren_table");
- if (get_from_handler_file(from, ha_thd()->mem_root))
+ if (get_from_handler_file(from, ha_thd()->mem_root, false))
DBUG_RETURN(TRUE);
DBUG_ASSERT(m_file_buffer);
DBUG_PRINT("enter", ("from: (%s) to: (%s)", from, to ? to : "(nil)"));
@@ -2110,18 +2143,16 @@ static uint name_add(char *dest, const c
}
-/*
+/**
Create the special .par file
- SYNOPSIS
- create_handler_file()
- name Full path of table name
+ @param name Full path of table name
- RETURN VALUE
- >0 Error code
- 0 Success
+ @return Operation status
+ @retval FALSE Error code
+ @retval TRUE Success
- DESCRIPTION
+ @note
Method used to create handler file with names of partitions, their
engine types and the number of partitions.
*/
@@ -2185,19 +2216,22 @@ bool ha_partition::create_handler_file(c
Array of engine types n * 4 bytes where
n = (m_tot_parts + 3)/4
Length of name part in bytes 4 bytes
+ (Names in filename format)
Name part m * 4 bytes where
m = ((length_name_part + 3)/4)*4
All padding bytes are zeroed
*/
- tot_partition_words= (tot_parts + 3) / 4;
- tot_name_words= (tot_name_len + 3) / 4;
+ tot_partition_words= (tot_parts + PAR_WORD_SIZE - 1) / PAR_WORD_SIZE;
+ tot_name_words= (tot_name_len + PAR_WORD_SIZE - 1) / PAR_WORD_SIZE;
+ /* 4 static words (tot words, checksum, tot partitions, name length) */
tot_len_words= 4 + tot_partition_words + tot_name_words;
- tot_len_byte= 4 * tot_len_words;
+ tot_len_byte= PAR_WORD_SIZE * tot_len_words;
if (!(file_buffer= (uchar *) my_malloc(tot_len_byte, MYF(MY_ZEROFILL))))
DBUG_RETURN(TRUE);
- engine_array= (file_buffer + PAR_FILE_ENGINE_OFFSET);
- name_buffer_ptr= (char*) (file_buffer + ((4 + tot_partition_words) * 4));
+ engine_array= (file_buffer + PAR_ENGINES_OFFSET);
+ name_buffer_ptr= (char*) (engine_array + tot_partition_words * PAR_WORD_SIZE
+ + PAR_WORD_SIZE);
part_it.rewind();
for (i= 0; i < num_parts; i++)
{
@@ -2235,14 +2269,15 @@ bool ha_partition::create_handler_file(c
}
chksum= 0;
int4store(file_buffer, tot_len_words);
- int4store(file_buffer + 8, tot_parts);
- int4store(file_buffer + PAR_FILE_ENGINE_OFFSET + (tot_partition_words * 4),
+ int4store(file_buffer + PAR_NUM_PARTS_OFFSET, tot_parts);
+ int4store(file_buffer + PAR_ENGINES_OFFSET +
+ (tot_partition_words * PAR_WORD_SIZE),
tot_name_len);
for (i= 0; i < tot_len_words; i++)
- chksum^= uint4korr(file_buffer + 4 * i);
- int4store(file_buffer + 4, chksum);
+ chksum^= uint4korr(file_buffer + PAR_WORD_SIZE * i);
+ int4store(file_buffer + PAR_CHECKSUM_OFFSET, chksum);
/*
- Remove .frm extension and replace with .par
+ Add .par extension to the file name.
Create and write and close file
to be used at open, delete_table and rename_table
*/
@@ -2261,14 +2296,9 @@ bool ha_partition::create_handler_file(c
DBUG_RETURN(result);
}
-/*
- Clear handler variables and free some memory
-
- SYNOPSIS
- clear_handler_file()
- RETURN VALUE
- NONE
+/**
+ Clear handler variables and free some memory
*/
void ha_partition::clear_handler_file()
@@ -2286,16 +2316,15 @@ void ha_partition::clear_handler_file()
}
}
-/*
+
+/**
Create underlying handler objects
- SYNOPSIS
- create_handlers()
- mem_root Allocate memory through this
+ @param mem_root Allocate memory through this
- RETURN VALUE
- TRUE Error
- FALSE Success
+ @return Operation status
+ @retval TRUE Error
+ @retval FALSE Success
*/
bool ha_partition::create_handlers(MEM_ROOT *mem_root)
@@ -2333,6 +2362,7 @@ bool ha_partition::create_handlers(MEM_R
DBUG_RETURN(FALSE);
}
+
/*
Create underlying handler objects from partition info
@@ -2404,109 +2434,180 @@ error_end:
}
-/*
- Get info about partition engines and their names from the .par file
+/**
+ Read the .par file to get the partitions engines and names
- SYNOPSIS
- get_from_handler_file()
- name Full path of table name
- mem_root Allocate memory through this
+ @param name Name of table file (without extention)
- RETURN VALUE
- TRUE Error
- FALSE Success
+ @return Operation status
+ @retval true Failure
+ @retval false Success
- DESCRIPTION
- Open handler file to get partition names, engine types and number of
- partitions.
+ @note On success, m_file_buffer is allocated and must be
+ freed by the caller. m_name_buffer_ptr and m_tot_parts is also set.
*/
-bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
+bool ha_partition::read_par_file(const char *name)
{
- char buff[FN_REFLEN], *address_tot_name_len;
+ char buff[FN_REFLEN], *tot_name_len_offset;
File file;
- char *file_buffer, *name_buffer_ptr;
- handlerton *first_engine;
+ char *file_buffer;
uint i, len_bytes, len_words, tot_partition_words, tot_name_words, chksum;
- enum legacy_db_type first_db_type, db_type;
- DBUG_ENTER("ha_partition::get_from_handler_file");
+ DBUG_ENTER("ha_partition::read_par_file");
DBUG_PRINT("enter", ("table name: '%s'", name));
if (m_file_buffer)
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
fn_format(buff, name, "", ha_par_ext, MY_APPEND_EXT);
/* Following could be done with mysql_file_stat to read in whole file */
if ((file= mysql_file_open(key_file_partition,
buff, O_RDONLY | O_SHARE, MYF(0))) < 0)
DBUG_RETURN(TRUE);
- if (mysql_file_read(file, (uchar *) &buff[0], 8, MYF(MY_NABP)))
+ if (mysql_file_read(file, (uchar *) &buff[0], PAR_WORD_SIZE, MYF(MY_NABP)))
goto err1;
len_words= uint4korr(buff);
- len_bytes= 4 * len_words;
+ len_bytes= PAR_WORD_SIZE * len_words;
+ if (mysql_file_seek(file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
+ goto err1;
if (!(file_buffer= (char*) my_malloc(len_bytes, MYF(0))))
goto err1;
- mysql_file_seek(file, 0, MY_SEEK_SET, MYF(0));
if (mysql_file_read(file, (uchar *) file_buffer, len_bytes, MYF(MY_NABP)))
goto err2;
chksum= 0;
for (i= 0; i < len_words; i++)
- chksum ^= uint4korr((file_buffer) + 4 * i);
+ chksum ^= uint4korr((file_buffer) + PAR_WORD_SIZE * i);
if (chksum)
goto err2;
- m_tot_parts= uint4korr((file_buffer) + 8);
+ m_tot_parts= uint4korr((file_buffer) + PAR_NUM_PARTS_OFFSET);
DBUG_PRINT("info", ("No of parts = %u", m_tot_parts));
- tot_partition_words= (m_tot_parts + 3) / 4;
- first_db_type= (enum legacy_db_type) file_buffer[PAR_FILE_ENGINE_OFFSET];
- first_engine= ha_resolve_by_legacy_type(ha_thd(), first_db_type);
- if (!first_engine)
- goto err2;
- address_tot_name_len= file_buffer + PAR_FILE_ENGINE_OFFSET +
- 4 * tot_partition_words;
- tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4;
+ tot_partition_words= (m_tot_parts + PAR_WORD_SIZE - 1) / PAR_WORD_SIZE;
+
+ tot_name_len_offset= file_buffer + PAR_ENGINES_OFFSET +
+ PAR_WORD_SIZE * tot_partition_words;
+ tot_name_words= (uint4korr(tot_name_len_offset) + PAR_WORD_SIZE - 1) /
+ PAR_WORD_SIZE;
+ /*
+ Verify the total length = tot size word, checksum word, num parts word +
+ engines array + name length word + name array.
+ */
if (len_words != (tot_partition_words + tot_name_words + 4))
goto err2;
- name_buffer_ptr= file_buffer + 16 + 4 * tot_partition_words;
(void) mysql_file_close(file, MYF(0));
m_file_buffer= file_buffer; // Will be freed in clear_handler_file()
- m_name_buffer_ptr= name_buffer_ptr;
-
+ m_name_buffer_ptr= tot_name_len_offset + PAR_WORD_SIZE;
+
+ DBUG_RETURN(false);
+
+err2:
+ my_free(file_buffer);
+err1:
+ (void) mysql_file_close(file, MYF(0));
+ DBUG_RETURN(true);
+}
+
+
+/**
+ Setup m_engine_array
+
+ @param mem_root MEM_ROOT to use for allocating new handlers
+
+ @return Operation status
+ @retval false Success
+ @retval true Failure
+*/
+
+bool ha_partition::setup_engine_array(MEM_ROOT *mem_root)
+{
+ uint i;
+ uchar *buff;
+ handlerton **engine_array, *first_engine;
+ enum legacy_db_type db_type, first_db_type;
+
+ DBUG_ASSERT(!m_file);
+ DBUG_ENTER("ha_partition::setup_engine_array");
+ engine_array= (handlerton **) my_alloca(m_tot_parts * sizeof(handlerton*));
+ if (!engine_array)
+ DBUG_RETURN(true);
+
+ buff= (uchar *) (m_file_buffer + PAR_ENGINES_OFFSET);
+ first_db_type= (enum legacy_db_type) buff[0];
+ first_engine= ha_resolve_by_legacy_type(ha_thd(), first_db_type);
+ if (!first_engine)
+ goto err;
+
if (!(m_engine_array= (plugin_ref*)
my_malloc(m_tot_parts * sizeof(plugin_ref), MYF(MY_WME))))
- goto err2;
+ goto err;
for (i= 0; i < m_tot_parts; i++)
{
- db_type= (enum legacy_db_type) file_buffer[PAR_FILE_ENGINE_OFFSET + i];
+ db_type= (enum legacy_db_type) buff[i];
if (db_type != first_db_type)
{
DBUG_PRINT("error", ("partition %u engine %d is not same as "
"first partition %d", i, db_type,
(int) first_db_type));
DBUG_ASSERT(0);
- goto err3;
+ clear_handler_file();
+ goto err;
}
m_engine_array[i]= ha_lock_engine(NULL, first_engine);
+ if (!m_engine_array[i])
+ {
+ clear_handler_file();
+ goto err;
+ }
}
- if (!m_file && create_handlers(mem_root))
+ my_afree((gptr) engine_array);
+
+ if (create_handlers(mem_root))
{
clear_handler_file();
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
- DBUG_RETURN(FALSE);
-err3:
- plugin_unlock_list(NULL, m_engine_array, i);
- my_free(m_engine_array);
- m_engine_array= NULL;
-err2:
- my_free(file_buffer);
- m_file_buffer= NULL;
-err1:
- (void) mysql_file_close(file, MYF(0));
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(false);
+
+err:
+ my_afree((gptr) engine_array);
+ DBUG_RETURN(true);
+}
+
+
+/**
+ Get info about partition engines and their names from the .par file
+
+ @param name Full path of table name
+ @param mem_root Allocate memory through this
+ @param is_clone If it is a clone, don't create new handlers
+
+ @return Operation status
+ @retval true Error
+ @retval false Success
+
+ @note Open handler file to get partition names, engine types and number of
+ partitions.
+*/
+
+bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root,
+ bool is_clone)
+{
+ DBUG_ENTER("ha_partition::get_from_handler_file");
+ DBUG_PRINT("enter", ("table name: '%s'", name));
+
+ if (m_file_buffer)
+ DBUG_RETURN(false);
+
+ if (read_par_file(name))
+ DBUG_RETURN(true);
+
+ if (!is_clone && setup_engine_array(mem_root))
+ DBUG_RETURN(true);
+
+ DBUG_RETURN(false);
}
@@ -2648,13 +2749,13 @@ void ha_data_partition_destroy(HA_DATA_P
int ha_partition::open(const char *name, int mode, uint test_if_locked)
{
- char *name_buffer_ptr= m_name_buffer_ptr;
- int error;
+ char *name_buffer_ptr;
+ int error= HA_ERR_INITIALIZATION;
uint alloc_len;
handler **file;
char name_buff[FN_REFLEN];
bool is_not_tmp_table= (table_share->tmp_table == NO_TMP_TABLE);
- ulonglong check_table_flags= 0;
+ ulonglong check_table_flags;
DBUG_ENTER("ha_partition::open");
DBUG_ASSERT(table->s == table_share);
@@ -2662,8 +2763,9 @@ int ha_partition::open(const char *name,
m_mode= mode;
m_open_test_lock= test_if_locked;
m_part_field_array= m_part_info->full_part_field_array;
- if (get_from_handler_file(name, &table->mem_root))
- DBUG_RETURN(1);
+ if (get_from_handler_file(name, &table->mem_root, test(m_is_clone_of)))
+ DBUG_RETURN(error);
+ name_buffer_ptr= m_name_buffer_ptr;
m_start_key.length= 0;
m_rec0= table->record[0];
m_rec_length= table_share->reclength;
@@ -2673,7 +2775,7 @@ int ha_partition::open(const char *name,
{
if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
{
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
{
/*
@@ -2696,57 +2798,96 @@ int ha_partition::open(const char *name,
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
bitmap_clear_all(&m_bulk_insert_started);
/* Initialize the bitmap we use to keep track of locked partitions */
if (bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
{
bitmap_free(&m_bulk_insert_started);
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
bitmap_clear_all(&m_locked_partitions);
/* Initialize the bitmap we use to determine what partitions are locked */
DBUG_ASSERT(m_part_info);
/* Initialize the bitmap for used partitions */
- if (!is_clone)
+ if (!m_is_clone_of)
{
+ DBUG_ASSERT(!m_clone_mem_root);
if (m_part_info->set_partition_bitmaps(NULL))
{
bitmap_free(&m_bulk_insert_started);
bitmap_free(&m_locked_partitions);
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
}
+ if (m_is_clone_of)
+ {
+ uint i;
+ DBUG_ASSERT(m_clone_mem_root);
+ /* Allocate an array of handler pointers for the partitions handlers. */
+ alloc_len= (m_tot_parts + 1) * sizeof(handler*);
+ if (!(m_file= (handler **) alloc_root(m_clone_mem_root, alloc_len)))
+ {
+ error= HA_ERR_INITIALIZATION;
+ goto err_alloc;
+ }
+ memset(m_file, 0, alloc_len);
+ /*
+ Populate them by cloning the original partitions. This also opens them.
+ Note that file->ref is allocated too.
+ */
+ file= m_is_clone_of->m_file;
+ for (i= 0; i < m_tot_parts; i++)
+ {
+ create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME,
+ FALSE);
+ if (!(m_file[i]= file[i]->clone(name_buff, m_clone_mem_root)))
+ {
+ error= HA_ERR_INITIALIZATION;
+ file= &m_file[i];
+ goto err_handler;
+ }
+ name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
+ }
+ }
+ else
+ {
+ file= m_file;
+ do
+ {
+ create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME,
+ FALSE);
+ if ((error= (*file)->ha_open(table, name_buff, mode, test_if_locked)))
+ goto err_handler;
+ m_num_locks+= (*file)->lock_count();
+ name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
+ } while (*(++file));
+ }
+
file= m_file;
- do
+ ref_length= (*file)->ref_length;
+ check_table_flags= (((*file)->ha_table_flags() &
+ ~(PARTITION_DISABLED_TABLE_FLAGS)) |
+ (PARTITION_ENABLED_TABLE_FLAGS));
+ while (*(++file))
{
- create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME,
- FALSE);
- if ((error= (*file)->ha_open(table, (const char*) name_buff, mode,
- test_if_locked)))
- goto err_handler;
- m_num_locks+= (*file)->lock_count();
- name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
+ DBUG_ASSERT(ref_length >= (*file)->ref_length);
set_if_bigger(ref_length, ((*file)->ref_length));
/*
Verify that all partitions have the same set of table flags.
Mask all flags that partitioning enables/disables.
*/
- if (!check_table_flags)
- {
- check_table_flags= (((*file)->ha_table_flags() &
- ~(PARTITION_DISABLED_TABLE_FLAGS)) |
- (PARTITION_ENABLED_TABLE_FLAGS));
- }
- else if (check_table_flags != (((*file)->ha_table_flags() &
- ~(PARTITION_DISABLED_TABLE_FLAGS)) |
- (PARTITION_ENABLED_TABLE_FLAGS)))
+ if (check_table_flags != (((*file)->ha_table_flags() &
+ ~(PARTITION_DISABLED_TABLE_FLAGS)) |
+ (PARTITION_ENABLED_TABLE_FLAGS)))
{
error= HA_ERR_INITIALIZATION;
+ /* set file to last handler, so all of them are closed */
+ file = &m_file[m_tot_parts - 1];
goto err_handler;
}
- } while (*(++file));
+ }
key_used_on_scan= m_file[0]->key_used_on_scan;
implicit_emptied= m_file[0]->implicit_emptied;
/*
@@ -2755,6 +2896,7 @@ int ha_partition::open(const char *name,
*/
ref_length+= PARTITION_BYTES_IN_POS;
m_ref_length= ref_length;
+
/*
Release buffer read from .par file. It will not be reused again after
being opened once.
@@ -2818,24 +2960,53 @@ err_handler:
DEBUG_SYNC(ha_thd(), "partition_open_error");
while (file-- != m_file)
(*file)->ha_close();
+err_alloc:
bitmap_free(&m_bulk_insert_started);
bitmap_free(&m_locked_partitions);
DBUG_RETURN(error);
}
-handler *ha_partition::clone(MEM_ROOT *mem_root)
+
+/**
+ Clone the open and locked partitioning handler.
+
+ @param mem_root MEM_ROOT to use.
+
+ @return Pointer to the successfully created clone or NULL
+
+ @details
+ This function creates a new ha_partition handler as a clone/copy. The
+ original (this) must already be opened and locked. The clone will use
+ the originals m_part_info.
+ It also allocates memory for ref + ref_dup.
+ In ha_partition::open() it will clone its original handlers partitions
+ which will allocate then on the correct MEM_ROOT and also open them.
+*/
+
+handler *ha_partition::clone(const char *name, MEM_ROOT *mem_root)
{
- handler *new_handler= get_new_handler(table->s, mem_root,
- table->s->db_type());
- ((ha_partition*)new_handler)->m_part_info= m_part_info;
- ((ha_partition*)new_handler)->is_clone= TRUE;
- if (new_handler && !new_handler->ha_open(table,
- table->s->normalized_path.str,
- table->db_stat,
- HA_OPEN_IGNORE_IF_LOCKED))
- return new_handler;
- return NULL;
+ ha_partition *new_handler;
+
+ DBUG_ENTER("ha_partition::clone");
+ new_handler= new (mem_root) ha_partition(ht, table_share, m_part_info,
+ this, mem_root);
+ /*
+ Allocate new_handler->ref here because otherwise ha_open will allocate it
+ on this->table->mem_root and we will not be able to reclaim that memory
+ when the clone handler object is destroyed.
+ */
+ if (new_handler &&
+ !(new_handler->ref= (uchar*) alloc_root(mem_root,
+ ALIGN_SIZE(m_ref_length)*2)))
+ new_handler= NULL;
+
+ if (new_handler &&
+ new_handler->ha_open(table, name,
+ table->db_stat, HA_OPEN_IGNORE_IF_LOCKED))
+ new_handler= NULL;
+
+ DBUG_RETURN((handler*) new_handler);
}
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h revid:kevin.lewis@stripped
+++ b/sql/ha_partition.h revid:vasil.dimov@stripped
@@ -37,6 +37,16 @@ enum partition_keywords
HA_DUPLICATE_POS | \
HA_CAN_SQL_HANDLER | \
HA_CAN_INSERT_DELAYED)
+
+/* First 4 bytes in the .par file is the number of 32-bit words in the file */
+#define PAR_WORD_SIZE 4
+/* offset to the .par file checksum */
+#define PAR_CHECKSUM_OFFSET 4
+/* offset to the total number of partitions */
+#define PAR_NUM_PARTS_OFFSET 8
+/* offset to the engines array */
+#define PAR_ENGINES_OFFSET 12
+
class ha_partition :public handler
{
private:
@@ -53,7 +63,7 @@ private:
/* Data for the partition handler */
int m_mode; // Open mode
uint m_open_test_lock; // Open test_if_locked
- char *m_file_buffer; // Buffer with names
+ char *m_file_buffer; // Content of the .par file
char *m_name_buffer_ptr; // Pointer to first partition name
plugin_ref *m_engine_array; // Array of types of the handlers
handler **m_file; // Array of references to handler inst.
@@ -115,6 +125,13 @@ private:
bool m_is_sub_partitioned; // Is subpartitioned
bool m_ordered_scan_ongoing;
+ /*
+ If set, this object was created with ha_partition::clone and doesn't
+ "own" the m_part_info structure.
+ */
+ ha_partition *m_is_clone_of;
+ MEM_ROOT *m_clone_mem_root;
+
/*
We keep track if all underlying handlers are MyISAM since MyISAM has a
great number of extra flags not needed by other handlers.
@@ -148,11 +165,6 @@ private:
*/
THR_LOCK_DATA lock; /* MySQL lock */
- /*
- TRUE <=> this object was created with ha_partition::clone and doesn't
- "own" the m_part_info structure.
- */
- bool is_clone;
bool auto_increment_lock; /**< lock reading/updating auto_inc */
/**
Flag to keep the auto_increment lock through out the statement.
@@ -167,7 +179,7 @@ private:
/** keep track of locked partitions */
MY_BITMAP m_locked_partitions;
public:
- handler *clone(MEM_ROOT *mem_root);
+ handler *clone(const char *name, MEM_ROOT *mem_root);
virtual void set_part_info(partition_info *part_info, bool early)
{
m_part_info= part_info;
@@ -186,6 +198,10 @@ public:
*/
ha_partition(handlerton *hton, TABLE_SHARE * table);
ha_partition(handlerton *hton, partition_info * part_info);
+ ha_partition(handlerton *hton, TABLE_SHARE *share,
+ partition_info *part_info_arg,
+ ha_partition *clone_arg,
+ MEM_ROOT *clone_mem_root_arg);
~ha_partition();
/*
A partition handler has no characteristics in itself. It only inherits
@@ -255,7 +271,10 @@ private:
And one method to read it in.
*/
bool create_handler_file(const char *name);
- bool get_from_handler_file(const char *name, MEM_ROOT *mem_root);
+ bool setup_engine_array(MEM_ROOT *mem_root);
+ bool read_par_file(const char *name);
+ bool get_from_handler_file(const char *name, MEM_ROOT *mem_root,
+ bool is_clone);
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
bool create_handlers(MEM_ROOT *mem_root);
void clear_handler_file();
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc revid:kevin.lewis@stripped
+++ b/sql/handler.cc revid:vasil.dimov@stripped
@@ -2080,7 +2080,7 @@ int ha_delete_table(THD *thd, handlerton
}
delete file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely((error == 0) && (PSI_server != NULL)))
PSI_server->drop_table_share(db, strlen(db), alias, strlen(alias));
#endif
@@ -2091,22 +2091,29 @@ int ha_delete_table(THD *thd, handlerton
/****************************************************************************
** General handler functions
****************************************************************************/
-handler *handler::clone(MEM_ROOT *mem_root)
+handler *handler::clone(const char *name, MEM_ROOT *mem_root)
{
- handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
+ handler *new_handler= get_new_handler(table->s, mem_root, ht);
/*
Allocate handler->ref here because otherwise ha_open will allocate it
on this->table->mem_root and we will not be able to reclaim that memory
when the clone handler object is destroyed.
*/
- if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2)))
- return NULL;
- if (new_handler && !new_handler->ha_open(table,
- table->s->normalized_path.str,
- table->db_stat,
- HA_OPEN_IGNORE_IF_LOCKED))
- return new_handler;
- return NULL;
+ if (new_handler &&
+ !(new_handler->ref= (uchar*) alloc_root(mem_root,
+ ALIGN_SIZE(ref_length)*2)))
+ new_handler= NULL;
+ /*
+ TODO: Implement a more efficient way to have more than one index open for
+ the same table instance. The ha_open call is not cachable for clone.
+ */
+ if (new_handler && new_handler->ha_open(table,
+ name,
+ table->db_stat,
+ HA_OPEN_IGNORE_IF_LOCKED))
+ new_handler= NULL;
+
+ return new_handler;
}
@@ -2173,7 +2180,7 @@ int handler::ha_open(TABLE *table_arg, c
{
DBUG_ASSERT(m_psi == NULL);
DBUG_ASSERT(table_share != NULL);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server != NULL))
{
PSI_table_share *share_psi= ha_table_share_psi(table_share);
@@ -2202,7 +2209,7 @@ int handler::ha_open(TABLE *table_arg, c
int handler::ha_close(void)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server && m_psi))
{
PSI_server->close_table(m_psi);
@@ -3894,7 +3901,7 @@ int ha_create_table(THD *thd, const char
if (open_table_def(thd, &share, 0))
goto err;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server != NULL))
{
my_bool temp= (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE);
@@ -3973,7 +3980,7 @@ int ha_create_table_from_engine(THD* thd
DBUG_RETURN(3);
}
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
/*
Table discovery is not instrumented.
Once discovered, the table will be opened normally,
@@ -4818,7 +4825,7 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
DBUG_ASSERT(h->active_index != MAX_KEY);
uint mrr_keyno= h->active_index;
- if (!(new_h2= h->clone(thd->mem_root)) ||
+ if (!(new_h2= h->clone(h->table->s->normalized_path.str, thd->mem_root)) ||
new_h2->ha_external_lock(thd, h->m_lock_type))
{
delete new_h2;
=== modified file 'sql/handler.h'
--- a/sql/handler.h revid:kevin.lewis@stripped
+++ b/sql/handler.h revid:vasil.dimov@stripped
@@ -1530,7 +1530,7 @@ public:
DBUG_ASSERT(m_lock_type == F_UNLCK);
DBUG_ASSERT(inited == NONE);
}
- virtual handler *clone(MEM_ROOT *mem_root);
+ virtual handler *clone(const char *name, MEM_ROOT *mem_root);
/** This is called after create to allow us to set up cached variables */
void init()
{
@@ -1804,9 +1804,12 @@ public:
}
/**
@brief
- Positions an index cursor to the index specified in the handle. Fetches the
- row if available. If the key value is null, begin at the first key of the
- index.
+ Positions an index cursor to the index specified in the handle
+ ('active_index'). Fetches the row if available. If the key value is null,
+ begin at the first key of the index.
+ @returns 0 if success (found a record, and function has set table->status
+ to 0); non-zero if no record (function has set table->status to
+ STATUS_NOT_FOUND).
*/
virtual int index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
@@ -1818,27 +1821,34 @@ public:
protected:
/**
@brief
- Positions an index cursor to the index specified in the handle. Fetches the
- row if available. If the key value is null, begin at the first key of the
- index.
+ Positions an index cursor to the index specified in argument. Fetches
+ the row if available. If the key value is null, begin at the first key of
+ the index.
+ @returns @see index_read_map().
*/
virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
+ /// @returns @see index_read_map().
virtual int index_next(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
+ /// @returns @see index_read_map().
virtual int index_prev(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
+ /// @returns @see index_read_map().
virtual int index_first(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
+ /// @returns @see index_read_map().
virtual int index_last(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
public:
+ /// @returns @see index_read_map().
virtual int index_next_same(uchar *buf, const uchar *key, uint keylen);
/**
@brief
The following functions works like index_read, but it find the last
row with the current key value or prefix.
+ @returns @see index_read_map().
*/
virtual int index_read_last_map(uchar * buf, const uchar * key,
key_part_map keypart_map)
@@ -1858,7 +1868,9 @@ public:
{ return NULL; }
virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; }
protected:
+ /// @returns @see index_read_map().
virtual int rnd_next(uchar *buf)=0;
+ /// @returns @see index_read_map().
virtual int rnd_pos(uchar * buf, uchar *pos)=0;
public:
/**
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc revid:kevin.lewis@stripped
+++ b/sql/item_cmpfunc.cc revid:vasil.dimov@stripped
@@ -426,7 +426,8 @@ static bool convert_constant_item(THD *t
*/
bool save_field_value= (field_item->depended_from &&
(field_item->const_item() ||
- !(field->table->status & STATUS_NO_RECORD)));
+ !(field->table->status &
+ (STATUS_GARBAGE | STATUS_NOT_FOUND))));
if (save_field_value)
orig_field_val= field->val_int();
if (!(*item)->is_null() && !(*item)->save_in_field(field, 1))
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc revid:kevin.lewis@stripped
+++ b/sql/item_func.cc revid:vasil.dimov@stripped
@@ -3658,14 +3658,10 @@ static PSI_mutex_info all_user_mutexes[]
static void init_user_lock_psi_keys(void)
{
- const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_user_mutexes);
- PSI_server->register_mutex(category, all_user_mutexes, count);
+ mysql_mutex_register("sql", all_user_mutexes, count);
}
#endif
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc revid:kevin.lewis@stripped
+++ b/sql/item_timefunc.cc revid:vasil.dimov@stripped
@@ -665,7 +665,7 @@ bool make_date_time(DATE_TIME_FORMAT *fo
system_charset_info);
break;
case 'W':
- if (type == MYSQL_TIMESTAMP_TIME)
+ if (type == MYSQL_TIMESTAMP_TIME || !(l_time->month || l_time->year))
return 1;
weekday= calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0);
@@ -674,7 +674,7 @@ bool make_date_time(DATE_TIME_FORMAT *fo
system_charset_info);
break;
case 'a':
- if (type == MYSQL_TIMESTAMP_TIME)
+ if (type == MYSQL_TIMESTAMP_TIME || !(l_time->month || l_time->year))
return 1;
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0);
@@ -833,7 +833,7 @@ bool make_date_time(DATE_TIME_FORMAT *fo
}
break;
case 'w':
- if (type == MYSQL_TIMESTAMP_TIME)
+ if (type == MYSQL_TIMESTAMP_TIME || !(l_time->month || l_time->year))
return 1;
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),1);
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc revid:kevin.lewis@stripped
+++ b/sql/mdl.cc revid:vasil.dimov@stripped
@@ -51,20 +51,16 @@ static PSI_cond_info all_mdl_conds[]=
*/
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);
+ mysql_mutex_register("sql", all_mdl_mutexes, count);
count= array_elements(all_mdl_rwlocks);
- PSI_server->register_rwlock(category, all_mdl_rwlocks, count);
+ mysql_rwlock_register("sql", all_mdl_rwlocks, count);
count= array_elements(all_mdl_conds);
- PSI_server->register_cond(category, all_mdl_conds, count);
+ mysql_cond_register("sql", all_mdl_conds, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc revid:kevin.lewis@stripped
+++ b/sql/mysqld.cc revid:vasil.dimov@stripped
@@ -2073,7 +2073,7 @@ static bool cache_thread()
DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Delete the instrumentation for the job that just completed,
before parking this pthread in the cache (blocked on COND_thread_cache).
@@ -2095,7 +2095,7 @@ static bool cache_thread()
thd->thread_stack= (char*) &thd; // For store_globals
(void) thd->store_globals();
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Create new instrumentation for the new THD job,
and attach it to this running pthread.
@@ -2734,7 +2734,7 @@ pthread_handler_t signal_hand(void *arg
if (!abort_loop)
{
abort_loop=1; // mark abort for threads
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
/* Delete the instrumentation for the signal thread */
if (likely(PSI_server != NULL))
PSI_server->delete_current_thread();
@@ -4939,7 +4939,7 @@ int mysqld_main(int argc, char **argv)
#endif
#endif /* __WIN__ */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Disable the main thread instrumentation,
to avoid recording events during the shutdown.
@@ -8513,35 +8513,34 @@ void init_server_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_server_mutexes);
- PSI_server->register_mutex(category, all_server_mutexes, count);
+ mysql_mutex_register(category, all_server_mutexes, count);
count= array_elements(all_server_rwlocks);
- PSI_server->register_rwlock(category, all_server_rwlocks, count);
+ mysql_rwlock_register(category, all_server_rwlocks, count);
count= array_elements(all_server_conds);
- PSI_server->register_cond(category, all_server_conds, count);
+ mysql_cond_register(category, all_server_conds, count);
count= array_elements(all_server_threads);
- PSI_server->register_thread(category, all_server_threads, count);
+ mysql_thread_register(category, all_server_threads, count);
count= array_elements(all_server_files);
- PSI_server->register_file(category, all_server_files, count);
+ mysql_file_register(category, all_server_files, count);
count= array_elements(all_server_stages);
- PSI_server->register_stage(category, all_server_stages, count);
+ mysql_stage_register(category, all_server_stages, count);
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
init_sql_statement_info();
count= array_elements(sql_statement_info);
- PSI_server->register_statement(category, sql_statement_info, count);
+ mysql_statement_register(category, sql_statement_info, count);
category= "com";
init_com_statement_info();
count= array_elements(com_statement_info);
- PSI_server->register_statement(category, com_statement_info, count);
+ mysql_statement_register(category, com_statement_info, count);
+#endif
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h revid:kevin.lewis@stripped
+++ b/sql/mysqld.h revid:vasil.dimov@stripped
@@ -79,7 +79,7 @@ void set_remaining_args(int argc, char *
int init_common_variables();
void my_init_signals();
-extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
+extern "C" MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *table_alias_charset;
@@ -197,7 +197,8 @@ extern my_bool opt_slave_sql_verify_chec
extern ulong thread_cache_size;
extern ulong back_log;
extern char language[FN_REFLEN];
-extern ulong server_id, concurrency;
+extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
+extern ulong concurrency;
extern time_t server_start_time, flush_status_time;
extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
extern int mysql_unpacked_real_data_home_len;
@@ -218,8 +219,8 @@ extern handlerton *heap_hton;
extern const char *load_default_groups[];
extern struct my_option my_long_options[];
extern int mysqld_server_started;
-extern int orig_argc;
-extern char **orig_argv;
+extern "C" MYSQL_PLUGIN_IMPORT int orig_argc;
+extern "C" MYSQL_PLUGIN_IMPORT char **orig_argv;
extern pthread_attr_t connection_attrib;
extern MYSQL_FILE *bootstrap_file;
extern my_bool old_mode;
@@ -430,7 +431,7 @@ extern uint mysql_real_data_home_len;
extern const char *mysql_real_data_home_ptr;
extern ulong thread_handling;
extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
-extern char server_version[SERVER_VERSION_LENGTH];
+extern "C" MYSQL_PLUGIN_IMPORT char server_version[SERVER_VERSION_LENGTH];
extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[];
extern char mysql_unpacked_real_data_home[];
extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables;
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc revid:kevin.lewis@stripped
+++ b/sql/opt_range.cc revid:vasil.dimov@stripped
@@ -1420,7 +1420,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_
}
thd= head->in_use;
- if (!(file= head->file->clone(thd->mem_root)))
+ if (!(file= head->file->clone(head->s->normalized_path.str, thd->mem_root)))
{
/*
Manually set the error flag. Note: there seems to be quite a few
=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc revid:kevin.lewis@stripped
+++ b/sql/rpl_master.cc revid:vasil.dimov@stripped
@@ -75,14 +75,10 @@ static PSI_mutex_info all_slave_list_mut
static void init_all_slave_list_mutexes(void)
{
- const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_slave_list_mutexes);
- PSI_server->register_mutex(category, all_slave_list_mutexes, count);
+ mysql_mutex_register("sql", all_slave_list_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc revid:kevin.lewis@stripped
+++ b/sql/rpl_slave.cc revid:vasil.dimov@stripped
@@ -245,11 +245,8 @@ static void init_slave_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_slave_threads);
- PSI_server->register_thread(category, all_slave_threads, count);
+ mysql_thread_register(category, all_slave_threads, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc revid:kevin.lewis@stripped
+++ b/sql/sp.cc revid:vasil.dimov@stripped
@@ -1696,7 +1696,8 @@ sp_find_routine(THD *thd, int type, sp_n
@param thd Thread handler
@param routines List of needles in the hay stack
- @param any Any of the needles are good enough
+ @param is_proc Indicates whether routines in the list are procedures
+ or functions.
@return
@retval FALSE Found.
@@ -1704,7 +1705,7 @@ sp_find_routine(THD *thd, int type, sp_n
*/
bool
-sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
+sp_exist_routines(THD *thd, TABLE_LIST *routines, bool is_proc)
{
TABLE_LIST *routine;
bool sp_object_found;
@@ -1720,17 +1721,14 @@ sp_exist_routines(THD *thd, TABLE_LIST *
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name, true);
name->init_qname(thd);
- sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
- &thd->sp_proc_cache, FALSE) != NULL ||
- sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
- &thd->sp_func_cache, FALSE) != NULL;
+ sp_object_found= is_proc ? sp_find_routine(thd, TYPE_ENUM_PROCEDURE,
+ name, &thd->sp_proc_cache,
+ FALSE) != NULL :
+ sp_find_routine(thd, TYPE_ENUM_FUNCTION,
+ name, &thd->sp_func_cache,
+ FALSE) != NULL;
thd->warning_info->clear_warning_info(thd->query_id);
- if (sp_object_found)
- {
- if (any)
- break;
- }
- else if (!any)
+ if (! sp_object_found)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
routine->table_name);
=== modified file 'sql/sp.h'
--- a/sql/sp.h revid:kevin.lewis@stripped
+++ b/sql/sp.h revid:vasil.dimov@stripped
@@ -110,7 +110,7 @@ sp_cache_routine(THD *thd, int type, sp_
bool lookup_only, sp_head **sp);
bool
-sp_exist_routines(THD *thd, TABLE_LIST *procs, bool any);
+sp_exist_routines(THD *thd, TABLE_LIST *procs, bool is_proc);
bool
sp_show_create_routine(THD *thd, int type, sp_name *name);
=== modified file 'sql/sp_cache.cc'
--- a/sql/sp_cache.cc revid:kevin.lewis@stripped
+++ b/sql/sp_cache.cc revid:vasil.dimov@stripped
@@ -75,11 +75,8 @@ static void init_sp_cache_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_sp_cache_mutexes);
- PSI_server->register_mutex(category, all_sp_cache_mutexes, count);
+ mysql_mutex_register(category, all_sp_cache_mutexes, count);
}
#endif
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc revid:kevin.lewis@stripped
+++ b/sql/sql_acl.cc revid:vasil.dimov@stripped
@@ -9464,8 +9464,8 @@ acl_authenticate(THD *thd, uint connect_
thd->net.skip_big_packet= TRUE;
#endif
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ if (likely(PSI_server != NULL))
{
PSI_server->set_thread_user_host(thd->main_security_ctx.user,
strlen(thd->main_security_ctx.user),
=== modified file 'sql/sql_audit.cc'
--- a/sql/sql_audit.cc revid:kevin.lewis@stripped
+++ b/sql/sql_audit.cc revid:vasil.dimov@stripped
@@ -290,11 +290,8 @@ static void init_audit_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_audit_mutexes);
- PSI_server->register_mutex(category, all_audit_mutexes, count);
+ mysql_mutex_register(category, all_audit_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc revid:kevin.lewis@stripped
+++ b/sql/sql_base.cc revid:vasil.dimov@stripped
@@ -116,11 +116,8 @@ static void init_tdc_psi_keys(void)
const char *category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_tdc_mutexes);
- PSI_server->register_mutex(category, all_tdc_mutexes, count);
+ mysql_mutex_register(category, all_tdc_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
@@ -549,7 +546,7 @@ TABLE_SHARE *get_table_share(THD *thd, T
}
share->ref_count++; // Mark in use
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server != NULL))
share->m_psi= PSI_server->get_table_share(false, share);
#endif
@@ -5896,7 +5893,7 @@ TABLE *open_table_uncached(THD *thd, con
DBUG_RETURN(0);
}
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server != NULL))
share->m_psi= PSI_server->get_table_share(true, share);
#endif
=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h revid:kevin.lewis@stripped
+++ b/sql/sql_base.h revid:vasil.dimov@stripped
@@ -318,7 +318,7 @@ inline void setup_table_map(TABLE *table
table->used_fields= 0;
table->const_table= 0;
table->null_row= 0;
- table->status= STATUS_NO_RECORD;
+ table->status= STATUS_GARBAGE | STATUS_NOT_FOUND;
table->maybe_null= table_list->outer_join;
TABLE_LIST *embedding= table_list->embedding;
while (!table->maybe_null && embedding)
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc revid:kevin.lewis@stripped
+++ b/sql/sql_class.cc revid:vasil.dimov@stripped
@@ -260,8 +260,8 @@ const char *set_thd_proc_info(void *thd_
thd->profiling.status_change(info, calling_function, basename, calling_line);
#endif
thd->proc_info= info;
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ if (likely(PSI_server != NULL))
PSI_server->set_thread_state(info);
#endif
return old_info;
@@ -3540,8 +3540,8 @@ void THD::inc_examined_row_count(ha_rows
void THD::inc_status_created_tmp_disk_tables()
{
status_var_increment(status_var.created_tmp_disk_tables);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_created_tmp_disk_tables(m_statement_psi, 1);
#endif
}
@@ -3549,8 +3549,8 @@ void THD::inc_status_created_tmp_disk_ta
void THD::inc_status_created_tmp_tables()
{
status_var_increment(status_var.created_tmp_tables);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_created_tmp_tables(m_statement_psi, 1);
#endif
}
@@ -3558,8 +3558,8 @@ void THD::inc_status_created_tmp_tables(
void THD::inc_status_select_full_join()
{
status_var_increment(status_var.select_full_join_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_select_full_join(m_statement_psi, 1);
#endif
}
@@ -3567,8 +3567,8 @@ void THD::inc_status_select_full_join()
void THD::inc_status_select_full_range_join()
{
status_var_increment(status_var.select_full_range_join_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_select_full_range_join(m_statement_psi, 1);
#endif
}
@@ -3576,8 +3576,8 @@ void THD::inc_status_select_full_range_j
void THD::inc_status_select_range()
{
status_var_increment(status_var.select_range_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_select_range(m_statement_psi, 1);
#endif
}
@@ -3585,8 +3585,8 @@ void THD::inc_status_select_range()
void THD::inc_status_select_range_check()
{
status_var_increment(status_var.select_range_check_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_select_range_check(m_statement_psi, 1);
#endif
}
@@ -3594,8 +3594,8 @@ void THD::inc_status_select_range_check(
void THD::inc_status_select_scan()
{
status_var_increment(status_var.select_scan_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_select_scan(m_statement_psi, 1);
#endif
}
@@ -3603,8 +3603,8 @@ void THD::inc_status_select_scan()
void THD::inc_status_sort_merge_passes()
{
status_var_increment(status_var.filesort_merge_passes);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_sort_merge_passes(m_statement_psi, 1);
#endif
}
@@ -3612,8 +3612,8 @@ void THD::inc_status_sort_merge_passes()
void THD::inc_status_sort_range()
{
status_var_increment(status_var.filesort_range_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_sort_range(m_statement_psi, 1);
#endif
}
@@ -3621,8 +3621,8 @@ void THD::inc_status_sort_range()
void THD::inc_status_sort_rows(ha_rows count)
{
statistic_add(status_var.filesort_rows, count, &LOCK_status);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_sort_rows(m_statement_psi, count);
#endif
}
@@ -3630,8 +3630,8 @@ void THD::inc_status_sort_rows(ha_rows c
void THD::inc_status_sort_scan()
{
status_var_increment(status_var.filesort_scan_count);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->inc_statement_sort_scan(m_statement_psi, 1);
#endif
}
@@ -3639,8 +3639,8 @@ void THD::inc_status_sort_scan()
void THD::set_status_no_index_used()
{
server_status|= SERVER_QUERY_NO_INDEX_USED;
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->set_statement_no_index_used(m_statement_psi);
#endif
}
@@ -3648,8 +3648,8 @@ void THD::set_status_no_index_used()
void THD::set_status_no_good_index_used()
{
server_status|= SERVER_QUERY_NO_GOOD_INDEX_USED;
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ if (likely(PSI_server && m_statement_psi))
PSI_server->set_statement_no_good_index_used(m_statement_psi);
#endif
}
@@ -3657,8 +3657,8 @@ void THD::set_status_no_good_index_used(
void THD::set_command(enum enum_server_command command)
{
m_command= command;
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ if (likely(PSI_server != NULL))
PSI_server->set_thread_command(m_command);
#endif
}
@@ -3672,8 +3672,8 @@ void THD::set_query(const CSET_STRING &s
set_query_inner(string_arg);
mysql_mutex_unlock(&LOCK_thd_data);
-#ifdef HAVE_PSI_INTERFACE
- if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ if (likely(PSI_server != NULL))
PSI_server->set_thread_info(query(), query_length());
#endif
}
@@ -3808,11 +3808,8 @@ static void init_xid_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_xid_mutexes);
- PSI_server->register_mutex(category, all_xid_mutexes, count);
+ mysql_mutex_register(category, all_xid_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc revid:kevin.lewis@stripped
+++ b/sql/sql_db.cc revid:vasil.dimov@stripped
@@ -128,11 +128,8 @@ static void init_database_names_psi_keys
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_database_names_rwlocks);
- PSI_server->register_rwlock(category, all_database_names_rwlocks, count);
+ mysql_rwlock_register(category, all_database_names_rwlocks, count);
}
#endif
=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc revid:kevin.lewis@stripped
+++ b/sql/sql_join_cache.cc revid:vasil.dimov@stripped
@@ -1757,7 +1757,6 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
{
uint cnt;
int error;
- JOIN_TAB *tab;
READ_RECORD *info;
enum_nested_loop_state rc= NESTED_LOOP_OK;
SQL_SELECT *select= join_tab->cache_select;
@@ -1781,18 +1780,9 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
/* A dynamic range access was used last. Clean up after it */
join_tab->select->set_quick(NULL);
- for (tab= join->join_tab; tab != join_tab ; tab++)
- {
- tab->status= tab->table->status;
- tab->table->status= 0;
- }
-
/* Start retrieving all records of the joined table */
if ((error= join_init_read_record(join_tab)))
- {
- rc= error < 0 ? NESTED_LOOP_NO_MORE_ROWS: NESTED_LOOP_ERROR;
- goto finish;
- }
+ return error < 0 ? NESTED_LOOP_NO_MORE_ROWS: NESTED_LOOP_ERROR;
info= &join_tab->read_record;
do
@@ -1804,8 +1794,7 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
- rc= NESTED_LOOP_KILLED;
- goto finish;
+ return NESTED_LOOP_KILLED;
}
/*
@@ -1819,10 +1808,7 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
(!select->skip_record(join->thd, &skip_record) &&
!skip_record));
if (select && join->thd->is_error())
- {
- rc= NESTED_LOOP_ERROR;
- goto finish;
- }
+ return NESTED_LOOP_ERROR;
if (consider_record)
{
/* Prepare to read records from the join buffer */
@@ -1840,7 +1826,7 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
get_record();
rc= generate_full_extensions(get_curr_rec());
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
- goto finish;
+ return rc;
}
}
}
@@ -1849,9 +1835,6 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
if (error > 0) // Fatal error
rc= NESTED_LOOP_ERROR;
-finish:
- for (tab= join->join_tab; tab != join_tab ; tab++)
- tab->table->status= tab->status;
return rc;
}
@@ -2292,7 +2275,7 @@ enum_nested_loop_state JOIN_CACHE_BKA::j
rc= init_join_matching_records(&seq_funcs, records);
if (rc != NESTED_LOOP_OK)
- goto finish;
+ return rc;
while (!(error= file->multi_range_read_next((char **) &rec_ptr)))
{
@@ -2300,8 +2283,7 @@ enum_nested_loop_state JOIN_CACHE_BKA::j
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
- rc= NESTED_LOOP_KILLED;
- goto finish;
+ return NESTED_LOOP_KILLED;
}
if (join_tab->keep_current_rowid)
join_tab->table->file->position(join_tab->table->record[0]);
@@ -2316,14 +2298,13 @@ enum_nested_loop_state JOIN_CACHE_BKA::j
get_record_by_pos(rec_ptr);
rc= generate_full_extensions(rec_ptr);
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
- goto finish;
+ return rc;
}
}
if (error > 0 && error != HA_ERR_END_OF_FILE)
return NESTED_LOOP_ERROR;
-finish:
- return end_join_matching_records(rc);
+ return rc;
}
@@ -2368,12 +2349,6 @@ JOIN_CACHE_BKA::init_join_matching_recor
/* Dynamic range access is never used with BKA */
DBUG_ASSERT(join_tab->use_quick != 2);
- for (JOIN_TAB *tab =join->join_tab; tab != join_tab ; tab++)
- {
- tab->status= tab->table->status;
- tab->table->status= 0;
- }
-
init_mrr_buff();
/*
@@ -2391,31 +2366,6 @@ JOIN_CACHE_BKA::init_join_matching_recor
/*
- Finish searching for records that match records from the join buffer
-
- SYNOPSIS
- end_join_matching_records()
- rc return code passed by the join_matching_records function
-
- DESCRIPTION
- This function perform final actions on searching for all matches for
- the records from the join buffer and building all full join extensions
- of the records with these matches.
-
- RETURN
- return code rc passed to the function as a parameter
-*/
-
-enum_nested_loop_state
-JOIN_CACHE_BKA::end_join_matching_records(enum_nested_loop_state rc)
-{
- for (JOIN_TAB *tab=join->join_tab; tab != join_tab ; tab++)
- tab->table->status= tab->status;
- return rc;
-}
-
-
-/*
Get the key built over the next record from BKA join buffer
SYNOPSIS
@@ -3185,7 +3135,7 @@ JOIN_CACHE_BKA_UNIQUE::join_matching_rec
rc= init_join_matching_records(&seq_funcs, key_entries);
if (rc != NESTED_LOOP_OK)
- goto finish;
+ return rc;
while (!(error= file->multi_range_read_next((char **) &key_chain_ptr)))
{
@@ -3220,8 +3170,7 @@ JOIN_CACHE_BKA_UNIQUE::join_matching_rec
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
- rc= NESTED_LOOP_KILLED;
- goto finish;
+ return NESTED_LOOP_KILLED;
}
/*
If only the first match is needed and it has been already found
@@ -3234,7 +3183,7 @@ JOIN_CACHE_BKA_UNIQUE::join_matching_rec
get_record_by_pos(rec_ptr);
rc= generate_full_extensions(rec_ptr);
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
- goto finish;
+ return rc;
}
}
while (next_rec_ref_ptr != last_rec_ref_ptr);
@@ -3242,8 +3191,7 @@ JOIN_CACHE_BKA_UNIQUE::join_matching_rec
if (error > 0 && error != HA_ERR_END_OF_FILE)
return NESTED_LOOP_ERROR;
-finish:
- return end_join_matching_records(rc);
+ return rc;
}
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc revid:kevin.lewis@stripped
+++ b/sql/sql_load.cc revid:vasil.dimov@stripped
@@ -1302,9 +1302,10 @@ READ_INFO::READ_INFO(File file_par, uint
String &field_term, String &line_start, String &line_term,
String &enclosed_par, int escape, bool get_it_from_net,
bool is_fifo)
- :file(file_par),escape_char(escape)
+ :file(file_par), buff_length(tot_length), escape_char(escape),
+ found_end_of_line(false), eof(false), need_end_io_cache(false),
+ error(false), line_cuted(false), found_null(false), read_charset(cs)
{
- read_charset= cs;
field_term_ptr=(char*) field_term.ptr();
field_term_length= field_term.length();
line_term_ptr=(char*) line_term.ptr();
@@ -1332,8 +1333,6 @@ READ_INFO::READ_INFO(File file_par, uint
(uchar) enclosed_par[0] : INT_MAX;
field_term_char= field_term_length ? (uchar) field_term_ptr[0] : INT_MAX;
line_term_char= line_term_length ? (uchar) line_term_ptr[0] : INT_MAX;
- error=eof=found_end_of_line=found_null=line_cuted=0;
- buff_length=tot_length;
/* Set of a stack for unget if long terminators */
@@ -1379,7 +1378,7 @@ READ_INFO::READ_INFO(File file_par, uint
READ_INFO::~READ_INFO()
{
- if (!error && need_end_io_cache)
+ if (need_end_io_cache)
::end_io_cache(&cache);
if (buffer != NULL)
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc revid:kevin.lewis@stripped
+++ b/sql/sql_parse.cc revid:vasil.dimov@stripped
@@ -911,7 +911,7 @@ static my_bool deny_updates_if_read_only
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
{
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
PSI_statement_locker_state state;
#endif
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc revid:kevin.lewis@stripped
+++ b/sql/sql_plugin.cc revid:vasil.dimov@stripped
@@ -1185,11 +1185,8 @@ static void init_plugin_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_plugin_mutexes);
- PSI_server->register_mutex(category, all_plugin_mutexes, count);
+ mysql_mutex_register(category, all_plugin_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc revid:kevin.lewis@stripped
+++ b/sql/sql_select.cc revid:vasil.dimov@stripped
@@ -3228,7 +3228,7 @@ JOIN::exec()
Item* sort_table_cond= make_cond_for_table(curr_join->tmp_having,
used_tables,
- used_tables, 0);
+ (table_map) 0, 0);
if (sort_table_cond)
{
if (!curr_table->select)
@@ -11228,7 +11228,7 @@ make_join_readinfo(JOIN *join, ulonglong
tab->cache_idx_cond= 0;
tab->sorted= sorted;
sorted= false; // only first must be sorted
- table->status=STATUS_NO_RECORD;
+ table->status= STATUS_GARBAGE | STATUS_NOT_FOUND;
pick_table_access_method (tab);
if (tab->loosescan_match_tab)
@@ -18011,7 +18011,7 @@ join_read_const_table(JOIN_TAB *tab, POS
TABLE *table=tab->table;
table->const_table=1;
table->null_row=0;
- table->status=STATUS_NO_RECORD;
+ table->status= STATUS_GARBAGE | STATUS_NOT_FOUND;
if (tab->type == JT_SYSTEM)
{
@@ -18206,7 +18206,7 @@ join_read_key2(JOIN_TAB *tab, TABLE *tab
indices on NOT NULL columns (see create_ref_for_key()).
*/
if (cmp_buffer_with_ref(tab->join->thd, table, table_ref) ||
- (table->status & (STATUS_GARBAGE | STATUS_NO_PARENT | STATUS_NULL_ROW)))
+ (table->status & (STATUS_GARBAGE | STATUS_NULL_ROW)))
{
if (table_ref->key_err)
{
@@ -19148,6 +19148,42 @@ static bool test_if_ref(Item *root_cond,
return 0; // keep test
}
+/**
+ Extract a condition that can be checked after reading given table
+
+ @param cond Condition to analyze
+ @param tables Tables for which "current field values" are available
+ @param used_table Table that we're extracting the condition for (may
+ also include PSEUDO_TABLE_BITS, and may be zero)
+ @param exclude_expensive_cond Do not push expensive conditions
+
+ @retval <>NULL Generated condition
+ @retval =NULL Already checked, OR error
+
+ @details
+ Extract the condition that can be checked after reading the table
+ specified in 'used_table', given that current-field values for tables
+ specified in 'tables' bitmap are available.
+ If 'used_table' is 0
+ - extract conditions for all tables in 'tables'.
+ - extract conditions are unrelated to any tables
+ in the same query block/level(i.e. conditions
+ which have used_tables == 0).
+
+ The function assumes that
+ - Constant parts of the condition has already been checked.
+ - Condition that could be checked for tables in 'tables' has already
+ been checked.
+
+ The function takes into account that some parts of the condition are
+ guaranteed to be true by employed 'ref' access methods (the code that
+ does this is located at the end, search down for "EQ_FUNC").
+
+ @note
+ Make sure to keep the implementations of make_cond_for_table() and
+ make_cond_after_sjm() synchronized.
+ make_cond_for_info_schema() uses similar algorithm as well.
+*/
/**
Destructively replaces a sub-condition inside a condition tree. The
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h revid:kevin.lewis@stripped
+++ b/sql/sql_select.h revid:vasil.dimov@stripped
@@ -317,7 +317,6 @@ typedef struct st_join_table : public Sq
table_map dependent,key_dependent;
uint index;
- uint status; ///< Save status for cache
uint used_fields,used_fieldlength,used_blobs;
uint used_null_fields;
uint used_rowid_fields;
@@ -505,7 +504,6 @@ st_join_table::st_join_table()
dependent(0),
key_dependent(0),
index(0),
- status(0),
used_fields(0),
used_fieldlength(0),
used_blobs(0),
@@ -1067,9 +1065,6 @@ protected:
enum_nested_loop_state init_join_matching_records(RANGE_SEQ_IF *seq_funcs,
uint ranges);
- /* Finish searching for records that match records from the join buffer */
- enum_nested_loop_state end_join_matching_records(enum_nested_loop_state rc);
-
public:
/*
=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc revid:kevin.lewis@stripped
+++ b/sql/sql_servers.cc revid:vasil.dimov@stripped
@@ -108,11 +108,8 @@ static void init_servers_cache_psi_keys(
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_servers_cache_rwlocks);
- PSI_server->register_rwlock(category, all_servers_cache_rwlocks, count);
+ mysql_rwlock_register(category, all_servers_cache_rwlocks, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc revid:kevin.lewis@stripped
+++ b/sql/sql_udf.cc revid:vasil.dimov@stripped
@@ -115,11 +115,8 @@ static void init_udf_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_udf_rwlocks);
- PSI_server->register_rwlock(category, all_udf_rwlocks, count);
+ mysql_rwlock_register(category, all_udf_rwlocks, count);
}
#endif
=== modified file 'sql/structs.h'
--- a/sql/structs.h revid:kevin.lewis@stripped
+++ b/sql/structs.h revid:vasil.dimov@stripped
@@ -231,14 +231,21 @@ typedef struct user_conn {
#define REG_SKIP_DUP 256
/* Bits in form->status */
-#define STATUS_NO_RECORD (1+2) /* Record isn't usably */
-#define STATUS_GARBAGE 1
-#define STATUS_NOT_FOUND 2 /* No record in database when needed */
-#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
-#define STATUS_NOT_READ 8 /* Record isn't read */
-#define STATUS_UPDATED 16 /* Record is updated by formula */
-#define STATUS_NULL_ROW 32 /* table->null_row is set */
-#define STATUS_DELETED 64
+#define STATUS_GARBAGE 1
+/**
+ Means we were searching for a row and didn't find it. This is used by
+ storage engines (@see handler::index_read_map()) and the Server layer.
+*/
+#define STATUS_NOT_FOUND 2
+/// Reserved for use by multi-table update. Means the row has been updated.
+#define STATUS_UPDATED 16
+/**
+ Means that table->null_row is set. This is an artificial NULL-filled row
+ (one example: in outer join, if no match has been found in inner table).
+*/
+#define STATUS_NULL_ROW 32
+/// Reserved for use by multi-table delete. Means the row has been deleted.
+#define STATUS_DELETED 64
/*
Such interval is "discrete": it is the set of
=== modified file 'sql/table.cc'
--- a/sql/table.cc revid:kevin.lewis@stripped
+++ b/sql/table.cc revid:vasil.dimov@stripped
@@ -470,7 +470,7 @@ void TABLE_SHARE::destroy()
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(PSI_server && m_psi))
PSI_server->release_table_share(m_psi);
#endif
@@ -3376,7 +3376,7 @@ void TABLE::init(THD *thd, TABLE_LIST *t
force_index= 0;
force_index_order= 0;
force_index_group= 0;
- status= STATUS_NO_RECORD;
+ status= STATUS_GARBAGE | STATUS_NOT_FOUND;
insert_values= 0;
fulltext_searched= 0;
file->ft_handler= 0;
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc revid:kevin.lewis@stripped
+++ b/sql/tztime.cc revid:vasil.dimov@stripped
@@ -1549,11 +1549,8 @@ static void init_tz_psi_keys(void)
const char* category= "sql";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_tz_mutexes);
- PSI_server->register_mutex(category, all_tz_mutexes, count);
+ mysql_mutex_register(category, all_tz_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc revid:kevin.lewis@stripped
+++ b/storage/archive/ha_archive.cc revid:vasil.dimov@stripped
@@ -157,11 +157,8 @@ static void init_archive_psi_keys(void)
const char* category= "archive";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_archive_mutexes);
- PSI_server->register_mutex(category, all_archive_mutexes, count);
+ mysql_mutex_register(category, all_archive_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc revid:kevin.lewis@stripped
+++ b/storage/blackhole/ha_blackhole.cc revid:vasil.dimov@stripped
@@ -389,11 +389,8 @@ void init_blackhole_psi_keys()
const char* category= "blackhole";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_blackhole_mutexes);
- PSI_server->register_mutex(category, all_blackhole_mutexes, count);
+ mysql_mutex_register(category, all_blackhole_mutexes, count);
}
#endif
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc revid:kevin.lewis@stripped
+++ b/storage/csv/ha_tina.cc revid:vasil.dimov@stripped
@@ -129,14 +129,11 @@ static void init_tina_psi_keys(void)
const char* category= "csv";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_tina_mutexes);
- PSI_server->register_mutex(category, all_tina_mutexes, count);
+ mysql_mutex_register(category, all_tina_mutexes, count);
count= array_elements(all_tina_files);
- PSI_server->register_file(category, all_tina_files, count);
+ mysql_file_register(category, all_tina_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc revid:kevin.lewis@stripped
+++ b/storage/example/ha_example.cc revid:vasil.dimov@stripped
@@ -136,11 +136,8 @@ static void init_example_psi_keys()
const char* category= "example";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_example_mutexes);
- PSI_server->register_mutex(category, all_example_mutexes, count);
+ mysql_mutex_register(category, all_example_mutexes, count);
}
#endif
=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc revid:kevin.lewis@stripped
+++ b/storage/federated/ha_federated.cc revid:vasil.dimov@stripped
@@ -441,11 +441,8 @@ static void init_federated_psi_keys(void
const char* category= "federated";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_federated_mutexes);
- PSI_server->register_mutex(category, all_federated_mutexes, count);
+ mysql_mutex_register(category, all_federated_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/heap/ha_heap.cc'
--- a/storage/heap/ha_heap.cc revid:kevin.lewis@stripped
+++ b/storage/heap/ha_heap.cc revid:vasil.dimov@stripped
@@ -153,11 +153,11 @@ int ha_heap::close(void)
DESCRIPTION
Do same as default implementation but use file->s->name instead of
table->s->path. This is needed by Windows where the clone() call sees
- '/'-delimited path in table->s->path, while ha_peap::open() was called
+ '/'-delimited path in table->s->path, while ha_heap::open() was called
with '\'-delimited path.
*/
-handler *ha_heap::clone(MEM_ROOT *mem_root)
+handler *ha_heap::clone(const char *name, MEM_ROOT *mem_root)
{
handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
if (new_handler && !new_handler->ha_open(table, file->s->name, table->db_stat,
=== modified file 'storage/heap/ha_heap.h'
--- a/storage/heap/ha_heap.h revid:kevin.lewis@stripped
+++ b/storage/heap/ha_heap.h revid:vasil.dimov@stripped
@@ -31,7 +31,7 @@ class ha_heap: public handler
public:
ha_heap(handlerton *hton, TABLE_SHARE *table);
~ha_heap() {}
- handler *clone(MEM_ROOT *mem_root);
+ handler *clone(const char *name, MEM_ROOT *mem_root);
const char *table_type() const
{
return (table->in_use->variables.sql_mode & MODE_MYSQL323) ?
=== modified file 'storage/heap/hp_static.c'
--- a/storage/heap/hp_static.c revid:kevin.lewis@stripped
+++ b/storage/heap/hp_static.c revid:vasil.dimov@stripped
@@ -41,11 +41,8 @@ void init_heap_psi_keys()
const char* category= "memory";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_heap_mutexes);
- PSI_server->register_mutex(category, all_heap_mutexes, count);
+ mysql_mutex_register(category, all_heap_mutexes, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc revid:kevin.lewis@stripped
+++ b/storage/innobase/handler/ha_innodb.cc revid:vasil.dimov@stripped
@@ -2681,35 +2681,35 @@ innobase_change_buffering_inited_ok:
count = array_elements(all_pthread_mutexes);
- PSI_server->register_mutex(
+ mysql_mutex_register(
"innodb", all_pthread_mutexes, count);
# ifdef UNIV_PFS_MUTEX
count = array_elements(all_innodb_mutexes);
- PSI_server->register_mutex("innodb",
+ mysql_mutex_register("innodb",
all_innodb_mutexes, count);
# endif /* UNIV_PFS_MUTEX */
# ifdef UNIV_PFS_RWLOCK
count = array_elements(all_innodb_rwlocks);
- PSI_server->register_rwlock("innodb",
+ mysql_rwlock_register("innodb",
all_innodb_rwlocks, count);
# endif /* UNIV_PFS_MUTEX */
# ifdef UNIV_PFS_THREAD
count = array_elements(all_innodb_threads);
- PSI_server->register_thread("innodb",
+ mysql_thread_register("innodb",
all_innodb_threads, count);
# endif /* UNIV_PFS_THREAD */
# ifdef UNIV_PFS_IO
count = array_elements(all_innodb_files);
- PSI_server->register_file("innodb",
+ mysql_file_register("innodb",
all_innodb_files, count);
# endif /* UNIV_PFS_IO */
count = array_elements(all_innodb_conds);
- PSI_server->register_cond("innodb",
+ mysql_cond_register("innodb",
all_innodb_conds, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc revid:kevin.lewis@stripped
+++ b/storage/myisam/ha_myisam.cc revid:vasil.dimov@stripped
@@ -639,9 +639,10 @@ ha_myisam::ha_myisam(handlerton *hton, T
can_enable_indexes(1)
{}
-handler *ha_myisam::clone(MEM_ROOT *mem_root)
+handler *ha_myisam::clone(const char *name, MEM_ROOT *mem_root)
{
- ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(mem_root));
+ ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(name,
+ mem_root));
if (new_handler)
new_handler->file->state= file->state;
return new_handler;
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h revid:kevin.lewis@stripped
+++ b/storage/myisam/ha_myisam.h revid:vasil.dimov@stripped
@@ -50,7 +50,7 @@ class ha_myisam: public handler
public:
ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
~ha_myisam() {}
- handler *clone(MEM_ROOT *mem_root);
+ handler *clone(const char *name, MEM_ROOT *mem_root);
const char *table_type() const { return "MyISAM"; }
const char *index_type(uint key_number);
const char **bas_ext() const;
=== modified file 'storage/myisam/mi_static.c'
--- a/storage/myisam/mi_static.c revid:kevin.lewis@stripped
+++ b/storage/myisam/mi_static.c revid:vasil.dimov@stripped
@@ -118,23 +118,20 @@ void init_myisam_psi_keys()
const char* category= "myisam";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_myisam_mutexes);
- PSI_server->register_mutex(category, all_myisam_mutexes, count);
+ mysql_mutex_register(category, all_myisam_mutexes, count);
count= array_elements(all_myisam_rwlocks);
- PSI_server->register_rwlock(category, all_myisam_rwlocks, count);
+ mysql_rwlock_register(category, all_myisam_rwlocks, count);
count= array_elements(all_myisam_conds);
- PSI_server->register_cond(category, all_myisam_conds, count);
+ mysql_cond_register(category, all_myisam_conds, count);
count= array_elements(all_myisam_files);
- PSI_server->register_file(category, all_myisam_files, count);
+ mysql_file_register(category, all_myisam_files, count);
count= array_elements(all_myisam_threads);
- PSI_server->register_thread(category, all_myisam_threads, count);
+ mysql_thread_register(category, all_myisam_threads, count);
}
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc revid:kevin.lewis@stripped
+++ b/storage/myisammrg/ha_myisammrg.cc revid:vasil.dimov@stripped
@@ -677,7 +677,7 @@ CPP_UNNAMED_NS_END
@return A cloned handler instance.
*/
-handler *ha_myisammrg::clone(MEM_ROOT *mem_root)
+handler *ha_myisammrg::clone(const char *name, MEM_ROOT *mem_root)
{
MYRG_TABLE *u_table,*newu_table;
ha_myisammrg *new_handler=
@@ -698,8 +698,8 @@ handler *ha_myisammrg::clone(MEM_ROOT *m
return NULL;
}
- if (new_handler->ha_open(table, table->s->normalized_path.str, table->db_stat,
- HA_OPEN_IGNORE_IF_LOCKED))
+ if (new_handler->ha_open(table, name, table->db_stat,
+ HA_OPEN_IGNORE_IF_LOCKED))
{
delete new_handler;
return NULL;
=== modified file 'storage/myisammrg/ha_myisammrg.h'
--- a/storage/myisammrg/ha_myisammrg.h revid:kevin.lewis@stripped
+++ b/storage/myisammrg/ha_myisammrg.h revid:vasil.dimov@stripped
@@ -106,7 +106,7 @@ public:
int add_children_list(void);
int attach_children(void);
int detach_children(void);
- virtual handler *clone(MEM_ROOT *mem_root);
+ virtual handler *clone(const char *name, MEM_ROOT *mem_root);
int close(void);
int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data);
=== modified file 'storage/myisammrg/myrg_static.c'
--- a/storage/myisammrg/myrg_static.c revid:kevin.lewis@stripped
+++ b/storage/myisammrg/myrg_static.c revid:vasil.dimov@stripped
@@ -48,14 +48,11 @@ void init_myisammrg_psi_keys()
const char* category= "myisammrg";
int count;
- if (PSI_server == NULL)
- return;
-
count= array_elements(all_myisammrg_mutexes);
- PSI_server->register_mutex(category, all_myisammrg_mutexes, count);
+ mysql_mutex_register(category, all_myisammrg_mutexes, count);
count= array_elements(all_myisammrg_files);
- PSI_server->register_file(category, all_myisammrg_files, count);
+ mysql_file_register(category, all_myisammrg_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-innodb branch (vasil.dimov:3608 to 3609) | vasil.dimov | 28 Apr |