1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.5' into 10.6

This commit is contained in:
Oleksandr Byelkin
2020-09-02 14:36:14 +02:00
185 changed files with 2917 additions and 1594 deletions

2
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,2 @@
/debian @ottok

View File

@@ -313,10 +313,11 @@ gcov_configs="--with-gcov"
# gprof # gprof
gprof_compile_flags="-O2 -pg -g" gprof_compile_flags="-O2"
# Rest of the flags are set in CmakeFile.txt
gprof_link_flags="--disable-shared $static_link" gprof_link_flags="--disable-shared $static_link"
disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga" disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga --with-gprof"
disable_asan_plugins="--without-plugin-rocksdb" disable_asan_plugins="--without-plugin-rocksdb"

View File

@@ -242,13 +242,18 @@ IF (WITH_MSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
ENDIF() ENDIF()
OPTION(WITH_GPROF "Enable profilingg with gprof" OFF)
IF (WITH_GPROF)
MY_CHECK_AND_SET_COMPILER_FLAG("-pg -g -no-pie -fPIC")
ENDIF()
# Be nice to profilers etc # Be nice to profilers etc
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO)
# enable security hardening features, like most distributions do # enable security hardening features, like most distributions do
# in our benchmarks that costs about ~1% of performance, depending on the load # in our benchmarks that costs about ~1% of performance, depending on the load
OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON)
IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN) IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF)
# security-enhancing flags # security-enhancing flags
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now") MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now")

View File

@@ -184,7 +184,7 @@ static uint opt_tail_lines= 0;
static uint opt_connect_timeout= 0; static uint opt_connect_timeout= 0;
static uint opt_wait_for_pos_timeout= 0; static uint opt_wait_for_pos_timeout= 0;
static const uint default_wait_for_pos_timeout= 300;
static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static char delimiter[MAX_DELIMITER_LENGTH]= ";";
static size_t delimiter_length= 1; static size_t delimiter_length= 1;
@@ -5079,6 +5079,8 @@ void do_shutdown_server(struct st_command *command)
}; };
DBUG_ENTER("do_shutdown_server"); DBUG_ENTER("do_shutdown_server");
/* the wait-for-pos' default based value of 'timeout' must fit to MDEV-23511 */
compile_time_assert(default_wait_for_pos_timeout / 5 >= 60);
check_command_args(command, command->first_argument, shutdown_args, check_command_args(command, command->first_argument, shutdown_args,
sizeof(shutdown_args)/sizeof(struct command_arg), sizeof(shutdown_args)/sizeof(struct command_arg),
' '); ' ');
@@ -7058,7 +7060,7 @@ static struct my_option my_long_options[] =
{"wait_for_pos_timeout", 0, {"wait_for_pos_timeout", 0,
"Number of seconds to wait for master_pos_wait", "Number of seconds to wait for master_pos_wait",
&opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT, &opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT,
REQUIRED_ARG, 300, 0, 3600 * 12, 0, 0, 0}, REQUIRED_ARG, default_wait_for_pos_timeout, 0, 3600 * 12, 0, 0, 0},
{"plugin_dir", 0, "Directory for client-side plugins.", {"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0, &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -9085,10 +9087,6 @@ static void init_signal_handling(void)
struct sigaction sa; struct sigaction sa;
DBUG_ENTER("init_signal_handling"); DBUG_ENTER("init_signal_handling");
#ifdef HAVE_STACKTRACE
my_init_stacktrace(0);
#endif
sa.sa_flags = SA_RESETHAND | SA_NODEFER; sa.sa_flags = SA_RESETHAND | SA_NODEFER;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL);

View File

@@ -1721,7 +1721,7 @@ apply_log_finish()
bool bool
copy_back() copy_back()
{ {
bool ret; bool ret = false;
datadir_iter_t *it = NULL; datadir_iter_t *it = NULL;
datadir_node_t node; datadir_node_t node;
char *dst_dir; char *dst_dir;

View File

@@ -19,6 +19,8 @@
#ifndef ILIST_H #ifndef ILIST_H
#define ILIST_H #define ILIST_H
#include "my_dbug.h"
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
@@ -73,11 +75,13 @@ public:
typedef T *pointer; typedef T *pointer;
typedef T &reference; typedef T &reference;
Iterator(ListNode *node) noexcept : node_(node) {} Iterator(ListNode *node) noexcept : node_(node)
{ DBUG_ASSERT(node_ != nullptr); }
Iterator &operator++() noexcept Iterator &operator++() noexcept
{ {
node_= node_->next; node_= node_->next;
DBUG_ASSERT(node_ != nullptr);
return *this; return *this;
} }
Iterator operator++(int) noexcept Iterator operator++(int) noexcept
@@ -90,6 +94,7 @@ public:
Iterator &operator--() noexcept Iterator &operator--() noexcept
{ {
node_= node_->prev; node_= node_->prev;
DBUG_ASSERT(node_ != nullptr);
return *this; return *this;
} }
Iterator operator--(int) noexcept Iterator operator--(int) noexcept
@@ -184,8 +189,8 @@ public:
#ifndef DBUG_OFF #ifndef DBUG_OFF
ListNode *curr= pos.node_; ListNode *curr= pos.node_;
curr->prev= NULL; curr->prev= nullptr;
curr->next= NULL; curr->next= nullptr;
#endif #endif
return next; return next;

View File

@@ -106,6 +106,9 @@ extern int (*dbug_sanity)(void);
(_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) (_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
#define DBUG_PRINT(keyword,arglist) \ #define DBUG_PRINT(keyword,arglist) \
do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0)
#define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); }
#define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); }
#define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ () #define DBUG_POP() _db_pop_ ()
#define DBUG_SET(a1) _db_set_ (a1) #define DBUG_SET(a1) _db_set_ (a1)
@@ -172,6 +175,8 @@ extern void _db_suicide_(void);
#define DBUG_EVALUATE(keyword,a1,a2) (a2) #define DBUG_EVALUATE(keyword,a1,a2) (a2)
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0) #define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH_EMPTY do { } while(0)
#define DBUG_POP_EMPTY do { } while(0)
#define DBUG_PUSH(a1) do { } while(0) #define DBUG_PUSH(a1) do { } while(0)
#define DBUG_SET(a1) do { } while(0) #define DBUG_SET(a1) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0) #define DBUG_SET_INITIAL(a1) do { } while(0)

View File

@@ -1,5 +1,6 @@
/* /*
Copyright (c) 2001, 2011, Oracle and/or its affiliates. Copyright (c) 2001, 2011, Oracle and/or its affiliates.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -41,19 +42,21 @@
C_MODE_START C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void my_init_stacktrace(int setup_handlers);
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
my_bool silent); my_bool silent);
int my_safe_print_str(const char* val, size_t max_len); int my_safe_print_str(const char* val, size_t max_len);
void my_write_core(int sig); void my_write_core(int sig);
#if BACKTRACE_DEMANGLE # if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status); char *my_demangle(const char *mangled_name, int *status);
#endif /* BACKTRACE_DEMANGLE */ # endif /* BACKTRACE_DEMANGLE */
#ifdef __WIN__ # ifdef __WIN__
# define my_setup_stacktrace()
void my_set_exception_pointers(EXCEPTION_POINTERS *ep); void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
#endif /* __WIN__ */ # else
void my_setup_stacktrace(void);
# endif /* __WIN__ */
#else #else
#define my_init_stacktrace(A) do { } while(0) # define my_setup_stacktrace()
#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */ #endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */
#ifndef _WIN32 #ifndef _WIN32

View File

@@ -915,9 +915,7 @@ extern MYSQL_PLUGIN_IMPORT my_crc32_t my_checksum;
#if defined(__GNUC__) && defined(HAVE_ARMV8_CRC) #if defined(__GNUC__) && defined(HAVE_ARMV8_CRC)
int crc32_aarch64_available(void); int crc32_aarch64_available(void);
#if defined(HAVE_ARMV8_CRYPTO) const char *crc32c_aarch64_available(void);
int crc32c_aarch64_available(void);
#endif
#endif #endif
#ifdef DBUG_ASSERT_EXISTS #ifdef DBUG_ASSERT_EXISTS

View File

@@ -491,7 +491,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
*prev_row= NULL; *prev_row= NULL;
data->embedded_info->prev_ptr= prev_row; data->embedded_info->prev_ptr= prev_row;
return_ok: return_ok:
net_send_eof(thd, thd->server_status, thd->protocol->net_send_eof(thd, thd->server_status,
thd->get_stmt_da()->current_statement_warn_count()); thd->get_stmt_da()->current_statement_warn_count());
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:

View File

@@ -81,4 +81,3 @@ public:
uint emb_count_querycache_size(THD *thd); uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src); int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd); void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);

View File

@@ -1138,7 +1138,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
for (uint pos= 0 ; (item= it++); pos++) for (uint pos= 0 ; (item= it++); pos++)
{ {
if (prot.store_field_metadata(thd, item, pos)) if (prot.store_item_metadata(thd, item, pos))
goto err; goto err;
} }
@@ -1253,8 +1253,7 @@ bool Protocol_binary::write()
@retval FALSE Success @retval FALSE Success
*/ */
bool bool Protocol::net_send_ok(THD *thd,
net_send_ok(THD *thd,
uint server_status, uint statement_warn_count, uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong id, const char *message, ulonglong affected_rows, ulonglong id, const char *message,
bool) bool)
@@ -1289,7 +1288,7 @@ net_send_ok(THD *thd,
*/ */
bool bool
net_send_eof(THD *thd, uint server_status, uint statement_warn_count) Protocol::net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
{ {
bool error= write_eof_packet(thd, server_status, statement_warn_count); bool error= write_eof_packet(thd, server_status, statement_warn_count);
thd->cur_data= 0; thd->cur_data= 0;
@@ -1297,7 +1296,7 @@ net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
} }
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, bool Protocol::net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate) const char *sqlstate)
{ {
uint error; uint error;

View File

@@ -1087,11 +1087,6 @@ unsigned int STDCALL mysql_field_count(MYSQL *mysql)
return mysql->field_count; return mysql->field_count;
} }
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
{
return mysql->affected_rows;
}
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
{ {
return mysql->insert_id; return mysql->insert_id;

View File

@@ -1,6 +1,6 @@
# ==== Usage ==== # ==== Usage ====
# #
# [--let $shutdown_timeout= 30] # [--let $shutdown_timeout= 60]
# [--let $allow_rpl_inited= 1] # [--let $allow_rpl_inited= 1]
# --source include/restart_mysqld.inc # --source include/restart_mysqld.inc

View File

@@ -47,8 +47,8 @@ if ($rpl_debug)
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
# Send shutdown to the connected server and give # Send shutdown to the connected server and give
# it 60 seconds to die before zapping it # it 60 seconds (of mysqltest's default) to die before zapping it
shutdown_server 60; shutdown_server;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc

View File

@@ -39,7 +39,7 @@
# # Stop the server # # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; # let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file # --exec echo "wait" > $restart_file
# --shutdown_server 10 # --shutdown_server
# --source include/wait_until_disconnected.inc # --source include/wait_until_disconnected.inc
# #
# --error 1 # --error 1

View File

@@ -1,6 +1,6 @@
# ==== Usage ==== # ==== Usage ====
# #
# [--let $shutdown_timeout= 30] # [--let $shutdown_timeout= 60]
# [--let $allow_rpl_inited= 1] # [--let $allow_rpl_inited= 1]
# --source include/shutdown_mysqld.inc # --source include/shutdown_mysqld.inc

View File

@@ -4,7 +4,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
create server '' foreign data wrapper w2 options (host '127.0.0.1'); create server '' foreign data wrapper w2 options (host '127.0.0.1');
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

View File

@@ -44,7 +44,7 @@ select @@global.Host_Cache_Size > 0;
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file --exec echo "wait" > $restart_file
--shutdown_server 10 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
-- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect -- enable_reconnect
@@ -143,7 +143,7 @@ SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
#let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; #let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
#--exec echo "wait" > $restart_file #--exec echo "wait" > $restart_file
#--shutdown_server 10 #--shutdown_server
#--source include/wait_until_disconnected.inc #--source include/wait_until_disconnected.inc
#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect #-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#-- enable_reconnect #-- enable_reconnect

View File

@@ -15,7 +15,7 @@ EOF
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

View File

@@ -31,7 +31,7 @@
--echo # and slow query log file. --echo # and slow query log file.
# Restart server with fifo file as general log file. # Restart server with fifo file as general log file.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 60 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--enable_reconnect --enable_reconnect
# Write file to make mysql-test-run.pl start up the server again # Write file to make mysql-test-run.pl start up the server again

View File

@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | \d |
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT') (@time_zone_id, 0, 0, 0, 'GMT')
; ;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | \d |
@@ -160,6 +164,8 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | \d |

View File

@@ -57,6 +57,7 @@ select * from t1;
t t
0000-00-00 00:00:00 0000-00-00 00:00:00
drop table t1; drop table t1;
SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime); CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now()); insert into t1 (b,c,d) values(now(),curtime(),now());
Warnings: Warnings:
@@ -65,6 +66,7 @@ select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0 date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0
1 1 1 1 1 1
drop table t1; drop table t1;
SET TIMESTAMP=DEFAULT;
CREATE TABLE t1 (a datetime not null); CREATE TABLE t1 (a datetime not null);
insert into t1 values (0); insert into t1 values (0);
select * from t1 where a is null; select * from t1 where a is null;
@@ -298,8 +300,10 @@ f2 f3
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15"; select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
f2 f2
2001-04-15 00:00:00 2001-04-15 00:00:00
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE(); SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
1 1
SET timestamp=DEFAULT;
drop table t1; drop table t1;
create table t1 (f1 date); create table t1 (f1 date);
insert into t1 values('01-01-01'),('01-01-02'),('01-01-03'); insert into t1 values('01-01-01'),('01-01-02'),('01-01-03');

View File

@@ -32,10 +32,12 @@ drop table t1;
# Test insert of now() and curtime() # Test insert of now() and curtime()
# #
SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime); CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now()); insert into t1 (b,c,d) values(now(),curtime(),now());
select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1; select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
drop table t1; drop table t1;
SET TIMESTAMP=DEFAULT;
# #
# Test of datetime and not null # Test of datetime and not null
@@ -201,6 +203,7 @@ drop table t1;
# #
# Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function. # Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function.
# #
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01'); insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01'); insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
@@ -214,7 +217,9 @@ select f1, f2, f3 from t1 where cast(f1 as datetime) between f2 and
select f2 from t1 where '2001-04-10 12:34:56' between f2 and '01-05-01'; select f2 from t1 where '2001-04-10 12:34:56' between f2 and '01-05-01';
select f2, f3 from t1 where '01-03-10' between f2 and f3; select f2, f3 from t1 where '01-03-10' between f2 and f3;
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15"; select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE(); SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
SET timestamp=DEFAULT;
drop table t1; drop table t1;
# #

View File

