summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/my_attribute.h14
-rw-r--r--include/my_base.h7
-rw-r--r--include/my_bitmap.h67
-rw-r--r--include/my_global.h2
-rw-r--r--include/my_rdtsc.h12
-rw-r--r--include/my_sys.h3
-rw-r--r--include/mysql/service_print_check_msg.h44
-rw-r--r--include/mysql_com.h1
-rw-r--r--include/service_versions.h1
-rw-r--r--include/source_revision.h1
-rw-r--r--include/sslopt-longopts.h10
-rw-r--r--include/violite.h8
12 files changed, 132 insertions, 38 deletions
diff --git a/include/my_attribute.h b/include/my_attribute.h
index c8e98070..25d21d5e 100644
--- a/include/my_attribute.h
+++ b/include/my_attribute.h
@@ -70,5 +70,19 @@
# endif /* GNUC >= 3.1 */
#endif
+/* Define pragmas to disable warnings for stack frame checking */
+#if defined(__clang__)
+#define PRAGMA_DISABLE_CHECK_STACK_FRAME \
+_Pragma("clang diagnostic push") \
+_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"")
+
+#define PRAGMA_REENABLE_CHECK_STACK_FRAME \
+_Pragma("clang diagnostic pop")
+
+#else
+#define PRAGMA_DISABLE_CHECK_STACK_FRAME
+#define PRAGMA_REENABLE_CHECK_STACK_FRAME
#endif
+
+#endif /* _my_attribute_h */
diff --git a/include/my_base.h b/include/my_base.h
index 9a5a4e94..3cbd4f7e 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -49,6 +49,7 @@
#define HA_OPEN_MERGE_TABLE 2048U
#define HA_OPEN_FOR_CREATE 4096U
#define HA_OPEN_FOR_DROP (1U << 13) /* Open part of drop */
+#define HA_OPEN_GLOBAL_TMP_TABLE (1U << 14) /* TMP table used by repliction */
/*
Allow opening even if table is incompatible as this is for ALTER TABLE which
@@ -369,6 +370,12 @@ enum ha_base_keytype {
#define HA_CREATE_INTERNAL_TABLE 256U
#define HA_PRESERVE_INSERT_ORDER 512U
#define HA_CREATE_NO_ROLLBACK 1024U
+/*
+ A temporary table that can be used by different threads, eg. replication
+ threads. This flag ensure that memory is not allocated with THREAD_SPECIFIC,
+ as we do for other temporary tables.
+*/
+#define HA_CREATE_GLOBAL_TMP_TABLE 2048U
/* Flags used by start_bulk_insert */
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index f88a6fe8..d5467065 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -22,14 +22,15 @@
#include <m_string.h>
#include <my_pthread.h>
-typedef uint32 my_bitmap_map;
+typedef ulonglong my_bitmap_map;
typedef struct st_bitmap
{
my_bitmap_map *bitmap;
my_bitmap_map *last_word_ptr;
- my_bitmap_map last_word_mask;
+ my_bitmap_map last_bit_mask;
uint32 n_bits; /* number of bits occupied by the above */
+ my_bool bitmap_allocated;
} MY_BITMAP;
#ifdef __cplusplus
@@ -39,7 +40,7 @@ extern "C" {
/* Reset memory. Faster then doing a full bzero */
#define my_bitmap_clear(A) ((A)->bitmap= 0)
-extern void create_last_word_mask(MY_BITMAP *map);
+extern void create_last_bit_mask(MY_BITMAP *map);
extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
@@ -53,12 +54,12 @@ extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_union_is_set_all(const MY_BITMAP *map1,
const MY_BITMAP *map2);
-extern my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array,
+extern my_bool bitmap_exists_intersection(MY_BITMAP **bitmap_array,
uint bitmap_count,
uint start_bit, uint end_bit);
extern uint bitmap_set_next(MY_BITMAP *map);
-extern uint bitmap_get_first(const MY_BITMAP *map);
+extern uint bitmap_get_first_clear(const MY_BITMAP *map);
extern uint bitmap_get_first_set(const MY_BITMAP *map);
extern uint bitmap_bits_set(const MY_BITMAP *map);
extern uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit);
@@ -71,54 +72,70 @@ extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_invert(MY_BITMAP *map);
extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2);
+/* Functions to export/import bitmaps to an architecture independent format */
+extern void bitmap_export(uchar *to, MY_BITMAP *map);
+extern void bitmap_import(MY_BITMAP *map, uchar *from);
+
+#define my_bitmap_map_bytes sizeof(my_bitmap_map)
+#define my_bitmap_map_bits (my_bitmap_map_bytes*8)
+/* Size in bytes to store 'bits' number of bits */
+#define bitmap_buffer_size(bits) (MY_ALIGN((bits), my_bitmap_map_bits)/8)
+#define my_bitmap_buffer_size(map) bitmap_buffer_size((map)->n_bits)
+#define no_bytes_in_export_map(map) (((map)->n_bits + 7)/8)
+#define no_words_in_map(map) (((map)->n_bits + (my_bitmap_map_bits-1))/my_bitmap_map_bits)
/* Fast, not thread safe, bitmap functions */
-#define bitmap_buffer_size(bits) (((bits)+31)/32)*4
-#define no_bytes_in_map(map) (((map)->n_bits + 7)/8)
-#define no_words_in_map(map) (((map)->n_bits + 31)/32)
-#define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
-/* The following functions must be compatible with create_last_word_mask()! */
+/* The following functions must be compatible with create_last_bit_mask()! */
static inline void
bitmap_set_bit(MY_BITMAP *map,uint bit)
{
- uchar *b= (uchar*) map->bitmap + bit / 8;
DBUG_ASSERT(bit < map->n_bits);
- *b= (uchar) (*b | 1U << (bit & 7));
+ map->bitmap[bit/my_bitmap_map_bits]|=
+ (1ULL << (bit & (my_bitmap_map_bits-1)));
}
static inline void
bitmap_flip_bit(MY_BITMAP *map,uint bit)
{
- uchar *b= (uchar*) map->bitmap + bit / 8;
DBUG_ASSERT(bit < map->n_bits);
- *b= (uchar) (*b ^ 1U << (bit & 7));
+ map->bitmap[bit/my_bitmap_map_bits]^=
+ (1ULL << (bit & (my_bitmap_map_bits-1)));
}
static inline void
bitmap_clear_bit(MY_BITMAP *map,uint bit)
{
- uchar *b= (uchar*) map->bitmap + bit / 8;
DBUG_ASSERT(bit < map->n_bits);
- *b= (uchar) (*b & ~(1U << (bit & 7)));
+ map->bitmap[bit/my_bitmap_map_bits]&=
+ ~(1ULL << (bit & (my_bitmap_map_bits-1)));
}
static inline uint
bitmap_is_set(const MY_BITMAP *map,uint bit)
{
- const uchar *b= (const uchar*) map->bitmap + bit / 8;
DBUG_ASSERT(bit < map->n_bits);
- return !!(*b & (1U << (bit & 7)));
+ return (!!(map->bitmap[bit/my_bitmap_map_bits] &
+ (1ULL << (bit & (my_bitmap_map_bits-1)))));
}
+/* Return true if bitmaps are equal */
static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
- if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
- return FALSE;
- return ((*map1->last_word_ptr | map1->last_word_mask) ==
- (*map2->last_word_ptr | map2->last_word_mask));
+ DBUG_ASSERT(map1->n_bits == map2->n_bits);
+ return (memcmp(map1->bitmap, map2->bitmap,
+ my_bitmap_buffer_size(map1)) == 0);
}
#define bitmap_clear_all(MAP) \
- { memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); }
-#define bitmap_set_all(MAP) \
- (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
+ { memset((MAP)->bitmap, 0, my_bitmap_buffer_size(MAP)); }
+
+static inline void
+bitmap_set_all(const MY_BITMAP *map)
+{
+ if (map->n_bits)
+ {
+ memset(map->bitmap, 0xFF, my_bitmap_map_bytes * (no_words_in_map(map)-1));
+ DBUG_ASSERT(map->bitmap + no_words_in_map(map)-1 == map->last_word_ptr);
+ *map->last_word_ptr= ~map->last_bit_mask;
+ }
+}
#ifdef __cplusplus
}
diff --git a/include/my_global.h b/include/my_global.h
index 54f76bf5..7da8b73c 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -973,6 +973,7 @@ typedef struct st_mysql_lex_string LEX_STRING;
#define SOCKET_ECONNRESET WSAECONNRESET
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
+#define SOCKET_CLOSED EIO
#else /* Unix */
#define socket_errno errno
#define closesocket(A) close(A)
@@ -982,6 +983,7 @@ typedef struct st_mysql_lex_string LEX_STRING;
#define SOCKET_EADDRINUSE EADDRINUSE
#define SOCKET_ETIMEDOUT ETIMEDOUT
#define SOCKET_ECONNRESET ECONNRESET
+#define SOCKET_CLOSED EIO
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#endif
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
index 8b9b0046..21e44847 100644
--- a/include/my_rdtsc.h
+++ b/include/my_rdtsc.h
@@ -111,7 +111,7 @@ C_MODE_START
On AARCH64, we use the generic timer base register. We override clang
implementation for aarch64 as it access a PMU register which is not
guaranteed to be active.
- On RISC-V, we use the rdcycle instruction to read from mcycle register.
+ On RISC-V, we use the rdtime instruction to read from mtime register.
Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
HP PA-RISC or other non-mainstream (or obsolete) processors.
@@ -211,15 +211,15 @@ static inline ulonglong my_timer_cycles(void)
}
#elif defined(__riscv)
#define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_RISCV
- /* Use RDCYCLE (and RDCYCLEH on riscv32) */
+ /* Use RDTIME (and RDTIMEH on riscv32) */
{
# if __riscv_xlen == 32
ulong result_lo, result_hi0, result_hi1;
/* Implemented in assembly because Clang insisted on branching. */
__asm __volatile__(
- "rdcycleh %0\n"
- "rdcycle %1\n"
- "rdcycleh %2\n"
+ "rdtimeh %0\n"
+ "rdtime %1\n"
+ "rdtimeh %2\n"
"sub %0, %0, %2\n"
"seqz %0, %0\n"
"sub %0, zero, %0\n"
@@ -228,7 +228,7 @@ static inline ulonglong my_timer_cycles(void)
return (static_cast<ulonglong>(result_hi1) << 32) | result_lo;
# else
ulonglong result;
- __asm __volatile__("rdcycle %0" : "=r"(result));
+ __asm __volatile__("rdtime %0" : "=r"(result));
return result;
}
# endif
diff --git a/include/my_sys.h b/include/my_sys.h
index 540432ce..e4ab497a 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -154,7 +154,7 @@ char *guess_malloc_library();
void sf_report_leaked_memory(my_thread_id id);
int sf_sanity();
extern my_thread_id (*sf_malloc_dbug_id)(void);
-#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X)
+#define SAFEMALLOC_REPORT_MEMORY(X) if (!sf_leaking_memory) sf_report_leaked_memory(X)
#else
#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0)
#endif
@@ -655,6 +655,7 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
myf MyFlags);
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
+extern void (*my_sleep_for_space)(unsigned int seconds);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,
diff --git a/include/mysql/service_print_check_msg.h b/include/mysql/service_print_check_msg.h
new file mode 100644
index 00000000..c2c7cf0a
--- /dev/null
+++ b/include/mysql/service_print_check_msg.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2019, MariaDB Corporation.
+
+ 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-1335 USA */
+
+#pragma once
+
+/**
+ @file include/mysql/service_print_check_msg.h
+ This service provides functions to write messages for check or repair
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern struct print_check_msg_service_st {
+ void (*print_check_msg)(MYSQL_THD, const char *db_name, const char *table_name,
+ const char *op, const char *msg_type, const char *message,
+ my_bool print_to_log);
+} *print_check_msg_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+# define print_check_msg_context(_THD) print_check_msg_service->print_check_msg
+#else
+extern void print_check_msg(MYSQL_THD, const char *db_name, const char *table_name,
+ const char *op, const char *msg_type, const char *message,
+ my_bool print_to_log);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 4b07be8f..28627e38 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -478,6 +478,7 @@ typedef struct st_net {
my_bool thread_specific_malloc;
unsigned char compress;
my_bool pkt_nr_can_be_reset;
+ my_bool using_proxy_protocol;
/*
Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet
diff --git a/include/service_versions.h b/include/service_versions.h
index 9abae740..c8169614 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -44,6 +44,7 @@
#define VERSION_wsrep 0x0500
#define VERSION_json 0x0100
#define VERSION_thd_mdl 0x0100
+#define VERSION_print_check_msg 0x0100
#define VERSION_sql_service 0x0101
#define VERSION_provider_bzip2 0x0100
diff --git a/include/source_revision.h b/include/source_revision.h
new file mode 100644
index 00000000..e93bf678
--- /dev/null
+++ b/include/source_revision.h
@@ -0,0 +1 @@
+#define SOURCE_REVISION "3a069644682e336e445039e48baae9693f9a08ee"
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index 63d1a42c..be3fedd9 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -19,13 +19,12 @@
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- {"ssl", OPT_SSL_SSL,
+ {"ssl", 0,
"Enable SSL for connection (automatically enabled with other flags).",
&opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
- &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
- 0, 0, 0, 0, 0, 0},
+ &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
&opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
@@ -46,13 +45,12 @@
"Certificate revocation list path (implies --ssl).",
&opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
- {"tls-version", OPT_TLS_VERSION,
- "TLS protocol version for secure connection.",
+ {"tls-version", 0, "TLS protocol version for secure connection.",
&opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
- {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
+ {"ssl-verify-server-cert", 0,
"Verify server's \"Common Name\" in its cert against hostname used "
"when connecting. This option is disabled by default.",
&opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert,
diff --git a/include/violite.h b/include/violite.h
index b823e62b..f1e5c95a 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -41,6 +41,13 @@ enum enum_vio_type
VIO_TYPE_SSL
/* see also vio_type_names[] */
};
+
+enum enum_vio_state
+{
+ VIO_STATE_NOT_INITIALIZED, VIO_STATE_ACTIVE, VIO_STATE_SHUTDOWN,
+ VIO_STATE_CLOSED
+};
+
#define FIRST_VIO_TYPE VIO_CLOSED
#define LAST_VIO_TYPE VIO_TYPE_SSL
@@ -244,6 +251,7 @@ struct st_vio
struct sockaddr_storage local; /* Local internet address */
struct sockaddr_storage remote; /* Remote internet address */
enum enum_vio_type type; /* Type of connection */
+ enum enum_vio_state state; /* State of the connection */
const char *desc; /* String description */
char *read_buffer; /* buffer for vio_read_buff */
char *read_pos; /* start of unfetched data in the