diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-09-21 12:54:56 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-09-21 12:54:56 +0200 |
commit | 59d51f0c12d6f2bccc8354079be67c6e520d3675 (patch) | |
tree | d4bf888eceb9434807dd4889fd04257d5bf5ad2b /include | |
parent | fb8bc59f0120fbd3517a291e71d81c3d11443baa (diff) | |
parent | 4368efe870f225279106798f71978b68c473e2ab (diff) | |
download | mariadb-git-59d51f0c12d6f2bccc8354079be67c6e520d3675.tar.gz |
Merge branch '10.2' into bb-10.2-connector-c-integ-subm
Diffstat (limited to 'include')
-rw-r--r-- | include/CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/dur_prop.h | 32 | ||||
-rw-r--r-- | include/m_ctype.h | 70 | ||||
-rw-r--r-- | include/my_base.h | 25 | ||||
-rw-r--r-- | include/my_global.h | 1 | ||||
-rw-r--r-- | include/my_handler_errors.h | 16 | ||||
-rw-r--r-- | include/my_stacktrace.h | 2 | ||||
-rw-r--r-- | include/my_valgrind.h | 2 | ||||
-rw-r--r-- | include/mysql.h | 1 | ||||
-rw-r--r-- | include/mysql.h.pp | 17 | ||||
-rw-r--r-- | include/mysql/psi/psi_base.h | 147 | ||||
-rw-r--r-- | include/mysql/psi/psi_memory.h | 155 | ||||
-rw-r--r-- | include/mysql_com.h | 59 | ||||
-rw-r--r-- | include/pack.h | 29 |
14 files changed, 522 insertions, 35 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index d0c4768e882..8ebd72b9c58 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -25,6 +25,7 @@ SET(HEADERS mysql.h mysql_com.h mysql_com_server.h + pack.h my_byteorder.h byte_order_generic.h byte_order_generic_x86.h diff --git a/include/dur_prop.h b/include/dur_prop.h new file mode 100644 index 00000000000..558ce5acc01 --- /dev/null +++ b/include/dur_prop.h @@ -0,0 +1,32 @@ +/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifndef _my_dur_prop_h +#define _my_dur_prop_h + +enum durability_properties +{ + /* + Preserves the durability properties defined by the engine + */ + HA_REGULAR_DURABILITY= 0, + /* + Ignore the durability properties defined by the engine and + write only in-memory entries. + */ + HA_IGNORE_DURABILITY= 1 +}; + +#endif /* _my_dur_prop_h */ diff --git a/include/m_ctype.h b/include/m_ctype.h index 7a688f76acb..9812e9fa2eb 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -362,6 +362,8 @@ struct my_collation_handler_st extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; /* Some typedef to make it easy for C++ to make function pointers */ @@ -585,49 +587,81 @@ struct charset_info_st extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1; +extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci; extern struct charset_info_st my_charset_big5_bin; extern struct charset_info_st my_charset_big5_chinese_ci; +extern struct charset_info_st my_charset_big5_nopad_bin; +extern struct charset_info_st my_charset_big5_chinese_nopad_ci; extern struct charset_info_st my_charset_cp1250_czech_ci; extern struct charset_info_st my_charset_cp932_bin; extern struct charset_info_st my_charset_cp932_japanese_ci; +extern struct charset_info_st my_charset_cp932_nopad_bin; +extern struct charset_info_st my_charset_cp932_japanese_nopad_ci; extern struct charset_info_st my_charset_eucjpms_bin; extern struct charset_info_st my_charset_eucjpms_japanese_ci; +extern struct charset_info_st my_charset_eucjpms_nopad_bin; +extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci; extern struct charset_info_st my_charset_euckr_bin; extern struct charset_info_st my_charset_euckr_korean_ci; +extern struct charset_info_st my_charset_euckr_nopad_bin; +extern struct charset_info_st my_charset_euckr_korean_nopad_ci; extern struct charset_info_st my_charset_gb2312_bin; extern struct charset_info_st my_charset_gb2312_chinese_ci; +extern struct charset_info_st my_charset_gb2312_nopad_bin; +extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci; extern struct charset_info_st my_charset_gbk_bin; extern struct charset_info_st my_charset_gbk_chinese_ci; +extern struct charset_info_st my_charset_gbk_nopad_bin; +extern struct charset_info_st my_charset_gbk_chinese_nopad_ci; extern struct charset_info_st my_charset_latin1_bin; +extern struct charset_info_st my_charset_latin1_nopad_bin; extern struct charset_info_st my_charset_latin1_german2_ci; extern struct charset_info_st my_charset_latin2_czech_ci; extern struct charset_info_st my_charset_sjis_bin; extern struct charset_info_st my_charset_sjis_japanese_ci; +extern struct charset_info_st my_charset_sjis_nopad_bin; +extern struct charset_info_st my_charset_sjis_japanese_nopad_ci; extern struct charset_info_st my_charset_tis620_bin; extern struct charset_info_st my_charset_tis620_thai_ci; +extern struct charset_info_st my_charset_tis620_nopad_bin; +extern struct charset_info_st my_charset_tis620_thai_nopad_ci; extern struct charset_info_st my_charset_ucs2_bin; extern struct charset_info_st my_charset_ucs2_general_ci; +extern struct charset_info_st my_charset_ucs2_nopad_bin; +extern struct charset_info_st my_charset_ucs2_general_nopad_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ucs2_unicode_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ujis_bin; extern struct charset_info_st my_charset_ujis_japanese_ci; +extern struct charset_info_st my_charset_ujis_nopad_bin; +extern struct charset_info_st my_charset_ujis_japanese_nopad_ci; extern struct charset_info_st my_charset_utf16_bin; extern struct charset_info_st my_charset_utf16_general_ci; extern struct charset_info_st my_charset_utf16_unicode_ci; extern struct charset_info_st my_charset_utf16le_bin; extern struct charset_info_st my_charset_utf16le_general_ci; +extern struct charset_info_st my_charset_utf16_general_nopad_ci; +extern struct charset_info_st my_charset_utf16_nopad_bin; +extern struct charset_info_st my_charset_utf16le_nopad_bin; +extern struct charset_info_st my_charset_utf16le_general_nopad_ci; extern struct charset_info_st my_charset_utf32_bin; extern struct charset_info_st my_charset_utf32_general_ci; extern struct charset_info_st my_charset_utf32_unicode_ci; +extern struct charset_info_st my_charset_utf32_nopad_bin; +extern struct charset_info_st my_charset_utf32_general_nopad_ci; extern struct charset_info_st my_charset_utf8_bin; +extern struct charset_info_st my_charset_utf8_nopad_bin; +extern struct charset_info_st my_charset_utf8_general_nopad_ci; extern struct charset_info_st my_charset_utf8_general_mysql500_ci; extern struct charset_info_st my_charset_utf8_unicode_ci; extern struct charset_info_st my_charset_utf8mb4_bin; extern struct charset_info_st my_charset_utf8mb4_general_ci; +extern struct charset_info_st my_charset_utf8mb4_nopad_bin; +extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci; extern struct charset_info_st my_charset_utf8mb4_unicode_ci; #define MY_UTF8MB3 "utf8" @@ -653,6 +687,11 @@ extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, extern void my_hash_sort_simple(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); + +extern void my_hash_sort_simple_nopad(CHARSET_INFO *cs, + const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + extern void my_hash_sort_bin(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); @@ -824,18 +863,38 @@ int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2); +void my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + size_t my_strnxfrm_mb(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); +size_t my_strnxfrm_mb_nopad(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + size_t my_strnxfrm_unicode(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); + +size_t my_strnxfrm_unicode_nopad(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t); size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); + uchar *dst, size_t dstlen, + uint nweights, const uchar *src, + size_t srclen, uint flags); + +size_t my_strnxfrm_unicode_full_nopad_bin(CHARSET_INFO *, + uchar *dst, size_t dstlen, + uint nweights, const uchar *src, + size_t srclen, uint flags); + size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t); int my_wildcmp_unicode(CHARSET_INFO *cs, @@ -865,7 +924,6 @@ void my_string_metadata_get(MY_STRING_METADATA *metadata, CHARSET_INFO *cs, const char *str, size_t len); uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len); my_bool my_charset_is_ascii_based(CHARSET_INFO *cs); -my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs); uint my_charset_repertoire(CHARSET_INFO *cs); uint my_strxfrm_flag_normalize(uint flags, uint nlevels); @@ -874,8 +932,10 @@ void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, size_t my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, uchar *str, uchar *frmend, uchar *strend, uint nweights, uint flags, uint level); - -my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs); +size_t my_strxfrm_pad_desc_and_reverse_nopad(CHARSET_INFO *cs, + uchar *str, uchar *frmend, + uchar *strend, uint nweights, + uint flags, uint level); const MY_CONTRACTIONS *my_charset_get_contractions(CHARSET_INFO *cs, int level); diff --git a/include/my_base.h b/include/my_base.h index 1317639c528..f5842685f9d 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -497,13 +497,19 @@ enum ha_base_keytype { #define HA_ERR_DISK_FULL 189 #define HA_ERR_INCOMPATIBLE_DEFINITION 190 #define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */ -#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but - decypt failed */ -#define HA_ERR_LAST 192 /* Copy of last error nr */ +#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but decypt failed */ +#define HA_ERR_FK_DEPTH_EXCEEDED 193 /* FK cascade depth exceeded */ +#define HA_ERR_TABLESPACE_MISSING 194 /* Missing Tablespace */ +#define HA_ERR_LAST 194 /* Copy of last error nr * */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) +/* aliases */ +#define HA_ERR_TABLE_CORRUPT HA_ERR_WRONG_IN_RECORD +#define HA_ERR_QUERY_INTERRUPTED HA_ERR_ABORTED_BY_USER +#define HA_ERR_NOT_ALLOWED_COMMAND HA_ERR_WRONG_COMMAND + /* Other constants */ #define HA_NAMELEN 64 /* Max length of saved filename */ @@ -632,17 +638,4 @@ C_MODE_START typedef void (* invalidator_by_filename)(const char * filename); C_MODE_END - -enum durability_properties -{ - /* - Preserves the durability properties defined by the engine */ - HA_REGULAR_DURABILITY= 0, - /* - Ignore the durability properties defined by the engine and - write only in-memory entries. - */ - HA_IGNORE_DURABILITY= 1 -}; - #endif /* _my_base_h */ diff --git a/include/my_global.h b/include/my_global.h index a3d6ebba96e..0f24570c2f7 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -817,6 +817,7 @@ static inline bool isfinite(double x) { return std::isfinite(x); } #ifndef HAVE_ISNAN #define isnan(x) ((x) != (x)) #endif +#define my_isnan(x) isnan(x) #ifdef HAVE_ISINF #define my_isinf(X) isinf(X) diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index 5af6a359348..bdea4f71eaf 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -23,16 +23,18 @@ static const char *handler_error_messages[]= { + /* 120 */ "Didn't find key on read or update", "Duplicate key on write or update", "Internal (unspecified) error in handler", "Someone has changed the row since it was read (while the table was locked to prevent it)", "Wrong index given to function", "Undefined handler error 125", - "Index file is crashed", - "Record file is crashed", + "Index is corrupted", + "Table file is corrupted", "Out of memory in engine", "Undefined handler error 129", + /* 130 */ "Incorrect file format", "Command not supported by database", "Old database file", @@ -43,6 +45,7 @@ static const char *handler_error_messages[]= "No more records (read after end of file)", "Unsupported extension used for table", "Too big row", + /* 140 */ "Wrong create options", "Duplicate unique key or constraint on write or update", "Unknown character set used in table", @@ -53,6 +56,7 @@ static const char *handler_error_messages[]= "Lock table is full; Restart program with a larger lock table", "Updates are not allowed under a read only transactions", "Lock deadlock; Retry transaction", + /* 150 */ "Foreign key constraint is incorrectly formed", "Cannot add a child row", "Cannot delete a parent row", @@ -63,6 +67,7 @@ static const char *handler_error_messages[]= "Could not connect to storage engine", "Unexpected null pointer found when using spatial index", "The table changed in storage engine", + /* 160 */ "There's no partition in table for the given value", "Row-based binary logging of row failed", "Index needed in foreign key constraint", @@ -73,6 +78,7 @@ static const char *handler_error_messages[]= "Failed to set row auto increment value", "Unknown (generic) error from engine", "Record was not update. Original values was same as new values", + /* 170 */ "It is not possible to log this statement", "The event was corrupt, leading to illegal data being read", "The table is of a new format not supported by this version", @@ -83,6 +89,7 @@ static const char *handler_error_messages[]= "Too many active concurrent transactions", "Record not matching the given partition set", "Index column length exceeds limit", + /* 180 */ "Index corrupted", "Undo record too big", "Invalid InnoDB FTS Doc ID", @@ -93,9 +100,12 @@ static const char *handler_error_messages[]= "Row is not visible by the current transaction", "Operation was interrupted by end user (probably kill command?)", "Disk full", + /* 190 */ "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump and restore the table to fix this", "Too many words in a FTS phrase or proximity search", - "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match." + "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.", + "Foreign key cascade delete/update exceeds max depth", + "Tablespace is missing for table" }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index fb2525e3a12..fad6e532de9 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -45,7 +45,7 @@ C_MODE_START #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) void my_init_stacktrace(); void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack); -void my_safe_print_str(const char* val, int max_len); +int my_safe_print_str(const char* val, int max_len); void my_write_core(int sig); #if BACKTRACE_DEMANGLE char *my_demangle(const char *mangled_name, int *status); diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 0662f5dce71..9ceb49c1094 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -41,3 +41,5 @@ #define TRASH_FREE(A,B) TRASH_FILL(A,B,0x8F) #define TRASH(A,B) TRASH_FREE(A,B) +# define DBUG_ASSERT_DEFINED(x) \ + DBUG_ASSERT(!VALGRIND_CHECK_MEM_IS_DEFINED(&(x), sizeof(x))) diff --git a/include/mysql.h b/include/mysql.h index 19099b4f404..eab859270f7 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -137,6 +137,7 @@ typedef unsigned long long my_ulonglong; /* backward compatibility define - to be removed eventually */ #define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED #define WARN_PLUGIN_DELETE_BUILTIN ER_PLUGIN_DELETE_BUILTIN +#define ER_FK_DUP_NAME ER_DUP_CONSTRAINT_NAME typedef struct st_mysql_rows { struct st_mysql_rows *next; /* list of rows */ diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 0c06141df6c..857f5b99a90 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -10,7 +10,10 @@ enum enum_server_command COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, COM_MDB_GAP_BEG, - COM_MDB_GAP_END=253, + COM_MDB_GAP_END=250, + COM_SLAVE_WORKER, + COM_SLAVE_IO, + COM_SLAVE_SQL, COM_MULTI, COM_END }; @@ -30,7 +33,7 @@ typedef struct st_net { char save_char; char net_skip_rest_factor; my_bool thread_specific_malloc; - my_bool compress; + unsigned char compress; my_bool unused3; void *thd; unsigned int last_errno; @@ -84,6 +87,16 @@ enum enum_mysql_set_option MYSQL_OPTION_MULTI_STATEMENTS_ON, MYSQL_OPTION_MULTI_STATEMENTS_OFF }; +enum enum_session_state_type +{ + SESSION_TRACK_SYSTEM_VARIABLES, + SESSION_TRACK_SCHEMA, + SESSION_TRACK_STATE_CHANGE, + SESSION_TRACK_GTIDS, + SESSION_TRACK_TRANSACTION_CHARACTERISTICS, + SESSION_TRACK_TRANSACTION_STATE, + SESSION_TRACK_always_at_the_end +}; my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags); void my_net_local_init(NET *net); void net_end(NET *net); diff --git a/include/mysql/psi/psi_base.h b/include/mysql/psi/psi_base.h new file mode 100644 index 00000000000..10593c4dab4 --- /dev/null +++ b/include/mysql/psi/psi_base.h @@ -0,0 +1,147 @@ +/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ + +#ifndef MYSQL_PSI_BASE_H +#define MYSQL_PSI_BASE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + @file mysql/psi/psi_base.h + Performance schema instrumentation interface. + + @defgroup Instrumentation_interface Instrumentation Interface + @ingroup Performance_schema + @{ +*/ + +#define PSI_INSTRUMENT_ME 0 + +#define PSI_NOT_INSTRUMENTED 0 + +/** + Global flag. + This flag indicate that an instrumentation point is a global variable, + or a singleton. +*/ +#define PSI_FLAG_GLOBAL (1 << 0) + +/** + Mutable flag. + This flag indicate that an instrumentation point is a general placeholder, + that can mutate into a more specific instrumentation point. +*/ +#define PSI_FLAG_MUTABLE (1 << 1) + +#define PSI_FLAG_THREAD (1 << 2) + +/** + Stage progress flag. + This flag apply to the stage instruments only. + It indicates the instrumentation provides progress data. +*/ +#define PSI_FLAG_STAGE_PROGRESS (1 << 3) + +/** + Shared Exclusive flag. + Indicates that rwlock support the shared exclusive state. +*/ +#define PSI_RWLOCK_FLAG_SX (1 << 4) + +/** + Transferable flag. + This flag indicate that an instrumented object can + be created by a thread and destroyed by another thread. +*/ +#define PSI_FLAG_TRANSFER (1 << 5) + +#ifdef HAVE_PSI_INTERFACE + +/** + @def PSI_VERSION_1 + Performance Schema Interface number for version 1. + This version is supported. +*/ +#define PSI_VERSION_1 1 + +/** + @def PSI_VERSION_2 + Performance Schema Interface number for version 2. + This version is not implemented, it's a placeholder. +*/ +#define PSI_VERSION_2 2 + +/** + @def PSI_CURRENT_VERSION + Performance Schema Interface number for the most recent version. + The most current version is @c PSI_VERSION_1 +*/ +#define PSI_CURRENT_VERSION 1 + +/** + @def USE_PSI_1 + Define USE_PSI_1 to use the interface version 1. +*/ + +/** + @def USE_PSI_2 + Define USE_PSI_2 to use the interface version 2. +*/ + +/** + @def HAVE_PSI_1 + Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. +*/ + +/** + @def HAVE_PSI_2 + Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. +*/ + +#ifndef USE_PSI_2 +#ifndef USE_PSI_1 +#define USE_PSI_1 +#endif +#endif + +#ifdef USE_PSI_1 +#define HAVE_PSI_1 +#endif + +#ifdef USE_PSI_2 +#define HAVE_PSI_2 +#endif + +/* + Allow to override PSI_XXX_CALL at compile time + with more efficient implementations, if available. + If nothing better is available, + make a dynamic call using the PSI_server function pointer. +*/ + +#define PSI_DYNAMIC_CALL(M) PSI_server->M + +#endif /* HAVE_PSI_INTERFACE */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* MYSQL_PSI_BASE_H */ + diff --git a/include/mysql/psi/psi_memory.h b/include/mysql/psi/psi_memory.h new file mode 100644 index 00000000000..725b3ed77d0 --- /dev/null +++ b/include/mysql/psi/psi_memory.h @@ -0,0 +1,155 @@ +/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ + +#ifndef MYSQL_PSI_MEMORY_H +#define MYSQL_PSI_MEMORY_H + +#include "psi_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + @file mysql/psi/psi_memory.h + Performance schema instrumentation interface. + + @defgroup Instrumentation_interface Instrumentation Interface + @ingroup Performance_schema + @{ +*/ + +#ifdef HAVE_PSI_INTERFACE +#ifndef DISABLE_ALL_PSI +#ifndef DISABLE_PSI_MEMORY +#define HAVE_PSI_MEMORY_INTERFACE +#endif /* DISABLE_PSI_MEMORY */ +#endif /* DISABLE_ALL_PSI */ +#endif /* HAVE_PSI_INTERFACE */ + +struct PSI_thread; + +/** + Instrumented memory key. + To instrument memory, a memory key must be obtained using @c register_memory. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_memory_key; + +#ifdef HAVE_PSI_1 + +/** + @defgroup Group_PSI_v1 Application Binary Interface, version 1 + @ingroup Instrumentation_interface + @{ +*/ + +/** + Memory instrument information. + @since PSI_VERSION_1 + This structure is used to register instrumented memory. +*/ +struct PSI_memory_info_v1 +{ + /** Pointer to the key assigned to the registered memory. */ + PSI_memory_key *m_key; + /** The name of the memory instrument to register. */ + const char *m_name; + /** + The flags of the socket instrument to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_memory_info_v1 PSI_memory_info_v1; + +/** + Memory registration API. + @param category a category name (typically a plugin name) + @param info an array of memory info to register + @param count the size of the info array +*/ +typedef void (*register_memory_v1_t) + (const char *category, struct PSI_memory_info_v1 *info, int count); + +/** + Instrument memory allocation. + @param key the memory instrument key + @param size the size of memory allocated + @param[out] owner the memory owner + @return the effective memory instrument key +*/ +typedef PSI_memory_key (*memory_alloc_v1_t) + (PSI_memory_key key, size_t size, struct PSI_thread ** owner); + +/** + Instrument memory re allocation. + @param key the memory instrument key + @param old_size the size of memory previously allocated + @param new_size the size of memory re allocated + @param[in, out] owner the memory owner + @return the effective memory instrument key +*/ +typedef PSI_memory_key (*memory_realloc_v1_t) + (PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread ** owner); + +/** + Instrument memory claim. + @param key the memory instrument key + @param size the size of memory allocated + @param[in, out] owner the memory owner + @return the effective memory instrument key +*/ +typedef PSI_memory_key (*memory_claim_v1_t) + (PSI_memory_key key, size_t size, struct PSI_thread ** owner); + +/** + Instrument memory free. + @param key the memory instrument key + @param size the size of memory allocated + @param owner the memory owner +*/ +typedef void (*memory_free_v1_t) + (PSI_memory_key key, size_t size, struct PSI_thread * owner); + +/** @} (end of group Group_PSI_v1) */ + +#endif /* HAVE_PSI_1 */ + +#ifdef HAVE_PSI_2 +struct PSI_memory_info_v2 +{ + int placeholder; +}; + +#endif /* HAVE_PSI_2 */ + +#ifdef USE_PSI_1 +typedef struct PSI_memory_info_v1 PSI_memory_info; +#endif + +#ifdef USE_PSI_2 +typedef struct PSI_memory_info_v2 PSI_memory_info; +#endif + +/** @} (end of group Instrumentation_interface) */ + +#ifdef __cplusplus +} +#endif + + +#endif /* MYSQL_PSI_MEMORY_H */ + diff --git a/include/mysql_com.h b/include/mysql_com.h index 7003e7b6bd7..461800f3ce7 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -73,6 +73,14 @@ #define TABLE_PARTITION_COMMENT_MAXLEN 1024 /* + Maximum length of protocol packet. + OK packet length limit also restricted to this value as any length greater + than this value will have first byte of OK packet to be 254 thus does not + provide a means to identify if this is OK or EOF packet. +*/ +#define MAX_PACKET_LENGTH (256L*256L*256L-1) + +/* USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain username and hostname parts of the user identifier with trailing zero in MySQL standard format: @@ -105,7 +113,10 @@ enum enum_server_command COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, /* don't forget to update const char *command_name[] in sql_parse.cc */ COM_MDB_GAP_BEG, - COM_MDB_GAP_END=253, + COM_MDB_GAP_END=250, + COM_SLAVE_WORKER, + COM_SLAVE_IO, + COM_SLAVE_SQL, COM_MULTI, /* Must be last */ COM_END @@ -218,6 +229,14 @@ enum enum_server_command /* Don't close the connection for a connection with expired password. */ #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) +/** + Capable of handling server state change information. Its a hint to the + server to include the state change information in Ok packet. +*/ +#define CLIENT_SESSION_TRACK (1UL << 23) +/* Client no longer needs EOF packet */ +#define CLIENT_DEPRECATE_EOF (1UL << 24) + #define CLIENT_PROGRESS_OBSOLETE (1UL << 29) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) /* @@ -273,6 +292,8 @@ enum enum_server_command MARIADB_CLIENT_PROGRESS | \ CLIENT_PLUGIN_AUTH | \ CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ + CLIENT_SESSION_TRACK |\ + CLIENT_DEPRECATE_EOF |\ CLIENT_CONNECT_ATTRS |\ MARIADB_CLIENT_COM_MULTI) @@ -337,6 +358,11 @@ enum enum_server_command */ #define SERVER_STATUS_IN_TRANS_READONLY 8192 +/** + This status flag, when on, implies that one of the state information has + changed on the server because of the execution of the last statement. +*/ +#define SERVER_SESSION_STATE_CHANGED (1UL << 14) /** Server status flags that must be cleared when starting @@ -353,7 +379,8 @@ enum enum_server_command SERVER_QUERY_WAS_SLOW |\ SERVER_STATUS_DB_DROPPED |\ SERVER_STATUS_CURSOR_EXISTS|\ - SERVER_STATUS_LAST_ROW_SENT) + SERVER_STATUS_LAST_ROW_SENT|\ + SERVER_SESSION_STATE_CHANGED) #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ @@ -391,7 +418,7 @@ typedef struct st_net { char save_char; char net_skip_rest_factor; my_bool thread_specific_malloc; - my_bool compress; + unsigned char compress; my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* Pointer to query object in query cache, do not equal NULL (0) for @@ -520,6 +547,26 @@ enum enum_mysql_set_option MYSQL_OPTION_MULTI_STATEMENTS_OFF }; +/* + Type of state change information that the server can include in the Ok + packet. +*/ +enum enum_session_state_type +{ + SESSION_TRACK_SYSTEM_VARIABLES, /* Session system variables */ + SESSION_TRACK_SCHEMA, /* Current schema */ + SESSION_TRACK_STATE_CHANGE, /* track session state changes */ + SESSION_TRACK_GTIDS, + SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /* Transaction chistics */ + SESSION_TRACK_TRANSACTION_STATE, /* Transaction state */ + SESSION_TRACK_always_at_the_end /* must be last */ +}; + +#define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES + +#define IS_SESSION_STATE_TYPE(T) \ + (((int)(T) >= SESSION_TRACK_BEGIN) && ((T) < SESSION_TRACK_always_at_the_end)) + #define net_new_transaction(net) ((net)->pkt_nr=0) #ifdef __cplusplus @@ -633,11 +680,7 @@ my_bool my_thread_init(void); void my_thread_end(void); #ifdef MY_GLOBAL_INCLUDED -ulong STDCALL net_field_length(uchar **packet); -my_ulonglong net_field_length_ll(uchar **packet); -my_ulonglong safe_net_field_length_ll(uchar **packet, size_t packet_len); -uchar *net_store_length(uchar *pkg, ulonglong length); -uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length); +#include "pack.h" #endif #ifdef __cplusplus diff --git a/include/pack.h b/include/pack.h new file mode 100644 index 00000000000..f991e72326b --- /dev/null +++ b/include/pack.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2016, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifdef __cplusplus +extern "C" { +#endif + +ulong net_field_length(uchar **packet); +my_ulonglong net_field_length_ll(uchar **packet); +my_ulonglong safe_net_field_length_ll(uchar **packet, size_t packet_len); +uchar *net_store_length(uchar *pkg, ulonglong length); +uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length); +unsigned int net_length_size(ulonglong num); + +#ifdef __cplusplus +} +#endif |