@@ -2286,5 +2286,127 @@ SELECT '1972-11-06 16:58:58' < TIME'20:31:05';
'1972-11-06 16:58:58' < TIME'20:31:05' '1972-11-06 16:58:58' < TIME'20:31:05'
1 1
# #
# MDEV-23525 Wrong result of MIN(time_expr) and MAX(time_expr) with GROUP BY
#
SET timestamp=UNIX_TIMESTAMP('2020-08-21 18:19:20');
CREATE PROCEDURE p1()
BEGIN
SELECT MIN(t), MAX(t) FROM t1;
SELECT i, MIN(t), MAX(t) FROM t1 GROUP BY i;
SELECT i, MIN(COALESCE(t)), MAX(COALESCE(t)) FROM t1 GROUP BY i;
SELECT i, MIN(t+INTERVAL 1 SECOND), MAX(t+INTERVAL 1 SECOND) FROM t1 GROUP BY i;
SELECT i, MIN(TIME'10:20:30'+INTERVAL 1 SECOND) FROM t1 GROUP BY i;
SELECT i, MIN(CURRENT_TIME), MAX(CURRENT_TIME) FROM t1 GROUP BY i;
SELECT
i,
MIN((SELECT MAX(CURRENT_TIME) FROM t1)),
MAX((SELECT MAX(CURRENT_TIME) FROM t1))
FROM t1 GROUP BY i;
SELECT
i,
MIN(NAME_CONST('name',TIME'10:20:30')),
MAX(NAME_CONST('name',TIME'10:20:30'))
FROM t1 GROUP BY i;
EXECUTE IMMEDIATE "SELECT i, MIN(?),MAX(?) FROM t1 GROUP BY i"
USING TIME'10:20:30', TIME'10:20:30';
END;
$$
CREATE TABLE t1 (i INT, t TIME);
INSERT INTO t1 VALUES (1,'10:20:30');
INSERT INTO t1 VALUES (1,'100:20:20');
CALL p1;
MIN(t) MAX(t)
10:20:30 100:20:20
i MIN(t) MAX(t)
1 10:20:30 100:20:20
i MIN(COALESCE(t)) MAX(COALESCE(t))
1 10:20:30 100:20:20
i MIN(t+INTERVAL 1 SECOND) MAX(t+INTERVAL 1 SECOND)
1 10:20:31 100:20:21
i MIN(TIME'10:20:30'+INTERVAL 1 SECOND)
1 10:20:31
i MIN(CURRENT_TIME) MAX(CURRENT_TIME)
1 18:19:20 18:19:20
i MIN((SELECT MAX(CURRENT_TIME) FROM t1)) MAX((SELECT MAX(CURRENT_TIME) FROM t1))
1 18:19:20 18:19:20
i MIN(NAME_CONST('name',TIME'10:20:30')) MAX(NAME_CONST('name',TIME'10:20:30'))
1 10:20:30 10:20:30
i MIN(?) MAX(?)
1 10:20:30 10:20:30
DROP TABLE t1;
CREATE TABLE t1 (i INT, t TIME(3));
INSERT INTO t1 VALUES (1,'10:20:30.123');
INSERT INTO t1 VALUES (1,'100:20:20.123');
CALL p1;
MIN(t) MAX(t)
10:20:30.123 100:20:20.123
i MIN(t) MAX(t)
1 10:20:30.123 100:20:20.123
i MIN(COALESCE(t)) MAX(COALESCE(t))
1 10:20:30.123 100:20:20.123
i MIN(t+INTERVAL 1 SECOND) MAX(t+INTERVAL 1 SECOND)
1 10:20:31.123 100:20:21.123
i MIN(TIME'10:20:30'+INTERVAL 1 SECOND)
1 10:20:31
i MIN(CURRENT_TIME) MAX(CURRENT_TIME)
1 18:19:20 18:19:20
i MIN((SELECT MAX(CURRENT_TIME) FROM t1)) MAX((SELECT MAX(CURRENT_TIME) FROM t1))
1 18:19:20 18:19:20
i MIN(NAME_CONST('name',TIME'10:20:30')) MAX(NAME_CONST('name',TIME'10:20:30'))
1 10:20:30 10:20:30
i MIN(?) MAX(?)
1 10:20:30 10:20:30
DROP TABLE t1;
CREATE TABLE t1 (i INT, t TIME(6));
INSERT INTO t1 VALUES (1,'10:20:30.123456');
INSERT INTO t1 VALUES (1,'100:20:20.123456');
CALL p1;
MIN(t) MAX(t)
10:20:30.123456 100:20:20.123456
i MIN(t) MAX(t)
1 10:20:30.123456 100:20:20.123456
i MIN(COALESCE(t)) MAX(COALESCE(t))
1 10:20:30.123456 100:20:20.123456
i MIN(t+INTERVAL 1 SECOND) MAX(t+INTERVAL 1 SECOND)
1 10:20:31.123456 100:20:21.123456
i MIN(TIME'10:20:30'+INTERVAL 1 SECOND)
1 10:20:31
i MIN(CURRENT_TIME) MAX(CURRENT_TIME)
1 18:19:20 18:19:20
i MIN((SELECT MAX(CURRENT_TIME) FROM t1)) MAX((SELECT MAX(CURRENT_TIME) FROM t1))
1 18:19:20 18:19:20
i MIN(NAME_CONST('name',TIME'10:20:30')) MAX(NAME_CONST('name',TIME'10:20:30'))
1 10:20:30 10:20:30
i MIN(?) MAX(?)
1 10:20:30 10:20:30
DROP TABLE t1;
SET @@global.mysql56_temporal_format=false;
CREATE TABLE t1 (i INT, t TIME(6));
INSERT INTO t1 VALUES (1,'10:20:30.123456');
INSERT INTO t1 VALUES (1,'100:20:20.123456');
CALL p1;
MIN(t) MAX(t)
10:20:30.123456 100:20:20.123456
i MIN(t) MAX(t)
1 10:20:30.123456 100:20:20.123456
i MIN(COALESCE(t)) MAX(COALESCE(t))
1 10:20:30.123456 100:20:20.123456
i MIN(t+INTERVAL 1 SECOND) MAX(t+INTERVAL 1 SECOND)
1 10:20:31.123456 100:20:21.123456
i MIN(TIME'10:20:30'+INTERVAL 1 SECOND)
1 10:20:31
i MIN(CURRENT_TIME) MAX(CURRENT_TIME)
1 18:19:20 18:19:20
i MIN((SELECT MAX(CURRENT_TIME) FROM t1)) MAX((SELECT MAX(CURRENT_TIME) FROM t1))
1 18:19:20 18:19:20
i MIN(NAME_CONST('name',TIME'10:20:30')) MAX(NAME_CONST('name',TIME'10:20:30'))
1 10:20:30 10:20:30
i MIN(?) MAX(?)
1 10:20:30 10:20:30
DROP TABLE t1;
SET @@global.mysql56_temporal_format=default;
DROP PROCEDURE p1;
SET timestamp=DEFAULT;
#
# End of 10.4 tests # End of 10.4 tests
# #

View File

@@ -1490,6 +1490,66 @@ DROP TABLE t1;
SELECT '1972-11-06 16:58:58' < TIME'20:31:05'; SELECT '1972-11-06 16:58:58' < TIME'20:31:05';
--echo #
--echo # MDEV-23525 Wrong result of MIN(time_expr) and MAX(time_expr) with GROUP BY
--echo #
SET timestamp=UNIX_TIMESTAMP('2020-08-21 18:19:20');
DELIMITER $$;
CREATE PROCEDURE p1()
BEGIN
SELECT MIN(t), MAX(t) FROM t1;
SELECT i, MIN(t), MAX(t) FROM t1 GROUP BY i;
SELECT i, MIN(COALESCE(t)), MAX(COALESCE(t)) FROM t1 GROUP BY i;
SELECT i, MIN(t+INTERVAL 1 SECOND), MAX(t+INTERVAL 1 SECOND) FROM t1 GROUP BY i;
SELECT i, MIN(TIME'10:20:30'+INTERVAL 1 SECOND) FROM t1 GROUP BY i;
SELECT i, MIN(CURRENT_TIME), MAX(CURRENT_TIME) FROM t1 GROUP BY i;
SELECT
i,
MIN((SELECT MAX(CURRENT_TIME) FROM t1)),
MAX((SELECT MAX(CURRENT_TIME) FROM t1))
FROM t1 GROUP BY i;
SELECT
i,
MIN(NAME_CONST('name',TIME'10:20:30')),
MAX(NAME_CONST('name',TIME'10:20:30'))
FROM t1 GROUP BY i;
EXECUTE IMMEDIATE "SELECT i, MIN(?),MAX(?) FROM t1 GROUP BY i"
USING TIME'10:20:30', TIME'10:20:30';
END;
$$
DELIMITER ;$$
CREATE TABLE t1 (i INT, t TIME);
INSERT INTO t1 VALUES (1,'10:20:30');
INSERT INTO t1 VALUES (1,'100:20:20');
CALL p1;
DROP TABLE t1;
CREATE TABLE t1 (i INT, t TIME(3));
INSERT INTO t1 VALUES (1,'10:20:30.123');
INSERT INTO t1 VALUES (1,'100:20:20.123');
CALL p1;
DROP TABLE t1;
CREATE TABLE t1 (i INT, t TIME(6));
INSERT INTO t1 VALUES (1,'10:20:30.123456');
INSERT INTO t1 VALUES (1,'100:20:20.123456');
CALL p1;
DROP TABLE t1;
SET @@global.mysql56_temporal_format=false;
CREATE TABLE t1 (i INT, t TIME(6));
INSERT INTO t1 VALUES (1,'10:20:30.123456');
INSERT INTO t1 VALUES (1,'100:20:20.123456');
CALL p1;
DROP TABLE t1;
SET @@global.mysql56_temporal_format=default;
DROP PROCEDURE p1;
SET timestamp=DEFAULT;
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #

View File

@@ -41,7 +41,7 @@ RESET MASTER;
# 1. Stop master server # 1. Stop master server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 10 -- shutdown_server
-- source include/wait_until_disconnected.inc -- source include/wait_until_disconnected.inc
# 2. Prepare log and index file # 2. Prepare log and index file
@@ -70,7 +70,7 @@ FLUSH LOGS;
# 1. Stop the server # 1. Stop the server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 10 -- shutdown_server
-- source include/wait_until_disconnected.inc -- source include/wait_until_disconnected.inc
# 2. Undo changes to index and log files # 2. Undo changes to index and log files

View File

@@ -22,7 +22,7 @@
--enable_reconnect --enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
shutdown_server 10; shutdown_server;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc

View File

@@ -1,6 +1,12 @@
connection node_2;
connection node_1;
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
connection node_1;
connection node_2;
SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
@@ -12,8 +18,13 @@ INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8); INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9); INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
include/assert_grep.inc [Receiving IST: 11 writesets, seqnos] connection node_1;
include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete] connection node_2;
include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(11/11 events\) complete] connection node_1;
include/assert_grep.inc [Receiving IST: 13 writesets, seqnos 3-15]
include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete]
include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(13/13 events\) complete]
connection node_1;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -0,0 +1,19 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
INSERT INTO t1 VALUES (1, 1);
SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
UPDATE t1 SET f2 = 2 WHERE f1 = 1;
connection node_1_ctrl;
SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
connection node_2;
connection node_1_ctrl;
SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
connection node_1;
SET DEBUG_SYNC = "RESET";
connection node_2;
connection node_1;
DROP TABLE t1;

View File

@@ -5,6 +5,7 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
# This could cause out of storage if run /dev/shm # This could cause out of storage if run /dev/shm
--source include/big_test.inc --source include/big_test.inc
--source include/force_restart.inc
# Isolate node #2 # Isolate node #2
--connection node_2 --connection node_2
@@ -58,16 +59,16 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_only_after = Need state transfer --let $assert_only_after = Need state transfer
--let $assert_text = Receiving IST: 1[13] writesets --let $assert_text = Receiving IST: 13 writesets, seqnos 3-15
--let $assert_select = Receiving IST: 1[13] writesets --let $assert_select = Receiving IST: 13 writesets, seqnos 3-15
--source include/assert_grep.inc --source include/assert_grep.inc
--let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete --let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete
--let $assert_select = Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete --let $assert_select = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete
--source include/assert_grep.inc --source include/assert_grep.inc
--let $assert_text = Receiving IST\.\.\.100\.0% \(11/11 events\) complete --let $assert_text = Receiving IST\.\.\.100\.0% \(13/13 events\) complete
--let $assert_select = Receiving IST\.\.\.100\.0% \(11/11 events\) complete --let $assert_select = Receiving IST\.\.\.100\.0% \(13/13 events\) complete
--source include/assert_grep.inc --source include/assert_grep.inc
# Cleanup # Cleanup

View File

@@ -0,0 +1,58 @@
# The test verifies that the FLUSH TABLES WITH READ LOCK does not
# time out if it needs to wait for another MDL lock for short duration
# during SST donation.
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $node_1 = node_1
--let $node_2 = node_2
--source include/auto_increment_offset_save.inc
--let $galera_connection_name = node_1_ctrl
--let $galera_server_number = 1
--source include/galera_connect.inc
#
# Run UPDATE on node_1 and make it block before table locks are taken.
# This should block FTWRL.
#
--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
INSERT INTO t1 VALUES (1, 1);
SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
--send UPDATE t1 SET f2 = 2 WHERE f1 = 1
--connection node_1_ctrl
SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
#
# Restart node_2, force SST.
#
--connection node_2
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
# Restart without waiting. The UPDATE should block FTWRL on node_1,
# so the SST cannot be completed and node_2 cannot join before
# UPDATE connection is signalled to continue.
--exec echo "restart:$start_mysqld_params" > $_expect_file_name
# If the bug is present, FTWRL times out on node_1 in couple of
# seconds and node_2 fails to join.
--sleep 10
--connection node_1_ctrl
SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
--connection node_1
--reap
SET DEBUG_SYNC = "RESET";
--connection node_2
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection node_1
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc

View File

@@ -5,6 +5,9 @@ SET wsrep_on=OFF;
DROP SCHEMA test; DROP SCHEMA test;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3; connection node_3;
connection node_1;
connection node_2;
connection node_3;
SET wsrep_on=OFF; SET wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER); CREATE TABLE test.t1 (f1 INTEGER);
connection node_1; connection node_1;

View File

@@ -1,40 +1,81 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 1);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (2, 3); INSERT INTO t1 VALUES (2, 3);
connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET wsrep_sync_wait = 0; SET wsrep_sync_wait = 0;
SET wsrep_on = OFF; SET wsrep_on = OFF;
SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (3, 2); INSERT INTO t1 VALUES (3, 2);
connection node_1a;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_3;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (4, 3); INSERT INTO t1 VALUES (4, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (5, 2); INSERT INTO t1 VALUES (5, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (6, 3); INSERT INTO t1 VALUES (6, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (7, 2); INSERT INTO t1 VALUES (7, 2);
connection node_3;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (8, 3); INSERT INTO t1 VALUES (8, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_2;
INSERT INTO t1 VALUES (9, 2); INSERT INTO t1 VALUES (9, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
DROP TABLE t1; DROP TABLE t1;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_2;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_3;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");

View File

@@ -1,18 +1,39 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 1);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (2, 3); INSERT INTO t1 VALUES (2, 3);
connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET wsrep_sync_wait = 0; SET wsrep_sync_wait = 0;
SET wsrep_on = OFF; SET wsrep_on = OFF;
SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (3, 2); INSERT INTO t1 VALUES (3, 2);
connection node_1a;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_3;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (4, 3); INSERT INTO t1 VALUES (4, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (5, 2); INSERT INTO t1 VALUES (5, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
@@ -24,18 +45,35 @@ SET SESSION wsrep_on = 0;
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (6, 3); INSERT INTO t1 VALUES (6, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (7, 2); INSERT INTO t1 VALUES (7, 2);
connection node_3;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (8, 3); INSERT INTO t1 VALUES (8, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_2;
INSERT INTO t1 VALUES (9, 2); INSERT INTO t1 VALUES (9, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
@@ -44,7 +82,10 @@ VARIABLE_NAME VARIABLE_VALUE
WSREP_DEBUG_SYNC_WAITERS process_primary_configuration WSREP_DEBUG_SYNC_WAITERS process_primary_configuration
SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
DROP TABLE t1; DROP TABLE t1;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_2;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_3;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");

View File

@@ -1,44 +1,85 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 1);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (2, 3); INSERT INTO t1 VALUES (2, 3);
connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET wsrep_sync_wait = 0; SET wsrep_sync_wait = 0;
SET wsrep_on = OFF; SET wsrep_on = OFF;
SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (3, 2); INSERT INTO t1 VALUES (3, 2);
connection node_1a;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_3;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (4, 3); INSERT INTO t1 VALUES (4, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (5, 2); INSERT INTO t1 VALUES (5, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
4 4
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
WSREP_DEBUG_SYNC_WAITERS WSREP_DEBUG_SYNC_WAITERS
connection node_3;
INSERT INTO t1 VALUES (6, 3); INSERT INTO t1 VALUES (6, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
INSERT INTO t1 VALUES (7, 2); INSERT INTO t1 VALUES (7, 2);
connection node_3;
connection node_1a;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_2;
connection node_3;
INSERT INTO t1 VALUES (8, 3); INSERT INTO t1 VALUES (8, 3);
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
connection node_2;
connection node_1a;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
connection node_2;
INSERT INTO t1 VALUES (9, 2); INSERT INTO t1 VALUES (9, 2);
connection node_3;
connection node_1a;
SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
@@ -48,8 +89,11 @@ SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0;
SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
connection node_1;
DROP TABLE t1; DROP TABLE t1;
call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_2;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
connection node_3;
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");

View File

@@ -263,3 +263,10 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1); insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none; alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1; drop table t1;
# pk(o1,o2) to pk(o1,o2,autoinc) must not sort
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;

View File

@@ -53,6 +53,13 @@ ALTER TABLE t1 DROP a;
ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint
ALTER TABLE t1 ADD c INT; ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx; DROP TABLE t1, tx;
#
# MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
#
CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
create table t1 (a int) transactional=1 engine=aria; create table t1 (a int) transactional=1 engine=aria;
create table t2 (a int) transactional=1 engine=innodb; create table t2 (a int) transactional=1 engine=innodb;
show create table t1; show create table t1;

View File

@@ -655,6 +655,7 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# MDEV-17187 table doesn't exist in engine after ALTER other tables # MDEV-17187 table doesn't exist in engine after ALTER other tables
# with CONSTRAINTs # with CONSTRAINTs
# #
call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=on; set foreign_key_checks=on;
create table t1 (id int not null primary key) engine=innodb; create table t1 (id int not null primary key) engine=innodb;
create table t2 (id int not null primary key, fid int not null, create table t2 (id int not null primary key, fid int not null,
@@ -710,6 +711,32 @@ drop table t1,t2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
drop table t1,t2; drop table t1,t2;
ERROR 42S02: Unknown table 'test.t2' ERROR 42S02: Unknown table 'test.t2'
#
# MDEV-22934 Table disappear after two alter table command
#
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL,
PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL,
f2 INT NOT NULL, f3 INT NOT NULL,
PRIMARY KEY(f1, f2), UNIQUE KEY(f2),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE,
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE;
ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
`f3` int(11) NOT NULL,
PRIMARY KEY (`f3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB;
ERROR 42S01: Table 't2' already exists
DROP TABLE t2, t1;
# End of 10.2 tests # End of 10.2 tests
CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)), CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)),
FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB; FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB;
@@ -761,11 +788,12 @@ set default_storage_engine= default;
# #
# MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func
# #
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB; CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b); ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
SET FOREIGN_KEY_CHECKS=DEFAULT;
DROP TABLE t1; DROP TABLE t1;
# End of 10.5 tests
# #
# MDEV-22602 Disable UPDATE CASCADE for SQL constraints # MDEV-22602 Disable UPDATE CASCADE for SQL constraints
# #
@@ -784,3 +812,4 @@ create or replace table t1 (a varchar(4096) unique) engine=innodb;
create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign key(a) references t1(a) on update cascade) engine=innodb; create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign key(a) references t1(a) on update cascade) engine=innodb;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
drop table t1; drop table t1;
# End of 10.5 tests

View File

@@ -1081,3 +1081,10 @@ update t2 set col145=@b;
COMMIT; COMMIT;
drop table t2; drop table t2;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-19526 heap number overflow
#
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
DROP TABLE t1;

View File

@@ -323,4 +323,9 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1); insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none; alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1; drop table t1;
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;
SET DEBUG_DBUG = @saved_debug_dbug; SET DEBUG_DBUG = @saved_debug_dbug;

View File

@@ -1907,6 +1907,11 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1); insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none; alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1; drop table t1;
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;
# #
# MDEV-15325 Incomplete validation of missing tablespace during recovery # MDEV-15325 Incomplete validation of missing tablespace during recovery
# #

View File

@@ -2544,7 +2544,6 @@ set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb;
alter table t1 modify column a int; alter table t1 modify column a int;
Got one of the listed errors
set foreign_key_checks=1; set foreign_key_checks=1;
drop table t2,t1; drop table t2,t1;
set foreign_key_checks=0; set foreign_key_checks=0;
@@ -2553,6 +2552,7 @@ create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin
alter table t1 convert to character set utf8; alter table t1 convert to character set utf8;
set foreign_key_checks=1; set foreign_key_checks=1;
drop table t2,t1; drop table t2,t1;
call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=0; set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;

View File

@@ -410,4 +410,10 @@ CREATE TABLE t (i INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t SET i=1; INSERT INTO t SET i=1;
ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT;
DROP TABLE t; DROP TABLE t;
#
# MDEV-23499 Assertion c.same_type(*o) failed
#
CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB;
ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST;
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_sequence.inc
# #
# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error # MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error
# #
@@ -60,6 +61,14 @@ ALTER TABLE t1 DROP a;
ALTER TABLE t1 ADD c INT; ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx; DROP TABLE t1, tx;
--echo #
--echo # MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
--echo #
CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
# #
# Check that innodb supports transactional=1 # Check that innodb supports transactional=1
# #

View File

@@ -657,6 +657,8 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo # with CONSTRAINTs --echo # with CONSTRAINTs
--echo # --echo #
call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=on; set foreign_key_checks=on;
create table t1 (id int not null primary key) engine=innodb; create table t1 (id int not null primary key) engine=innodb;
create table t2 (id int not null primary key, fid int not null, create table t2 (id int not null primary key, fid int not null,
@@ -698,6 +700,27 @@ drop table t1,t2;
--error ER_BAD_TABLE_ERROR --error ER_BAD_TABLE_ERROR
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-22934 Table disappear after two alter table command
--echo #
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL,
PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL,
f2 INT NOT NULL, f3 INT NOT NULL,
PRIMARY KEY(f1, f2), UNIQUE KEY(f2),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE,
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE;
ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY;
SHOW CREATE TABLE t2;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB;
DROP TABLE t2, t1;
--echo # End of 10.2 tests --echo # End of 10.2 tests
# MDEV-21792 Server aborts upon attempt to create foreign key on spatial field # MDEV-21792 Server aborts upon attempt to create foreign key on spatial field
@@ -732,15 +755,15 @@ set default_storage_engine= default;
--echo # --echo #
--echo # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func --echo # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func
--echo # --echo #
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB; CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b); ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
SET FOREIGN_KEY_CHECKS=DEFAULT;
# Cleanup # Cleanup
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.5 tests
--echo # --echo #
--echo # MDEV-22602 Disable UPDATE CASCADE for SQL constraints --echo # MDEV-22602 Disable UPDATE CASCADE for SQL constraints
--echo # --echo #
@@ -764,4 +787,6 @@ create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign
drop table t1; drop table t1;
--echo # End of 10.5 tests
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

View File

@@ -2,6 +2,7 @@
# Tests for setting innodb-page-size=64k; # Tests for setting innodb-page-size=64k;
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_innodb_64k.inc --source include/have_innodb_64k.inc
--source include/have_sequence.inc
call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
@@ -638,3 +639,11 @@ COMMIT;
drop table t2; drop table t2;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-19526 heap number overflow
--echo #
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
DROP TABLE t1;

View File

@@ -24,7 +24,7 @@ alter table t1 add primary key (pk);
--echo # Stop the server, replace the frm with the old one and restart the server --echo # Stop the server, replace the frm with the old one and restart the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $datadir/test/t1.frm --remove_file $datadir/test/t1.frm

View File

@@ -1622,7 +1622,6 @@ drop table t1;
set foreign_key_checks=0; set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb;
-- error 1025,1025
alter table t1 modify column a int; alter table t1 modify column a int;
set foreign_key_checks=1; set foreign_key_checks=1;
drop table t2,t1; drop table t2,t1;
@@ -1638,6 +1637,7 @@ drop table t2,t1;
# test that RENAME does not allow invalid charsets when f_k_c is 0 # test that RENAME does not allow invalid charsets when f_k_c is 0
call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=0; set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;

View File

@@ -50,7 +50,7 @@ SELECT * FROM bug_60196;
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Send a shutdown request to the server # Send a shutdown request to the server
-- shutdown_server 10 -- shutdown_server
# Call script that will poll the server waiting for it to disapear # Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc -- source include/wait_until_disconnected.inc
@@ -124,7 +124,7 @@ SELECT * FROM Bug_60309;
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Send a shutdown request to the server # Send a shutdown request to the server
-- shutdown_server 10 -- shutdown_server
# Call script that will poll the server waiting for it to disapear # Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc -- source include/wait_until_disconnected.inc

View File

@@ -430,4 +430,11 @@ INSERT INTO t SET i=1;
ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-23499 Assertion c.same_type(*o) failed
--echo #
CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB;
ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST;
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View File

@@ -11,7 +11,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show warnings; show warnings;
Level Code Message Level Code Message
Error 1062 Duplicate entry '2' for key 'PRIMARY' Error 1062 Duplicate entry '2' for key 'PRIMARY'
Note 4173 Engine Aria does not support rollback. Changes where committed during rollback call Note 4173 Engine Aria does not support rollback. Changes were committed during rollback call
Warning 1196 Some non-transactional changed tables couldn't be rolled back Warning 1196 Some non-transactional changed tables couldn't be rolled back
select * from t1; select * from t1;
a a

View File

@@ -150,7 +150,7 @@ show all slaves status;
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
restart restart
EOF EOF
--shutdown_server 60 --shutdown_server
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--source include/wait_for_slave_to_start.inc --source include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2'; set default_master_connection = 'MASTER 2.2';

View File

@@ -10,7 +10,7 @@ flush tables;
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait wait
EOF EOF
--shutdown_server 60 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--enable_reconnect --enable_reconnect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

View File

@@ -40,7 +40,7 @@ SET @@GLOBAL.debug_dbug="+d,simulate_delay_at_shutdown";
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait wait
EOF EOF
# --shutdown_server 60 # --shutdown_server
--send SHUTDOWN WAIT FOR ALL SLAVES --send SHUTDOWN WAIT FOR ALL SLAVES
--reap --reap
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc

View File

@@ -626,7 +626,7 @@ SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait wait
EOF EOF
shutdown_server 10; shutdown_server;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $datadir/master-bin.state --remove_file $datadir/master-bin.state

View File

@@ -29,7 +29,7 @@ CHANGE MASTER TO master_use_gtid=current_pos;
wait wait
EOF EOF
FLUSH LOGS; FLUSH LOGS;
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection server_1 --connection server_1
@@ -70,7 +70,7 @@ SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -103,7 +103,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -148,7 +148,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -191,7 +191,7 @@ SET sql_log_bin= 1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -221,7 +221,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -237,7 +237,7 @@ SET sql_log_bin= 1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -273,7 +273,7 @@ SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -305,7 +305,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
# Let the slave mysqld server start again. # Let the slave mysqld server start again.

View File

@@ -57,7 +57,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection server_1 --connection server_1
@@ -96,7 +96,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection server_1 --connection server_1
@@ -134,7 +134,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection server_1 --connection server_1
@@ -178,7 +178,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection server_1 --connection server_1
@@ -275,7 +275,7 @@ while (!$done)
wait wait
EOF EOF
--connection server_2 --connection server_2
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--echo *** Restart the slave server to prove 'gtid_slave_pos_innodb' autodiscovery *** --echo *** Restart the slave server to prove 'gtid_slave_pos_innodb' autodiscovery ***

View File

@@ -208,7 +208,7 @@ SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
wait-rpl_mdev382.test wait-rpl_mdev382.test
EOF EOF
--shutdown_server 30 --shutdown_server
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test restart-rpl_mdev382.test

View File

@@ -42,7 +42,7 @@ ALTER TABLE `E` REMOVE PARTITIONING;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait wait
EOF EOF
--shutdown_server 30 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection default --connection default
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc

View File

@@ -46,7 +46,7 @@ wait
EOF EOF
--enable_reconnect --enable_reconnect
--shutdown_server 60 --shutdown_server
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc

View File

@@ -12,7 +12,7 @@
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart restart
EOF EOF
--shutdown_server 60 --shutdown_server
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc

View File

@@ -314,7 +314,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE zlib DEFAULT_VALUE zlib
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM VARIABLE_TYPE ENUM
VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2 VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL

View File

@@ -0,0 +1,3 @@
SET SESSION wsrep_sync_wait=15;
SET SESSION wsrep_on=1;
START TRANSACTION READ WRITE;

View File

@@ -0,0 +1,13 @@
SET COLLATION_CONNECTION='utf16le_bin';
SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/'
SET GLOBAL wsrep_cluster_address='OFF';
SET GLOBAL wsrep_slave_threads=10;
SELECT 1;
1
1
SET GLOBAL wsrep_cluster_address='gcomm://';
SET GLOBAL wsrep_slave_threads=DEFAULT;
CALL mtr.add_suppression("wsrep_load()");
CALL mtr.add_suppression("Failed to create a new provider");
CALL mtr.add_suppression("Failed to load provider");

View File

@@ -0,0 +1,3 @@
SELECT WSREP_LAST_SEEN_GTID();
WSREP_LAST_SEEN_GTID()
0-0-0

View File

@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | \d |
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT') (@time_zone_id, 0, 0, 0, 'GMT')
; ;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | \d |

View File

@@ -9,6 +9,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -26,6 +27,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# Silent run # Silent run
@@ -36,6 +38,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -50,6 +53,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT') (@time_zone_id, 0, 0, 0, 'GMT')
; ;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# #

View File

@@ -0,0 +1,8 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=OFF
binlog-format=ROW
wsrep-provider=none
wsrep-cluster-address='gcomm://'
innodb_autoinc_lock_mode=2

View File

@@ -0,0 +1,12 @@
#
# MDEV-22443: terminate called after throwing an instance of
# 'wsrep::runtime_error' in std::terminate on START TRANSACTION
#
--source include/have_innodb.inc
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
SET SESSION wsrep_sync_wait=15;
SET SESSION wsrep_on=1;
START TRANSACTION READ WRITE;

View File

@@ -0,0 +1,8 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=OFF
binlog-format=ROW
wsrep-provider=none
wsrep-cluster-address='gcomm://'
innodb_autoinc_lock_mode=2

View File

@@ -0,0 +1,22 @@
#
# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting
# invalid wsrep_provider (on optimized builds)
#
--source include/have_innodb.inc
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
SET COLLATION_CONNECTION='utf16le_bin';
--error 1231
SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
SET GLOBAL wsrep_cluster_address='OFF';
SET GLOBAL wsrep_slave_threads=10;
SELECT 1;
SET GLOBAL wsrep_cluster_address='gcomm://';
SET GLOBAL wsrep_slave_threads=DEFAULT;
CALL mtr.add_suppression("wsrep_load()");
CALL mtr.add_suppression("Failed to create a new provider");
CALL mtr.add_suppression("Failed to load provider");

View File

@@ -0,0 +1,8 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=OFF
binlog-format=ROW
wsrep-provider=none
wsrep-cluster-address='gcomm://'
innodb_autoinc_lock_mode=2

View File

@@ -0,0 +1,10 @@
#
# MDEV-23466: SIGABRT in wsrep::server_state::provider on
# SELECT WSREP_LAST_SEEN_GTID() on optimized builds
#
--source include/have_innodb.inc
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
SELECT WSREP_LAST_SEEN_GTID();

View File

@@ -8,40 +8,49 @@
#include <asm/hwcap.h> #include <asm/hwcap.h>
#ifndef HWCAP_CRC32 #ifndef HWCAP_CRC32
#define HWCAP_CRC32 (1 << 7) # define HWCAP_CRC32 (1 << 7)
#endif #endif
#ifndef HWCAP_PMULL
# define HWCAP_PMULL (1 << 4)
#endif
static int pmull_supported;
/* ARM made crc32 default from ARMv8.1 but optional in ARMv8A /* ARM made crc32 default from ARMv8.1 but optional in ARMv8A
so the runtime check. */ * Runtime check API.
*/
int crc32_aarch64_available(void) int crc32_aarch64_available(void)
{ {
unsigned long auxv= getauxval(AT_HWCAP); unsigned long auxv= getauxval(AT_HWCAP);
return (auxv & HWCAP_CRC32) != 0; return (auxv & HWCAP_CRC32) != 0;
} }
#if defined(HAVE_ARMV8_CRYPTO) const char *crc32c_aarch64_available(void)
#ifndef HWCAP_PMULL
#define HWCAP_PMULL (1 << 4)
#endif
/* Check if target ARM machine support crc32 + pmull for computing crc32c */
int crc32c_aarch64_available(void)
{ {
return !(~getauxval(AT_HWCAP) & (HWCAP_CRC32 | HWCAP_PMULL)); unsigned long auxv= getauxval(AT_HWCAP);
if (!(auxv & HWCAP_CRC32))
return NULL;
pmull_supported= (auxv & HWCAP_PMULL) != 0;
if (pmull_supported)
return "Using ARMv8 crc32 + pmull instructions";
else
return "Using ARMv8 crc32 instructions";
} }
#endif /* HAVE_ARMV8_CRYPTO */
#endif /* HAVE_ARMV8_CRC */ #endif /* __GNUC__ && HAVE_ARMV8_CRC */
#ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS #ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
/* Request crc extension capabilities from the assembler */ /* Request crc extension capabilities from the assembler */
asm(".arch_extension crc"); asm(".arch_extension crc");
#ifdef HAVE_ARMV8_CRYPTO # ifdef HAVE_ARMV8_CRYPTO
/* crypto extension */ /* crypto extension */
asm(".arch_extension crypto"); asm(".arch_extension crypto");
#endif # endif
#define CRC32CX(crc, value) __asm__("crc32cx %w[c], %w[c], %x[v]":[c]"+r"(crc):[v]"r"(value)) #define CRC32CX(crc, value) __asm__("crc32cx %w[c], %w[c], %x[v]":[c]"+r"(crc):[v]"r"(value))
#define CRC32CW(crc, value) __asm__("crc32cw %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value)) #define CRC32CW(crc, value) __asm__("crc32cw %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
@@ -53,9 +62,6 @@ asm(".arch_extension crypto");
__asm__("crc32cx %w[c2], %w[c2], %x[v]":[c2]"+r"(crc2):[v]"r"(*((const uint64_t *)buffer + 42*2 + (ITR))));\ __asm__("crc32cx %w[c2], %w[c2], %x[v]":[c2]"+r"(crc2):[v]"r"(*((const uint64_t *)buffer + 42*2 + (ITR))));\
__asm__("crc32cx %w[c0], %w[c0], %x[v]":[c0]"+r"(crc0):[v]"r"(*((const uint64_t *)buffer + 42*0 + (ITR)))); __asm__("crc32cx %w[c0], %w[c0], %x[v]":[c0]"+r"(crc0):[v]"r"(*((const uint64_t *)buffer + 42*0 + (ITR))));
#define CRC32C3X8_ZERO \
__asm__("crc32cx %w[c0], %w[c0], xzr":[c0]"+r"(crc0));
#else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ #else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
/* Intrinsics header*/ /* Intrinsics header*/
@@ -72,9 +78,6 @@ asm(".arch_extension crypto");
crc2 = __crc32cd(crc2, *((const uint64_t *)buffer + 42*2 + (ITR)));\ crc2 = __crc32cd(crc2, *((const uint64_t *)buffer + 42*2 + (ITR)));\
crc0 = __crc32cd(crc0, *((const uint64_t *)buffer + 42*0 + (ITR))); crc0 = __crc32cd(crc0, *((const uint64_t *)buffer + 42*0 + (ITR)));
#define CRC32C3X8_ZERO \
crc0 = __crc32cd(crc0, (const uint64_t)0);
#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ #endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
#define CRC32C7X3X8(buffer, ITR) do {\ #define CRC32C7X3X8(buffer, ITR) do {\
@@ -85,17 +88,7 @@ asm(".arch_extension crypto");
CRC32C3X8(buffer, ((ITR) * 7 + 4)) \ CRC32C3X8(buffer, ((ITR) * 7 + 4)) \
CRC32C3X8(buffer, ((ITR) * 7 + 5)) \ CRC32C3X8(buffer, ((ITR) * 7 + 5)) \
CRC32C3X8(buffer, ((ITR) * 7 + 6)) \ CRC32C3X8(buffer, ((ITR) * 7 + 6)) \
} while(0) } while(0)
#define CRC32C7X3X8_ZERO do {\
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
CRC32C3X8_ZERO \
} while(0)
#define PREF4X64L1(buffer, PREF_OFFSET, ITR) \ #define PREF4X64L1(buffer, PREF_OFFSET, ITR) \
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\
@@ -121,37 +114,46 @@ asm(".arch_extension crypto");
PREF4X64L2(buffer,(PREF_OFFSET), 8) \ PREF4X64L2(buffer,(PREF_OFFSET), 8) \
PREF4X64L2(buffer,(PREF_OFFSET), 12) PREF4X64L2(buffer,(PREF_OFFSET), 12)
uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len) uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
{ {
uint32_t crc0, crc1, crc2; uint32_t crc0, crc1, crc2;
int64_t length = (int64_t)len; int64_t length= (int64_t)len;
crc = 0xFFFFFFFFU; crc= 0xFFFFFFFFU;
if (buffer) { /* Pmull runtime check here.
* Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030).
/* Crypto extension Support *
* Process 1024 Bytes (per block) * Consider the condition that the target platform does support hardware crc32
* but not support PMULL. In this condition, it should leverage the aarch64
* crc32 instruction (__crc32c) and just only skip parallel computation (pmull/vmull)
* rather than skip all hardware crc32 instruction of computation.
*/ */
if (pmull_supported)
{
/* The following Macro (HAVE_ARMV8_CRYPTO) is used for compiling check */
#ifdef HAVE_ARMV8_CRYPTO #ifdef HAVE_ARMV8_CRYPTO
/* Intrinsics Support */ /* Crypto extension Support
#ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS * Parallel computation with 1024 Bytes (per block)
const poly64_t k1 = 0xe417f38a, k2 = 0x8f158014; * Intrinsics Support
*/
# ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
const poly64_t k1= 0xe417f38a, k2= 0x8f158014;
uint64_t t0, t1; uint64_t t0, t1;
/* Process per block size of 1024 Bytes /* Process per block size of 1024 Bytes
* A block size = 8 + 42*3*sizeof(uint64_t) + 8 * A block size = 8 + 42*3*sizeof(uint64_t) + 8
*/ */
while ((length -= 1024) >= 0) { while ((length-= 1024) >= 0)
{
/* Prefetch 3*1024 data for avoiding L2 cache miss */ /* Prefetch 3*1024 data for avoiding L2 cache miss */
PREF1KL2(buffer, 1024*3); PREF1KL2(buffer, 1024*3);
/* Do first 8 bytes here for better pipelining */ /* Do first 8 bytes here for better pipelining */
crc0 = __crc32cd(crc, *(const uint64_t *)buffer); crc0= __crc32cd(crc, *(const uint64_t *)buffer);
crc1 = 0; crc1= 0;
crc2 = 0; crc2= 0;
buffer += sizeof(uint64_t); buffer+= sizeof(uint64_t);
/* Process block inline /* Process block inline
* Process crc0 last to avoid dependency with above * Process crc0 last to avoid dependency with above
@@ -163,7 +165,7 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
CRC32C7X3X8(buffer, 4); CRC32C7X3X8(buffer, 4);
CRC32C7X3X8(buffer, 5); CRC32C7X3X8(buffer, 5);
buffer += 42*3*sizeof(uint64_t); buffer+= 42*3*sizeof(uint64_t);
/* Prefetch data for following block to avoid L1 cache miss */ /* Prefetch data for following block to avoid L1 cache miss */
PREF1KL1(buffer, 1024); PREF1KL1(buffer, 1024);
@@ -172,18 +174,18 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
* crc1 multiply by K2 * crc1 multiply by K2
* crc0 multiply by K1 * crc0 multiply by K1
*/ */
t1 = (uint64_t)vmull_p64(crc1, k2); t1= (uint64_t)vmull_p64(crc1, k2);
t0 = (uint64_t)vmull_p64(crc0, k1); t0= (uint64_t)vmull_p64(crc0, k1);
crc = __crc32cd(crc2, *(const uint64_t *)buffer); crc= __crc32cd(crc2, *(const uint64_t *)buffer);
crc1 = __crc32cd(0, t1); crc1= __crc32cd(0, t1);
crc ^= crc1; crc^= crc1;
crc0 = __crc32cd(0, t0); crc0= __crc32cd(0, t0);
crc ^= crc0; crc^= crc0;
buffer += sizeof(uint64_t); buffer+= sizeof(uint64_t);
} }
#else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ # else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
/*No intrinsics*/ /*No intrinsics*/
__asm__("mov x16, #0xf38a \n\t" __asm__("mov x16, #0xf38a \n\t"
@@ -194,13 +196,14 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
"mov v0.2d[0], x16 \n\t" "mov v0.2d[0], x16 \n\t"
:::"x16"); :::"x16");
while ((length -= 1024) >= 0) { while ((length-= 1024) >= 0)
{
PREF1KL2(buffer, 1024*3); PREF1KL2(buffer, 1024*3);
__asm__("crc32cx %w[c0], %w[c], %x[v]\n\t" __asm__("crc32cx %w[c0], %w[c], %x[v]\n\t"
:[c0]"=r"(crc0):[c]"r"(crc), [v]"r"(*(const uint64_t *)buffer):); :[c0]"=r"(crc0):[c]"r"(crc), [v]"r"(*(const uint64_t *)buffer):);
crc1 = 0; crc1= 0;
crc2 = 0; crc2= 0;
buffer += sizeof(uint64_t); buffer+= sizeof(uint64_t);
CRC32C7X3X8(buffer, 0); CRC32C7X3X8(buffer, 0);
CRC32C7X3X8(buffer, 1); CRC32C7X3X8(buffer, 1);
@@ -209,7 +212,7 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
CRC32C7X3X8(buffer, 4); CRC32C7X3X8(buffer, 4);
CRC32C7X3X8(buffer, 5); CRC32C7X3X8(buffer, 5);
buffer += 42*3*sizeof(uint64_t); buffer+= 42*3*sizeof(uint64_t);
PREF1KL1(buffer, 1024); PREF1KL1(buffer, 1024);
__asm__("mov v2.2d[0], %x[c1] \n\t" __asm__("mov v2.2d[0], %x[c1] \n\t"
"pmull v2.1q, v2.1d, v0.1d \n\t" "pmull v2.1q, v2.1d, v0.1d \n\t"
@@ -224,94 +227,41 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
"eor %w[c], %w[c], %w[c0] \n\t" "eor %w[c], %w[c], %w[c0] \n\t"
:[c1]"+r"(crc1), [c0]"+r"(crc0), [c2]"+r"(crc2), [c]"+r"(crc) :[c1]"+r"(crc1), [c0]"+r"(crc0), [c2]"+r"(crc2), [c]"+r"(crc)
:[v]"r"(*((const uint64_t *)buffer))); :[v]"r"(*((const uint64_t *)buffer)));
buffer += sizeof(uint64_t); buffer+= sizeof(uint64_t);
} }
#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ # endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
/* Done if Input data size is aligned with 1024 */ /* Done if Input data size is aligned with 1024 */
if(!(length += 1024)) if (!(length+= 1024))
return (~crc); return ~crc;
#endif /* HAVE_ARMV8_CRYPTO */ #endif /* HAVE_ARMV8_CRYPTO */
while ((length -= sizeof(uint64_t)) >= 0) { } // end if pmull_supported
while ((length-= sizeof(uint64_t)) >= 0)
{
CRC32CX(crc, *(uint64_t *)buffer); CRC32CX(crc, *(uint64_t *)buffer);
buffer += sizeof(uint64_t); buffer+= sizeof(uint64_t);
} }
/* The following is more efficient than the straight loop */
if (length & sizeof(uint32_t)) {
CRC32CW(crc, *(uint32_t *)buffer);
buffer += sizeof(uint32_t);
}
if (length & sizeof(uint16_t)) {
CRC32CH(crc, *(uint16_t *)buffer);
buffer += sizeof(uint16_t);
}
if (length & sizeof(uint8_t))
CRC32CB(crc, *buffer);
} else {
#ifdef HAVE_ARMV8_CRYPTO
#ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
const poly64_t k1 = 0xe417f38a;
uint64_t t0;
while ((length -= 1024) >= 0) {
crc0 = __crc32cd(crc, 0);
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
/* Merge crc0 into crc: crc0 multiply by K1 */
t0 = (uint64_t)vmull_p64(crc0, k1);
crc = __crc32cd(0, t0);
}
#else /* !HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
__asm__("mov x16, #0xf38a \n\t"
"movk x16, #0xe417, lsl 16 \n\t"
"mov v1.2d[0], x16 \n\t"
:::"x16");
while ((length -= 1024) >= 0) {
__asm__("crc32cx %w[c0], %w[c], xzr\n\t"
:[c0]"=r"(crc0):[c]"r"(crc));
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
CRC32C7X3X8_ZERO;
__asm__("mov v3.2d[0], %x[c0] \n\t"
"pmull v3.1q, v3.1d, v1.1d \n\t"
"mov %x[c0], v3.2d[0] \n\t"
"crc32cx %w[c], wzr, %x[c0] \n\t"
:[c]"=r"(crc)
:[c0]"r"(crc0));
}
#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
if(!(length += 1024))
return (~crc);
#endif /* HAVE_ARMV8_CRYPTO */
while ((length -= sizeof(uint64_t)) >= 0)
CRC32CX(crc, 0);
/* The following is more efficient than the straight loop */ /* The following is more efficient than the straight loop */
if (length & sizeof(uint32_t)) if (length & sizeof(uint32_t))
CRC32CW(crc, 0); {
CRC32CW(crc, *(uint32_t *)buffer);
if (length & sizeof(uint16_t)) buffer+= sizeof(uint32_t);
CRC32CH(crc, 0);
if (length & sizeof(uint8_t))
CRC32CB(crc, 0);
} }
return (~crc); if (length & sizeof(uint16_t))
{
CRC32CH(crc, *(uint16_t *)buffer);
buffer+= sizeof(uint16_t);
}
if (length & sizeof(uint8_t))
CRC32CB(crc, *buffer);
return ~crc;
} }
/* There are multiple approaches to calculate crc. /* There are multiple approaches to calculate crc.

View File

@@ -1,5 +1,6 @@
/* /*
Copyright (c) 2001, 2011, Oracle and/or its affiliates Copyright (c) 2001, 2011, Oracle and/or its affiliates
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -33,15 +34,6 @@
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#ifdef __linux__
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
static char *heap_start;
char *__bss_start;
#else
#define PTR_SANE(p) (p)
#endif /* __linux */
/** /**
Default handler for printing stacktrace Default handler for printing stacktrace
*/ */
@@ -61,18 +53,10 @@ static sig_handler default_handle_fatal_signal(int sig)
/** /**
Initialize priting off stacktrace at signal Initialize priting off stacktrace at signal
@param setup_handlers 0 only initialize variables
1 setup signal handlers for stacktrace printing
*/ */
void my_init_stacktrace(int setup_handlers) void my_setup_stacktrace(void)
{ {
#ifdef __linux__
heap_start = (char*) &__bss_start;
#endif /* __linux */
if (setup_handlers)
{
struct sigaction sa; struct sigaction sa;
sa.sa_flags = SA_RESETHAND | SA_NODEFER; sa.sa_flags = SA_RESETHAND | SA_NODEFER;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
@@ -84,88 +68,8 @@ void my_init_stacktrace(int setup_handlers)
#endif #endif
sigaction(SIGILL, &sa, NULL); sigaction(SIGILL, &sa, NULL);
sigaction(SIGFPE, &sa, NULL); sigaction(SIGFPE, &sa, NULL);
}
} }
#ifdef __linux__
static void print_buffer(char *buffer, size_t count)
{
const char s[]= " ";
for (; count && *buffer; --count)
{
my_write_stderr(isprint(*buffer) ? buffer : s, 1);
++buffer;
}
}
/**
Access the pages of this process through /proc/self/task/<tid>/mem
in order to safely print the contents of a memory address range.
@param addr The address at the start of the memory region.
@param max_len The length of the memory region.
@return Zero on success.
*/
static int safe_print_str(const char *addr, size_t max_len)
{
int fd;
pid_t tid;
off_t offset;
ssize_t nbytes= 0;
size_t total, count;
char buf[256];
tid= (pid_t) syscall(SYS_gettid);
sprintf(buf, "/proc/self/task/%d/mem", tid);
if ((fd= open(buf, O_RDONLY)) < 0)
return -1;
/* Ensure that off_t can hold a pointer. */
compile_time_assert(sizeof(off_t) >= sizeof(intptr));
total= max_len;
offset= (intptr) addr;
/* Read up to the maximum number of bytes. */
while (total)
{
count= MY_MIN(sizeof(buf), total);
if ((nbytes= pread(fd, buf, count, offset)) < 0)
{
/* Just in case... */
if (errno == EINTR)
continue;
else
break;
}
/* Advance offset into memory. */
total-= nbytes;
offset+= nbytes;
addr+= nbytes;
/* Output the printable characters. */
print_buffer(buf, nbytes);
/* Break if less than requested... */
if ((count - nbytes))
break;
}
if (nbytes == -1)
my_safe_printf_stderr("Can't read from address %p", addr);
close(fd);
return 0;
}
#endif
/* /*
Attempt to print a char * pointer as a string. Attempt to print a char * pointer as a string.
@@ -187,24 +91,25 @@ static int safe_print_str(const char *addr, size_t max_len)
int my_safe_print_str(const char* val, size_t max_len) int my_safe_print_str(const char* val, size_t max_len)
{ {
#ifdef __linux__ const char *orig_val= val;
char *heap_end; if (!val)
// Try and make use of /proc filesystem to safely print memory contents.
if (!safe_print_str(val, max_len))
return 0;
heap_end= (char*) sbrk(0);
#endif
if (!PTR_SANE(val))
{ {
my_safe_printf_stderr("%s", "is an invalid pointer"); my_safe_printf_stderr("%s", "(null)");
return 1; return 1;
} }
for (; max_len && PTR_SANE(val) && *val; --max_len) for (; max_len; --max_len)
my_write_stderr((val++), 1); {
if (my_write_stderr((val++), 1) != 1)
{
if ((errno == EFAULT) &&(val == orig_val + 1))
{
// We can not read the address from very beginning
my_safe_printf_stderr("Can't access address %p", orig_val);
}
break;
}
}
my_safe_printf_stderr("%s", "\n"); my_safe_printf_stderr("%s", "\n");
return 0; return 0;
@@ -548,11 +453,6 @@ static EXCEPTION_POINTERS *exception_ptrs;
#define MODULE64_SIZE_WINXP 576 #define MODULE64_SIZE_WINXP 576
#define STACKWALK_MAX_FRAMES 64 #define STACKWALK_MAX_FRAMES 64
void my_init_stacktrace(int setup_handlers __attribute__((unused)))
{
}
void my_set_exception_pointers(EXCEPTION_POINTERS *ep) void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
{ {
exception_ptrs = ep; exception_ptrs = ep;

View File

@@ -233,7 +233,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int error; int error;
DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null", DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null",
(ulong) mp)); (ulong) mp));
DBUG_PUSH(""); DBUG_PUSH_EMPTY;
pthread_mutex_lock(&mp->global); pthread_mutex_lock(&mp->global);
if (!mp->file) if (!mp->file)
@@ -395,7 +395,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
} }
end: end:
DBUG_POP(); DBUG_POP_EMPTY;
if (!error) if (!error)
DBUG_PRINT("mutex", ("%s (0x%lx) locked", mp->name, (ulong) mp)); DBUG_PRINT("mutex", ("%s (0x%lx) locked", mp->name, (ulong) mp));
return error; return error;

View File

@@ -1,7 +1,8 @@
IF(WIN32) IF(WIN32 OR WITHOUT_SERVER)
# Handlersocket does not compile on Windows, compiles but does # Handlersocket does not compile on Windows, compiles but does
# not start on FreeBSD. # not start on FreeBSD.
# It is a server plugin and disable it explicitly here.
RETURN() RETURN()
ENDIF() ENDIF()

View File

@@ -1431,7 +1431,6 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
const char *res_start= result; const char *res_start= result;
const char *res_end= result + result_len - 2; const char *res_end= result + result_len - 2;
size_t d_len; size_t d_len;
char b_char;
while (len) while (len)
{ {
@@ -1469,12 +1468,9 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
if (*next_s) if (*next_s)
{ {
memmove(result + d_len, "*****", 5); const char b_char= *next_s++;
memset(result + d_len, '*', 5);
result+= d_len + 5; result+= d_len + 5;
b_char= *(next_s++);
}
else
result+= d_len;
while (*next_s) while (*next_s)
{ {
@@ -1490,6 +1486,10 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
} }
next_s++; next_s++;
} }
}
else
result+= d_len;
len-= (uint)(next_s - str); len-= (uint)(next_s - str);
str= next_s; str= next_s;
continue; continue;
@@ -1497,7 +1497,10 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
no_password: no_password:
if (result >= res_end) if (result >= res_end)
break; break;
if ((b_char= escaped_char(*str))) else
{
const char b_char= escaped_char(*str);
if (b_char)
{ {
if (result+1 >= res_end) if (result+1 >= res_end)
break; break;
@@ -1511,6 +1514,7 @@ no_password:
str++; str++;
len--; len--;
} }
}
*result= 0; *result= 0;
return result - res_start; return result - res_start;
} }

View File

@@ -308,9 +308,7 @@ sub report_mysqlds
sub start_mysqlds() sub start_mysqlds()
{ {
my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $suffix_found, $info_sent); my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
$suffix_found= 0;
if (!$opt_no_log) if (!$opt_no_log)
{ {
@@ -349,10 +347,6 @@ sub start_mysqlds()
$options[$j]= quote_shell_word($options[$j]); $options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]"; $tmp.= " $options[$j]";
} }
elsif ("--defaults-group-suffix=" eq substr($options[$j], 0, 24))
{
$suffix_found= 1;
}
else else
{ {
$options[$j]= quote_shell_word($options[$j]); $options[$j]= quote_shell_word($options[$j]);
@@ -369,12 +363,6 @@ sub start_mysqlds()
$info_sent= 1; $info_sent= 1;
} }
if (!$suffix_found)
{
$com.= " --defaults-group-suffix=";
$com.= substr($groups[$i],6);
}
$com.= $tmp; $com.= $tmp;
if ($opt_wsrep_new_cluster) { if ($opt_wsrep_new_cluster) {

View File

@@ -712,7 +712,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
fi fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf # if no command line arg and INNODB_DATA_HOME_DIR environment variable
# is not set, try to get it from my.cnf:
if [ -z "$INNODB_DATA_HOME_DIR" ]; then if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '') INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi fi
@@ -951,17 +952,25 @@ then
ib_home_dir=$INNODB_DATA_HOME_DIR ib_home_dir=$INNODB_DATA_HOME_DIR
# Try to set ib_log_dir from the command line: WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
ib_log_dir=$INNODB_LOG_GROUP_HOME_ARG # Try to set WSREP_LOG_DIR from the command line:
if [ -z "$ib_log_dir" ]; then if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
ib_log_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir "") WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
fi fi
if [ -z "$ib_log_dir" ]; then # if no command line arg and WSREP_LOG_DIR is not set,
ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "") # try to get it from my.cnf:
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf --mysqld innodb-log-group-home-dir '')
fi fi
ib_log_dir=$WSREP_LOG_DIR
# Try to set ib_undo_dir from the command line: # Try to set ib_undo_dir from the command line:
ib_undo_dir=$INNODB_UNDO_DIR_ARG ib_undo_dir=${INNODB_UNDO_DIR_ARG:-""}
# if no command line arg then try to get it from my.cnf:
if [ -z "$ib_undo_dir" ]; then if [ -z "$ib_undo_dir" ]; then
ib_undo_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-undo-directory "") ib_undo_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-undo-directory "")
fi fi

View File

@@ -152,10 +152,11 @@ fi
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# Try to set WSREP_LOG_DIR from the command line: # Try to set WSREP_LOG_DIR from the command line:
if [ -z "$WSREP_LOG_DIR" ]; then if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
fi fi
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf # if no command line arg and WSREP_LOG_DIR is not set,
# try to get it from my.cnf:
if [ -z "$WSREP_LOG_DIR" ]; then if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '') WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi fi
@@ -176,7 +177,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
fi fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf # if no command line arg and INNODB_DATA_HOME_DIR environment variable
# is not set, try to get it from my.cnf:
if [ -z "$INNODB_DATA_HOME_DIR" ]; then if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '') INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi fi

View File

@@ -3665,6 +3665,12 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
} }
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
{
return mysql->affected_rows;
}
/************************************************************************** /**************************************************************************
Return next row of the query results Return next row of the query results
**************************************************************************/ **************************************************************************/

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. # Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2010, 2018, MariaDB Corporation # Copyright (c) 2010, 2020, MariaDB Corporation.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2018, MariaDB Corporation /* Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License. the Free Software Foundation; version 2 of the License.
@@ -96,7 +96,7 @@ bool run_backup_stage(THD *thd, backup_stages stage)
do do
{ {
bool res; bool res= false;
backup_stages previous_stage= thd->current_backup_stage; backup_stages previous_stage= thd->current_backup_stage;
thd->current_backup_stage= next_stage; thd->current_backup_stage= next_stage;
switch (next_stage) { switch (next_stage) {
@@ -120,7 +120,6 @@ bool run_backup_stage(THD *thd, backup_stages stage)
break; break;
case BACKUP_FINISHED: case BACKUP_FINISHED:
DBUG_ASSERT(0); DBUG_ASSERT(0);
res= 0;
} }
if (res) if (res)
{ {

View File

@@ -1888,7 +1888,7 @@ void Field::copy_from_tmp(int row_offset)
} }
bool Field::send_binary(Protocol *protocol) bool Field::send(Protocol *protocol)
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),charset()); String tmp(buff,sizeof(buff),charset());
@@ -1897,6 +1897,18 @@ bool Field::send_binary(Protocol *protocol)
} }
bool Field_num::send_numeric_zerofill_str(Protocol_text *protocol,
protocol_send_type_t send_type)
{
DBUG_ASSERT(marked_for_read());
StringBuffer<MAX_FIELD_WIDTH> tmp(&my_charset_latin1);
val_str(&tmp);
return protocol->store_numeric_zerofill_str(tmp.ptr(),
tmp.length(),
send_type);
}
/** /**
Check to see if field size is compatible with destination. Check to see if field size is compatible with destination.
@@ -2407,6 +2419,33 @@ bool Field::get_date(MYSQL_TIME *to, date_mode_t mode)
return !t->is_valid_temporal(); return !t->is_valid_temporal();
} }
longlong Field::val_datetime_packed(THD *thd)
{
MYSQL_TIME ltime, tmp;
if (get_date(&ltime, Datetime::Options_cmp(thd)))
return 0;
if (ltime.time_type != MYSQL_TIMESTAMP_TIME)
return pack_time(&ltime);
if (time_to_datetime_with_warn(thd, &ltime, &tmp, TIME_CONV_NONE))
return 0;
return pack_time(&tmp);
}
longlong Field::val_time_packed(THD *thd)
{
MYSQL_TIME ltime;
Time::Options_cmp opt(thd);
if (get_date(&ltime, opt))
return 0;
if (ltime.time_type == MYSQL_TIMESTAMP_TIME)
return pack_time(&ltime);
// Conversion from DATETIME or DATE to TIME is needed
return Time(thd, &ltime, opt).to_packed();
}
/** /**
This is called when storing a date in a string. This is called when storing a date in a string.
@@ -3855,11 +3894,16 @@ String *Field_tiny::val_str(String *val_buffer,
return val_str_from_long(val_buffer, 5, -10, nr); return val_str_from_long(val_buffer, 5, -10, nr);
} }
bool Field_tiny::send_binary(Protocol *protocol) bool Field_tiny::send(Protocol *protocol)
{ {
return protocol->store_tiny((longlong) (int8) ptr[0]); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_TINY);
return protocol->store_tiny(Field_tiny::val_int());
} }
int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr) const int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{ {
signed char a,b; signed char a,b;
@@ -4015,8 +4059,12 @@ String *Field_short::val_str(String *val_buffer,
} }
bool Field_short::send_binary(Protocol *protocol) bool Field_short::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_SHORT);
return protocol->store_short(Field_short::val_int()); return protocol->store_short(Field_short::val_int());
} }
@@ -4198,9 +4246,12 @@ String *Field_int::val_str_from_long(String *val_buffer,
} }
bool Field_medium::send_binary(Protocol *protocol) bool Field_medium::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read()); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_LONG);
return protocol->store_long(Field_medium::val_int()); return protocol->store_long(Field_medium::val_int());
} }
@@ -4369,12 +4420,16 @@ String *Field_long::val_str(String *val_buffer,
} }
bool Field_long::send_binary(Protocol *protocol) bool Field_long::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read()); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_LONG);
return protocol->store_long(Field_long::val_int()); return protocol->store_long(Field_long::val_int());
} }
int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr) const int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{ {
int32 a,b; int32 a,b;
@@ -4506,9 +4561,12 @@ String *Field_longlong::val_str(String *val_buffer,
} }
bool Field_longlong::send_binary(Protocol *protocol) bool Field_longlong::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read()); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_LONGLONG);
return protocol->store_longlong(Field_longlong::val_int(), unsigned_flag); return protocol->store_longlong(Field_longlong::val_int(), unsigned_flag);
} }
@@ -4686,10 +4744,13 @@ void Field_float::sort_string(uchar *to,uint length __attribute__((unused)))
} }
bool Field_float::send_binary(Protocol *protocol) bool Field_float::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read()); DBUG_ASSERT(marked_for_read());
return protocol->store((float) Field_float::val_real(), dec, (String*) 0); Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_FLOAT);
return protocol->store_float((float) Field_float::val_real(), dec);
} }
@@ -4980,9 +5041,13 @@ String *Field_double::val_str(String *val_buffer,
return val_buffer; return val_buffer;
} }
bool Field_double::send_binary(Protocol *protocol) bool Field_double::send(Protocol *protocol)
{ {
return protocol->store((double) Field_double::val_real(), dec, (String*) 0); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if (unlikely(zerofill) && (txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_DOUBLE);
return protocol->store_double(Field_double::val_real(), dec);
} }
@@ -5378,7 +5443,7 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
} }
bool Field_timestamp0::send_binary(Protocol *protocol) bool Field_timestamp0::send(Protocol *protocol)
{ {
MYSQL_TIME ltime; MYSQL_TIME ltime;
Field_timestamp0::get_date(&ltime, date_mode_t(0)); Field_timestamp0::get_date(&ltime, date_mode_t(0));
@@ -5538,7 +5603,7 @@ int Field_timestamp_with_dec::set_time()
return 0; return 0;
} }
bool Field_timestamp_with_dec::send_binary(Protocol *protocol) bool Field_timestamp_with_dec::send(Protocol *protocol)
{ {
MYSQL_TIME ltime; MYSQL_TIME ltime;
Field_timestamp::get_date(&ltime, date_mode_t(0)); Field_timestamp::get_date(&ltime, date_mode_t(0));
@@ -6047,7 +6112,25 @@ bool Field_time0::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
} }
bool Field_time::send_binary(Protocol *protocol) int Field_time::store_native(const Native &value)
{
Time t(value);
DBUG_ASSERT(t.is_valid_time());
store_TIME(t);
return 0;
}
bool Field_time::val_native(Native *to)
{
MYSQL_TIME ltime;
get_date(&ltime, date_mode_t(0));
int warn;
return Time(&warn, &ltime, 0).to_native(to, decimals());
}
bool Field_time::send(Protocol *protocol)
{ {
MYSQL_TIME ltime; MYSQL_TIME ltime;
get_date(&ltime, Time::Options(TIME_TIME_ONLY, get_thd())); get_date(&ltime, Time::Options(TIME_TIME_ONLY, get_thd()));
@@ -6283,6 +6366,33 @@ Binlog_type_info Field_timef::binlog_type_info() const
return Binlog_type_info(Field_timef::binlog_type(), decimals(), 1); return Binlog_type_info(Field_timef::binlog_type(), decimals(), 1);
} }
longlong Field_timef::val_time_packed(THD *thd)
{
DBUG_ASSERT(marked_for_read());
longlong tmp= my_time_packed_from_binary(ptr, dec);
MYSQL_TIME ltime;
TIME_from_longlong_time_packed(&ltime, tmp);
return pack_time(&ltime);
}
int Field_timef::store_native(const Native &value)
{
DBUG_ASSERT(value.length() == my_time_binary_length(dec));
DBUG_ASSERT(Time(value).is_valid_time());
memcpy(ptr, value.ptr(), value.length());
return 0;
}
bool Field_timef::val_native(Native *to)
{
uint32 binlen= my_time_binary_length(dec);
return to->copy((const char*) ptr, binlen);
}
/**************************************************************************** /****************************************************************************
** year type ** year type
** Save in a byte the year 0, 1901->2155 ** Save in a byte the year 0, 1901->2155
@@ -6369,9 +6479,12 @@ int Field_year::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
return 0; return 0;
} }
bool Field_year::send_binary(Protocol *protocol) bool Field_year::send(Protocol *protocol)
{ {
DBUG_ASSERT(marked_for_read()); DBUG_ASSERT(marked_for_read());
Protocol_text *txt;
if ((txt= dynamic_cast<Protocol_text*>(protocol)))
return send_numeric_zerofill_str(txt, PROTOCOL_SEND_SHORT);
ulonglong tmp= Field_year::val_int(); ulonglong tmp= Field_year::val_int();
return protocol->store_short(tmp); return protocol->store_short(tmp);
} }
@@ -6506,7 +6619,7 @@ void Field_date::store_TIME(const MYSQL_TIME *ltime)
int4store(ptr,tmp); int4store(ptr,tmp);
} }
bool Field_date::send_binary(Protocol *protocol) bool Field_date::send(Protocol *protocol)
{ {
longlong tmp= Field_date::val_int(); longlong tmp= Field_date::val_int();
MYSQL_TIME tm; MYSQL_TIME tm;
@@ -6600,7 +6713,7 @@ void Field_newdate::store_TIME(const MYSQL_TIME *ltime)
} }
bool Field_newdate::send_binary(Protocol *protocol) bool Field_newdate::send(Protocol *protocol)
{ {
MYSQL_TIME tm; MYSQL_TIME tm;
Field_newdate::get_date(&tm, date_mode_t(0)); Field_newdate::get_date(&tm, date_mode_t(0));
@@ -6668,6 +6781,14 @@ bool Field_newdate::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
} }
longlong Field_newdate::val_datetime_packed(THD *thd)
{
MYSQL_TIME ltime;
Field_newdate::get_date(&ltime, date_mode_t(0));
return pack_time(&ltime);
}
int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr) const int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{ {
uint32 a,b; uint32 a,b;
@@ -6772,7 +6893,7 @@ Field_datetime::conversion_depends_on_sql_mode(THD *thd, Item *expr) const
} }
bool Field_datetime0::send_binary(Protocol *protocol) bool Field_datetime0::send(Protocol *protocol)
{ {
MYSQL_TIME tm; MYSQL_TIME tm;
Field_datetime0::get_date(&tm, date_mode_t(0)); Field_datetime0::get_date(&tm, date_mode_t(0));
@@ -6900,7 +7021,7 @@ void Field_datetime_hires::store_TIME(const MYSQL_TIME *ltime)
store_bigendian(packed, ptr, Field_datetime_hires::pack_length()); store_bigendian(packed, ptr, Field_datetime_hires::pack_length());
} }
bool Field_datetime_with_dec::send_binary(Protocol *protocol) bool Field_datetime_with_dec::send(Protocol *protocol)
{ {
MYSQL_TIME ltime; MYSQL_TIME ltime;
get_date(&ltime, date_mode_t(0)); get_date(&ltime, date_mode_t(0));
@@ -6989,6 +7110,16 @@ Binlog_type_info Field_datetimef::binlog_type_info() const
return Binlog_type_info(Field_datetimef::binlog_type(), decimals(), 1); return Binlog_type_info(Field_datetimef::binlog_type(), decimals(), 1);
} }
longlong Field_datetimef::val_datetime_packed(THD *thd)
{
DBUG_ASSERT(marked_for_read());
longlong tmp= my_datetime_packed_from_binary(ptr, dec);
MYSQL_TIME ltime;
TIME_from_longlong_datetime_packed(&ltime, tmp);
return pack_time(&ltime);
}
/**************************************************************************** /****************************************************************************
** string type ** string type
** A string may be varchar or binary ** A string may be varchar or binary
@@ -7109,6 +7240,23 @@ void Field_longstr::make_send_field(Send_field *field)
} }
} }
/*
An optimized version that uses less stack than Field::send().
*/
bool Field_longstr::send(Protocol *protocol)
{
String tmp;
val_str(&tmp, &tmp);
/*
Ensure this function is only used with classes that do not allocate
memory in val_str()
*/
DBUG_ASSERT(tmp.alloced_length() == 0);
return protocol->store(tmp.ptr(), tmp.length(), tmp.charset());
}
/* Copy a string and fill with space */ /* Copy a string and fill with space */
int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs) int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
@@ -7698,6 +7846,17 @@ my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
} }
/*
An optimized version that uses less stack and less temporary
variable initialization than Field_longstr::send()
*/
bool Field_varstring::send(Protocol *protocol)
{
return protocol->store((const char *) get_data(), get_length(),
field_charset());
}
#ifdef HAVE_valgrind #ifdef HAVE_valgrind
void Field_varstring::mark_unused_memory_as_defined() void Field_varstring::mark_unused_memory_as_defined()
{ {

View File

@@ -37,6 +37,7 @@
class Send_field; class Send_field;
class Copy_field; class Copy_field;
class Protocol; class Protocol;
class Protocol_text;
class Create_field; class Create_field;
class Relay_log_info; class Relay_log_info;
class Field; class Field;
@@ -1576,7 +1577,7 @@ public:
ptr= old_ptr; ptr= old_ptr;
return str; return str;
} }
virtual bool send_binary(Protocol *protocol); virtual bool send(Protocol *protocol);
virtual uchar *pack(uchar *to, const uchar *from, uint max_length); virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
/** /**
@@ -1605,6 +1606,8 @@ public:
void copy_from_tmp(int offset); void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy); uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate); virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
virtual longlong val_datetime_packed(THD *thd);
virtual longlong val_time_packed(THD *thd);
virtual const TYPELIB *get_typelib() const { return NULL; } virtual const TYPELIB *get_typelib() const { return NULL; }
virtual CHARSET_INFO *charset() const= 0; virtual CHARSET_INFO *charset() const= 0;
virtual const DTCollation &dtcollation() const= 0; virtual const DTCollation &dtcollation() const= 0;
@@ -2005,6 +2008,9 @@ protected:
return (flags & UNSIGNED_FLAG) ? Binlog_type_info::SIGN_UNSIGNED : return (flags & UNSIGNED_FLAG) ? Binlog_type_info::SIGN_UNSIGNED :
Binlog_type_info::SIGN_SIGNED; Binlog_type_info::SIGN_SIGNED;
} }
bool send_numeric_zerofill_str(Protocol_text *protocol,
protocol_send_type_t send_type);
public: public:
const uint8 dec; const uint8 dec;
bool zerofill,unsigned_flag; // Purify cannot handle bit fields bool zerofill,unsigned_flag; // Purify cannot handle bit fields
@@ -2194,6 +2200,7 @@ public:
int store_decimal(const my_decimal *d) override; int store_decimal(const my_decimal *d) override;
uint32 max_data_length() const override; uint32 max_data_length() const override;
void make_send_field(Send_field *) override; void make_send_field(Send_field *) override;
bool send(Protocol *protocol) override;
bool is_varchar_and_in_write_set() const override bool is_varchar_and_in_write_set() const override
{ {
@@ -2520,7 +2527,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 1; } uint32 pack_length() const override { return 1; }
@@ -2583,7 +2590,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 2; } uint32 pack_length() const override { return 2; }
@@ -2630,7 +2637,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 3; } uint32 pack_length() const override { return 3; }
@@ -2681,7 +2688,7 @@ public:
int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; } int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
@@ -2743,7 +2750,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 8; } uint32 pack_length() const override { return 8; }
@@ -2843,7 +2850,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff, uint length) override; void sort_string(uchar *buff, uint length) override;
uint32 pack_length() const override { return sizeof(float); } uint32 pack_length() const override { return sizeof(float); }
@@ -2907,7 +2914,7 @@ public:
longlong val_int() override final { return val_int_from_real(false); } longlong val_int() override final { return val_int_from_real(false); }
ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); } ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); }
String *val_str(String *, String *) override final; String *val_str(String *, String *) override final;
bool send_binary(Protocol *protocol) override final; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override final; int cmp(const uchar *,const uchar *) const override final;
void sort_string(uchar *buff, uint length) override final; void sort_string(uchar *buff, uint length) override final;
uint32 pack_length() const override final { return sizeof(double); } uint32 pack_length() const override final { return sizeof(double); }
@@ -3210,7 +3217,7 @@ public:
{ {
return (double) Field_timestamp0::val_int(); return (double) Field_timestamp0::val_int();
} }
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 4; } uint32 pack_length() const override { return 4; }
@@ -3265,7 +3272,7 @@ public:
DBUG_ASSERT(length == pack_length()); DBUG_ASSERT(length == pack_length());
memcpy(to, ptr, length); memcpy(to, ptr, length);
} }
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
double val_real() override; double val_real() override;
my_decimal* val_decimal(my_decimal*) override; my_decimal* val_decimal(my_decimal*) override;
int set_time() override; int set_time() override;
@@ -3403,7 +3410,7 @@ public:
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
Information_schema_numeric_attributes Information_schema_numeric_attributes
information_schema_numeric_attributes() const override information_schema_numeric_attributes() const override
{ {
@@ -3462,7 +3469,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 4; } uint32 pack_length() const override { return 4; }
@@ -3501,13 +3508,14 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 3; } uint32 pack_length() const override { return 3; }
void sql_type(String &str) const override; void sql_type(String &str) const override;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_newdate::get_TIME(ltime, ptr, fuzzydate); } { return Field_newdate::get_TIME(ltime, ptr, fuzzydate); }
longlong val_datetime_packed(THD *thd) override;
uint size_of() const override { return sizeof *this; } uint size_of() const override { return sizeof *this; }
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
override; override;
@@ -3555,13 +3563,15 @@ public:
decimals() == from->decimals(); decimals() == from->decimals();
} }
sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override; sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override;
int store_native(const Native &value) override;
bool val_native(Native *to) override;
int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
int store(const char *to,size_t length,CHARSET_INFO *charset) override; int store(const char *to,size_t length,CHARSET_INFO *charset) override;
int store(double nr) override; int store(double nr) override;
int store(longlong nr, bool unsigned_val) override; int store(longlong nr, bool unsigned_val) override;
int store_decimal(const my_decimal *) override; int store_decimal(const my_decimal *) override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
void set_curdays(THD *thd); void set_curdays(THD *thd);
Field *new_key_field(MEM_ROOT *root, TABLE *new_table, Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length, uchar *new_ptr, uint32 length,
@@ -3706,6 +3716,9 @@ public:
} }
int reset() override; int reset() override;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
longlong val_time_packed(THD *thd) override;
int store_native(const Native &value) override;
bool val_native(Native *to) override;
uint size_of() const override { return sizeof *this; } uint size_of() const override { return sizeof *this; }
Binlog_type_info binlog_type_info() const override; Binlog_type_info binlog_type_info() const override;
}; };
@@ -3775,7 +3788,7 @@ public:
} }
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override; bool send(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override; int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override; void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 8; } uint32 pack_length() const override { return 8; }
@@ -3815,7 +3828,7 @@ public:
uint decimals() const override final { return dec; } uint decimals() const override final { return dec; }
enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; } enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; }
void make_send_field(Send_field *field) override final; void make_send_field(Send_field *field) override final;
bool send_binary(Protocol *protocol) override final; bool send(Protocol *protocol) override final;
uchar *pack(uchar *to, const uchar *from, uint max_length) override final uchar *pack(uchar *to, const uchar *from, uint max_length) override final
{ return Field::pack(to, from, max_length); } { return Field::pack(to, from, max_length); }
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
@@ -3907,6 +3920,7 @@ public:
int reset() override; int reset() override;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); } { return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); }
longlong val_datetime_packed(THD *thd) override;
uint size_of() const override { return sizeof *this; } uint size_of() const override { return sizeof *this; }
Binlog_type_info binlog_type_info() const override; Binlog_type_info binlog_type_info() const override;
}; };
@@ -4153,6 +4167,7 @@ public:
longlong val_int() override; longlong val_int() override;
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
my_decimal *val_decimal(my_decimal *) override; my_decimal *val_decimal(my_decimal *) override;
bool send(Protocol *protocol) override;
int cmp(const uchar *a,const uchar *b) const override; int cmp(const uchar *a,const uchar *b) const override;
int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const
override; override;
@@ -4217,6 +4232,15 @@ private:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
uint size_of() const override { return sizeof *this; } uint size_of() const override { return sizeof *this; }
/*
We use the default Field::send() implementation,
because the derived optimized version (from Field_longstr)
is not suitable for compressed fields.
*/
bool send(Protocol *protocol) override
{
return Field::send(protocol);
}
enum_field_types binlog_type() const override enum_field_types binlog_type() const override
{ return MYSQL_TYPE_VARCHAR_COMPRESSED; } { return MYSQL_TYPE_VARCHAR_COMPRESSED; }
void sql_type(String &str) const override void sql_type(String &str) const override
@@ -4614,6 +4638,15 @@ private:
String *val_str(String *, String *) override; String *val_str(String *, String *) override;
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
/*
We use the default Field::send() implementation,
because the derived optimized version (from Field_longstr)
is not suitable for compressed fields.
*/
bool send(Protocol *protocol) override
{
return Field::send(protocol);
}
uint size_of() const override { return sizeof *this; } uint size_of() const override { return sizeof *this; }
enum_field_types binlog_type() const override enum_field_types binlog_type() const override
{ return MYSQL_TYPE_BLOB_COMPRESSED; } { return MYSQL_TYPE_BLOB_COMPRESSED; }

View File

@@ -215,7 +215,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
DBUG_EXECUTE("info",TEST_filesort(filesort->sortorder, s_length);); DBUG_EXECUTE("info",TEST_filesort(filesort->sortorder, s_length););
#ifdef SKIP_DBUG_IN_FILESORT #ifdef SKIP_DBUG_IN_FILESORT
DBUG_PUSH(""); /* No DBUG here */ DBUG_PUSH_EMPTY; /* No DBUG here */
#endif #endif
SORT_INFO *sort; SORT_INFO *sort;
TABLE_LIST *tab= table->pos_in_table_list; TABLE_LIST *tab= table->pos_in_table_list;
@@ -496,7 +496,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
sort->examined_rows= param.examined_rows; sort->examined_rows= param.examined_rows;
sort->return_rows= num_rows; sort->return_rows= num_rows;
#ifdef SKIP_DBUG_IN_FILESORT #ifdef SKIP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */ DBUG_POP_EMPTY; /* Ok to DBUG */
#endif #endif
DBUG_PRINT("exit", DBUG_PRINT("exit",

View File

@@ -9683,7 +9683,6 @@ double ha_partition::read_time(uint index, uint ranges, ha_rows rows)
ha_rows ha_partition::records() ha_rows ha_partition::records()
{ {
int error;
ha_rows tot_rows= 0; ha_rows tot_rows= 0;
uint i; uint i;
DBUG_ENTER("ha_partition::records"); DBUG_ENTER("ha_partition::records");
@@ -9692,9 +9691,10 @@ ha_rows ha_partition::records()
i < m_tot_parts; i < m_tot_parts;
i= bitmap_get_next_set(&m_part_info->read_partitions, i)) i= bitmap_get_next_set(&m_part_info->read_partitions, i))
{ {
ha_rows rows; if (unlikely(m_file[i]->pre_records()))
if (unlikely((error= m_file[i]->pre_records()) || DBUG_RETURN(HA_POS_ERROR);
(rows= m_file[i]->records()) == HA_POS_ERROR)) const ha_rows rows= m_file[i]->records();
if (unlikely(rows == HA_POS_ERROR))
DBUG_RETURN(HA_POS_ERROR); DBUG_RETURN(HA_POS_ERROR);
tot_rows+= rows; tot_rows+= rows;
} }

View File

@@ -2064,6 +2064,11 @@ bool Item_name_const::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat
return rc; return rc;
} }
bool Item_name_const::val_native(THD *thd, Native *to)
{
return val_native_from_item(thd, value_item, to);
}
bool Item_name_const::is_null() bool Item_name_const::is_null()
{ {
return value_item->is_null(); return value_item->is_null();
@@ -3193,6 +3198,12 @@ void Item_ident::print(String *str, enum_query_type query_type)
use_db_name= use_table_name= false; use_db_name= use_table_name= false;
} }
if ((query_type & QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES))
{
// Don't print db or table name irrespective of any other settings.
use_db_name= use_table_name= false;
}
if (!field_name.str || !field_name.str[0]) if (!field_name.str || !field_name.str[0])
{ {
append_identifier(thd, str, STRING_WITH_LEN("tmp_field")); append_identifier(thd, str, STRING_WITH_LEN("tmp_field"));
@@ -3309,6 +3320,24 @@ bool Item_field::val_native_result(THD *thd, Native *to)
} }
longlong Item_field::val_datetime_packed(THD *thd)
{
DBUG_ASSERT(fixed == 1);
if ((null_value= field->is_null()))
return 0;
return field->val_datetime_packed(thd);
}
longlong Item_field::val_time_packed(THD *thd)
{
DBUG_ASSERT(fixed == 1);
if ((null_value= field->is_null()))
return 0;
return field->val_time_packed(thd);
}
void Item_field::save_result(Field *to) void Item_field::save_result(Field *to)
{ {
save_field_in_field(result_field, &null_value, to, TRUE); save_field_in_field(result_field, &null_value, to, TRUE);
@@ -7537,7 +7566,6 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
DBUG_ASSERT(item->type() == Item::FIELD_ITEM || DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
(item->type() == Item::REF_ITEM && (item->type() == Item::REF_ITEM &&
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF)); ((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
Item *producing_item;
Item_field *field_item= NULL; Item_field *field_item= NULL;
Item_equal *item_equal= item->get_item_equal(); Item_equal *item_equal= item->get_item_equal();
table_map tab_map= sel->master_unit()->derived->table->map; table_map tab_map= sel->master_unit()->derived->table->map;
@@ -7559,6 +7587,7 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
List_iterator_fast<Item> li(sel->item_list); List_iterator_fast<Item> li(sel->item_list);
if (field_item) if (field_item)
{ {
Item *producing_item= NULL;
uint field_no= field_item->field->field_index; uint field_no= field_item->field->field_index;
for (uint i= 0; i <= field_no; i++) for (uint i= 0; i <= field_no; i++)
producing_item= li++; producing_item= li++;

View File

@@ -1333,16 +1333,13 @@ public:
{ {
/* /*
The default implementation for the Items that do not need native format: The default implementation for the Items that do not need native format:
- Item_basic_value - Item_basic_value (default implementation)
- Item_copy - Item_copy
- Item_exists_subselect - Item_exists_subselect
- Item_sum_field - Item_sum_field
- Item_sum_or_func (default implementation) - Item_sum_or_func (default implementation)
- Item_proc - Item_proc
- Item_type_holder (as val_xxx() are never called for it); - Item_type_holder (as val_xxx() are never called for it);
- TODO: Item_name_const will need val_native() in the future,
when we add this syntax:
TIMESTAMP WITH LOCAL TIMEZONE'2001-01-01 00:00:00'
These hybrid Item types override val_native(): These hybrid Item types override val_native():
- Item_field - Item_field
@@ -1353,6 +1350,8 @@ public:
- Item_direct_ref - Item_direct_ref
- Item_direct_view_ref - Item_direct_view_ref
- Item_ref_null_helper - Item_ref_null_helper
- Item_name_const
- Item_time_literal
- Item_sum_or_func - Item_sum_or_func
Note, these hybrid type Item_sum_or_func descendants Note, these hybrid type Item_sum_or_func descendants
override the default implementation: override the default implementation:
@@ -3173,6 +3172,7 @@ public:
String *val_str(String *sp); String *val_str(String *sp);
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool val_native(THD *thd, Native *to);
bool is_null(); bool is_null();
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
@@ -3474,6 +3474,8 @@ public:
longlong val_int_endpoint(bool left_endp, bool *incl_endp); longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate); bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate);
longlong val_datetime_packed(THD *thd);
longlong val_time_packed(THD *thd);
bool is_null() { return field->is_null(); } bool is_null() { return field->is_null(); }
void update_null_value(); void update_null_value();
void update_table_bitmaps() void update_table_bitmaps()
@@ -4897,6 +4899,10 @@ public:
String *val_str(String *to) { return Time(this).to_string(to, decimals); } String *val_str(String *to) { return Time(this).to_string(to, decimals); }
my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); } my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); }
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
bool val_native(THD *thd, Native *to)
{
return Time(thd, this).to_native(to, decimals);
}
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_time_literal>(thd, this); } { return get_item_copy<Item_time_literal>(thd, this); }
}; };
@@ -6874,6 +6880,10 @@ public:
{ {
return has_value() ? Time(this).to_decimal(to) : NULL; return has_value() ? Time(this).to_decimal(to) : NULL;
} }
bool val_native(THD *thd, Native *to)
{
return has_value() ? Time(thd, this).to_native(to, decimals) : true;
}
}; };

View File

@@ -485,6 +485,12 @@ public:
virtual longlong val_int(Item_handled_func *) const= 0; virtual longlong val_int(Item_handled_func *) const= 0;
virtual my_decimal *val_decimal(Item_handled_func *, my_decimal *) const= 0; virtual my_decimal *val_decimal(Item_handled_func *, my_decimal *) const= 0;
virtual bool get_date(THD *thd, Item_handled_func *, MYSQL_TIME *, date_mode_t fuzzydate) const= 0; virtual bool get_date(THD *thd, Item_handled_func *, MYSQL_TIME *, date_mode_t fuzzydate) const= 0;
virtual bool val_native(THD *thd, Item_handled_func *, Native *to) const
{
DBUG_ASSERT(0);
to->length(0);
return true;
}
virtual const Type_handler * virtual const Type_handler *
return_type_handler(const Item_handled_func *item) const= 0; return_type_handler(const Item_handled_func *item) const= 0;
virtual const Type_handler * virtual const Type_handler *
@@ -631,6 +637,10 @@ public:
{ {
return Time(item).to_string(to, item->decimals); return Time(item).to_string(to, item->decimals);
} }
bool val_native(THD *thd, Item_handled_func *item, Native *to) const
{
return Time(thd, item).to_native(to, item->decimals);
}
}; };
@@ -788,6 +798,10 @@ public:
{ {
return m_func_handler->get_date(thd, this, to, fuzzydate); return m_func_handler->get_date(thd, this, to, fuzzydate);
} }
bool val_native(THD *thd, Native *to)
{
return m_func_handler->val_native(thd, this, to);
}
}; };

View File

@@ -2372,12 +2372,15 @@ double Item_func_distance::val_real()
MBR mbr1, mbr2; MBR mbr1, mbr2;
const char *c_end; const char *c_end;
if (args[0]->null_value || args[1]->null_value)
if ((null_value= (args[0]->null_value || args[1]->null_value || goto mem_error;
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || g1= Geometry::construct(&buffer1, res1->ptr(), res1->length());
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || if (!g1)
g1->get_mbr(&mbr1, &c_end) || goto mem_error;
g2->get_mbr(&mbr2, &c_end)))) g2= Geometry::construct(&buffer2, res2->ptr(), res2->length());
if (!g2)
goto mem_error;
if (g1->get_mbr(&mbr1, &c_end) || g2->get_mbr(&mbr2, &c_end))
goto mem_error; goto mem_error;
mbr1.add_mbr(&mbr2); mbr1.add_mbr(&mbr2);
@@ -2526,7 +2529,7 @@ String *Item_func_pointonsurface::val_str(String *str)
Geometry *g; Geometry *g;
MBR mbr; MBR mbr;
const char *c_end; const char *c_end;
double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0; double UNINIT_VAR(px), UNINIT_VAR(py), x0, UNINIT_VAR(y0);
String *result= 0; String *result= 0;
const Gcalc_scan_iterator::point *pprev= NULL; const Gcalc_scan_iterator::point *pprev= NULL;
uint32 srid; uint32 srid;

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2017, Oracle and/or its affiliates. Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -641,7 +641,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
THD *thd= current_thd; THD *thd= current_thd;
String *res; String *res= NULL;
uint i; uint i;
null_value=0; null_value=0;
@@ -651,7 +651,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
if ((res= args[i]->val_str(str))) if ((res= args[i]->val_str(str)))
break; break;
} }
if (i == arg_count) if (!res)
goto null; goto null;
if (res != str) if (res != str)

View File

@@ -598,6 +598,10 @@ public:
double val_real() { return Time(this).to_double(); } double val_real() { return Time(this).to_double(); }
String *val_str(String *to) { return Time(this).to_string(to, decimals); } String *val_str(String *to) { return Time(this).to_string(to, decimals); }
my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); } my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); }
bool val_native(THD *thd, Native *to)
{
return Time(thd, this).to_native(to, decimals);
}
}; };

View File

@@ -25,6 +25,9 @@
#include <mysql/plugin.h> #include <mysql/plugin.h>
#include <mysql/service_thd_wait.h> #include <mysql/service_thd_wait.h>
#include <mysql/psi/mysql_stage.h> #include <mysql/psi/mysql_stage.h>
#ifdef WITH_WSREP
#include "wsrep_sst.h"
#endif
#include <tpool.h> #include <tpool.h>
#include <pfs_metadata_provider.h> #include <pfs_metadata_provider.h>
#include <mysql/psi/mysql_mdl.h> #include <mysql/psi/mysql_mdl.h>
@@ -2332,10 +2335,17 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE, wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE,
mdl_request->key.get_wait_state_name()); mdl_request->key.get_wait_state_name());
THD* thd= m_owner->get_thd();
if (wait_status != MDL_wait::EMPTY) if (wait_status != MDL_wait::EMPTY)
break; break;
/* Check if the client is gone while we were waiting. */ /* Check if the client is gone while we were waiting. */
if (! thd_is_connected(m_owner->get_thd())) if (! thd_is_connected(thd))
{
#if defined(WITH_WSREP) && !defined(EMBEDDED_LIBRARY)
// During SST client might not be connected
if (!wsrep_is_sst_progress())
#endif
{ {
/* /*
* The client is disconnected. Don't wait forever: * The client is disconnected. Don't wait forever:
@@ -2345,6 +2355,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
wait_status= MDL_wait::TIMEOUT; wait_status= MDL_wait::TIMEOUT;
break; break;
} }
}
mysql_prlock_wrlock(&lock->m_rwlock); mysql_prlock_wrlock(&lock->m_rwlock);
if (lock->needs_notification(ticket)) if (lock->needs_notification(ticket))

View File

@@ -2553,7 +2553,7 @@ void close_connection(THD *thd, uint sql_errno)
if (sql_errno) if (sql_errno)
{ {
net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL); thd->protocol->net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL);
thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno)); thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno));
} }
else else
@@ -2873,7 +2873,6 @@ void init_signals(void)
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
my_init_stacktrace(0);
#if defined(__amiga__) #if defined(__amiga__)
sa.sa_handler=(void(*)())handle_fatal_signal; sa.sa_handler=(void(*)())handle_fatal_signal;
#else #else

View File

@@ -872,6 +872,12 @@ enum enum_query_type
QT_ITEM_SUBSELECT_ID_ONLY, QT_ITEM_SUBSELECT_ID_ONLY,
QT_SHOW_SELECT_NUMBER= (1<<10), QT_SHOW_SELECT_NUMBER= (1<<10),
/// Do not print database name or table name in the identifiers (even if
/// this means the printout will be ambigous). It is assumed that the caller
/// passing this flag knows what they are doing.
QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES= (1 <<11),
/// This is used for EXPLAIN EXTENDED extra warnings / Be more detailed /// This is used for EXPLAIN EXTENDED extra warnings / Be more detailed
/// Be more detailed than QT_EXPLAIN. /// Be more detailed than QT_EXPLAIN.
/// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE

View File

@@ -32,13 +32,6 @@
#include <stdarg.h> #include <stdarg.h>
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024; static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
/* Declared non-static only because of the embedded library. */
bool net_send_error_packet(THD *, uint, const char *, const char *);
/* Declared non-static only because of the embedded library. */
bool net_send_ok(THD *, uint, uint, ulonglong, ulonglong, const char *,
bool);
/* Declared non-static only because of the embedded library. */
bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count);
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
static bool write_eof_packet(THD *, NET *, uint, uint); static bool write_eof_packet(THD *, NET *, uint, uint);
#endif #endif
@@ -152,11 +145,11 @@ bool Protocol_binary::net_store_data_cs(const uchar *from, size_t length,
@retval TRUE An error occurred and the message wasn't sent properly @retval TRUE An error occurred and the message wasn't sent properly
*/ */
bool net_send_error(THD *thd, uint sql_errno, const char *err, bool Protocol::net_send_error(THD *thd, uint sql_errno, const char *err,
const char* sqlstate) const char* sqlstate)
{ {
bool error; bool error;
DBUG_ENTER("net_send_error"); DBUG_ENTER("Protocol::net_send_error");
DBUG_ASSERT(!thd->spcont); DBUG_ASSERT(!thd->spcont);
DBUG_ASSERT(sql_errno); DBUG_ASSERT(sql_errno);
@@ -214,10 +207,10 @@ bool net_send_error(THD *thd, uint sql_errno, const char *err,
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
bool bool
net_send_ok(THD *thd, Protocol::net_send_ok(THD *thd,
uint server_status, uint statement_warn_count, uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong id, const char *message, ulonglong affected_rows, ulonglong id,
bool is_eof) const char *message, bool is_eof)
{ {
NET *net= &thd->net; NET *net= &thd->net;
StringBuffer<MYSQL_ERRMSG_SIZE + 10> store; StringBuffer<MYSQL_ERRMSG_SIZE + 10> store;
@@ -225,7 +218,7 @@ net_send_ok(THD *thd,
bool state_changed= false; bool state_changed= false;
bool error= FALSE; bool error= FALSE;
DBUG_ENTER("net_send_ok"); DBUG_ENTER("Protocol::net_send_ok");
if (! net->vio) // hack for re-parsing queries if (! net->vio) // hack for re-parsing queries
{ {
@@ -328,11 +321,11 @@ static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
*/ */
bool bool
net_send_eof(THD *thd, uint server_status, uint statement_warn_count) Protocol::net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
{ {
NET *net= &thd->net; NET *net= &thd->net;
bool error= FALSE; bool error= FALSE;
DBUG_ENTER("net_send_eof"); DBUG_ENTER("Protocol::net_send_eof");
/* /*
Check if client understand new format packets (OK instead of EOF) Check if client understand new format packets (OK instead of EOF)
@@ -419,7 +412,7 @@ static bool write_eof_packet(THD *thd, NET *net,
@retval TRUE An error occurred and the messages wasn't sent properly @retval TRUE An error occurred and the messages wasn't sent properly
*/ */
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, bool Protocol::net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char* sqlstate) const char* sqlstate)
{ {
@@ -433,7 +426,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos; char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
my_bool ret; my_bool ret;
uint8 save_compress; uint8 save_compress;
DBUG_ENTER("send_error_packet"); DBUG_ENTER("Protocol::send_error_packet");
if (net->vio == 0) if (net->vio == 0)
{ {
@@ -845,13 +838,12 @@ bool Protocol_text::store_field_metadata(const THD * thd,
{ {
CHARSET_INFO *thd_charset= thd->variables.character_set_results; CHARSET_INFO *thd_charset= thd->variables.character_set_results;
char *pos; char *pos;
CHARSET_INFO *cs= system_charset_info;
DBUG_ASSERT(field.is_sane()); DBUG_ASSERT(field.is_sane());
if (thd->client_capabilities & CLIENT_PROTOCOL_41) if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{ {
const LEX_CSTRING def= {STRING_WITH_LEN("def")}; const LEX_CSTRING def= {STRING_WITH_LEN("def")};
if (store_ident(def, MY_REPERTOIRE_ASCII) || if (store_ident(def) ||
store_ident(field.db_name) || store_ident(field.db_name) ||
store_ident(field.table_name) || store_ident(field.table_name) ||
store_ident(field.org_table_name) || store_ident(field.org_table_name) ||
@@ -867,8 +859,7 @@ bool Protocol_text::store_field_metadata(const THD * thd,
Don't apply character set conversion: Don't apply character set conversion:
extended metadata is a binary encoded data. extended metadata is a binary encoded data.
*/ */
if (store_binary_string(&metadata, cs, if (store_binary_string(metadata.ptr(), metadata.length()))
MY_REPERTOIRE_UNICODE30))
return true; return true;
} }
if (packet->realloc(packet->length() + 12)) if (packet->realloc(packet->length() + 12))
@@ -962,7 +953,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
for (uint pos= 0; (item=it++); pos++) for (uint pos= 0; (item=it++); pos++)
{ {
prot.prepare_for_resend(); prot.prepare_for_resend();
if (prot.store_field_metadata(thd, item, pos)) if (prot.store_item_metadata(thd, item, pos))
goto err; goto err;
if (prot.write()) if (prot.write())
DBUG_RETURN(1); DBUG_RETURN(1);
@@ -1042,7 +1033,7 @@ bool Protocol::write()
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
bool Protocol_text::store_field_metadata(THD *thd, Item *item, uint pos) bool Protocol_text::store_item_metadata(THD *thd, Item *item, uint pos)
{ {
Send_field field(thd, item); Send_field field(thd, item);
return store_field_metadata(thd, field, item->charset_for_protocol(), pos); return store_field_metadata(thd, field, item->charset_for_protocol(), pos);
@@ -1182,12 +1173,10 @@ bool Protocol_text::store_null()
*/ */
bool Protocol::store_string_aux(const char *from, size_t length, bool Protocol::store_string_aux(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs)
{ {
/* 'tocs' is set 0 when client issues SET character_set_results=NULL */ /* 'tocs' is set 0 when client issues SET character_set_results=NULL */
if (needs_conversion(fromcs, from_repertoire, tocs)) if (needs_conversion(fromcs, tocs))
{ {
/* Store with conversion */ /* Store with conversion */
return net_store_data_cs((uchar*) from, length, fromcs, tocs); return net_store_data_cs((uchar*) from, length, fromcs, tocs);
@@ -1220,9 +1209,7 @@ bool Protocol::store_warning(const char *from, size_t length)
bool Protocol_text::store_str(const char *from, size_t length, bool Protocol_text::store_str(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
DBUG_PRINT("info", ("Protocol_text::store field %u : %.*b", field_pos, DBUG_PRINT("info", ("Protocol_text::store field %u : %.*b", field_pos,
@@ -1231,7 +1218,23 @@ bool Protocol_text::store_str(const char *from, size_t length,
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_STRING)); DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_STRING));
field_pos++; field_pos++;
#endif #endif
return store_string_aux(from, length, fromcs, from_repertoire, tocs); return store_string_aux(from, length, fromcs, tocs);
}
bool Protocol_text::store_numeric_zerofill_str(const char *from,
size_t length,
protocol_send_type_t send_type)
{
#ifndef DBUG_OFF
DBUG_PRINT("info",
("Protocol_text::store_numeric_zerofill_str field %u : %.*b",
field_pos, (int) length, (length == 0 ? "" : from)));
DBUG_ASSERT(field_handlers == 0 || field_pos < field_count);
DBUG_ASSERT(valid_handler(field_pos, send_type));
field_pos++;
#endif
return store_numeric_string_aux(from, length);
} }
@@ -1298,25 +1301,25 @@ bool Protocol_text::store_decimal(const my_decimal *d)
} }
bool Protocol_text::store(float from, uint32 decimals, String *buffer) bool Protocol_text::store_float(float from, uint32 decimals)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_FLOAT)); DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_FLOAT));
field_pos++; field_pos++;
#endif #endif
Float(from).to_string(buffer, decimals); Float(from).to_string(&buffer, decimals);
return store_numeric_string_aux(buffer->ptr(), buffer->length()); return store_numeric_string_aux(buffer.ptr(), buffer.length());
} }
bool Protocol_text::store(double from, uint32 decimals, String *buffer) bool Protocol_text::store_double(double from, uint32 decimals)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_DOUBLE)); DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_DOUBLE));
field_pos++; field_pos++;
#endif #endif
buffer->set_real(from, decimals, thd->charset()); buffer.set_real(from, decimals, thd->charset());
return store_numeric_string_aux(buffer->ptr(), buffer->length()); return store_numeric_string_aux(buffer.ptr(), buffer.length());
} }
@@ -1324,12 +1327,6 @@ bool Protocol_text::store(Field *field)
{ {
if (field->is_null()) if (field->is_null())
return store_null(); return store_null();
#ifndef DBUG_OFF
field_pos++;
#endif
char buff[MAX_FIELD_WIDTH];
String str(buff,sizeof(buff), &my_charset_bin);
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
#ifdef DBUG_ASSERT_EXISTS #ifdef DBUG_ASSERT_EXISTS
TABLE *table= field->table; TABLE *table= field->table;
my_bitmap_map *old_map= 0; my_bitmap_map *old_map= 0;
@@ -1337,14 +1334,14 @@ bool Protocol_text::store(Field *field)
old_map= dbug_tmp_use_all_columns(table, table->read_set); old_map= dbug_tmp_use_all_columns(table, table->read_set);
#endif #endif
field->val_str(&str); bool rc= field->send(this);
#ifdef DBUG_ASSERT_EXISTS #ifdef DBUG_ASSERT_EXISTS
if (old_map) if (old_map)
dbug_tmp_restore_column_map(table->read_set, old_map); dbug_tmp_restore_column_map(table->read_set, old_map);
#endif #endif
return store_string_aux(str.ptr(), str.length(), str.charset(), return rc;
field->dtcollation().repertoire, tocs);
} }
@@ -1463,12 +1460,10 @@ void Protocol_binary::prepare_for_resend()
bool Protocol_binary::store_str(const char *from, size_t length, bool Protocol_binary::store_str(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs)
{ {
field_pos++; field_pos++;
return store_string_aux(from, length, fromcs, from_repertoire, tocs); return store_string_aux(from, length, fromcs, tocs);
} }
bool Protocol_binary::store_null() bool Protocol_binary::store_null()
@@ -1531,11 +1526,10 @@ bool Protocol_binary::store_decimal(const my_decimal *d)
StringBuffer<DECIMAL_MAX_STR_LENGTH> str; StringBuffer<DECIMAL_MAX_STR_LENGTH> str;
(void) d->to_string(&str); (void) d->to_string(&str);
return store_str(str.ptr(), str.length(), str.charset(), return store_str(str.ptr(), str.length(), str.charset(),
MY_REPERTOIRE_ASCII,
thd->variables.character_set_results); thd->variables.character_set_results);
} }
bool Protocol_binary::store(float from, uint32 decimals, String *buffer) bool Protocol_binary::store_float(float from, uint32 decimals)
{ {
field_pos++; field_pos++;
char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC); char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC);
@@ -1546,7 +1540,7 @@ bool Protocol_binary::store(float from, uint32 decimals, String *buffer)
} }
bool Protocol_binary::store(double from, uint32 decimals, String *buffer) bool Protocol_binary::store_double(double from, uint32 decimals)
{ {
field_pos++; field_pos++;
char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC); char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC);
@@ -1560,12 +1554,12 @@ bool Protocol_binary::store(double from, uint32 decimals, String *buffer)
bool Protocol_binary::store(Field *field) bool Protocol_binary::store(Field *field)
{ {
/* /*
We should not increment field_pos here as send_binary() will call another We should not increment field_pos here as send() will call another
protocol function to do this for us protocol function to do this for us
*/ */
if (field->is_null()) if (field->is_null())
return store_null(); return store_null();
return field->send_binary(this); return field->send(this);
} }

View File

@@ -50,38 +50,31 @@ protected:
} }
#endif #endif
uint field_count; uint field_count;
#ifndef EMBEDDED_LIBRARY
bool net_store_data(const uchar *from, size_t length);
bool net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
#else
virtual bool net_store_data(const uchar *from, size_t length); virtual bool net_store_data(const uchar *from, size_t length);
virtual bool net_store_data_cs(const uchar *from, size_t length, virtual bool net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs); CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
virtual bool net_send_ok(THD *, uint, uint, ulonglong, ulonglong, const char *,
bool);
virtual bool net_send_error_packet(THD *, uint, const char *, const char *);
#ifdef EMBEDDED_LIBRARY
char **next_field; char **next_field;
MYSQL_FIELD *next_mysql_field; MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc; MEM_ROOT *alloc;
#endif #endif
bool needs_conversion(CHARSET_INFO *fromcs, bool needs_conversion(CHARSET_INFO *fromcs,
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs) const CHARSET_INFO *tocs) const
{ {
// 'tocs' is set 0 when client issues SET character_set_results=NULL // 'tocs' is set 0 when client issues SET character_set_results=NULL
return tocs && !my_charset_same(fromcs, tocs) && return tocs && !my_charset_same(fromcs, tocs) &&
fromcs != &my_charset_bin && fromcs != &my_charset_bin &&
tocs != &my_charset_bin && tocs != &my_charset_bin;
(from_repertoire != MY_REPERTOIRE_ASCII ||
(fromcs->state & MY_CS_NONASCII) ||
(tocs->state & MY_CS_NONASCII));
} }
/* /*
The following two are low-level functions that are invoked from The following two are low-level functions that are invoked from
higher-level store_xxx() funcs. The data is stored into this->packet. higher-level store_xxx() funcs. The data is stored into this->packet.
*/ */
bool store_string_aux(const char *from, size_t length, bool store_string_aux(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs);
virtual bool send_ok(uint server_status, uint statement_warn_count, virtual bool send_ok(uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong last_insert_id, ulonglong affected_rows, ulonglong last_insert_id,
@@ -138,11 +131,9 @@ public:
virtual bool store_longlong(longlong from, bool unsigned_flag)=0; virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
virtual bool store_decimal(const my_decimal *)=0; virtual bool store_decimal(const my_decimal *)=0;
virtual bool store_str(const char *from, size_t length, virtual bool store_str(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
my_repertoire_t from_repertoire, virtual bool store_float(float from, uint32 decimals)=0;
CHARSET_INFO *tocs)=0; virtual bool store_double(double from, uint32 decimals)=0;
virtual bool store(float from, uint32 decimals, String *buffer)=0;
virtual bool store(double from, uint32 decimals, String *buffer)=0;
virtual bool store(MYSQL_TIME *time, int decimals)=0; virtual bool store(MYSQL_TIME *time, int decimals)=0;
virtual bool store_date(MYSQL_TIME *time)=0; virtual bool store_date(MYSQL_TIME *time)=0;
virtual bool store_time(MYSQL_TIME *time, int decimals)=0; virtual bool store_time(MYSQL_TIME *time, int decimals)=0;
@@ -150,30 +141,23 @@ public:
// Various useful wrappers for the virtual store*() methods. // Various useful wrappers for the virtual store*() methods.
// Backward wrapper for store_str() // Backward wrapper for store_str()
inline bool store(const char *from, size_t length, CHARSET_INFO *cs, bool store(const char *from, size_t length, CHARSET_INFO *cs)
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
{ {
return store_str(from, length, cs, repertoire, character_set_results()); return store_str(from, length, cs, character_set_results());
} }
inline bool store_lex_cstring(const LEX_CSTRING &s, bool store_lex_cstring(const LEX_CSTRING &s,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs,
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs) CHARSET_INFO *tocs)
{ {
return store_str(s.str, (uint) s.length, fromcs, from_repertoire, tocs); return store_str(s.str, (uint) s.length, fromcs, tocs);
} }
inline bool store_binary_string(Binary_string *str, bool store_binary_string(const char *str, size_t length)
CHARSET_INFO *fromcs,
my_repertoire_t from_repertoire)
{ {
return store_str(str->ptr(), (uint) str->length(), fromcs, from_repertoire, return store_str(str, (uint) length, &my_charset_bin, &my_charset_bin);
&my_charset_bin);
} }
bool store_ident(const LEX_CSTRING &s, bool store_ident(const LEX_CSTRING &s)
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
{ {
return store_lex_cstring(s, system_charset_info, repertoire, return store_lex_cstring(s, system_charset_info, character_set_results());
character_set_results());
} }
// End of wrappers // End of wrappers
@@ -196,6 +180,9 @@ public:
}; };
virtual enum enum_protocol_type type()= 0; virtual enum enum_protocol_type type()= 0;
virtual bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count);
bool net_send_error(THD *thd, uint sql_errno, const char *err,
const char* sqlstate);
void end_statement(); void end_statement();
friend int send_answer_1(Protocol *protocol, String *s1, String *s2, friend int send_answer_1(Protocol *protocol, String *s1, String *s2,
@@ -206,8 +193,9 @@ public:
/** Class used for the old (MySQL 4.0 protocol). */ /** Class used for the old (MySQL 4.0 protocol). */
class Protocol_text final :public Protocol class Protocol_text :public Protocol
{ {
StringBuffer<FLOATING_POINT_BUFFER> buffer;
bool store_numeric_string_aux(const char *from, size_t length); bool store_numeric_string_aux(const char *from, size_t length);
public: public:
Protocol_text(THD *thd_arg, ulong prealloc= 0) Protocol_text(THD *thd_arg, ulong prealloc= 0)
@@ -224,24 +212,26 @@ public:
bool store_longlong(longlong from, bool unsigned_flag) override; bool store_longlong(longlong from, bool unsigned_flag) override;
bool store_decimal(const my_decimal *) override; bool store_decimal(const my_decimal *) override;
bool store_str(const char *from, size_t length, bool store_str(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override;
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs) override;
bool store(MYSQL_TIME *time, int decimals) override; bool store(MYSQL_TIME *time, int decimals) override;
bool store_date(MYSQL_TIME *time) override; bool store_date(MYSQL_TIME *time) override;
bool store_time(MYSQL_TIME *time, int decimals) override; bool store_time(MYSQL_TIME *time, int decimals) override;
bool store(float nr, uint32 decimals, String *buffer) override; bool store_float(float nr, uint32 decimals) override;
bool store(double from, uint32 decimals, String *buffer) override; bool store_double(double from, uint32 decimals) override;
bool store(Field *field) override; bool store(Field *field) override;
bool send_out_parameters(List<Item_param> *sp_params) override; bool send_out_parameters(List<Item_param> *sp_params) override;
bool store_numeric_zerofill_str(const char *from, size_t length,
protocol_send_type_t send_type);
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
void remove_last_row() override; void remove_last_row() override;
#endif #endif
bool store_field_metadata(const THD *thd, const Send_field &field, virtual bool store_field_metadata(const THD *thd, const Send_field &field,
CHARSET_INFO *charset_for_protocol, CHARSET_INFO *charset_for_protocol,
uint pos); uint pos);
bool store_field_metadata(THD *thd, Item *item, uint pos); bool store_item_metadata(THD *thd, Item *item, uint pos);
bool store_field_metadata_for_list_fields(const THD *thd, Field *field, bool store_field_metadata_for_list_fields(const THD *thd, Field *field,
const TABLE_LIST *table_list, const TABLE_LIST *table_list,
uint pos); uint pos);
@@ -270,14 +260,12 @@ public:
bool store_longlong(longlong from, bool unsigned_flag) override; bool store_longlong(longlong from, bool unsigned_flag) override;
bool store_decimal(const my_decimal *) override; bool store_decimal(const my_decimal *) override;
bool store_str(const char *from, size_t length, bool store_str(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override;
my_repertoire_t from_repertoire,
CHARSET_INFO *tocs) override;
bool store(MYSQL_TIME *time, int decimals) override; bool store(MYSQL_TIME *time, int decimals) override;
bool store_date(MYSQL_TIME *time) override; bool store_date(MYSQL_TIME *time) override;
bool store_time(MYSQL_TIME *time, int decimals) override; bool store_time(MYSQL_TIME *time, int decimals) override;
bool store(float nr, uint32 decimals, String *buffer) override; bool store_float(float nr, uint32 decimals) override;
bool store(double from, uint32 decimals, String *buffer) override; bool store_double(double from, uint32 decimals) override;
bool store(Field *field) override; bool store(Field *field) override;
bool send_out_parameters(List<Item_param> *sp_params) override; bool send_out_parameters(List<Item_param> *sp_params) override;
@@ -320,24 +308,21 @@ public:
bool store_long(longlong) override { return false; } bool store_long(longlong) override { return false; }
bool store_longlong(longlong, bool) override { return false; } bool store_longlong(longlong, bool) override { return false; }
bool store_decimal(const my_decimal *) override { return false; } bool store_decimal(const my_decimal *) override { return false; }
bool store_str(const char *, size_t, CHARSET_INFO *, my_repertoire_t, bool store_str(const char *, size_t, CHARSET_INFO *, CHARSET_INFO *) override
CHARSET_INFO *) override
{ {
return false; return false;
} }
bool store(MYSQL_TIME *, int) override { return false; } bool store(MYSQL_TIME *, int) override { return false; }
bool store_date(MYSQL_TIME *) override { return false; } bool store_date(MYSQL_TIME *) override { return false; }
bool store_time(MYSQL_TIME *, int) override { return false; } bool store_time(MYSQL_TIME *, int) override { return false; }
bool store(float, uint32, String *) override { return false; } bool store_float(float, uint32) override { return false; }
bool store(double, uint32, String *) override { return false; } bool store_double(double, uint32) override { return false; }
bool store(Field *) override { return false; } bool store(Field *) override { return false; }
enum enum_protocol_type type() override { return PROTOCOL_DISCARD; }; enum enum_protocol_type type() override { return PROTOCOL_DISCARD; };
}; };
void send_warning(THD *thd, uint sql_errno, const char *err=0); void send_warning(THD *thd, uint sql_errno, const char *err=0);
bool net_send_error(THD *thd, uint sql_errno, const char *err,
const char* sqlstate);
void net_send_progress_packet(THD *thd); void net_send_progress_packet(THD *thd);
uchar *net_store_data(uchar *to,const uchar *from, size_t length); uchar *net_store_data(uchar *to,const uchar *from, size_t length);
uchar *net_store_data(uchar *to,int32 from); uchar *net_store_data(uchar *to,int32 from);

Some files were not shown because too many files have changed in this diff Show More