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

Merge 10.7 into 10.8

This commit is contained in:
Marko Mäkelä
2022-01-04 10:30:45 +02:00
154 changed files with 4426 additions and 1087 deletions

View File

@@ -6,6 +6,10 @@ init:
version: build-{build}~branch-{branch}
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
clone_depth: 1
build_script:

View File

@@ -100,8 +100,8 @@ extern "C" {
# endif
# endif
#define HAVE_READLINE
#define USE_POPEN
#endif
#define USE_POPEN
}
#ifdef HAVE_VIDATTR
@@ -4269,11 +4269,6 @@ com_nopager(String *buffer __attribute__((unused)),
}
#endif
/*
Sorry, you can't send the result to an editor in Win32
*/
#ifdef USE_POPEN
static int
com_edit(String *buffer,char *line __attribute__((unused)))
@@ -4294,7 +4289,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
if (!(editor = (char *)getenv("EDITOR")) &&
!(editor = (char *)getenv("VISUAL")))
editor = "vi";
editor = IF_WIN("notepad","vi");
strxmov(buff,editor," ",filename,NullS);
if ((error= system(buff)))
{
@@ -4309,7 +4304,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
goto err;
(void) buffer->alloc((uint) stat_arg.st_size);
if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
if ((tmp=(int)my_read(fd,(uchar*) buffer->ptr(),buffer->alloced_length(),MYF(0))) >= 0)
buffer->length((uint) tmp);
else
buffer->length(0);

View File

@@ -132,6 +132,7 @@ static my_bool disable_info= 1;
static my_bool abort_on_error= 1, opt_continue_on_error= 0;
static my_bool server_initialized= 0;
static my_bool is_windows= 0;
static my_bool optimizer_trace_active= 0;
static char **default_argv;
static const char *load_default_groups[]=
{ "mysqltest", "mariadb-test", "client", "client-server", "client-mariadb",
@@ -388,6 +389,7 @@ enum enum_commands {
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
Q_RESET_CONNECTION,
Q_OPTIMIZER_TRACE,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND,
@@ -498,7 +500,7 @@ const char *command_names[]=
"enable_prepare_warnings",
"disable_prepare_warnings",
"reset_connection",
"optimizer_trace",
0
};
@@ -643,6 +645,9 @@ void free_all_replace(){
}
void var_set_int(const char* name, int value);
void enable_optimizer_trace(struct st_connection *con);
void display_optimizer_trace(struct st_connection *con,
DYNAMIC_STRING *ds);
class LogFile {
@@ -1551,6 +1556,8 @@ static void die(const char *fmt, ...)
{
char buff[DIE_BUFF_SIZE];
va_list args;
DBUG_ENTER("die");
va_start(args, fmt);
make_error_message(buff, sizeof(buff), fmt, args);
really_die(buff);
@@ -7900,7 +7907,7 @@ static void handle_no_active_connection(struct st_command *command,
*/
void run_query_normal(struct st_connection *cn, struct st_command *command,
int flags, char *query, size_t query_len,
int flags, const char *query, size_t query_len,
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
{
MYSQL_RES *res= 0;
@@ -8019,6 +8026,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
/* If we come here the query is both executed and read successfully */
handle_no_error(command);
display_optimizer_trace(cn, ds);
revert_properties();
end:
@@ -9677,6 +9685,9 @@ int main(int argc, char **argv)
case Q_RESET_CONNECTION:
do_reset_connection();
break;
case Q_OPTIMIZER_TRACE:
enable_optimizer_trace(cur_con);
break;
case Q_SEND_SHUTDOWN:
handle_command_error(command,
mysql_shutdown(cur_con->mysql,
@@ -11357,3 +11368,90 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
return buf;
}
/*
Enable optimizer trace for the next command
*/
LEX_CSTRING enable_optimizer_trace_query=
{
STRING_WITH_LEN("set @mysqltest_save_optimzer_trace=@@optimizer_trace,@@optimizer_trace=\"enabled=on\"")
};
LEX_CSTRING restore_optimizer_trace_query=
{
STRING_WITH_LEN("set @@optimizer_trace=@mysqltest_save_optimzer_trace")
};
LEX_CSTRING display_optimizer_trace_query
{
STRING_WITH_LEN("SELECT * from information_schema.optimizer_trace")
};
void enable_optimizer_trace(struct st_connection *con)
{
MYSQL *mysql= con->mysql;
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
my_bool save_view_protocol_enabled= view_protocol_enabled;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
struct st_command command;
DBUG_ENTER("enable_optimizer_trace");
if (!mysql)
DBUG_VOID_RETURN;
ps_protocol_enabled= view_protocol_enabled= 0;
init_dynamic_string(&ds_result, NULL, 0, 256);
init_dynamic_string(&ds_warnings, NULL, 0, 256);
bzero(&command, sizeof(command));
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
enable_optimizer_trace_query.str,
enable_optimizer_trace_query.length,
&ds_result, &ds_warnings);
dynstr_free(&ds_result);
dynstr_free(&ds_warnings);
ps_protocol_enabled= save_ps_protocol_enabled;
view_protocol_enabled= save_view_protocol_enabled;
optimizer_trace_active= 1;
DBUG_VOID_RETURN;
}
void display_optimizer_trace(struct st_connection *con,
DYNAMIC_STRING *ds)
{
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
my_bool save_view_protocol_enabled= view_protocol_enabled;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
struct st_command command;
DBUG_ENTER("display_optimizer_trace");
if (!optimizer_trace_active)
DBUG_VOID_RETURN;
optimizer_trace_active= 0;
ps_protocol_enabled= view_protocol_enabled= 0;
init_dynamic_string(&ds_result, NULL, 0, 256);
init_dynamic_string(&ds_warnings, NULL, 0, 256);
bzero(&command, sizeof(command));
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
display_optimizer_trace_query.str,
display_optimizer_trace_query.length,
ds, &ds_warnings);
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
restore_optimizer_trace_query.str,
restore_optimizer_trace_query.length,
ds, &ds_warnings);
dynstr_free(&ds_result);
dynstr_free(&ds_warnings);
ps_protocol_enabled= save_ps_protocol_enabled;
view_protocol_enabled= save_view_protocol_enabled;
DBUG_VOID_RETURN;
}

49
debian/salsa-ci.yml vendored
View File

@@ -32,11 +32,11 @@ build:
# Run Salsa-CI .build-before-script equivalent
- mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
- mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
# Run Salsa-CI .build-script equivalent
- export CCACHE_DIR="${CCACHE_TMP_DIR}"
- apt-get update && eatmydata apt-get install --yes --no-install-recommends aptitude devscripts ccache equivs
# Run Salsa-CI .build-script equivalent, with extra devscripts so autobake-deb.sh can run 'dch'
- export CCACHE_DIR=${CCACHE_TMP_DIR}
- apt-get update && eatmydata apt-get install --no-install-recommends -y ccache fakeroot build-essential devscripts
- cd ${WORKING_DIR}/${SOURCE_DIR}
- eatmydata install-build-deps.sh .
- eatmydata apt-get build-dep --no-install-recommends -y .
- update-ccache-symlinks; ccache -z # Zero out ccache counters
- while true; do sleep 600; echo "10 minutes passed" >&2; done & # Progress keeper since build is long and silent
- debian/autobake-deb.sh |& tail -n 10000 # Keep Gitlab-CI output under 4 MB
@@ -44,7 +44,7 @@ build:
- rm -rf ${WORKING_DIR}/${SOURCE_DIR}
- du -shc ${WORKING_DIR}/* # Show total file size of artifacts. Must stay are under 100 MB.
- ccache -s # Show ccache stats to validate it worked
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR} || true
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
build bullseye-backports:
extends: .build-package
@@ -70,45 +70,6 @@ build i386:
build native deb:
extends: .build-package
script: &buildpackage-script |
mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
export CCACHE_DIR=${CCACHE_TMP_DIR}
# Add deb-src entries
sed -n '/^deb\s/s//deb-src /p' /etc/apt/sources.list > /etc/apt/sources.list.d/deb-src.list
apt-get update && eatmydata apt-get install --no-install-recommends -y \
aptitude \
devscripts \
ccache \
equivs \
build-essential \
python3
# Enter source package dir
cd ${WORKING_DIR}/${SOURCE_DIR}
# Install package build dependencies
eatmydata install-build-deps.sh .
# Generate ccache links
dpkg-reconfigure ccache
PATH="/usr/lib/ccache/:${PATH}"
# Reset ccache stats
ccache -z
# Create salsaci user and fix permissions
useradd salsaci
chown -R salsaci. ${WORKING_DIR} ${CCACHE_DIR}
# Define buildlog filename
BUILD_LOGFILE_SOURCE=$(dpkg-parsechangelog -S Source)
BUILD_LOGFILE_VERSION=$(dpkg-parsechangelog -S Version)
BUILD_LOGFILE_VERSION=${BUILD_LOGFILE_VERSION#*:}
BUILD_LOGFILE_ARCH=$(dpkg --print-architecture)
BUILD_LOGFILE="${WORKING_DIR}/${BUILD_LOGFILE_SOURCE}_${BUILD_LOGFILE_VERSION}_${BUILD_LOGFILE_ARCH}.build"
# Build package as user salsaci
su salsaci -c "eatmydata dpkg-buildpackage ${DB_BUILD_PARAM}" |& OUTPUT_FILENAME=${BUILD_LOGFILE} filter-output
# Restore PWD to ${WORKING_DIR}
cd ${WORKING_DIR}
rm -rf ${WORKING_DIR}/${SOURCE_DIR}
# Print ccache stats on job log
ccache -s
mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
piuparts:
extends: .test-piuparts

View File

@@ -91,6 +91,7 @@ extern struct wsrep_service_st {
unsigned long long trx_id);
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_kill_UNLOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_set_wsrep_PA_unsafe_func)(MYSQL_THD thd);
} *wsrep_service;
#define MYSQL_SERVICE_WSREP_INCLUDED
@@ -137,6 +138,7 @@ extern struct wsrep_service_st {
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2)
#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I)
#define wsrep_thd_set_PA_unsafe(T) wsrep_service->wsrep_thd_set_PA_unsafe_func(T)
#else
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
@@ -238,5 +240,7 @@ extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
unsigned long long trx_id);
/* declare parallel applying unsafety for the THD */
extern "C" void wsrep_thd_set_PA_unsafe(MYSQL_THD thd);
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */

View File

@@ -41,8 +41,7 @@
if (WSREP(thd) && \
wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_, \
fk_tables_, create_info_)) \
goto wsrep_error_label;
fk_tables_, create_info_))
/*
Checks if lex->no_write_to_binlog is set for statements that use LOCAL or

View File

@@ -0,0 +1,4 @@
if (`select version() like '%valgrind%'`)
{
skip Does not run with binaries built with valgrind;
}

View File

@@ -2,9 +2,6 @@
# MDEV-25334 FTWRL/Backup blocks DDL on temporary tables with binlog
# enabled assertion fails in Diagnostics_area::set_error_status
#
select @@binlog_format;
@@binlog_format
MIXED
connect con1,localhost,root,,;
connection default;
#

View File

@@ -9,7 +9,6 @@
--echo # enabled assertion fails in Diagnostics_area::set_error_status
--echo #
select @@binlog_format;
--connect (con1,localhost,root,,)
connection default;

View File

@@ -1,7 +1,7 @@
#
# MDEV-5317 Compound statement / anonymous blocks
#
source include/have_log_bin.inc;
source include/have_binlog_format_mixed_or_statement.inc;
delimiter |;
CREATE TABLE t1 (a INT PRIMARY KEY)|

View File

@@ -0,0 +1 @@
--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci

View File

@@ -0,0 +1,11 @@
#
# Start of 10.3 tests
#
#
# MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
#
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;
#
# End of 10.3 tests
#

View File

@@ -0,0 +1,15 @@
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
--echo #
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #

View File

@@ -0,0 +1,29 @@
#
# Start of 10.5 tests
#
#
# MDEV-27307 main.ctype_utf8mb4_uca_allkeys tests fail with Valgrind/MSAN
#
# In this scenario packing is fully disabled:
# - The sortkey is of a fixed width data type
# - The addon fields have too small potential savings
SET NAMES latin1;
CREATE TABLE t1 (
code INT NOT NULL,
str VARCHAR(5) CHARACTER SET latin1 NOT NULL
) ENGINE=MyISAM;
FOR i IN 0..50
DO
INSERT INTO t1 VALUES (i, REPEAT('a',1));
END FOR;
$$
SELECT COUNT(*) FROM t1;
COUNT(*)
51
SET sort_buffer_size=1024;
SELECT HEX(code), HEX(str) FROM t1 ORDER BY HEX(str);
SET sort_buffer_size=DEFAULT;
DROP TABLE t1;
#
# End of 10.5 tests
#

View File

@@ -0,0 +1,51 @@
#
# Tests related to pack modes of the sortkey and addon fields.
# Fields can be either packed or fixed length.
#
# See the comment in filesort.cc:
#
# Heuristic: skip packing if potential savings are less than 10 bytes.
#
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27307 main.ctype_utf8mb4_uca_allkeys tests fail with Valgrind/MSAN
--echo #
--echo # In this scenario packing is fully disabled:
--echo # - The sortkey is of a fixed width data type
--echo # - The addon fields have too small potential savings
SET NAMES latin1;
CREATE TABLE t1 (
code INT NOT NULL,
str VARCHAR(5) CHARACTER SET latin1 NOT NULL
) ENGINE=MyISAM;
DELIMITER $$;
FOR i IN 0..50
DO
INSERT INTO t1 VALUES (i, REPEAT('a',1));
END FOR;
$$
DELIMITER ;$$
SELECT COUNT(*) FROM t1;
# The result is not very interesting, let's suppress it.
# We just make sure there are no Valgrind/MSAN warnings about
# not initialized memory being written to disk.
SET sort_buffer_size=1024;
--disable_result_log
SELECT HEX(code), HEX(str) FROM t1 ORDER BY HEX(str);
--enable_result_log
SET sort_buffer_size=DEFAULT;
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -1,7 +1,3 @@
[ERROR] mariadbd: Can't lock aria aria_log_control for exclusive use, error: #. Will retry for 0 seconds
[ERROR] Plugin 'Aria' init function returned error.
[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
[Warning] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some options may be missing from the help text
#
# Check that we don't write any data to wrong or not existing datadir
#

View File

@@ -2,15 +2,10 @@
# Check errors from mysqld--help when providing different datadir
#
# We can't run this test on windows as windows doesn't provide file locking
# which the first exec requires.
--source include/not_windows.inc
--let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --lower-case-table-names=1 --help --verbose
--exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err
--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /control file '.*aria_log_control'/aria_log_control/ /error: \d+/error: #/
--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* //
--cat_file $MYSQL_TMP_DIR/mysqld--help2.err
--echo #

View File

@@ -585,7 +585,6 @@ create view v2 as select a from t2;
explain select * from v2 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10
select * from information_schema.OPTIMIZER_TRACE;
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
explain select * from v2 {
"steps": [
@@ -698,7 +697,6 @@ explain select * from v1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10
2 DERIVED t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
select * from information_schema.OPTIMIZER_TRACE;
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
explain select * from v1 {
"steps": [
@@ -2409,7 +2407,8 @@ select t1.a from t1 left join t2 on t1.a=t2.a {
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -2585,7 +2584,8 @@ explain select * from t1 left join t2 on t2.a=t1.a {
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -2755,7 +2755,8 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -3073,7 +3074,8 @@ explain extended select * from t1 where a in (select pk from t10) {
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -4782,7 +4784,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -7438,7 +7441,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
},
{
"condition_on_constant_tables": "1"
"condition_on_constant_tables": "1",
"computing_condition": []
},
{
"attaching_conditions_to_tables": {
@@ -8707,6 +8711,15 @@ SELECT 'a\0' LIMIT 0 {
}
SET optimizer_trace=DEFAULT;
#
# MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer::on_start_object
#
CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=MEMORY;
SET optimizer_trace=1;
INSERT INTO t1 VALUES (0,0);
SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
a
DROP TABLE t1;
#
# End of 10.4 tests
#
set optimizer_trace='enabled=on';
@@ -9252,5 +9265,22 @@ json_detailed(json_extract(trace, '$**.best_join_order'))
]
]
DROP TABLE t1;
#
# MDEV-27306: SET STATEMENT optimizer_trace=1 Doesn't save the trace
#
set optimizer_trace=0;
set statement optimizer_trace=1 for select * from seq_1_to_10 where seq<2;
seq
1
# The trace must not be empty:
select left(trace, 100) from information_schema.optimizer_trace;
left(trace, 100)
{
"steps": [
{
"join_preparation": {
"select_id": 1,
"steps": [
# End of 10.6 tests
set optimizer_trace='enabled=off';

View File

@@ -48,12 +48,12 @@ create view v1 as select a from t1 group by b;
create view v2 as select a from t2;
--echo # Mergeable view
--optimizer_trace
explain select * from v2 ;
select * from information_schema.OPTIMIZER_TRACE;
--echo # Non-Mergeable view
--optimizer_trace
explain select * from v1 ;
select * from information_schema.OPTIMIZER_TRACE;
drop table t1,t2;
drop view v1,v2;
@@ -645,6 +645,16 @@ SELECT 'a\0' LIMIT 0;
SELECT query, trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
SET optimizer_trace=DEFAULT;
--echo #
--echo # MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer::on_start_object
--echo #
CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=MEMORY;
SET optimizer_trace=1;
INSERT INTO t1 VALUES (0,0);
SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
@@ -865,5 +875,13 @@ select json_detailed(json_extract(trace, '$**.best_join_order'))
from information_schema.OPTIMIZER_TRACE;
DROP TABLE t1;
--echo #
--echo # MDEV-27306: SET STATEMENT optimizer_trace=1 Doesn't save the trace
--echo #
set optimizer_trace=0;
set statement optimizer_trace=1 for select * from seq_1_to_10 where seq<2;
--echo # The trace must not be empty:
select left(trace, 100) from information_schema.optimizer_trace;
--echo # End of 10.6 tests
set optimizer_trace='enabled=off';

View File

@@ -198,5 +198,28 @@ id id
1 NULL
2 1
3 3
#
# MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT
#
# This must NOT have "Range checked for each record" without any
# provisions to produce rows in the required ordering:
explain
select
t1.id,t2.id
from
t1 left join
t2 on t2.id2 = t1.id and
t2.id = (select dd.id
from t2 dd
where
dd.id2 = t1.id and
d1 > '2019-02-06 00:00:00'
order by
dd.d1, dd.d2, dd.id limit 1
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index
1 PRIMARY t2 eq_ref PRIMARY,id2 PRIMARY 4 func # Using where
2 DEPENDENT SUBQUERY dd range id2,for_latest_sort for_latest_sort 6 NULL # Using where
drop table t1,t2;
# End of 10.2 tests

View File

@@ -184,6 +184,28 @@ from
order by
dd.d1 desc, dd.d2 desc, dd.id desc limit 1
);
--echo #
--echo # MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT
--echo #
--echo # This must NOT have "Range checked for each record" without any
--echo # provisions to produce rows in the required ordering:
--replace_column 9 #
explain
select
t1.id,t2.id
from
t1 left join
t2 on t2.id2 = t1.id and
t2.id = (select dd.id
from t2 dd
where
dd.id2 = t1.id and
d1 > '2019-02-06 00:00:00'
order by
dd.d1, dd.d2, dd.id limit 1
);
drop table t1,t2;
--echo # End of 10.2 tests

View File

@@ -1,4 +1,6 @@
DROP TABLE IF EXISTS `t1`;
call mtr.add_suppression("option 'table_open_cache'");
call mtr.add_suppression("option 'max_connections'");
# Bug#46922: crash when adding partitions and open_files_limit is reached
CREATE TABLE t1 (a INT PRIMARY KEY)
ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;

View File

@@ -5563,6 +5563,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
#
# MDEV-21866: Assertion `!result' failed in convert_const_to_int upon 2nd execution of PS
#
CREATE TABLE t1 (a BIGINT DEFAULT -1);
CREATE VIEW v1 AS SELECT DISTINCT a FROM t1;
PREPARE stmt FROM 'SELECT * FROM v1 WHERE a <=> NULL';
EXECUTE stmt;
a
EXECUTE stmt;
a
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;
# End of 10.2 tests
#
#

View File

@@ -4991,6 +4991,22 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
--echo #
--echo # MDEV-21866: Assertion `!result' failed in convert_const_to_int upon 2nd execution of PS
--echo #
CREATE TABLE t1 (a BIGINT DEFAULT -1);
CREATE VIEW v1 AS SELECT DISTINCT a FROM t1;
PREPARE stmt FROM 'SELECT * FROM v1 WHERE a <=> NULL';
EXECUTE stmt;
EXECUTE stmt;
# Cleanup
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;
--echo # End of 10.2 tests
--echo #

View File

@@ -1,5 +1,5 @@
--source include/not_valgrind.inc
--source include/not_valgrind_build.inc
--echo # MDEV-20699 do not cache SP in SHOW CREATE
--echo # Warmup round, this might allocate some memory for session variable

View File

@@ -3098,6 +3098,48 @@ select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt
1
2
drop table t1;
#
# MDEV-23182: Server crashes in
# Item::fix_fields_if_needed / table_value_constr::prepare upon 2nd execution of PS
#
SET @save_in_predicate_conversion_threshold=@@in_predicate_conversion_threshold;
SET in_predicate_conversion_threshold=2;
CREATE TABLE t1 (c VARCHAR(10)) DEFAULT CHARSET=utf8;
PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
EXECUTE stmt;
c
# Without the patch second execution of the prepared statement 'stmt'
# results in crash.
EXECUTE stmt;
c
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# Check that the query without conversion doesn't crash server
CREATE TABLE t1 (c VARCHAR(10));
PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
EXECUTE stmt;
c
EXECUTE stmt;
c
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# Test case for a row expression in the left part of the IN clause
CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3)) DEFAULT CHARSET=utf8;
PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
EXECUTE stmt;
a b
EXECUTE stmt;
a b
DROP TABLE t1;
# Check that the query without conversion is handled successfully
CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3));
PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
EXECUTE stmt;
a b
EXECUTE stmt;
a b
DROP TABLE t1;
SET @@in_predicate_conversion_threshold = @save_in_predicate_conversion_threshold;
End of 10.3 tests
#
# MDEV-22610 Crash in INSERT INTO t1 (VALUES (DEFAULT) UNION VALUES (DEFAULT))

View File

@@ -1652,6 +1652,52 @@ select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt
drop table t1;
--echo #
--echo # MDEV-23182: Server crashes in
--echo # Item::fix_fields_if_needed / table_value_constr::prepare upon 2nd execution of PS
--echo #
SET @save_in_predicate_conversion_threshold=@@in_predicate_conversion_threshold;
SET in_predicate_conversion_threshold=2;
CREATE TABLE t1 (c VARCHAR(10)) DEFAULT CHARSET=utf8;
PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
EXECUTE stmt;
--echo # Without the patch second execution of the prepared statement 'stmt'
--echo # results in crash.
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo # Check that the query without conversion doesn't crash server
CREATE TABLE t1 (c VARCHAR(10));
PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo # Test case for a row expression in the left part of the IN clause
CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3)) DEFAULT CHARSET=utf8;
PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
EXECUTE stmt;
EXECUTE stmt;
DROP TABLE t1;
--echo # Check that the query without conversion is handled successfully
CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3));
PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
EXECUTE stmt;
EXECUTE stmt;
DROP TABLE t1;
SET @@in_predicate_conversion_threshold = @save_in_predicate_conversion_threshold;
--echo End of 10.3 tests
--echo #

View File

@@ -18,6 +18,7 @@ SELECT * FROM t1;
UNLOCK TABLES;
--connection con1
--error 0,ER_OPTION_PREVENTS_STATEMENT
--reap
--error ER_OPTION_PREVENTS_STATEMENT
TRUNCATE TABLE t1;

View File

@@ -0,0 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
d0:4d:23:85:ee:59:b3:fa
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
Not Before: Jan 27 10:11:10 2019 GMT
Not After : Jan 22 10:11:10 2039 GMT
Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:e8:0e:a7:84:d3:75:30:06:30:b2:10:b9:d1:88:
36:2b:5e:f8:c8:44:57:cb:67:72:ab:96:95:33:d5:
88:d1:8f:23:50:98:ba:6d:20:00:80:bd:35:d5:c1:
bf:98:49:c4:0a:15:4a:34:a6:21:9b:2e:8c:15:09:
f0:63:81:02:c2:7c:e2:53:e0:f7:a1:1a:40:5e:8f:
41:4a:4c:56:d4:20:f1:d5:a7:c1:53:2e:ff:7e:37:
17:cc:7e:74:bd:e2:22:33:ce:8c:77:62:a4:c5:3f:
44:35:7b:7e:b9:f5:7d:8c:7a:27:58:fd:2c:42:86:
2e:e7:6b:01:99:7b:fe:7d:a7:a1:4f:3e:39:39:54:
1f:61:de:74:66:d1:77:4f:43:1b:66:70:29:85:de:
fc:8f:8e:1b:7b:a2:66:48:26:7f:9b:a6:fd:4a:e4:
dc:eb:ed:bd:f8:e3:f1:57:98:13:6f:f1:a3:2a:e3:
73:bd:8d:7c:6f:4b:59:35:bc:b5:42:3e:99:a7:13:
8d:be:2e:5c:9a:c6:5b:ab:ae:bf:00:e9:c8:ee:05:
22:8e:d5:67:1a:47:9a:6d:9c:f9:42:3e:15:34:f8:
31:ec:b4:7e:d3:92:95:b0:b8:f9:66:f3:bd:1d:31:
2c:b1:90:62:a1:f8:4e:a6:5d:26:22:f0:e1:fe:16:
2b:69
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Authority Key Identifier:
keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha256WithRSAEncryption
df:fd:74:29:5b:5e:9a:8b:09:02:40:59:73:cb:71:47:3f:97:
3d:a9:fd:c4:8c:01:29:c9:86:b8:71:55:ff:72:0e:50:dc:c8:
b5:e6:91:41:52:47:21:30:cc:4d:e7:3b:4b:db:55:ea:7d:46:
eb:53:e0:b7:1b:80:7c:b1:0c:d3:d1:bc:a0:73:ae:96:1f:fd:
05:52:7e:54:d5:03:52:69:7b:34:5f:27:d7:98:da:98:76:73:
e6:bb:50:59:2a:94:90:67:03:1c:a4:76:2f:ee:ef:59:60:09:
48:33:03:2b:52:ed:83:42:f8:71:19:7f:d8:be:40:ed:20:01:
90:3c:7e:1c:8b:d2:9f:f3:2f:09:1f:50:c8:10:e1:8a:d9:a5:
49:9c:0b:74:17:b9:2b:68:f6:1e:73:c2:73:10:38:b3:35:e2:
87:91:1b:a1:d1:9b:81:9d:1b:32:cc:03:6e:4c:82:95:81:11:
42:56:e2:16:2b:22:65:db:40:2c:ca:dc:03:f4:d5:07:cf:f5:
13:b2:cf:51:5b:24:cd:c7:d1:9b:42:8e:f9:df:5d:1e:5a:09:
a3:4f:a9:0b:f4:21:c5:bb:ff:02:93:67:e8:2d:ee:ab:d9:59:
76:03:2c:a1:bd:fb:dc:af:b6:82:94:71:85:53:a8:18:0d:3a:
9e:42:eb:59
-----BEGIN CERTIFICATE-----
MIIDfzCCAmegAwIBAgIJANBNI4XuWbP6MA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV
BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD
VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xOTAxMjcxMDExMTBa
Fw0zOTAxMjIxMDExMTBaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH
TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgOp4TTdTAG
MLIQudGINite+MhEV8tncquWlTPViNGPI1CYum0gAIC9NdXBv5hJxAoVSjSmIZsu
jBUJ8GOBAsJ84lPg96EaQF6PQUpMVtQg8dWnwVMu/343F8x+dL3iIjPOjHdipMU/
RDV7frn1fYx6J1j9LEKGLudrAZl7/n2noU8+OTlUH2HedGbRd09DG2ZwKYXe/I+O
G3uiZkgmf5um/Urk3Ovtvfjj8VeYE2/xoyrjc72NfG9LWTW8tUI+macTjb4uXJrG
W6uuvwDpyO4FIo7VZxpHmm2c+UI+FTT4Mey0ftOSlbC4+WbzvR0xLLGQYqH4TqZd
JiLw4f4WK2kCAwEAAaNQME4wHQYDVR0OBBYEFMpxmYnwcqt1ZrtlagMEcqV7laaT
MB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQELBQADggEBAN/9dClbXpqLCQJAWXPLcUc/lz2p/cSMASnJhrhx
Vf9yDlDcyLXmkUFSRyEwzE3nO0vbVep9RutT4LcbgHyxDNPRvKBzrpYf/QVSflTV
A1JpezRfJ9eY2ph2c+a7UFkqlJBnAxykdi/u71lgCUgzAytS7YNC+HEZf9i+QO0g
AZA8fhyL0p/zLwkfUMgQ4YrZpUmcC3QXuSto9h5zwnMQOLM14oeRG6HRm4GdGzLM
A25MgpWBEUJW4hYrImXbQCzK3AP01QfP9ROyz1FbJM3H0ZtCjvnfXR5aCaNPqQv0
IcW7/wKTZ+gt7qvZWXYDLKG9+9yvtoKUcYVTqBgNOp5C61k=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
d0:4d:23:85:ee:59:b3:fa
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
Not Before: Jan 27 10:11:10 2019 GMT
Not After : Jan 22 10:11:10 2039 GMT
Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:e8:0e:a7:84:d3:75:30:06:30:b2:10:b9:d1:88:
36:2b:5e:f8:c8:44:57:cb:67:72:ab:96:95:33:d5:
88:d1:8f:23:50:98:ba:6d:20:00:80:bd:35:d5:c1:
bf:98:49:c4:0a:15:4a:34:a6:21:9b:2e:8c:15:09:
f0:63:81:02:c2:7c:e2:53:e0:f7:a1:1a:40:5e:8f:
41:4a:4c:56:d4:20:f1:d5:a7:c1:53:2e:ff:7e:37:
17:cc:7e:74:bd:e2:22:33:ce:8c:77:62:a4:c5:3f:
44:35:7b:7e:b9:f5:7d:8c:7a:27:58:fd:2c:42:86:
2e:e7:6b:01:99:7b:fe:7d:a7:a1:4f:3e:39:39:54:
1f:61:de:74:66:d1:77:4f:43:1b:66:70:29:85:de:
fc:8f:8e:1b:7b:a2:66:48:26:7f:9b:a6:fd:4a:e4:
dc:eb:ed:bd:f8:e3:f1:57:98:13:6f:f1:a3:2a:e3:
73:bd:8d:7c:6f:4b:59:35:bc:b5:42:3e:99:a7:13:
8d:be:2e:5c:9a:c6:5b:ab:ae:bf:00:e9:c8:ee:05:
22:8e:d5:67:1a:47:9a:6d:9c:f9:42:3e:15:34:f8:
31:ec:b4:7e:d3:92:95:b0:b8:f9:66:f3:bd:1d:31:
2c:b1:90:62:a1:f8:4e:a6:5d:26:22:f0:e1:fe:16:
2b:69
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Authority Key Identifier:
keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha256WithRSAEncryption
df:fd:74:29:5b:5e:9a:8b:09:02:40:59:73:cb:71:47:3f:97:
3d:a9:fd:c4:8c:01:29:c9:86:b8:71:55:ff:72:0e:50:dc:c8:
b5:e6:91:41:52:47:21:30:cc:4d:e7:3b:4b:db:55:ea:7d:46:
eb:53:e0:b7:1b:80:7c:b1:0c:d3:d1:bc:a0:73:ae:96:1f:fd:
05:52:7e:54:d5:03:52:69:7b:34:5f:27:d7:98:da:98:76:73:
e6:bb:50:59:2a:94:90:67:03:1c:a4:76:2f:ee:ef:59:60:09:
48:33:03:2b:52:ed:83:42:f8:71:19:7f:d8:be:40:ed:20:01:
90:3c:7e:1c:8b:d2:9f:f3:2f:09:1f:50:c8:10:e1:8a:d9:a5:
49:9c:0b:74:17:b9:2b:68:f6:1e:73:c2:73:10:38:b3:35:e2:
87:91:1b:a1:d1:9b:81:9d:1b:32:cc:03:6e:4c:82:95:81:11:
42:56:e2:16:2b:22:65:db:40:2c:ca:dc:03:f4:d5:07:cf:f5:
13:b2:cf:51:5b:24:cd:c7:d1:9b:42:8e:f9:df:5d:1e:5a:09:
a3:4f:a9:0b:f4:21:c5:bb:ff:02:93:67:e8:2d:ee:ab:d9:59:
76:03:2c:a1:bd:fb:dc:af:b6:82:94:71:85:53:a8:18:0d:3a:
9e:42:eb:59
-----BEGIN CERTIFICATE-----
MIIDfzCCAmegAwIBAgIJANBNI4XuWbP6MA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV
BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD
VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xOTAxMjcxMDExMTBa
Fw0zOTAxMjIxMDExMTBaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH
TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgOp4TTdTAG
MLIQudGINite+MhEV8tncquWlTPViNGPI1CYum0gAIC9NdXBv5hJxAoVSjSmIZsu
jBUJ8GOBAsJ84lPg96EaQF6PQUpMVtQg8dWnwVMu/343F8x+dL3iIjPOjHdipMU/
RDV7frn1fYx6J1j9LEKGLudrAZl7/n2noU8+OTlUH2HedGbRd09DG2ZwKYXe/I+O
G3uiZkgmf5um/Urk3Ovtvfjj8VeYE2/xoyrjc72NfG9LWTW8tUI+macTjb4uXJrG
W6uuvwDpyO4FIo7VZxpHmm2c+UI+FTT4Mey0ftOSlbC4+WbzvR0xLLGQYqH4TqZd
JiLw4f4WK2kCAwEAAaNQME4wHQYDVR0OBBYEFMpxmYnwcqt1ZrtlagMEcqV7laaT
MB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQELBQADggEBAN/9dClbXpqLCQJAWXPLcUc/lz2p/cSMASnJhrhx
Vf9yDlDcyLXmkUFSRyEwzE3nO0vbVep9RutT4LcbgHyxDNPRvKBzrpYf/QVSflTV
A1JpezRfJ9eY2ph2c+a7UFkqlJBnAxykdi/u71lgCUgzAytS7YNC+HEZf9i+QO0g
AZA8fhyL0p/zLwkfUMgQ4YrZpUmcC3QXuSto9h5zwnMQOLM14oeRG6HRm4GdGzLM
A25MgpWBEUJW4hYrImXbQCzK3AP01QfP9ROyz1FbJM3H0ZtCjvnfXR5aCaNPqQv0
IcW7/wKTZ+gt7qvZWXYDLKG9+9yvtoKUcYVTqBgNOp5C61k=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
d0:4d:23:85:ee:59:b3:fa
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
Not Before: Jan 27 10:11:10 2019 GMT
Not After : Jan 22 10:11:10 2039 GMT
Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:e8:0e:a7:84:d3:75:30:06:30:b2:10:b9:d1:88:
36:2b:5e:f8:c8:44:57:cb:67:72:ab:96:95:33:d5:
88:d1:8f:23:50:98:ba:6d:20:00:80:bd:35:d5:c1:
bf:98:49:c4:0a:15:4a:34:a6:21:9b:2e:8c:15:09:
f0:63:81:02:c2:7c:e2:53:e0:f7:a1:1a:40:5e:8f:
41:4a:4c:56:d4:20:f1:d5:a7:c1:53:2e:ff:7e:37:
17:cc:7e:74:bd:e2:22:33:ce:8c:77:62:a4:c5:3f:
44:35:7b:7e:b9:f5:7d:8c:7a:27:58:fd:2c:42:86:
2e:e7:6b:01:99:7b:fe:7d:a7:a1:4f:3e:39:39:54:
1f:61:de:74:66:d1:77:4f:43:1b:66:70:29:85:de:
fc:8f:8e:1b:7b:a2:66:48:26:7f:9b:a6:fd:4a:e4:
dc:eb:ed:bd:f8:e3:f1:57:98:13:6f:f1:a3:2a:e3:
73:bd:8d:7c:6f:4b:59:35:bc:b5:42:3e:99:a7:13:
8d:be:2e:5c:9a:c6:5b:ab:ae:bf:00:e9:c8:ee:05:
22:8e:d5:67:1a:47:9a:6d:9c:f9:42:3e:15:34:f8:
31:ec:b4:7e:d3:92:95:b0:b8:f9:66:f3:bd:1d:31:
2c:b1:90:62:a1:f8:4e:a6:5d:26:22:f0:e1:fe:16:
2b:69
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Authority Key Identifier:
keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha256WithRSAEncryption
df:fd:74:29:5b:5e:9a:8b:09:02:40:59:73:cb:71:47:3f:97:
3d:a9:fd:c4:8c:01:29:c9:86:b8:71:55:ff:72:0e:50:dc:c8:
b5:e6:91:41:52:47:21:30:cc:4d:e7:3b:4b:db:55:ea:7d:46:
eb:53:e0:b7:1b:80:7c:b1:0c:d3:d1:bc:a0:73:ae:96:1f:fd:
05:52:7e:54:d5:03:52:69:7b:34:5f:27:d7:98:da:98:76:73:
e6:bb:50:59:2a:94:90:67:03:1c:a4:76:2f:ee:ef:59:60:09:
48:33:03:2b:52:ed:83:42:f8:71:19:7f:d8:be:40:ed:20:01:
90:3c:7e:1c:8b:d2:9f:f3:2f:09:1f:50:c8:10:e1:8a:d9:a5:
49:9c:0b:74:17:b9:2b:68:f6:1e:73:c2:73:10:38:b3:35:e2:
87:91:1b:a1:d1:9b:81:9d:1b:32:cc:03:6e:4c:82:95:81:11:
42:56:e2:16:2b:22:65:db:40:2c:ca:dc:03:f4:d5:07:cf:f5:
13:b2:cf:51:5b:24:cd:c7:d1:9b:42:8e:f9:df:5d:1e:5a:09:
a3:4f:a9:0b:f4:21:c5:bb:ff:02:93:67:e8:2d:ee:ab:d9:59:
76:03:2c:a1:bd:fb:dc:af:b6:82:94:71:85:53:a8:18:0d:3a:
9e:42:eb:59
-----BEGIN CERTIFICATE-----
MIIDfzCCAmegAwIBAgIJANBNI4XuWbP6MA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV
BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD
VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xOTAxMjcxMDExMTBa
Fw0zOTAxMjIxMDExMTBaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH
TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgOp4TTdTAG
MLIQudGINite+MhEV8tncquWlTPViNGPI1CYum0gAIC9NdXBv5hJxAoVSjSmIZsu
jBUJ8GOBAsJ84lPg96EaQF6PQUpMVtQg8dWnwVMu/343F8x+dL3iIjPOjHdipMU/
RDV7frn1fYx6J1j9LEKGLudrAZl7/n2noU8+OTlUH2HedGbRd09DG2ZwKYXe/I+O
G3uiZkgmf5um/Urk3Ovtvfjj8VeYE2/xoyrjc72NfG9LWTW8tUI+macTjb4uXJrG
W6uuvwDpyO4FIo7VZxpHmm2c+UI+FTT4Mey0ftOSlbC4+WbzvR0xLLGQYqH4TqZd
JiLw4f4WK2kCAwEAAaNQME4wHQYDVR0OBBYEFMpxmYnwcqt1ZrtlagMEcqV7laaT
MB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQELBQADggEBAN/9dClbXpqLCQJAWXPLcUc/lz2p/cSMASnJhrhx
Vf9yDlDcyLXmkUFSRyEwzE3nO0vbVep9RutT4LcbgHyxDNPRvKBzrpYf/QVSflTV
A1JpezRfJ9eY2ph2c+a7UFkqlJBnAxykdi/u71lgCUgzAytS7YNC+HEZf9i+QO0g
AZA8fhyL0p/zLwkfUMgQ4YrZpUmcC3QXuSto9h5zwnMQOLM14oeRG6HRm4GdGzLM
A25MgpWBEUJW4hYrImXbQCzK3AP01QfP9ROyz1FbJM3H0ZtCjvnfXR5aCaNPqQv0
IcW7/wKTZ+gt7qvZWXYDLKG9+9yvtoKUcYVTqBgNOp5C61k=
-----END CERTIFICATE-----

View File

@@ -1,4 +1,3 @@
-- source include/have_log_bin.inc
# We change binlog format inside the test, so no need to re-run with
# more than one binlog_format.
@@ -9,13 +8,9 @@
# save status
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
let $otfc=`select @@log_bin_trust_function_creators`;
set global log_bin_trust_function_creators=0;
# fail *on definition*
set binlog_format=STATEMENT;
@@ -186,6 +181,7 @@ drop function fn16456;
# restore status
--disable_query_log
eval set binlog_format=$oblf;
set binlog_format=STATEMENT;
eval set global log_bin_trust_function_creators=$otfc;
reset master;
--enable_query_log

View File

@@ -45,5 +45,4 @@ partition : MDEV-19958 Galera test failure on galera.partition
pxc-421: wsrep_provider is read-only for security reasons
query_cache: MDEV-15805 Test failure on galera.query_cache
versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
galera_ssl_mode_server : Certificate CA mismatch
galera_bf_abort_at_after_statement : Unstable

View File

@@ -9,7 +9,6 @@ connection node_1;
SET SESSION wsrep_retry_autocommit = 0;
START TRANSACTION;
UPDATE t1 SET f2 = 1;
SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
connection node_1_ctrl;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
@@ -24,9 +23,15 @@ UPDATE t1 SET f2 = 2 WHERE f1 = 5;
connection node_1_ctrl;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
connection node_1;
SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
COMMIT;
connection node_1_ctrl;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET SESSION debug_sync = "now WAIT_FOR reached";
SET GLOBAL wsrep_provider_options = 'signal=local_monitor_slave_enter_sync';

View File

@@ -18,3 +18,4 @@ INSERT INTO t1 VALUES (1);
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP TABLE t1;
CALL mtr.add_suppression("CREATE TABLE isolation failure");

View File

@@ -0,0 +1,36 @@
connection node_2;
connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
CREATE TABLE p (id INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
INSERT INTO p VALUES(1,0);
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
CREATE TABLE c(id INT NOT NULL PRIMARY KEY, p_id INT, FOREIGN KEY (p_id) REFERENCES p(id) ON DELETE CASCADE) ENGINE=InnoDB;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
SELECT * FROM p;
id f2
SELECT * FROM c;
id p_id
DROP TABLE c;
DROP TABLE p;

View File

@@ -68,6 +68,31 @@ f1 f2 f3
10 10 0
INSERT INTO t1 VALUES (7,7,7);
INSERT INTO t1 VALUES (8,8,8);
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
3 3 1
4 4 2
5 5 2
7 7 7
8 8 8
10 10 0
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
3 3 1
4 4 2
5 5 2
7 7 7
8 8 8
10 10 0
DROP TABLE t1;
test scenario 2
connection node_1;
@@ -129,4 +154,29 @@ f1 f2 f3
10 10 0
INSERT INTO t1 VALUES (7,7,7);
INSERT INTO t1 VALUES (8,8,8);
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
3 3 1
4 4 2
5 5 2
7 7 7
8 8 8
10 10 0
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
3 3 1
4 4 2
5 5 2
7 7 7
8 8 8
10 10 0
DROP TABLE t1;

View File

@@ -48,3 +48,113 @@ id parent_id
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
Scenario 2, testing PA applying with FK cascade delete
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE);
connection node_2;
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM p1;
f1 f2
SELECT * FROM p2;
f1 f2
SELECT * FROM c;
f1 p1_id p2_id f2
connection node_1;
DROP TABLE c;
DROP TABLE p1,p2;
Scenario 4, testing PA applying with FK cascade delete on
more than one level
CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE) ENGINE=INNODB;
connection node_2;
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM gp1;
f1 f2
SELECT * FROM gp2;
f1 f2
SELECT * FROM p1;
f1 p1_id p2_id f2
SELECT * FROM p2;
f1 p1_id p2_id f2
SELECT * FROM c;
f1 p1_id p2_id f2
connection node_1;
DROP TABLE c;
DROP TABLE p1,p2;
DROP TABLE gp1,gp2;
Scenario 3, testing PA applying with FK cascade delete on
more than one level in a diamond topology
CREATE TABLE ggp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_6 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_5 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE) ENGINE=INNODB;
connection node_2;
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM ggp1;
f1 f2
SELECT * FROM gp2;
f1 p1_id p2_id f2
SELECT * FROM gp1;
f1 p1_id p2_id f2
SELECT * FROM p1;
f1 p1_id p2_id f2
SELECT * FROM p2;
f1 p1_id p2_id f2
SELECT * FROM c;
f1 p1_id p2_id f2
connection node_1;
DROP TABLE c;
DROP TABLE p1,p2;
DROP TABLE gp1,gp2;
DROP TABLE ggp1;

View File

@@ -4,6 +4,7 @@ connection node_1;
connection node_2;
call mtr.add_suppression("WSREP: TO isolation failed for: ");
connection node_1;
call mtr.add_suppression("CREATE TABLE isolation failure");
connection node_2;
Killing server ...
connection node_1;

View File

@@ -0,0 +1,191 @@
--- r/galera_sst_rsync_encrypt_with_server.result
+++ r/galera_sst_rsync_encrypt_with_server,debug.reject
@@ -519,4 +519,188 @@
1
DROP TABLE t1;
COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET GLOBAL debug_dbug = $debug_orig;
include/assert_grep.inc [Using stunnel for SSL encryption]

View File

@@ -0,0 +1,520 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
Performing State Transfer on a server that has been shut down cleanly and restarted
connection node_1;
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1,'node1_committed_before');
INSERT INTO t1 VALUES (2,'node1_committed_before');
INSERT INTO t1 VALUES (3,'node1_committed_before');
INSERT INTO t1 VALUES (4,'node1_committed_before');
INSERT INTO t1 VALUES (5,'node1_committed_before');
COMMIT;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (6,'node2_committed_before');
INSERT INTO t1 VALUES (7,'node2_committed_before');
INSERT INTO t1 VALUES (8,'node2_committed_before');
INSERT INTO t1 VALUES (9,'node2_committed_before');
INSERT INTO t1 VALUES (10,'node2_committed_before');
COMMIT;
Shutting down server ...
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (11,'node1_committed_during');
INSERT INTO t1 VALUES (12,'node1_committed_during');
INSERT INTO t1 VALUES (13,'node1_committed_during');
INSERT INTO t1 VALUES (14,'node1_committed_during');
INSERT INTO t1 VALUES (15,'node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
connection node_2;
Starting server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (26,'node2_committed_after');
INSERT INTO t1 VALUES (27,'node2_committed_after');
INSERT INTO t1 VALUES (28,'node2_committed_after');
INSERT INTO t1 VALUES (29,'node2_committed_after');
INSERT INTO t1 VALUES (30,'node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (36,'node1_committed_after');
INSERT INTO t1 VALUES (37,'node1_committed_after');
INSERT INTO t1 VALUES (38,'node1_committed_after');
INSERT INTO t1 VALUES (39,'node1_committed_after');
INSERT INTO t1 VALUES (40,'node1_committed_after');
COMMIT;
connection node_1a_galera_st_shutdown_slave;
INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
ROLLBACK;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_15 FROM t1;
EXPECT_15
35
SELECT * from t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
connection node_1;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_15 FROM t1;
EXPECT_15
35
SELECT * from t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
Performing State Transfer on a server that starts from a clean var directory
This is accomplished by shutting down node #2 and removing its var directory before restarting it
connection node_1;
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1,'node1_committed_before');
INSERT INTO t1 VALUES (2,'node1_committed_before');
INSERT INTO t1 VALUES (3,'node1_committed_before');
INSERT INTO t1 VALUES (4,'node1_committed_before');
INSERT INTO t1 VALUES (5,'node1_committed_before');
COMMIT;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (6,'node2_committed_before');
INSERT INTO t1 VALUES (7,'node2_committed_before');
INSERT INTO t1 VALUES (8,'node2_committed_before');
INSERT INTO t1 VALUES (9,'node2_committed_before');
INSERT INTO t1 VALUES (10,'node2_committed_before');
COMMIT;
Shutting down server ...
connection node_1;
Cleaning var directory ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (11,'node1_committed_during');
INSERT INTO t1 VALUES (12,'node1_committed_during');
INSERT INTO t1 VALUES (13,'node1_committed_during');
INSERT INTO t1 VALUES (14,'node1_committed_during');
INSERT INTO t1 VALUES (15,'node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
connection node_2;
Starting server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (26,'node2_committed_after');
INSERT INTO t1 VALUES (27,'node2_committed_after');
INSERT INTO t1 VALUES (28,'node2_committed_after');
INSERT INTO t1 VALUES (29,'node2_committed_after');
INSERT INTO t1 VALUES (30,'node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (36,'node1_committed_after');
INSERT INTO t1 VALUES (37,'node1_committed_after');
INSERT INTO t1 VALUES (38,'node1_committed_after');
INSERT INTO t1 VALUES (39,'node1_committed_after');
INSERT INTO t1 VALUES (40,'node1_committed_after');
COMMIT;
connection node_1a_galera_st_clean_slave;
INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
ROLLBACK;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * from t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
connection node_1;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * from t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
Performing State Transfer on a server that has been killed and restarted
connection node_1;
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1,'node1_committed_before');
INSERT INTO t1 VALUES (2,'node1_committed_before');
INSERT INTO t1 VALUES (3,'node1_committed_before');
INSERT INTO t1 VALUES (4,'node1_committed_before');
INSERT INTO t1 VALUES (5,'node1_committed_before');
COMMIT;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (6,'node2_committed_before');
INSERT INTO t1 VALUES (7,'node2_committed_before');
INSERT INTO t1 VALUES (8,'node2_committed_before');
INSERT INTO t1 VALUES (9,'node2_committed_before');
INSERT INTO t1 VALUES (10,'node2_committed_before');
COMMIT;
Killing server ...
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (11,'node1_committed_during');
INSERT INTO t1 VALUES (12,'node1_committed_during');
INSERT INTO t1 VALUES (13,'node1_committed_during');
INSERT INTO t1 VALUES (14,'node1_committed_during');
INSERT INTO t1 VALUES (15,'node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
connection node_2;
Performing --wsrep-recover ...
Starting server ...
Using --wsrep-start-position when starting mysqld ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (26,'node2_committed_after');
INSERT INTO t1 VALUES (27,'node2_committed_after');
INSERT INTO t1 VALUES (28,'node2_committed_after');
INSERT INTO t1 VALUES (29,'node2_committed_after');
INSERT INTO t1 VALUES (30,'node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (36,'node1_committed_after');
INSERT INTO t1 VALUES (37,'node1_committed_after');
INSERT INTO t1 VALUES (38,'node1_committed_after');
INSERT INTO t1 VALUES (39,'node1_committed_after');
INSERT INTO t1 VALUES (40,'node1_committed_after');
COMMIT;
connection node_1a_galera_st_kill_slave;
INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
ROLLBACK;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
connection node_1;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
include/assert_grep.inc [Using stunnel for SSL encryption]

View File

@@ -2,8 +2,6 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
CALL mtr.add_suppression("\\[ERROR\\] .*ib_buffer_pool' for reading: No such file or directory");
connection node_1;
Performing State Transfer on a server that has been shut down cleanly and restarted
connection node_1;

View File

@@ -2,8 +2,6 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
CALL mtr.add_suppression("\\[ERROR\\] .*ib_buffer_pool' for reading: No such file or directory");
connection node_1;
Performing State Transfer on a server that has been shut down cleanly and restarted
connection node_1;

View File

@@ -30,9 +30,9 @@ SET GLOBAL wsrep_slave_threads = 2;
SET SESSION wsrep_retry_autocommit = 0;
START TRANSACTION;
UPDATE t1 SET f2 = 1;
SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
--connection node_1_ctrl
# set sync point for incoming applier
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
@@ -42,8 +42,11 @@ SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
INSERT INTO t1 VALUES (2, 2);
--connection node_1_ctrl
# wait to see the INSERT from node_2 reaching applier sync point
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
# set sync point to catch other write set applying from node_2
--let $galera_sync_point = local_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
@@ -52,17 +55,38 @@ INSERT INTO t1 VALUES (2, 2);
UPDATE t1 SET f2 = 2 WHERE f1 = 5;
--connection node_1_ctrl
# wait until both appliers are stopped in sync points
--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_slave_enter_sync
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
# set sync point for catching node_1 transaction just before committing
--let $galera_sync_point = after_replicate_sync
--source include/galera_set_sync_point.inc
--connection node_1
# set sync point, which will stop execution after COMMIT has been BF aborted
# and send the COMMIT, it should stop in commit_monitor_master_enter_sync point
SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
--send COMMIT
--connection node_1_ctrl
# wait until both appliers and local COMMIT are idle in their sync points
--let $galera_sync_point = after_replicate_sync apply_monitor_slave_enter_sync local_monitor_slave_enter_sync
--source include/galera_wait_sync_point.inc
# release local COMMIT processing, it will continue and pause first before certification,
--let $galera_sync_point = after_replicate_sync
--source include/galera_signal_sync_point.inc
# release first applier (INSERT), it should BF abort the local COMMIT processing
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc
# wait to see that COMMIT was BF aborted and has reached replaying state
SET SESSION debug_sync = "now WAIT_FOR reached";
# release the latter applier, with real lock conflict
--let $galera_sync_point = local_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc
--source include/galera_clear_sync_point.inc

View File

@@ -31,3 +31,4 @@ INSERT INTO t1 VALUES (1);
UNLOCK TABLES;
DROP TABLE t1;
CALL mtr.add_suppression("CREATE TABLE isolation failure");

View File

@@ -0,0 +1,44 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
#
# Testing CREATE TABLE statement having foreign key constraint,
# while having concurrent DML for the referenced parent table.
#
# The replication of CREATE TABLE should have all referenced table names
# appended in the key set, and DML on the parent table should be considered as
# conflicting.
#
# There are related test scenarios in test mysql-wsrep#332, where a regular table
# is altered by adding new foreign key reference.
#
# We use concurrency facility of test MW-369 to setup the conflict between DDL and DML
#
# Open connection node_1a here, MW-369.inc will use it later
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
# create FK parent table
--connection node_1
CREATE TABLE p (id INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
# setup conflicting queries
--let $mw_369_parent_query = INSERT INTO p VALUES(1,0)
--let $mw_369_child_query = CREATE TABLE c(id INT NOT NULL PRIMARY KEY, p_id INT, FOREIGN KEY (p_id) REFERENCES p(id) ON DELETE CASCADE) ENGINE=InnoDB
# execute above queries through separate nodes
--source MW-369.inc
# Expect certification failure
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
--connection node_2
SELECT * FROM p;
SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;

View File

@@ -207,6 +207,8 @@ INSERT INTO t1 VALUES (5, 5, 2);
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
# first applier is now waiting in before commit, and local trx in commit monitor
# set sync point before replaying
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_replay_cb";

View File

@@ -68,3 +68,189 @@ SELECT * FROM child;
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
--echo
--echo Scenario 2, testing PA applying with FK cascade delete
--echo
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE);
--let $count = 100
--disable_query_log
while ($count)
{
--eval INSERT INTO p1 VALUES ($count, 0);
--eval INSERT INTO p2 VALUES ($count, 0);
--eval INSERT INTO c VALUES ($count, $count, $count, 0);
--dec $count
}
--connection node_2
set global wsrep_slave_threads=2;
--connection node_1
--let $count = 100
while ($count)
{
--eval DELETE FROM p2 WHERE f1=$count;
--eval DELETE FROM p1 WHERE f1=$count;
--dec $count
}
--enable_query_log
--connection node_2
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM p1;
SELECT * FROM p2;
SELECT * FROM c;
--connection node_1
DROP TABLE c;
DROP TABLE p1,p2;
--echo
--echo Scenario 4, testing PA applying with FK cascade delete on
--echo more than one level
--echo
CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE) ENGINE=INNODB;
--let $count = 100
--disable_query_log
while ($count)
{
--eval INSERT INTO gp1 VALUES ($count, 0);
--eval INSERT INTO gp2 VALUES ($count, 0);
--eval INSERT INTO p1 VALUES ($count, $count, $count, 0);
--eval INSERT INTO p2 VALUES ($count, $count, $count, 0);
--eval INSERT INTO c VALUES ($count, $count, $count, 0);
--dec $count
}
--connection node_2
set global wsrep_slave_threads=2;
--connection node_1
--let $count = 100
while ($count)
{
--eval DELETE FROM gp1 WHERE f1=$count;
--eval DELETE FROM gp2 WHERE f1=$count;
--dec $count
}
--enable_query_log
--connection node_2
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM gp1;
SELECT * FROM gp2;
SELECT * FROM p1;
SELECT * FROM p2;
SELECT * FROM c;
--connection node_1
DROP TABLE c;
DROP TABLE p1,p2;
DROP TABLE gp1,gp2;
--echo
--echo Scenario 3, testing PA applying with FK cascade delete on
--echo more than one level in a diamond topology
--echo
CREATE TABLE ggp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_6 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_5 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
f2 INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
ON DELETE CASCADE) ENGINE=INNODB;
--let $count = 100
--disable_query_log
while ($count)
{
--eval INSERT INTO ggp1 VALUES ($count, 0);
--eval INSERT INTO gp1 VALUES ($count, $count, $count, 0);
--eval INSERT INTO gp2 VALUES ($count, $count, $count, 0);
--eval INSERT INTO p1 VALUES ($count, $count, $count, 0);
--eval INSERT INTO p2 VALUES ($count, $count, $count, 0);
--eval INSERT INTO c VALUES ($count, $count, $count, 0);
--dec $count
}
--connection node_2
set global wsrep_slave_threads=2;
--connection node_1
--let $count = 100
while ($count)
{
--eval DELETE FROM ggp1 WHERE f1=$count;
--dec $count
}
--enable_query_log
--connection node_2
set global wsrep_slave_threads=DEFAULT;
SELECT * FROM ggp1;
SELECT * FROM gp2;
SELECT * FROM gp1;
SELECT * FROM p1;
SELECT * FROM p2;
SELECT * FROM c;
--connection node_1
DROP TABLE c;
DROP TABLE p1,p2;
DROP TABLE gp1,gp2;
DROP TABLE ggp1;

View File

@@ -17,6 +17,7 @@ call mtr.add_suppression("WSREP: TO isolation failed for: ");
--connection node_1
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
call mtr.add_suppression("CREATE TABLE isolation failure");
--connection node_2
--source include/kill_galera.inc

View File

@@ -66,6 +66,7 @@ COMMIT;
--source include/wait_condition.inc
--echo Cleaning var directory ...
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test

View File

@@ -0,0 +1,20 @@
!include ../galera_2nodes.cnf
[mysqld]
wsrep_sst_method=rsync
ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
ssl-capath=@ENV.MYSQL_TEST_DIR/std_data/capath
# We need to turn off the default setting for the duration
# of the test (to test working with a directory instead of
# a file):
ssl-ca=
[sst]
ssl-mode=VERIFY_CA
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'

View File

@@ -0,0 +1,26 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_stunnel.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_clean_slave.inc
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
# Confirm that transfer was SSL-encrypted
--let $assert_text = Using stunnel for SSL encryption
--let $assert_select = Using stunnel for SSL encryption
--let $assert_count = 5
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_only_after = CURRENT_TEST
--source include/assert_grep.inc
--source include/auto_increment_offset_restore.inc

View File

@@ -8,9 +8,6 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
CALL mtr.add_suppression("\\[ERROR\\] .*ib_buffer_pool' for reading: No such file or directory");
--connection node_1
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_clean_slave.inc

View File

@@ -8,9 +8,6 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
CALL mtr.add_suppression("\\[ERROR\\] .*ib_buffer_pool' for reading: No such file or directory");
--connection node_1
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_clean_slave.inc

View File

@@ -111,3 +111,4 @@ SELECT * FROM c;
DROP TABLE c;
DROP TABLE p1;
DROP TABLE p2;

View File

@@ -16,6 +16,7 @@ galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_g
galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(}
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query
galera_pc_bootstrap : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_slave_options_do : MDEV-8798
galera_slave_options_ignore : MDEV-8798
@@ -24,3 +25,10 @@ galera_ipv6_mysqldump : MDEV-26499: galera_3nodes.galera_ipv6_mysqldump MTR fail
galera_ipv6_mariabackup : MDEV-24097
galera_ipv6_mariabackup_section : MDEV-24097, MDEV-22195
galera_wsrep_schema : MDEV-26503 : galera_3nodes.galera_wsrep_schema MTR failed: mysql_shutdown failed
galera_ipv6_mariabackup : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_ipv6_mariabackup_section : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_ipv6_rsync : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_ipv6_rsync_section : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_ssl_reload : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_toi_vote : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_wsrep_schema_init : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed

View File

@@ -8,10 +8,10 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
INSERT INTO t1 VALUES (01), (02), (03), (04), (05);
connection node_2;
Unloading wsrep provider ...
SET GLOBAL wsrep_provider = 'none';
SET GLOBAL wsrep_cluster_address = '';
connection node_3;
Unloading wsrep provider ...
SET GLOBAL wsrep_provider = 'none';
SET GLOBAL wsrep_cluster_address = '';
connection node_1;
INSERT INTO t1 VALUES (11), (12), (13), (14), (15);
INSERT INTO t1 VALUES (21), (22), (23), (24), (25);

View File

@@ -1,4 +1,5 @@
--let galera_connection_address=::1
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/check_ipv6.inc
--source include/have_innodb.inc

View File

@@ -1,4 +1,5 @@
--let galera_connection_address=::1
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/check_ipv6.inc
--source include/have_innodb.inc

View File

@@ -29,9 +29,11 @@ INSERT INTO t1 VALUES (01), (02), (03), (04), (05);
# Disconnect nodes #2 and #3
--connection node_2
--let $wsrep_cluster_address_orig2 = `select @@wsrep_cluster_address`
--source suite/galera/include/galera_stop_replication.inc
--connection node_3
--let $wsrep_cluster_address_orig3 = `select @@wsrep_cluster_address`
--source suite/galera/include/galera_stop_replication.inc
--connection node_1
@@ -51,8 +53,8 @@ INSERT INTO t1 VALUES (21), (22), (23), (24), (25);
# ... and restart providers to force IST
--connection node_2
--disable_query_log
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
SET GLOBAL wsrep_cluster_address='';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig2';
--enable_query_log
--connection node_1
@@ -60,8 +62,8 @@ INSERT INTO t1 VALUES (31), (32), (33), (34), (35);
--connection node_3
--disable_query_log
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
SET GLOBAL wsrep_cluster_address='';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig3';
--enable_query_log
--connection node_1

View File

@@ -0,0 +1,13 @@
connection node_2;
connection node_1;
connection node_1;
SET GLOBAL wsrep_trx_fragment_unit='bytes';
SET GLOBAL wsrep_trx_fragment_size=10240000;
SET GLOBAL slow_query_log=ON;
SET GLOBAL log_output='TABLE';
SELECT SLEEP(10);
SLEEP(10)
0
SET GLOBAL wsrep_trx_fragment_unit=DEFAULT;
SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
SET GLOBAL log_output=DEFAULT;

View File

@@ -0,0 +1,11 @@
--source include/galera_cluster.inc
--connection node_1
SET GLOBAL wsrep_trx_fragment_unit='bytes';
SET GLOBAL wsrep_trx_fragment_size=10240000;
SET GLOBAL slow_query_log=ON;
SET GLOBAL log_output='TABLE';
SELECT SLEEP(10);
SET GLOBAL wsrep_trx_fragment_unit=DEFAULT;
SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
SET GLOBAL log_output=DEFAULT;

View File

@@ -10,3 +10,13 @@ create table `#mysql50#q.q` select 1;
ERROR 42000: Incorrect table name '#mysql50#q.q'
create table `#mysql50#q·q` select 1;
drop database `b`;
#
# MDEV-27336 Crash on DROP DATABASE due to out-of-bounds result
# from InnoDB SUBSTR() function
#
USE test;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB;
CREATE DATABASE somewhat_longer_name_to_cause_trouble;
DROP DATABASE somewhat_longer_name_to_cause_trouble;
DROP TABLE t2,t1;

View File

@@ -222,3 +222,12 @@ ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
DROP TABLE t1;
#
# MDEV-27316 Assertion `!(index)->is_spatial()' failed.
#
CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
INSERT INTO t VALUES (POINT(1, 1));
SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
COUNT(*)
1
DROP TABLE t;

View File

@@ -16,7 +16,6 @@ WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+/ in mysqld.1.err
# Remove ibdata1 & ibdata2
# Successfully let InnoDB create tablespaces
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES

View File

@@ -67,6 +67,13 @@ SELECT * FROM t;
a
3
20
#
# MDEV-27332 SIGSEGV in fetch_data_into_cache
#
BEGIN;
SELECT trx_state FROM information_schema.innodb_trx;
trx_state
COMMIT;
# restart
SELECT * FROM t;
a

View File

@@ -138,6 +138,7 @@ show tables;
Tables_in_test
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
SET GLOBAL innodb_encrypt_tables=DEFAULT;
# test various bad start-up parameters
FOUND 2 /InnoDB: Unable to create temporary file/ in mysqld.1.err
# restart: --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend

View File

@@ -14,3 +14,14 @@ use `b`;
create table `#mysql50#q.q` select 1;
create table `#mysql50#q·q` select 1;
drop database `b`;
--echo #
--echo # MDEV-27336 Crash on DROP DATABASE due to out-of-bounds result
--echo # from InnoDB SUBSTR() function
--echo #
USE test;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB;
CREATE DATABASE somewhat_longer_name_to_cause_trouble;
DROP DATABASE somewhat_longer_name_to_cause_trouble;
DROP TABLE t2,t1;

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/maybe_debug.inc
--source include/have_partition.inc
@@ -233,3 +234,11 @@ ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
DROP TABLE t1;
--echo #
--echo # MDEV-27316 Assertion `!(index)->is_spatial()' failed.
--echo #
CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
INSERT INTO t VALUES (POINT(1, 1));
SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
DROP TABLE t;

View File

@@ -64,9 +64,6 @@ eval $check_no_innodb;
let SEARCH_PATTERN=File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+;
--source include/search_pattern_in_file.inc
--echo # Remove ibdata1 & ibdata2
--remove_file $bugdir/ibdata1
--remove_file $bugdir/ibdata2
--list_files $bugdir
--echo # Successfully let InnoDB create tablespaces

View File

@@ -79,6 +79,13 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT * FROM t;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t;
--echo #
--echo # MDEV-27332 SIGSEGV in fetch_data_into_cache
--echo #
BEGIN;
SELECT trx_state FROM information_schema.innodb_trx;
COMMIT;
--let $restart_parameters=
--source include/restart_mysqld.inc
SELECT * FROM t;

View File

@@ -122,6 +122,8 @@ show tables;
--error ER_CANT_CREATE_TABLE
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
SET GLOBAL innodb_encrypt_tables=DEFAULT;
--echo # test various bad start-up parameters
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;

View File

@@ -0,0 +1,53 @@
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS proc_insert_many;
CREATE TABLE t1 (
field1 INTEGER NOT NULL,
field2 INTEGER NOT NULL,
field3 INTEGER NOT NULL,
KEY i_1 (field1),
KEY i_2 (field2),
KEY i_3 (field3),
KEY i_12 (field1, field2),
KEY i_13 (field1, field3),
KEY i_21 (field2, field1),
KEY i_23 (field2, field3),
KEY i_31 (field3, field1),
KEY i_32 (field3, field2),
KEY i_123 (field1, field2, field3),
KEY i_132 (field1, field3, field2),
KEY i_213 (field2, field1, field3),
KEY i_231 (field2, field3, field1),
KEY i_312 (field3, field1, field2),
KEY i_321 (field3, field2, field1)
) ENGINE=Aria;
CREATE PROCEDURE proc_insert_many()
BEGIN
DECLARE iRow INT DEFAULT 0;
insertRows: LOOP
IF (iRow = 70000) THEN
LEAVE insertRows;
END IF;
INSERT INTO t1 VALUES (1000000+iRow,2000000+iRow,3000000+iRow);
SET iRow = iRow + 1;
END LOOP insertRows;
END|
LOCK TABLES t1 WRITE;
CALL proc_insert_many();
UNLOCK TABLES;
SET debug_dbug="d,crash_shutdown";
shutdown;
ERROR HY000: Lost connection to MySQL server during query
SELECT * FROM t1 ORDER BY 1 DESC LIMIT 10;
field1 field2 field3
1069999 2069999 3069999
1069998 2069998 3069998
1069997 2069997 3069997
1069996 2069996 3069996
1069995 2069995 3069995
1069994 2069994 3069994
1069993 2069993 3069993
1069992 2069992 3069992
1069991 2069991 3069991
1069990 2069990 3069990
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS proc_insert_many;

View File

@@ -0,0 +1,90 @@
# MDEV-18187: If server crashes before flushing index pages in an
# encrypted Aria table, it could permanently fail to repair the table
--source include/have_maria.inc
--source include/default_charset.inc
# Cleanup
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS proc_insert_many;
--enable_warnings
# --------
# Configure encryption
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--write_file $MYSQLTEST_VARDIR/key.txt
1;76025E3ADC78D74819927DB02AAA4C35
EOF
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
# Create table with many indexes so that its index size grows quickly
# and it can be grown to needed size without too many inserts
CREATE TABLE t1 (
field1 INTEGER NOT NULL,
field2 INTEGER NOT NULL,
field3 INTEGER NOT NULL,
KEY i_1 (field1),
KEY i_2 (field2),
KEY i_3 (field3),
KEY i_12 (field1, field2),
KEY i_13 (field1, field3),
KEY i_21 (field2, field1),
KEY i_23 (field2, field3),
KEY i_31 (field3, field1),
KEY i_32 (field3, field2),
KEY i_123 (field1, field2, field3),
KEY i_132 (field1, field3, field2),
KEY i_213 (field2, field1, field3),
KEY i_231 (field2, field3, field1),
KEY i_312 (field3, field1, field2),
KEY i_321 (field3, field2, field1)
) ENGINE=Aria;
# Create procedures to insert many rows.
DELIMITER |;
CREATE PROCEDURE proc_insert_many()
BEGIN
DECLARE iRow INT DEFAULT 0;
insertRows: LOOP
IF (iRow = 70000) THEN
LEAVE insertRows;
END IF;
INSERT INTO t1 VALUES (1000000+iRow,2000000+iRow,3000000+iRow);
SET iRow = iRow + 1;
END LOOP insertRows;
END|
DELIMITER ;|
# Call the procedure to insert rows.
# Use 'LOCK TABLES' to make things a lot faster.
# Note that his code doesn't reproduce for some reason:
# INSERT INTO t1 SELECT 1000000+seq,2000000+seq,3000000+seq FROM seq_1_to_70000;
LOCK TABLES t1 WRITE;
CALL proc_insert_many();
UNLOCK TABLES;
# Crash and restart the server while it's still flushing index
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET debug_dbug="d,crash_shutdown";
--error 2013
shutdown;
--enable_reconnect
--source include/wait_until_connected_again.inc
# Access the table to trigger repair; validate repaired data
SELECT * FROM t1 ORDER BY 1 DESC LIMIT 10;
# --------
# Cleanup
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS proc_insert_many;

View File

@@ -8,6 +8,7 @@
# Test requires: sp-protocol/ps-protocol/view-protocol/cursor-protocol disabled
--source include/no_protocol.inc
--source include/not_embedded.inc
--source include/have_perfschema.inc
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);

View File

@@ -10,7 +10,6 @@
#
##############################################################################
#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666
@@ -18,4 +17,3 @@ rpl_semi_sync_after_sync : fails after MDEV-16172
rpl_semi_sync_slave_compressed_protocol : MDEV-25580 2021-05-05 Sujatha
rpl_auto_increment_update_failure : disabled for now
rpl_current_user : waits for MDEV-22374 fix
rpl_parallel2 : waits for MDEV-23089

View File

@@ -2,3 +2,19 @@ SELECT @@version;
@@version
my_favorite_version
1
select * from information_schema.system_variables where variable_name='version';
VARIABLE_NAME VERSION
SESSION_VALUE NULL
GLOBAL_VALUE my_favorite_version
GLOBAL_VALUE_ORIGIN COMMAND-LINE
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Server version number. It may also include a suffix with configuration or build information. -debug indicates debugging support was enabled on the server, and -log indicates at least one of the binary log, general log or slow query log are enabled, for example 10.1.1-MariaDB-mariadb1precise-log.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
GLOBAL_VALUE_PATH NULL

View File

@@ -4,3 +4,4 @@ perl;
grep /my_favorite_version/, `$ENV{MYSQL} -e status`;
print "$cnt\n";
EOF
query_vertical select * from information_schema.system_variables where variable_name='version';

View File

@@ -1,3 +1,6 @@
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='sys';
COUNT(*)
0
DESC sys.sys_config;
Field Type Null Key Default Extra
variable varchar(128) NO PRI NULL

View File

@@ -1,7 +1,7 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.sys_config table is as expected
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='sys';
DESC sys.sys_config;
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;
@@ -11,7 +11,6 @@ UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len';
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;
# Ensure the sys.sys_config_insert_set_user trigger functions correctly
INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar');
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;

View File

@@ -1141,6 +1141,15 @@ explain partitions select * from t1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn # NULL NULL NULL NULL # #
drop table t1;
#
# MDEV-27244 Table corruption upon adding serial data type
#
create table t1 (f int, key(f)) with system versioning
partition by system_time limit 10 (partition p0 history, partition pn current);
alter table t1 add x serial;
alter table t1 add partition (partition p1 history);
alter table t1 add partition (partition p2 history);
drop table t1;
# End of 10.3 tests
#
# MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine

View File

@@ -1019,6 +1019,16 @@ explain partitions select * from t1 for system_time as of '2000-01-01 02:00:00';
explain partitions select * from t1;
drop table t1;
--echo #
--echo # MDEV-27244 Table corruption upon adding serial data type
--echo #
create table t1 (f int, key(f)) with system versioning
partition by system_time limit 10 (partition p0 history, partition pn current);
alter table t1 add x serial;
alter table t1 add partition (partition p1 history);
alter table t1 add partition (partition p2 history);
drop table t1;
--echo # End of 10.3 tests
--echo #

View File

@@ -236,6 +236,6 @@ maria_declare_plugin(password_reuse_check)
NULL,
sysvars,
"1.0",
MariaDB_PLUGIN_MATURITY_ALPHA
MariaDB_PLUGIN_MATURITY_BETA
}
maria_declare_plugin_end;

View File

@@ -211,6 +211,6 @@ maria_declare_plugin(type_mysql_json)
NULL,
NULL,
"0.1",
MariaDB_PLUGIN_MATURITY_ALPHA
MariaDB_PLUGIN_MATURITY_BETA
}
maria_declare_plugin_end;

View File

@@ -28,7 +28,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function UUID()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Beta
PLUGIN_MATURITY Gamma
PLUGIN_AUTH_VERSION 1.0
#
# End of 10.5 tests

View File

@@ -24,7 +24,7 @@ PLUGIN_TYPE DATA TYPE
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Data type UUID
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Beta
PLUGIN_MATURITY Gamma
PLUGIN_AUTH_VERSION 1.0
#
# End of 10.5 tests

View File

@@ -87,7 +87,7 @@ maria_declare_plugin(type_uuid)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_BETA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@@ -102,7 +102,7 @@ maria_declare_plugin(type_uuid)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_BETA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@@ -117,6 +117,6 @@ maria_declare_plugin(type_uuid)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_BETA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/
}
maria_declare_plugin_end;

View File

@@ -17,7 +17,10 @@
# This is a common command line parser to be sourced by other SST scripts
set -u
set -ue
# Setting the path for some utilities on CentOS
export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
WSREP_SST_OPT_BYPASS=0
WSREP_SST_OPT_BINLOG=""
@@ -384,10 +387,8 @@ case "$1" in
skip_mysqld_arg=1
;;
'--innodb-force-recovery')
if [ -n "$value" ]; then
if [ "$value" -ne 0 ]; then
INNODB_FORCE_RECOVERY="$value"
fi
if [ -n "$value" -a "$value" != "0" ]; then
INNODB_FORCE_RECOVERY="$value"
fi
skip_mysqld_arg=1
;;
@@ -584,7 +585,8 @@ get_binlog()
if [ -n "$WSREP_SST_OPT_ADDR_PORT" ]; then
if [ -n "$WSREP_SST_OPT_PORT" ]; then
if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then
echo "WSREP_SST: [ERROR] port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR" >&2
echo "WSREP_SST: [ERROR] port in --port=$WSREP_SST_OPT_PORT" \
"differs from port in --address=$WSREP_SST_OPT_ADDR" >&2
exit 2
fi
else
@@ -616,8 +618,19 @@ fi
readonly WSREP_SST_OPT_ADDR
readonly WSREP_SST_OPT_ADDR_PORT
# try to use my_print_defaults, mysql and mysqldump that come with the sources
# (for MTR suite)
commandex()
{
if [ -n "$BASH_VERSION" ]; then
command -v "$1" || :
elif [ -x "$1" ]; then
echo "$1"
else
which "$1" || :
fi
}
# try to use my_print_defaults, mysql and mysqldump that come
# with the sources (for MTR suite):
script_binary=$(dirname "$0")
SCRIPTS_DIR=$(cd "$script_binary"; pwd -P)
EXTRA_DIR="$SCRIPTS_DIR/../extra"
@@ -626,13 +639,13 @@ CLIENT_DIR="$SCRIPTS_DIR/../client"
if [ -x "$CLIENT_DIR/mariadb" ]; then
MYSQL_CLIENT="$CLIENT_DIR/mariadb"
else
MYSQL_CLIENT="$(command -v mariadb)"
MYSQL_CLIENT=$(commandex 'mariadb')
fi
if [ -x "$CLIENT_DIR/mariadb-dump" ]; then
MYSQLDUMP="$CLIENT_DIR/mariadb-dump"
else
MYSQLDUMP="$(command -v mariadb-dump)"
MYSQLDUMP=$(commandex 'mariadb-dump')
fi
wsrep_log()
@@ -663,7 +676,7 @@ if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then
elif [ -x "$EXTRA_DIR/my_print_defaults" ]; then
MY_PRINT_DEFAULTS="$EXTRA_DIR/my_print_defaults"
else
MY_PRINT_DEFAULTS="$(command -v my_print_defaults)"
MY_PRINT_DEFAULTS=$(commandex 'my_print_defaults')
if [ -z "$MY_PRINT_DEFAULTS" ]; then
wsrep_log_error "my_print_defaults not found in path"
exit 2
@@ -673,16 +686,16 @@ fi
readonly MY_PRINT_DEFAULTS
wsrep_defaults="$WSREP_SST_OPT_DEFAULTS"
wsrep_defaults="$wsrep_defaults${wsrep_defaults:+ }$WSREP_SST_OPT_EXTRA_DEFAULTS"
wsrep_defaults="$wsrep_defaults${wsrep_defaults:+ }$WSREP_SST_OPT_SUFFIX_DEFAULT"
wsrep_defaults="$wsrep_defaults${WSREP_SST_OPT_EXTRA_DEFAULTS:+ }$WSREP_SST_OPT_EXTRA_DEFAULTS"
wsrep_defaults="$wsrep_defaults${WSREP_SST_OPT_SUFFIX_DEFAULT:+ }$WSREP_SST_OPT_SUFFIX_DEFAULT"
readonly WSREP_SST_OPT_CONF="$wsrep_defaults"
readonly WSREP_SST_OPT_CONF="${wsrep_defaults:+ }$wsrep_defaults"
wsrep_defaults="$WSREP_SST_OPT_DEFAULT"
wsrep_defaults="$wsrep_defaults${wsrep_defaults:+ }$WSREP_SST_OPT_EXTRA_DEFAULT"
wsrep_defaults="$wsrep_defaults${wsrep_defaults:+ }$WSREP_SST_OPT_SUFFIX_DEFAULT"
wsrep_defaults="$wsrep_defaults${WSREP_SST_OPT_EXTRA_DEFAULT:+ }$WSREP_SST_OPT_EXTRA_DEFAULT"
wsrep_defaults="$wsrep_defaults${WSREP_SST_OPT_SUFFIX_DEFAULT:+ }$WSREP_SST_OPT_SUFFIX_DEFAULT"
readonly WSREP_SST_OPT_CONF_UNQUOTED="$wsrep_defaults"
readonly WSREP_SST_OPT_CONF_UNQUOTED="${wsrep_defaults:+ }$wsrep_defaults"
#
# User can specify mariabackup specific settings that will be used during sst
@@ -819,8 +832,7 @@ if wsrep_auth_not_set; then
fi
# Splitting WSREP_SST_OPT_AUTH as "user:password" pair:
if ! wsrep_auth_not_set
then
if ! wsrep_auth_not_set; then
# Extract username as shortest prefix up to first ':' character:
WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}"
if [ -z "$WSREP_SST_OPT_USER" ]; then
@@ -848,8 +860,7 @@ readonly WSREP_SST_OPT_USER
readonly WSREP_SST_OPT_PSWD
readonly WSREP_SST_OPT_AUTH
if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]
then
if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then
# Split auth string at the last ':'
readonly WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}"
readonly WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}"
@@ -860,8 +871,7 @@ fi
readonly WSREP_SST_OPT_REMOTE_AUTH
if [ -n "$WSREP_SST_OPT_DATA" ]
then
if [ -n "$WSREP_SST_OPT_DATA" ]; then
SST_PROGRESS_FILE="$WSREP_SST_OPT_DATA/sst_in_progress"
else
SST_PROGRESS_FILE=""
@@ -869,14 +879,15 @@ fi
wsrep_cleanup_progress_file()
{
[ -n "$SST_PROGRESS_FILE" -a \
-f "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null || true
if [ -n "$SST_PROGRESS_FILE" -a -f "$SST_PROGRESS_FILE" ]; then
rm -f "$SST_PROGRESS_FILE" 2>/dev/null || :
fi
}
wsrep_check_program()
{
local prog="$1"
local cmd=$(command -v "$prog")
local cmd=$(commandex "$prog")
if [ -z "$cmd" ]; then
echo "'$prog' not found in PATH"
return 2 # no such file or directory
@@ -886,21 +897,18 @@ wsrep_check_program()
wsrep_check_programs()
{
local ret=0
while [ $# -gt 0 ]
do
while [ $# -gt 0 ]; do
wsrep_check_program "$1" || ret=$?
shift
done
return $ret
}
wsrep_check_datadir()
{
if [ -z "$WSREP_SST_OPT_DATA" ]
then
wsrep_log_error "The '--datadir' parameter must be passed to the SST script"
if [ -z "$WSREP_SST_OPT_DATA" ]; then
wsrep_log_error \
"The '--datadir' parameter must be passed to the SST script"
exit 2
fi
}
@@ -912,10 +920,10 @@ get_openssl()
return
fi
# Let's look for openssl:
OPENSSL_BINARY="$(command -v openssl)"
OPENSSL_BINARY=$(commandex 'openssl')
if [ -z "$OPENSSL_BINARY" ]; then
OPENSSL_BINARY='/usr/bin/openssl'
if [ -z "$OPENSSL_BINARY" ]; then
if [ ! -x "$OPENSSL_BINARY" ]; then
OPENSSL_BINARY=""
fi
fi
@@ -928,13 +936,12 @@ get_openssl()
wsrep_gen_secret()
{
get_openssl
if [ -n "$OPENSSL_BINARY" ]
then
if [ -n "$OPENSSL_BINARY" ]; then
echo $("$OPENSSL_BINARY" rand -hex 16)
else
printf "%04x%04x%04x%04x%04x%04x%04x%04x" \
$RANDOM $RANDOM $RANDOM $RANDOM \
$RANDOM $RANDOM $RANDOM $RANDOM
$RANDOM $RANDOM $RANDOM $RANDOM \
$RANDOM $RANDOM $RANDOM $RANDOM
fi
}
@@ -968,14 +975,14 @@ is_local_ip()
fi
# Now let's check if the given address is assigned to
# one of the network cards:
local ip_util="$(command -v ip)"
local ip_util=$(commandex 'ip')
if [ -n "$ip_util" ]; then
# ip address show ouput format is " inet[6] <address>/<mask>":
"$ip_util" address show \
| grep -E "^[[:space:]]*inet.? [^[:space:]]+/" -o \
| grep -F " $1/" >/dev/null && return 0
else
local ifconfig_util="$(command -v ifconfig)"
local ifconfig_util=$(commandex 'ifconfig')
if [ -n "$ifconfig_util" ]; then
# ifconfig output format is " inet[6] <address> ...":
"$ifconfig_util" \
@@ -992,15 +999,15 @@ check_sockets_utils()
sockstat_available=0
ss_available=0
[ -n "$(command -v lsof)" ] && lsof_available=1
[ -n "$(command -v sockstat)" ] && sockstat_available=1
[ -n "$(command -v ss)" ] && ss_available=1
[ -n "$(commandex lsof)" ] && lsof_available=1
[ -n "$(commandex sockstat)" ] && sockstat_available=1
[ -n "$(commandex ss)" ] && ss_available=1
if [ $lsof_available -eq 0 -a \
$sockstat_available -eq 0 -a \
$ss_available -eq 0 ]
then
wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in " \
wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in" \
"the PATH. Make sure you have it installed."
exit 2 # ENOENT
fi
@@ -1018,11 +1025,11 @@ check_sockets_utils()
#
check_port()
{
local pid="$1"
local pid="${1:-0}"
local port="$2"
local utils="$3"
[ -z "$pid" ] || [ $pid -eq 0 ] && pid='[0-9]+'
[ $pid -le 0 ] && pid='[0-9]+'
local rc=1
@@ -1060,14 +1067,20 @@ check_for_dhparams()
if [ ! -r "$ssl_dhparams" ]; then
get_openssl
if [ -n "$OPENSSL_BINARY" ]; then
wsrep_log_info "Could not find dhparams file, creating $ssl_dhparams"
if ! "$OPENSSL_BINARY" dhparam -out "$ssl_dhparams" 2048 >/dev/null 2>&1
then
wsrep_log_info \
"Could not find dhparams file, creating $ssl_dhparams"
local bug=0
local errmsg
errmsg=$("$OPENSSL_BINARY" \
dhparam -out "$ssl_dhparams" 2048 2>&1) || bug=1
if [ $bug -ne 0 ]; then
wsrep_log_info "run: \"$OPENSSL_BINARY\" dhparam -out \"$ssl_dhparams\" 2048"
wsrep_log_info "output: $errmsg"
wsrep_log_error "******** ERROR *****************************************"
wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. *"
wsrep_log_error "********************************************************"
ssl_dhparams=""
fi
fi
else
# Rollback: if openssl is not installed, then use
# the default parameters:
@@ -1085,26 +1098,48 @@ check_for_dhparams()
#
verify_ca_matches_cert()
{
local ca="$1"
local cert="$2"
local path=${3:-0}
local cert="$1"
local ca="$2"
local cap="$3"
local readable=1; [ ! -r "$cert" ] && readable=0
[ -n "$ca" -a ! -r "$ca" ] && readable=0
[ -n "$cap" -a ! -r "$cap" ] && readable=0
if [ $readable -eq 0 ]; then
wsrep_log_error \
"Both PEM file and CA file (or path) must be readable"
exit 22
fi
# If the openssl utility is not installed, then
# we will not do this certificate check:
get_openssl
if [ -z "$OPENSSL_BINARY" ]; then
wsrep_log_info "openssl utility not found"
return
fi
local not_match=0
local readable=1; [ ! -r "$cert" ] && readable=0
[ -n "$ca" ] && [ ! -r "$ca" ] && readable=0
[ -n "$cap" ] && [ ! -r "$cap" ] && readable=0
if [ $path -eq 0 ]; then
"$OPENSSL_BINARY" verify -verbose -CAfile "$ca" "$cert" >/dev/null 2>&1 || not_match=1
else
"$OPENSSL_BINARY" verify -verbose -CApath "$ca" "$cert" >/dev/null 2>&1 || not_match=1
if [ readable -eq 0 ]; then
wsrep_log_error \
"Both PEM file and CA file (or path) must be readable"
exit 22
fi
local not_match=0
local errmsg
errmsg=$("$OPENSSL_BINARY" verify -verbose \
${ca:+ -CAfile} ${ca:+ "$ca"} \
${cap:+ -CApath} ${cap:+ "$cap"} \
"$cert" 2>&1) || not_match=1
if [ $not_match -eq 1 ]; then
wsrep_log_info "run: \"$OPENSSL_BINARY\" verify -verbose${ca:+ -CAfile \"$ca\"}${cap:+ -CApath \"$cap\"} \"$cert\""
wsrep_log_info "output: $errmsg"
wsrep_log_error "******** FATAL ERROR ********************************************"
wsrep_log_error "* The certifcate and CA (certificate authority) do not match. *"
wsrep_log_error "* It does not appear that the certificate was issued by the CA. *"
@@ -1124,12 +1159,19 @@ verify_ca_matches_cert()
#
verify_cert_matches_key()
{
local cert_path="$1"
local key_path="$2"
local cert="$1"
local key="$2"
if [ ! -r "$key" -o ! -r "$cert" ]; then
wsrep_log_error "Both the certificate file and the key file" \
"must be readable"
exit 22
fi
# If the diff utility is not installed, then
# we will not do this certificate check:
if [ -z "$(command -v diff)" ]; then
if [ -z "$(commandex diff)" ]; then
wsrep_log_info "diff utility not found"
return
fi
@@ -1137,18 +1179,19 @@ verify_cert_matches_key()
# we will not do this certificate check:
get_openssl
if [ -z "$OPENSSL_BINARY" ]; then
wsrep_log_info "openssl utility not found"
return
fi
# Generate the public key from the cert and the key.
# They should match (otherwise we can't create an SSL connection).
if ! diff <("$OPENSSL_BINARY" x509 -in "$cert_path" -pubkey -noout 2>/dev/null) \
<("$OPENSSL_BINARY" pkey -in "$key_path" -pubout 2>/dev/null) >/dev/null 2>&1
if ! diff <("$OPENSSL_BINARY" x509 -in "$cert" -pubkey -noout 2>/dev/null) \
<("$OPENSSL_BINARY" pkey -in "$key" -pubout 2>/dev/null) >/dev/null 2>&1
then
wsrep_log_error "******************* FATAL ERROR ****************"
wsrep_log_error "* The certifcate and private key do not match. *"
wsrep_log_error "* Please check your certificate and key files. *"
wsrep_log_error "************************************************"
wsrep_log_error "******************* FATAL ERROR *****************"
wsrep_log_error "* The certificate and private key do not match. *"
wsrep_log_error "* Please check your certificate and key files. *"
wsrep_log_error "*************************************************"
exit 22
fi
}
@@ -1225,18 +1268,18 @@ check_pid()
{
local pid_file="$1"
if [ -r "$pid_file" ]; then
local pid=$(cat "$pid_file" 2>/dev/null)
local pid=$(cat "$pid_file" 2>/dev/null || :)
if [ -n "$pid" ]; then
if [ $pid -ne 0 ]; then
if ps -p "$pid" >/dev/null 2>&1; then
if [ $pid -gt 0 ]; then
if ps -p $pid >/dev/null 2>&1; then
CHECK_PID=$pid
return 0
fi
fi
fi
local remove=${2:-0}
if [ $remove -eq 1 ]; then
rm -f "$pid_file"
if [ $remove -ne 0 ]; then
rm -f "$pid_file" || :
fi
fi
CHECK_PID=0
@@ -1261,25 +1304,25 @@ cleanup_pid()
local pid_file="${2:-}"
local config="${3:-}"
if [ $pid -ne 0 ]; then
if [ $pid -gt 0 ]; then
if ps -p $pid >/dev/null 2>&1; then
if kill $pid >/dev/null 2>&1; then
sleep 0.5
local round=0
local force=0
while ps -p $pid >/dev/null 2>&1; do
sleep 1
round=$(( round+1 ))
if [ $round -eq 16 ]; then
if [ $force -eq 0 ]; then
round=8
force=1
kill -9 $pid >/dev/null 2>&1
sleep 0.5
else
return 1
fi
fi
sleep 1
round=$(( round+1 ))
if [ $round -eq 16 ]; then
if [ $force -eq 0 ]; then
round=8
force=1
kill -9 $pid >/dev/null 2>&1 || :
sleep 0.5
else
return 1
fi
fi
done
elif ps -p $pid >/dev/null 2>&1; then
wsrep_log_warning "Unable to kill PID=$pid ($pid_file)"
@@ -1288,8 +1331,8 @@ cleanup_pid()
fi
fi
[ -n "$pid_file" ] && [ -f "$pid_file" ] && rm -f "$pid_file"
[ -n "$config" ] && [ -f "$config" ] && rm -f "$config"
[ -n "$pid_file" -a -f "$pid_file" ] && rm -f "$pid_file" || :
[ -n "$config" -a -f "$config" ] && rm -f "$config" || :
return 0
}
@@ -1305,9 +1348,52 @@ get_proc()
elif [ "$OS" = 'Darwin' -o "$OS" = 'FreeBSD' ]; then
nproc=$(sysctl -n hw.ncpu)
fi
set -e
if [ -z "$nproc" ] || [ $nproc -eq 0 ]; then
nproc=1
fi
set -e
fi
}
check_server_ssl_config()
{
# backward-compatible behavior:
tcert=$(parse_cnf 'sst' 'tca')
tcap=$(parse_cnf 'sst' 'tcapath')
tpem=$(parse_cnf 'sst' 'tcert')
tkey=$(parse_cnf 'sst' 'tkey')
# reading new ssl configuration options:
local tcert2=$(parse_cnf "$encgroups" 'ssl-ca')
local tcap2=$(parse_cnf "$encgroups" 'ssl-capath')
local tpem2=$(parse_cnf "$encgroups" 'ssl-cert')
local tkey2=$(parse_cnf "$encgroups" 'ssl-key')
# if there are no old options, then we take new ones:
if [ -z "$tcert" -a -z "$tcap" -a -z "$tpem" -a -z "$tkey" ]; then
tcert="$tcert2"
tcap="$tcap2"
tpem="$tpem2"
tkey="$tkey2"
# checking for presence of the new-style SSL configuration:
elif [ -n "$tcert2" -o -n "$tcap2" -o -n "$tpem2" -o -n "$tkey2" ]; then
if [ "$tcert" != "$tcert2" -o \
"$tcap" != "$tcap2" -o \
"$tpem" != "$tpem2" -o \
"$tkey" != "$tkey2" ]
then
wsrep_log_info \
"new ssl configuration options (ssl-ca[path], ssl-cert" \
"and ssl-key) are ignored by SST due to presence" \
"of the tca[path], tcert and/or tkey in the [sst] section"
fi
fi
if [ -n "$tcert" ]; then
tcert=$(trim_string "$tcert")
if [ "${tcert%/}" != "$tcert" -o -d "$tcert" ]; then
tcap="$tcert"
tcert=""
fi
fi
if [ -n "$tcap" ]; then
tcap=$(trim_string "$tcap")
fi
}

View File

@@ -20,21 +20,21 @@
# https://mariadb.com/kb/en/mariabackup-overview/
# Make sure to read that before proceeding!
OS="$(uname)"
. $(dirname "$0")/wsrep_sst_common
wsrep_check_datadir
OS="$(uname)"
ealgo=""
eformat=""
ekey=""
ekeyfile=""
encrypt=0
ecode=0
ssyslog=""
ssystag=""
BACKUP_PID=""
tcert=""
tpath=0
tcap=""
tpem=""
tkey=""
tmode="DISABLED"
@@ -88,14 +88,14 @@ readonly SECRET_TAG="secret"
# For backup locks it is 1 sent by joiner
sst_ver=1
if [ -n "$(command -v pv)" ] && pv --help | grep -qw -- '-F'; then
if [ -n "$(commandex pv)" ] && pv --help | grep -qw -- '-F'; then
pvopts="$pvopts $pvformat"
fi
pcmd="pv $pvopts"
declare -a RC
BACKUP_BIN="$(command -v mariabackup)"
if [ ! -x "$BACKUP_BIN" ]; then
BACKUP_BIN=$(commandex 'mariabackup')
if [ -z "$BACKUP_BIN" ]; then
wsrep_log_error 'mariabackup binary not found in path'
exit 42
fi
@@ -145,14 +145,14 @@ get_keys()
if [ $encrypt -eq 0 ]; then
if [ -n "$ealgo" -o -n "$ekey" -o -n "$ekeyfile" ]; then
wsrep_log_error "Options for encryption are specified, " \
wsrep_log_error "Options for encryption are specified," \
"but encryption itself is disabled. SST may fail."
fi
return
fi
if [ $sfmt = 'tar' ]; then
wsrep_log_info "NOTE: key-based encryption (encrypt=1) " \
wsrep_log_info "NOTE: key-based encryption (encrypt=1)" \
"cannot be enabled with tar format"
encrypt=-1
return
@@ -165,16 +165,18 @@ get_keys()
exit 3
fi
if [ -z "$ekey" -a ! -r "$ekeyfile" ]; then
wsrep_log_error "FATAL: Either key must be specified " \
"or keyfile must be readable"
exit 3
if [ -z "$ekey" ]; then
if [ ! -r "$ekeyfile" ]; then
wsrep_log_error "FATAL: Either key must be specified" \
"or keyfile must be readable"
exit 3
fi
fi
if [ "$eformat" = 'openssl' ]; then
get_openssl
if [ -z "$OPENSSL_BINARY" ]; then
wsrep_log_error "If encryption using the openssl is enabled, " \
wsrep_log_error "If encryption using the openssl is enabled," \
"then you need to install openssl"
exit 2
fi
@@ -192,12 +194,12 @@ get_keys()
ecmd="$ecmd -k '$ekey'"
fi
elif [ "$eformat" = 'xbcrypt' ]; then
if [ -z "$(command -v xbcrypt)" ]; then
wsrep_log_error "If encryption using the xbcrypt is enabled, " \
if [ -z "$(commandex xbcrypt)" ]; then
wsrep_log_error "If encryption using the xbcrypt is enabled," \
"then you need to install xbcrypt"
exit 2
fi
wsrep_log_info "NOTE: xbcrypt-based encryption, " \
wsrep_log_info "NOTE: xbcrypt-based encryption," \
"supported only from Xtrabackup 2.1.4"
if [ -z "$ekey" ]; then
ecmd="xbcrypt --encrypt-algo='$ealgo' --encrypt-key-file='$ekeyfile'"
@@ -342,40 +344,34 @@ get_transfer()
CN_option=",commonname=''"
if [ $encrypt -eq 2 ]; then
wsrep_log_info "Using openssl based encryption with socat: with crt and pem"
if [ -z "$tpem" -o -z "$tcert" ]; then
wsrep_log_info \
"Using openssl based encryption with socat: with crt and pem"
if [ -z "$tpem" -o -z "$tcert$tcap" ]; then
wsrep_log_error \
"Both PEM file and CRT file (or path) are required"
exit 22
fi
if [ ! -r "$tpem" -o ! -r "$tcert" ]; then
wsrep_log_error \
"Both PEM file and CRT file (or path) must be readable"
exit 22
verify_ca_matches_cert "$tpem" "$tcert" "$tcap"
tcmd="$tcmd,cert='$tpem'"
if [ -n "$tcert" ]; then
tcmd="$tcmd,cafile='$tcert'"
fi
verify_ca_matches_cert "$tcert" "$tpem" $tpath
if [ $tpath -eq 0 ]; then
tcmd="$tcmd,cert='$tpem',cafile='$tcert'"
else
tcmd="$tcmd,cert='$tpem',capath='$tcert'"
if [ -n "$tcap" ]; then
tcmd="$tcmd,capath='$tcap'"
fi
stagemsg="$stagemsg-OpenSSL-Encrypted-2"
wsrep_log_info "$action with cert=$tpem, ca=$tcert"
wsrep_log_info "$action with cert='$tpem', ca='$tcert', capath='$tcap'"
elif [ $encrypt -eq 3 -o $encrypt -eq 4 ]; then
wsrep_log_info "Using openssl based encryption with socat: with key and crt"
wsrep_log_info \
"Using openssl based encryption with socat: with key and crt"
if [ -z "$tpem" -o -z "$tkey" ]; then
wsrep_log_error "Both certificate file (or path) " \
"and key file are required"
exit 22
fi
if [ ! -r "$tpem" -o ! -r "$tkey" ]; then
wsrep_log_error "Both certificate file (or path) " \
"and key file must be readable"
wsrep_log_error "Both the certificate file (or path) and" \
"the key file are required"
exit 22
fi
verify_cert_matches_key "$tpem" "$tkey"
stagemsg="$stagemsg-OpenSSL-Encrypted-3"
if [ -z "$tcert" ]; then
if [ -z "$tcert$tcap" ]; then
if [ $encrypt -eq 4 ]; then
wsrep_log_error \
"Peer certificate file (or path) required if encrypt=4"
@@ -384,14 +380,11 @@ get_transfer()
# no verification
CN_option=""
tcmd="$tcmd,cert='$tpem',key='$tkey',verify=0"
wsrep_log_info "$action with cert=$tpem, key=$tkey, verify=0"
wsrep_log_info \
"$action with cert='$tpem', key='$tkey', verify=0"
else
# CA verification
if [ ! -r "$tcert" ]; then
wsrep_log_error "Certificate file or path must be readable"
exit 22
fi
verify_ca_matches_cert "$tcert" "$tpem" $tpath
verify_ca_matches_cert "$tpem" "$tcert" "$tcap"
if [ -n "$WSREP_SST_OPT_REMOTE_USER" ]; then
CN_option=",commonname='$WSREP_SST_OPT_REMOTE_USER'"
elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' -o $encrypt -eq 4 ]
@@ -402,12 +395,15 @@ get_transfer()
else
CN_option=",commonname='$WSREP_SST_OPT_HOST_UNESCAPED'"
fi
if [ $tpath -eq 0 ]; then
tcmd="$tcmd,cert='$tpem',key='$tkey',cafile='$tcert'"
else
tcmd="$tcmd,cert='$tpem',key='$tkey',capath='$tcert'"
tcmd="$tcmd,cert='$tpem',key='$tkey'"
if [ -n "$tcert" ]; then
tcmd="$tcmd,cafile='$tcert'"
fi
wsrep_log_info "$action with cert=$tpem, key=$tkey, ca=$tcert"
if [ -n "$tcap" ]; then
tcmd="$tcmd,capath='$tcap'"
fi
wsrep_log_info "$action with cert='$tpem', key='$tkey'," \
"ca='$tcert', capath='$tcap'"
fi
else
wsrep_log_info "Unknown encryption mode: encrypt=$encrypt"
@@ -425,7 +421,9 @@ get_transfer()
get_footprint()
{
pushd "$WSREP_SST_OPT_DATA" 1>/dev/null
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \
-type f -print0 | du --files0-from=- --block-size=1 -c -s | \
awk 'END { print $1 }')
if [ "$compress" != 'none' ]; then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
@@ -438,7 +436,7 @@ get_footprint()
adjust_progress()
{
if [ -z "$(command -v pv)" ]; then
if [ -z "$(commandex pv)" ]; then
wsrep_log_error "pv not found in path: $PATH"
wsrep_log_error "Disabling all progress/rate-limiting"
pcmd=""
@@ -466,50 +464,16 @@ adjust_progress()
encgroups='--mysqld|sst|xtrabackup'
check_server_ssl_config()
{
# backward-compatible behavior:
tcert=$(parse_cnf 'sst' 'tca')
tpem=$(parse_cnf 'sst' 'tcert')
tkey=$(parse_cnf 'sst' 'tkey')
# reading new ssl configuration options:
local tcert2=$(parse_cnf "$encgroups" 'ssl-ca')
local tpem2=$(parse_cnf "$encgroups" 'ssl-cert')
local tkey2=$(parse_cnf "$encgroups" 'ssl-key')
# if there are no old options, then we take new ones:
if [ -z "$tcert" -a -z "$tpem" -a -z "$tkey" ]; then
tcert="$tcert2"
tpem="$tpem2"
tkey="$tkey2"
# checking for presence of the new-style SSL configuration:
elif [ -n "$tcert2" -o -n "$tpem2" -o -n "$tkey2" ]; then
if [ "$tcert" != "$tcert2" -o \
"$tpem" != "$tpem2" -o \
"$tkey" != "$tkey2" ]
then
wsrep_log_info "new ssl configuration options (ssl-ca, ssl-cert " \
"and ssl-key) are ignored by SST due to presence " \
"of the tca, tcert and/or tkey in the [sst] section"
fi
fi
if [ -n "$tcert" ]; then
tcert=$(trim_string "$tcert")
if [ "${tcert%/}" != "$tcert" ]; then
tpath=1
fi
fi
}
read_cnf()
{
sfmt=$(parse_cnf sst streamfmt 'mbstream')
tfmt=$(parse_cnf sst transferfmt 'socat')
encrypt=$(parse_cnf "$encgroups" 'encrypt' 0)
tmode=$(parse_cnf "$encgroups" 'ssl-mode' 'DISABLED' | tr [:lower:] [:upper:])
tmode=$(parse_cnf "$encgroups" 'ssl-mode' 'DISABLED' | \
tr [:lower:] [:upper:])
if [ $encrypt -eq 0 -o $encrypt -ge 2 ]
then
if [ $encrypt -eq 0 -o $encrypt -ge 2 ]; then
if [ "$tmode" != 'DISABLED' -o $encrypt -ge 2 ]; then
check_server_ssl_config
fi
@@ -517,11 +481,13 @@ read_cnf()
if [ 0 -eq $encrypt -a -n "$tpem" -a -n "$tkey" ]
then
encrypt=3 # enable cert/key SSL encyption
# avoid CA verification if not set explicitly:
# nodes may happen to have different CA if self-generated
# zeroing up tcert does the trick
[ "${tmode#VERIFY}" != "$tmode" ] || tcert=""
# nodes may happen to have different CA if self-generated,
# zeroing up tcert and tcap does the trick:
if [ "${tmode#VERIFY}" = "$tmode" ]; then
tcert=""
tcap=""
fi
fi
fi
elif [ $encrypt -eq 1 ]; then
@@ -535,8 +501,9 @@ read_cnf()
fi
fi
wsrep_log_info "SSL configuration: CA='$tcert', CERT='$tpem'," \
"KEY='$tkey', MODE='$tmode', encrypt='$encrypt'"
wsrep_log_info "SSL configuration: CA='$tcert', CAPATH='$tcap'," \
"CERT='$tpem', KEY='$tkey', MODE='$tmode'," \
"encrypt='$encrypt'"
sockopt=$(parse_cnf sst sockopt "")
progress=$(parse_cnf sst progress "")
@@ -561,7 +528,8 @@ read_cnf()
sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir '/tmp/sst_log_archive')
if [ $speciald -eq 0 ]; then
wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1"
wsrep_log_error \
"sst-special-dirs equal to 0 is not supported, falling back to 1"
speciald=1
fi
@@ -589,7 +557,7 @@ get_stream()
{
if [ "$sfmt" = 'mbstream' -o "$sfmt" = 'xbstream' ]; then
sfmt='mbstream'
STREAM_BIN="$(command -v mbstream)"
local STREAM_BIN=$(commandex "$sfmt")
if [ -z "$STREAM_BIN" ]; then
wsrep_log_error "Streaming with $sfmt, but $sfmt not found in path"
exit 42
@@ -621,7 +589,7 @@ cleanup_at_exit()
# Since this is invoked just after exit NNN
local estatus=$?
if [ $estatus -ne 0 ]; then
wsrep_log_error "Cleanup after exit with status:$estatus"
wsrep_log_error "Cleanup after exit with status: $estatus"
fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
@@ -630,42 +598,47 @@ cleanup_at_exit()
else
if [ -n "$BACKUP_PID" ]; then
if check_pid "$BACKUP_PID" 1; then
wsrep_log_error "mariabackup process is still running. Killing..."
wsrep_log_error \
"mariabackup process is still running. Killing..."
cleanup_pid $CHECK_PID "$BACKUP_PID"
fi
fi
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE"
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || :
fi
if [ -n "$progress" -a -p "$progress" ]; then
wsrep_log_info "Cleaning up fifo file $progress"
rm -f "$progress" || true
wsrep_log_info "Cleaning up fifo file: $progress"
rm -f "$progress" || :
fi
wsrep_log_info "Cleaning up temporary directories"
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
if [ -n "$STATDIR" ]; then
[ -d "$STATDIR" ] && rm -rf "$STATDIR"
fi
[ -n "$STATDIR" -a -d "$STATDIR" ] && rm -rf "$STATDIR" || :
else
[ -n "$xtmpdir" -a -d "$xtmpdir" ] && rm -rf "$xtmpdir" || true
[ -n "$itmpdir" -a -d "$itmpdir" ] && rm -rf "$itmpdir" || true
[ -n "$xtmpdir" -a -d "$xtmpdir" ] && rm -rf "$xtmpdir" || :
[ -n "$itmpdir" -a -d "$itmpdir" ] && rm -rf "$itmpdir" || :
fi
# Final cleanup
pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
pgid=$(ps -o pgid= $$ 2>/dev/null | grep -o '[0-9]*' || :)
# This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise.
if [ $$ -eq $pgid ]; then
# This means a signal was delivered to the process.
# So, more cleanup.
if [ $estatus -ge 128 ]; then
kill -KILL -- -$$ || true
if [ -n "$pgid" ]; then
if [ $$ -eq $pgid ]; then
# This means a signal was delivered to the process.
# So, more cleanup.
if [ $estatus -ge 128 ]; then
kill -KILL -- -$$ || :
fi
fi
fi
if [ -n "${SST_PID:-}" ]; then
[ -f "$SST_PID" ] && rm -f "$SST_PID" || :
fi
exit $estatus
}
@@ -738,7 +711,7 @@ recv_joiner()
local ltcmd="$tcmd"
if [ $tmt -gt 0 ]; then
if [ -n "$(command -v timeout)" ]; then
if [ -n "$(commandex timeout)" ]; then
if timeout --help | grep -qw -- '-k'; then
ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd"
else
@@ -760,14 +733,14 @@ recv_joiner()
popd 1>/dev/null
if [ ${RC[0]} -eq 124 ]; then
wsrep_log_error "Possible timeout in receiving first data from " \
wsrep_log_error "Possible timeout in receiving first data from" \
"donor in gtid stage: exit codes: ${RC[@]}"
exit 32
fi
for ecode in "${RC[@]}"; do
if [ $ecode -ne 0 ]; then
wsrep_log_error "Error while getting data from donor node: " \
wsrep_log_error "Error while getting data from donor node:" \
"exit codes: ${RC[@]}"
exit 32
fi
@@ -776,7 +749,7 @@ recv_joiner()
if [ $checkf -eq 1 ]; then
if [ ! -r "$MAGIC_FILE" ]; then
# this message should cause joiner to abort
wsrep_log_error "receiving process ended without creating " \
wsrep_log_error "receiving process ended without creating" \
"'$MAGIC_FILE'"
wsrep_log_info "Contents of datadir"
wsrep_log_info $(ls -l "$dir/"*)
@@ -784,10 +757,11 @@ recv_joiner()
fi
# check donor supplied secret
SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | cut -d ' ' -f 2)
SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | \
cut -d ' ' -f 2)
if [ "$SECRET" != "$MY_SECRET" ]; then
wsrep_log_error "Donor does not know my secret!"
wsrep_log_info "Donor:'$SECRET', my:'$MY_SECRET'"
wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'"
exit 32
fi
@@ -810,7 +784,7 @@ send_donor()
for ecode in "${RC[@]}"; do
if [ $ecode -ne 0 ]; then
wsrep_log_error "Error while sending data to joiner node: " \
wsrep_log_error "Error while sending data to joiner node:" \
"exit codes: ${RC[@]}"
exit 32
fi
@@ -823,7 +797,9 @@ monitor_process()
while true ; do
if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then
wsrep_log_error "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT) terminated unexpectedly."
wsrep_log_error \
"Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \
"terminated unexpectedly."
kill -- -"$WSREP_SST_OPT_PARENT"
exit 32
fi
@@ -845,7 +821,7 @@ read_cnf
setup_ports
if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -- '--version-check'; then
disver='--no-version-check'
disver=' --no-version-check'
fi
# if no command line argument and INNODB_DATA_HOME_DIR environment variable
@@ -867,7 +843,7 @@ INNODB_DATA_HOME_DIR=$(pwd -P)
cd "$OLD_PWD"
if [ $ssyslog -eq 1 ]; then
if [ -n "$(command -v logger)" ]; then
if [ -n "$(commandex logger)" ]; then
wsrep_log_info "Logging all stderr of SST/mariabackup to syslog"
exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE)
@@ -898,10 +874,8 @@ else
fi
fi
if [ -e "$INNOAPPLYLOG" ]
then
if [ -n "$sstlogarchivedir" ]
then
if [ -e "$INNOAPPLYLOG" ]; then
if [ -n "$sstlogarchivedir" ]; then
newfile=$(basename "$INNOAPPLYLOG")
newfile="$sstlogarchivedir/$newfile.$ARCHIVETIMESTAMP"
else
@@ -912,10 +886,8 @@ else
gzip "$newfile"
fi
if [ -e "$INNOMOVELOG" ]
then
if [ -n "$sstlogarchivedir" ]
then
if [ -e "$INNOMOVELOG" ]; then
if [ -n "$sstlogarchivedir" ]; then
newfile=$(basename "$INNOMOVELOG")
newfile="$sstlogarchivedir/$newfile.$ARCHIVETIMESTAMP"
else
@@ -926,10 +898,8 @@ else
gzip "$newfile"
fi
if [ -e "$INNOBACKUPLOG" ]
then
if [ -n "$sstlogarchivedir" ]
then
if [ -e "$INNOBACKUPLOG" ]; then
if [ -n "$sstlogarchivedir" ]; then
newfile=$(basename "$INNOBACKUPLOG")
newfile="$sstlogarchivedir/$newfile.$ARCHIVETIMESTAMP"
else
@@ -949,15 +919,15 @@ setup_commands()
{
local mysqld_args=""
if [ -n "$WSREP_SST_OPT_MYSQLD" ]; then
mysqld_args="--mysqld-args $WSREP_SST_OPT_MYSQLD"
mysqld_args=" --mysqld-args $WSREP_SST_OPT_MYSQLD"
fi
if [ -z "$INNODB_FORCE_RECOVERY" ]; then
INNOAPPLY="$BACKUP_BIN --prepare $disver $iapts $INNOEXTRA --target-dir='$DATA' --datadir='$DATA' $mysqld_args $INNOAPPLY"
else
INNOAPPLY="$BACKUP_BIN --prepare $disver $iapts $INNOEXTRA --innodb-force-recovery=$INNODB_FORCE_RECOVERY --target-dir='$DATA' --datadir='$DATA' $mysqld_args $INNOAPPLY"
local recovery=""
if [ -n "$INNODB_FORCE_RECOVERY" ]; then
recovery=" --innodb-force-recovery=$INNODB_FORCE_RECOVERY"
fi
INNOMOVE="$BACKUP_BIN $WSREP_SST_OPT_CONF --move-back $disver $impts --force-non-empty-directories --target-dir='$DATA' --datadir='${TDATA:-$DATA}' $INNOMOVE"
INNOBACKUP="$BACKUP_BIN $WSREP_SST_OPT_CONF --backup $disver $iopts $tmpopts $INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA' $mysqld_args $INNOBACKUP"
INNOAPPLY="$BACKUP_BIN --prepare$disver$recovery${iapts:+ }$iapts$INNOEXTRA --target-dir='$DATA' --datadir='$DATA'$mysqld_args $INNOAPPLY"
INNOMOVE="$BACKUP_BIN$WSREP_SST_OPT_CONF --move-back$disver${impts:+ }$impts --force-non-empty-directories --target-dir='$DATA' --datadir='${TDATA:-$DATA}' $INNOMOVE"
INNOBACKUP="$BACKUP_BIN$WSREP_SST_OPT_CONF --backup$disver${iopts:+ }$iopts$tmpopts$INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA'$mysqld_args $INNOBACKUP"
}
get_stream
@@ -985,7 +955,7 @@ then
fi
wsrep_log_info "Using '$xtmpdir' as mariabackup temporary directory"
tmpopts="--tmpdir='$xtmpdir'"
tmpopts=" --tmpdir='$xtmpdir'"
itmpdir="$(mktemp -d)"
wsrep_log_info "Using '$itmpdir' as mariabackup working directory"
@@ -1055,27 +1025,28 @@ then
tcmd="$ecmd | $tcmd"
fi
iopts="--databases-exclude='lost+found' $iopts"
iopts="--databases-exclude='lost+found'${iopts:+ }$iopts"
if [ ${FORCE_FTWRL:-0} -eq 1 ]; then
wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL"
iopts="--no-backup-locks $iopts"
wsrep_log_info "Forcing FTWRL due to environment variable" \
"FORCE_FTWRL equal to $FORCE_FTWRL"
iopts="--no-backup-locks${iopts:+ }$iopts"
fi
# if compression is enabled for backup files, then add the
# appropriate options to the mariabackup command line:
if [ "$compress" != 'none' ]; then
iopts="--compress${compress:+=$compress} $iopts"
iopts="--compress${compress:+=$compress}${iopts:+ }$iopts"
if [ -n "$compress_threads" ]; then
iopts="--compress-threads=$compress_threads $iopts"
iopts="--compress-threads=$compress_threads${iopts:+ }$iopts"
fi
if [ -n "$compress_chunk" ]; then
iopts="--compress-chunk-size=$compress_chunk $iopts"
iopts="--compress-chunk-size=$compress_chunk${iopts:+ }$iopts"
fi
fi
if [ -n "$backup_threads" ]; then
iopts="--parallel=$backup_threads $iopts"
iopts="--parallel=$backup_threads${iopts:+ }$iopts"
fi
setup_commands
@@ -1084,7 +1055,7 @@ then
set -e
if [ ${RC[0]} -ne 0 ]; then
wsrep_log_error "mariabackup finished with error: ${RC[0]}. " \
wsrep_log_error "mariabackup finished with error: ${RC[0]}." \
"Check syslog or '$INNOBACKUPLOG' for details"
exit 22
elif [ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]; then
@@ -1125,7 +1096,8 @@ then
elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]
then
[ -e "$SST_PROGRESS_FILE" ] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
[ -e "$SST_PROGRESS_FILE" ] && \
wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
[ -n "$SST_PROGRESS_FILE" ] && touch "$SST_PROGRESS_FILE"
ib_home_dir="$INNODB_DATA_HOME_DIR"
@@ -1146,13 +1118,26 @@ then
ib_undo_dir="$INNODB_UNDO_DIR"
if [ -n "$backup_threads" ]; then
impts="--parallel=$backup_threads $impts"
impts="--parallel=$backup_threads${impts:+ }$impts"
fi
stagemsg='Joiner-Recv'
SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
sencrypted=1
nthreads=1
# give some time for previous SST to complete:
check_round=0
while check_pid "$SST_PID" 0; do
wsrep_log_info "previous SST is not completed, waiting for it to exit"
check_round=$(( check_round + 1 ))
if [ $check_round -eq 10 ]; then
wsrep_log_error "previous SST script still running."
exit 114 # EALREADY
fi
sleep 1
done
echo $$ > "$SST_PID"
stagemsg='Joiner-Recv'
MODULE="xtrabackup_sst"
@@ -1165,15 +1150,15 @@ then
ADDR="$WSREP_SST_OPT_ADDR"
if [ "${tmode#VERIFY}" != "$tmode" ]
then # backward-incompatible behavior
if [ "${tmode#VERIFY}" != "$tmode" ]; then
# backward-incompatible behavior:
CN=""
if [ -n "$tpem" ]
then
if [ -n "$tpem" ]; then
# find out my Common Name
get_openssl
if [ -z "$OPENSSL_BINARY" ]; then
wsrep_log_error 'openssl not found but it is required for authentication'
wsrep_log_error \
'openssl not found but it is required for authentication'
exit 42
fi
CN=$("$OPENSSL_BINARY" x509 -noout -subject -in "$tpem" | \
@@ -1196,7 +1181,7 @@ then
fi
get_keys
if [ $encrypt -eq 1 -a $sencrypted -eq 1 ]; then
if [ $encrypt -eq 1 ]; then
strmcmd="$ecmd | $strmcmd"
fi
@@ -1213,15 +1198,17 @@ then
if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1
then
wsrep_log_error "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT) terminated unexpectedly."
wsrep_log_error "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \
"terminated unexpectedly."
exit 32
fi
if [ ! -r "$STATDIR/$IST_FILE" ]
then
if [ ! -r "$STATDIR/$IST_FILE" ]; then
if [ -d "$DATA/.sst" ]; then
wsrep_log_info "WARNING: Stale temporary SST directory: '$DATA/.sst' from previous state transfer. Removing"
wsrep_log_info \
"WARNING: Stale temporary SST directory:" \
"'$DATA/.sst' from previous state transfer, removing..."
rm -rf "$DATA/.sst"
fi
mkdir -p "$DATA/.sst"
@@ -1229,29 +1216,34 @@ then
jpid=$!
wsrep_log_info "Proceeding with SST"
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
wsrep_log_info \
"Cleaning the existing datadir and innodb-data/log directories"
if [ "$OS" = 'FreeBSD' ]; then
find -E ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" -o -exec rm -rfv {} 1>&2 \+
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rfv {} 1>&2 \+
else
find ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" -o -exec rm -rfv {} 1>&2 \+
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rfv {} 1>&2 \+
fi
get_binlog
if [ -n "$WSREP_SST_OPT_BINLOG" ]; then
binlog_dir=$(dirname "$WSREP_SST_OPT_BINLOG")
cd "$binlog_dir"
wsrep_log_info "Cleaning the binlog directory $binlog_dir as well"
rm -fv "$WSREP_SST_OPT_BINLOG".[0-9]* 1>&2 \+ || true
[ -f "$WSREP_SST_OPT_BINLOG_INDEX" ] && \
rm -fv "$WSREP_SST_OPT_BINLOG_INDEX" 1>&2 \+ || true
cd "$OLD_PWD"
if [ -d "$binlog_dir" ]; then
cd "$binlog_dir"
wsrep_log_info "Cleaning the binlog directory $binlog_dir as well"
rm -fv "$WSREP_SST_OPT_BINLOG".[0-9]* 1>&2 \+ || :
[ -f "$WSREP_SST_OPT_BINLOG_INDEX" ] && \
rm -fv "$WSREP_SST_OPT_BINLOG_INDEX" 1>&2 \+
cd "$OLD_PWD"
fi
fi
TDATA="$DATA"
@@ -1262,12 +1254,13 @@ then
monitor_process $jpid
if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then
wsrep_log_error "xtrabackup_checkpoints missing, failed mariabackup/SST on donor"
wsrep_log_error "xtrabackup_checkpoints missing," \
"failed mariabackup/SST on donor"
exit 2
fi
# Compact backups are not supported by mariabackup
if grep -q -F 'compact = 1' "$DATA/xtrabackup_checkpoints"; then
if grep -qw -F 'compact = 1' "$DATA/xtrabackup_checkpoints"; then
wsrep_log_info "Index compaction detected"
wsrel_log_error "Compact backups are not supported by mariabackup"
exit 2
@@ -1277,7 +1270,7 @@ then
if [ -n "$qpfiles" ]; then
wsrep_log_info "Compressed qpress files found"
if [ -z "$(command -v qpress)" ]; then
if [ -z "$(commandex qpress)" ]; then
wsrep_log_error "qpress utility not found in the path"
exit 22
fi
@@ -1300,14 +1293,17 @@ then
# Decompress the qpress files
wsrep_log_info "Decompression with $nproc threads"
timeit "Joiner-Decompression" "find '$DATA' -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
timeit "Joiner-Decompression" \
"find '$DATA' -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
extcode=$?
if [ $extcode -eq 0 ]; then
wsrep_log_info "Removing qpress files after decompression"
find "$DATA" -type f -name '*.qp' -delete
if [ $? -ne 0 ]; then
wsrep_log_error "Something went wrong with deletion of qpress files. Investigate"
wsrep_log_error \
"Something went wrong with deletion of qpress files." \
"Investigate"
fi
else
wsrep_log_error "Decompression failed. Exit code: $extcode"
@@ -1321,7 +1317,7 @@ then
BINLOG_FILENAME=$(basename "$WSREP_SST_OPT_BINLOG")
# To avoid comparing data directory and BINLOG_DIRNAME
mv "$DATA/$BINLOG_FILENAME".* "$BINLOG_DIRNAME/" 2>/dev/null || true
mv "$DATA/$BINLOG_FILENAME".* "$BINLOG_DIRNAME/" 2>/dev/null || :
cd "$BINLOG_DIRNAME"
for bfile in $(ls -1 "$BINLOG_FILENAME".[0-9]*); do
@@ -1336,7 +1332,8 @@ then
timeit "mariabackup prepare stage" "$INNOAPPLY"
if [ $? -ne 0 ]; then
wsrep_log_error "mariabackup apply finished with errors. Check syslog or '$INNOAPPLYLOG' for details"
wsrep_log_error "mariabackup apply finished with errors." \
"Check syslog or '$INNOAPPLYLOG' for details."
exit 22
fi

View File

@@ -19,7 +19,6 @@
# This is a reference script for mysqldump-based state snapshot tansfer
. $(dirname "$0")/wsrep_sst_common
PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
EINVAL=22
@@ -93,8 +92,7 @@ DROP PREPARE stmt;"
SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';"
SET_WSREP_GTID_DOMAIN_ID=""
if [ -n $WSREP_SST_OPT_GTID_DOMAIN_ID ]
then
if [ -n $WSREP_SST_OPT_GTID_DOMAIN_ID ]; then
SET_WSREP_GTID_DOMAIN_ID="
SET @val = (SELECT GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME = 'WSREP_GTID_STRICT_MODE' AND GLOBAL_VALUE > 0);
SET @stmt = IF (@val IS NOT NULL, 'SET GLOBAL WSREP_GTID_DOMAIN_ID=$WSREP_SST_OPT_GTID_DOMAIN_ID', 'SET @dummy = 0');
@@ -103,7 +101,7 @@ then
DROP PREPARE stmt;"
fi
MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF_UNQUOTED "\
MYSQL="$MYSQL_CLIENT$WSREP_SST_OPT_CONF_UNQUOTED "\
"$AUTH -h$WSREP_SST_OPT_HOST_UNESCAPED "\
"-P$WSREP_SST_OPT_PORT --disable-reconnect --connect_timeout=10"
@@ -125,8 +123,7 @@ SET_GTID_BINLOG_STATE=""
SQL_LOG_BIN_OFF=""
# Safety check
if [ ${SERVER_VERSION%%.*} -gt 5 ]
then
if [ ${SERVER_VERSION%%.*} -gt 5 ]; then
# If binary logging is enabled on the joiner node, we need to copy donor's
# gtid_binlog_state to joiner. In order to do that, a RESET MASTER must be
# executed to erase binary logs (if any). Binary logging should also be
@@ -140,7 +137,7 @@ then
fi
# NOTE: we don't use --routines here because we're dumping mysql.proc table
MYSQLDUMP="$MYSQLDUMP $WSREP_SST_OPT_CONF_UNQUOTED $AUTH -S$WSREP_SST_OPT_SOCKET \
MYSQLDUMP="$MYSQLDUMP$WSREP_SST_OPT_CONF_UNQUOTED $AUTH -S$WSREP_SST_OPT_SOCKET \
--add-drop-database --add-drop-table --skip-add-locks --create-options \
--disable-keys --extended-insert --skip-lock-tables --quick --set-charset \
--skip-comments --flush-privileges --all-databases --events"

View File

@@ -17,7 +17,7 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1335 USA.
# This is a reference script for rsync-based state snapshot tansfer
# This is a reference script for rsync-based state snapshot transfer
RSYNC_REAL_PID=0 # rsync process id
STUNNEL_REAL_PID=0 # stunnel process id
@@ -25,9 +25,6 @@ STUNNEL_REAL_PID=0 # stunnel process id
OS="$(uname)"
[ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH
# Setting the path for lsof on CentOS
export PATH="/usr/sbin:/sbin:$PATH"
. $(dirname "$0")/wsrep_sst_common
wsrep_check_datadir
@@ -37,13 +34,14 @@ cleanup_joiner()
{
local failure=0
wsrep_log_info "Joiner cleanup: rsync PID=$RSYNC_REAL_PID, stunnel PID=$STUNNEL_REAL_PID"
wsrep_log_info "Joiner cleanup: rsync PID=$RSYNC_REAL_PID," \
"stunnel PID=$STUNNEL_REAL_PID"
if [ -n "$STUNNEL" ]; then
if cleanup_pid $STUNNEL_REAL_PID "$STUNNEL_PID" "$STUNNEL_CONF"; then
if [ $RSYNC_REAL_PID -eq 0 ]; then
if [ -r "$RSYNC_PID" ]; then
RSYNC_REAL_PID=$(cat "$RSYNC_PID" 2>/dev/null)
RSYNC_REAL_PID=$(cat "$RSYNC_PID" 2>/dev/null || :)
if [ -z "$RSYNC_REAL_PID" ]; then
RSYNC_REAL_PID=0
fi
@@ -81,18 +79,18 @@ check_pid_and_port()
local utils='rsync|stunnel'
if ! check_port "$pid" "$port" "$utils"; then
if ! check_port $pid "$port" "$utils"; then
local port_info
local busy=0
if [ $lsof_available -ne 0 ]; then
port_info=$(lsof -Pnl -i ":$port" 2>/dev/null | \
grep -F '(LISTEN)')
grep -F '(LISTEN)')
echo "$port_info" | \
grep -q -E "[[:space:]](\\*|\\[?::\\]?):$port[[:space:]]" && busy=1
else
local filter='([^[:space:]]+[[:space:]]+){4}[^[:space:]]+'
if [ $sockstat_available -eq 1 ]; then
if [ $sockstat_available -ne 0 ]; then
local opts='-p'
if [ "$OS" = 'FreeBSD' ]; then
# sockstat on FreeBSD requires the "-s" option
@@ -112,19 +110,21 @@ check_pid_and_port()
fi
if [ $busy -eq 0 ]; then
if echo "$port_info" | grep -qw -F "[$addr]:$port" || \
echo "$port_info" | grep -qw -F -- "$addr:$port"
if ! echo "$port_info" | grep -qw -F "[$addr]:$port" && \
! echo "$port_info" | grep -qw -F -- "$addr:$port"
then
busy=1
if ! ps -p $pid >/dev/null 2>&1; then
wsrep_log_error \
"rsync or stunnel daemon (PID: $pid)" \
"terminated unexpectedly."
exit 16 # EBUSY
fi
return 1
fi
fi
if [ $busy -eq 0 ]; then
return 1
fi
if ! check_port "$pid" "$port" "$utils"; then
wsrep_log_error "rsync or stunnel daemon port '$port' " \
if ! check_port $pid "$port" "$utils"; then
wsrep_log_error "rsync or stunnel daemon port '$port'" \
"has been taken by another program"
exit 16 # EBUSY
fi
@@ -199,60 +199,23 @@ INNODB_UNDO_DIR=$(pwd -P)
cd "$OLD_PWD"
# Old filter - include everything except selected
# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \
# --exclude '*.conf' --exclude core --exclude 'galera.*' \
# --exclude grastate.txt --exclude '*.pem' \
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
encgroups='--mysqld|sst'
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER="-f '- /lost+found'
-f '- /.zfs'
-f '- /.fseventsd'
-f '- /.Trashes'
-f '- /.pid'
-f '- /.conf'
-f '+ /wsrep_sst_binlog.tar'
-f '- $INNODB_DATA_HOME_DIR/ib_lru_dump'
-f '- $INNODB_DATA_HOME_DIR/ibdata*'
-f '+ $INNODB_UNDO_DIR/undo*'
-f '+ /*/'
-f '- /*'"
check_server_ssl_config
# old-style SSL config
SSTKEY=$(parse_cnf 'sst' 'tkey')
SSTCERT=$(parse_cnf 'sst' 'tcert')
SSTCA=$(parse_cnf 'sst' 'tca')
SSTKEY="$tkey"
SSTCERT="$tpem"
SSTCA="$tcert"
SSTCAP="$tcap"
SST_SECTIONS="--mysqld|sst"
check_server_ssl_config()
{
SSTKEY=$(parse_cnf "$SST_SECTIONS" 'ssl-key')
SSTCERT=$(parse_cnf "$SST_SECTIONS" 'ssl-cert')
SSTCA=$(parse_cnf "$SST_SECTIONS" 'ssl-ca')
}
SSLMODE=$(parse_cnf "$SST_SECTIONS" 'ssl-mode' | tr [:lower:] [:upper:])
# no old-style SSL config in [sst], check for new one:
if [ -z "$SSTKEY" -a -z "$SSTCERT" -a -z "$SSTCA" ]; then
check_server_ssl_config
fi
SSTPATH=0
if [ -n "$SSTCA" ]; then
SSTCA=$(trim_string "$SSTCA")
if [ "${SSTCA%/}" != "$SSTCA" ]; then
SSTPATH=1
fi
fi
SSLMODE=$(parse_cnf "$encgroups" 'ssl-mode' | tr [:lower:] [:upper:])
if [ -z "$SSLMODE" ]; then
# Implicit verification if CA is set and the SSL mode
# is not specified by user:
if [ -n "$SSTCA" ]; then
if [ -n "$(command -v stunnel)" ]; then
if [ -n "$SSTCA$SSTCAP" ]; then
STUNNEL_BIN=$(commandex 'stunnel')
if [ -n "$STUNNEL_BIN" ]; then
SSLMODE='VERIFY_CA'
fi
# Require SSL by default if SSL key and cert are present:
@@ -261,28 +224,28 @@ if [ -z "$SSLMODE" ]; then
fi
fi
if [ -n "$SSTCERT" -a -n "$SSTKEY" ]; then
if [ -n "$SSTKEY" -a -n "$SSTCERT" ]; then
verify_cert_matches_key "$SSTCERT" "$SSTKEY"
fi
if [ -n "$SSTCA" ]; then
if [ $SSTPATH -eq 0 ]; then
CAFILE_OPT=""
CAPATH_OPT=""
if [ -n "$SSTCA$SSTCAP" ]; then
if [ -n "$SSTCA" ]; then
CAFILE_OPT="CAfile = $SSTCA"
else
CAFILE_OPT="CApath = $SSTCA"
fi
if [ -n "$SSTCAP" ]; then
CAPATH_OPT="CApath = $SSTCAP"
fi
if [ -n "$SSTCERT" ]; then
verify_ca_matches_cert "$SSTCA" "$SSTCERT" $SSTPATH
verify_ca_matches_cert "$SSTCERT" "$SSTCA" "$SSTCAP"
fi
else
CAFILE_OPT=""
fi
VERIFY_OPT=""
CHECK_OPT=""
CHECK_OPT_LOCAL=""
if [ "${SSLMODE#VERIFY}" != "$SSLMODE" ]
then
if [ "${SSLMODE#VERIFY}" != "$SSLMODE" ]; then
case "$SSLMODE" in
'VERIFY_IDENTITY')
VERIFY_OPT='verifyPeer = yes'
@@ -295,7 +258,7 @@ then
exit 22 # EINVAL
;;
esac
if [ -z "$SSTCA" ]; then
if [ -z "$SSTCA$SSTCAP" ]; then
wsrep_log_error "Can't have ssl-mode='$SSLMODE' without CA file or path"
exit 22 # EINVAL
fi
@@ -318,9 +281,12 @@ fi
STUNNEL=""
if [ -n "$SSLMODE" -a "$SSLMODE" != 'DISABLED' ]; then
STUNNEL_BIN="$(command -v stunnel)"
if [ -z "${STUNNEL_BIN+x}" ]; then
STUNNEL_BIN=$(commandex 'stunnel')
fi
if [ -n "$STUNNEL_BIN" ]; then
wsrep_log_info "Using stunnel for SSL encryption: CA: '$SSTCA', ssl-mode='$SSLMODE'"
wsrep_log_info "Using stunnel for SSL encryption: CA: '$SSTCA'," \
"CAPATH='$SSTCAP', ssl-mode='$SSLMODE'"
STUNNEL="$STUNNEL_BIN $STUNNEL_CONF"
fi
fi
@@ -340,6 +306,7 @@ then
key = $SSTKEY
cert = $SSTCERT
${CAFILE_OPT}
${CAPATH_OPT}
foreground = yes
pid = $STUNNEL_PID
debug = warning
@@ -354,8 +321,9 @@ EOF
[ -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF"
fi
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
then
RC=0
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed"
ERROR="$WSREP_SST_OPT_DATA/sst_error"
@@ -370,11 +338,11 @@ EOF
# (b) Cluster state ID & wsrep_gtid_domain_id to be written to the file, OR
# (c) ERROR file, in case flush tables operation failed.
while [ ! -r "$FLUSHED" ] && ! grep -q -F ':' "$FLUSHED" >/dev/null 2>&1
while [ ! -r "$FLUSHED" ] && \
! grep -q -F ':' '--' "$FLUSHED" >/dev/null 2>&1
do
# Check whether ERROR file exists.
if [ -f "$ERROR" ]
then
if [ -f "$ERROR" ]; then
# Flush tables operation failed.
rm -f "$ERROR"
exit 255
@@ -387,24 +355,22 @@ EOF
sync
if [ -n "$WSREP_SST_OPT_BINLOG" ]
if [ -n "$WSREP_SST_OPT_BINLOG" -a -d "${BINLOG_DIRNAME:-}" ]
then
# Prepare binlog files
cd "$BINLOG_DIRNAME"
binlog_files_full=$(tail -n $BINLOG_N_FILES "$WSREP_SST_OPT_BINLOG_INDEX")
binlog_files_full=$(tail -n $BINLOG_N_FILES \
"$WSREP_SST_OPT_BINLOG_INDEX")
binlog_files=""
for ii in $binlog_files_full
do
binlog_file=$(basename "$ii")
binlog_files="$binlog_files $binlog_file"
for file in $binlog_files_full; do
binlog_file=$(basename "$file")
binlog_files="$binlog_files${binlog_files:+ }'$binlog_file'"
done
if [ -n "$binlog_files" ]
then
if [ -n "$binlog_files" ]; then
wsrep_log_info "Preparing binlog files for transfer:"
tar -cvf "$BINLOG_TAR_FILE" $binlog_files >&2
eval tar -cvf "'$BINLOG_TAR_FILE'" $binlog_files >&2
fi
cd "$OLD_PWD"
@@ -417,9 +383,29 @@ EOF
WHOLE_FILE_OPT="--whole-file"
fi
# first, the normal directories, so that we can detect incompatible protocol
RC=0
eval rsync ${STUNNEL:+"'--rsh=$STUNNEL'"} \
# Old filter - include everything except selected
# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \
# --exclude '*.conf' --exclude core --exclude 'galera.*' \
# --exclude grastate.txt --exclude '*.pem' \
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER="-f '- /lost+found'
-f '- /.zfs'
-f '- /.fseventsd'
-f '- /.Trashes'
-f '- /.pid'
-f '- /.conf'
-f '+ /wsrep_sst_binlog.tar'
-f '- $INNODB_DATA_HOME_DIR/ib_lru_dump'
-f '- $INNODB_DATA_HOME_DIR/ibdata*'
-f '+ $INNODB_UNDO_DIR/undo*'
-f '+ /*/'
-f '- /*'"
# first, the normal directories, so that we can detect
# incompatible protocol:
eval rsync ${STUNNEL:+"--rsh='$STUNNEL'"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT $FILTER "'$WSREP_SST_OPT_DATA/'" \
@@ -430,8 +416,9 @@ EOF
case $RC in
12) RC=71 # EPROTO
wsrep_log_error \
"rsync server on the other end has incompatible protocol. " \
"Make sure you have the same version of rsync on all nodes."
"rsync server on the other end has incompatible" \
"protocol. Make sure you have the same version of" \
"rsync on all nodes."
;;
22) RC=12 # ENOMEM
;;
@@ -472,7 +459,7 @@ EOF
cd "$WSREP_SST_OPT_DATA"
backup_threads=$(parse_cnf "--mysqld|sst" 'backup-threads')
backup_threads=$(parse_cnf '--mysqld|sst' 'backup-threads')
if [ -z "$backup_threads" ]; then
get_proc
backup_threads=$nproc
@@ -481,9 +468,9 @@ EOF
find . -maxdepth 1 -mindepth 1 -type d -not -name 'lost+found' \
-not -name '.zfs' -print0 | xargs -I{} -0 -P $backup_threads \
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --recursive --delete --quiet \
$WHOLE_FILE_OPT --exclude '*/ib_logfile*' --exclude '*/aria_log.*' \
--owner --group --perms --links --specials --ignore-times \
--inplace --recursive --delete --quiet $WHOLE_FILE_OPT \
--exclude '*/ib_logfile*' --exclude '*/aria_log.*' \
--exclude '*/aria_log_control' "$WSREP_SST_OPT_DATA/{}/" \
"rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$?
@@ -514,7 +501,13 @@ EOF
fi
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--archive --quiet --checksum "$MAGIC_FILE" "rsync://$WSREP_SST_OPT_ADDR"
--archive --quiet --checksum "$MAGIC_FILE" \
"rsync://$WSREP_SST_OPT_ADDR" >&2 || RC=$?
if [ $RC -ne 0 ]; then
wsrep_log_error "rsync $MAGIC_FILE returned code $RC:"
exit 255 # unknown error
fi
echo "done $STATE"
@@ -527,12 +520,11 @@ elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]
then
check_sockets_utils
SST_PID="$WSREP_SST_OPT_DATA/wsrep_rsync_sst.pid"
SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
while check_pid "$SST_PID" 0
do
while check_pid "$SST_PID" 0 'wsrep_sst_'; do
wsrep_log_info "previous SST is not completed, waiting for it to exit"
check_round=$(( check_round + 1 ))
if [ $check_round -eq 10 ]; then
@@ -542,11 +534,13 @@ then
sleep 1
done
echo $$ > "$SST_PID"
# give some time for stunnel from the previous SST to complete:
check_round=0
while check_pid "$STUNNEL_PID" 1
do
wsrep_log_info "lingering stunnel daemon found at startup, waiting for it to exit"
while check_pid "$STUNNEL_PID" 1; do
wsrep_log_info "Lingering stunnel daemon found at startup," \
"waiting for it to exit"
check_round=$(( check_round + 1 ))
if [ $check_round -eq 10 ]; then
wsrep_log_error "stunnel daemon already running."
@@ -561,9 +555,9 @@ then
# give some time for rsync from the previous SST to complete:
check_round=0
while check_pid "$RSYNC_PID" 1
do
wsrep_log_info "lingering rsync daemon found at startup, waiting for it to exit"
while check_pid "$RSYNC_PID" 1; do
wsrep_log_info "Lingering rsync daemon found at startup," \
"waiting for it to exit"
check_round=$(( check_round + 1 ))
if [ $check_round -eq 10 ]; then
wsrep_log_error "rsync daemon already running."
@@ -575,9 +569,7 @@ then
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE"
if [ -z "$STUNNEL" ]; then
[ -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF"
fi
[ -z "$STUNNEL" -a -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF"
ADDR="$WSREP_SST_OPT_ADDR"
RSYNC_PORT="$WSREP_SST_OPT_PORT"
@@ -626,21 +618,21 @@ EOF
RSYNC_ADDR="*"
fi
echo $$ > "$SST_PID"
if [ -z "$STUNNEL" ]
then
rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" $RSYNC_EXTRA_ARGS &
if [ -z "$STUNNEL" ]; then
rsync --daemon --no-detach --port "$RSYNC_PORT" \
--config "$RSYNC_CONF" $RSYNC_EXTRA_ARGS &
RSYNC_REAL_PID=$!
TRANSFER_REAL_PID=$RSYNC_REAL_PID
TRANSFER_PID="$RSYNC_PID"
else
# Let's check if the path to the config file contains a space?
RSYNC_BIN=$(commandex 'rsync')
if [ "${RSYNC_CONF#* }" = "$RSYNC_CONF" ]; then
cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY
cert = $SSTCERT
${CAFILE_OPT}
${CAPATH_OPT}
foreground = yes
pid = $STUNNEL_PID
debug = warning
@@ -650,17 +642,18 @@ ${CHECK_OPT}
${CHECK_OPT_LOCAL}
[rsync]
accept = $STUNNEL_ACCEPT
exec = $(command -v rsync)
exec = $RSYNC_BIN
execargs = rsync --server --daemon --config=$RSYNC_CONF .
EOF
else
# The path contains a space, so we will run it via
# shell with "eval" command:
export RSYNC_CMD="eval $(command -v rsync) --server --daemon --config='$RSYNC_CONF' ."
export RSYNC_CMD="eval '$RSYNC_BIN' --server --daemon --config='$RSYNC_CONF' ."
cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY
cert = $SSTCERT
${CAFILE_OPT}
${CAPATH_OPT}
foreground = yes
pid = $STUNNEL_PID
debug = warning
@@ -688,7 +681,8 @@ EOF
# find out my Common Name
get_openssl
if [ -z "$OPENSSL_BINARY" ]; then
wsrep_log_error 'openssl not found but it is required for authentication'
wsrep_log_error \
'openssl not found but it is required for authentication'
exit 42
fi
CN=$("$OPENSSL_BINARY" x509 -noout -subject -in "$SSTCERT" | \
@@ -703,7 +697,8 @@ EOF
ADDR="$WSREP_SST_OPT_HOST"
fi
until check_pid_and_port "$TRANSFER_PID" $TRANSFER_REAL_PID "$RSYNC_ADDR_UNESCAPED" "$RSYNC_PORT"
until check_pid_and_port "$TRANSFER_PID" $TRANSFER_REAL_PID \
"$RSYNC_ADDR_UNESCAPED" "$RSYNC_PORT"
do
sleep 0.2
done
@@ -722,7 +717,7 @@ EOF
if ! ps -p $MYSQLD_PID >/dev/null 2>&1
then
wsrep_log_error \
"Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly."
"Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly."
kill -- -$MYSQLD_PID
sleep 1
exit 32
@@ -768,10 +763,11 @@ EOF
if [ -r "$MAGIC_FILE" ]; then
if [ -n "$MY_SECRET" ]; then
# check donor supplied secret
SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | cut -d ' ' -f 2)
SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | \
cut -d ' ' -f 2)
if [ "$SECRET" != "$MY_SECRET" ]; then
wsrep_log_error "Donor does not know my secret!"
wsrep_log_info "Donor:'$SECRET', my:'$MY_SECRET'"
wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'"
exit 32
fi
# remove secret from the magic file, and output

View File

@@ -390,6 +390,7 @@ ADD_CUSTOM_TARGET(
${CMAKE_CURRENT_BINARY_DIR}/yy_mariadb.cc
${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.cc
)
ADD_DEPENDENCIES(sql GenServerSource)
IF(TARGET libfmt)
ADD_DEPENDENCIES(sql libfmt)

View File

@@ -1390,12 +1390,17 @@ static uint make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos,
else
{
uchar *end= field->pack(to, field->ptr);
int sz= static_cast<int>(end - to);
DBUG_ASSERT(end >= to);
uint sz= static_cast<uint>(end - to);
res_len += sz;
if (packed_addon_fields)
to+= sz;
else
{
if (addonf->length > sz)
bzero(end, addonf->length - sz); // Make Valgrind/MSAN happy
to+= addonf->length;
}
}
}
if (packed_addon_fields)

View File

@@ -8341,8 +8341,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
{
List_iterator<Create_field> dup_it(alter_info->create_list);
for (Create_field *dup= dup_it++; !is_dup && dup != f; dup= dup_it++)
is_dup= my_strcasecmp(default_charset_info,
dup->field_name.str, f->field_name.str) == 0;
is_dup= Lex_ident(dup->field_name).streq(f->field_name);
}
if (!(f->flags & VERS_UPDATE_UNVERSIONED_FLAG) && !is_dup)

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2021, MariaDB Corporation.
Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7028,7 +7028,6 @@ void MYSQL_BIN_LOG::purge()
DBUG_EXECUTE_IF("expire_logs_always", { purge_time = my_time(0); });
if (purge_time >= 0)
{
ha_flush_logs();
purge_logs_before_date(purge_time);
}
DEBUG_SYNC(current_thd, "after_purge_logs_before_date");
@@ -7979,6 +7978,9 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
DBUG_ASSERT(entry != NULL);
cur= entry->thd->wait_for_commit_ptr;
}
result= orig_queue == NULL;
#ifdef WITH_WSREP
if (wsrep_is_active(entry->thd) &&
wsrep_run_commit_hook(entry->thd, entry->all))
@@ -7991,8 +7993,6 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
if (orig_queue == NULL)
result= -3;
}
else
DBUG_ASSERT(result == 0);
#endif /* WITH_WSREP */
if (opt_binlog_commit_wait_count > 0 && orig_queue != NULL)
@@ -8002,7 +8002,6 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
DBUG_PRINT("info", ("Queued for group commit as %s",
(orig_queue == NULL) ? "leader" : "participant"));
result= orig_queue == NULL;
end:
if (backup_lock_released)

View File

@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2021, MariaDB
Copyright (c) 2009, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -3296,7 +3296,8 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
(thd->lex->sql_command == SQLCOM_XA_PREPARE ||
xid_state.get_state_code() == XA_PREPARED))
{
DBUG_ASSERT(thd->lex->xa_opt != XA_ONE_PHASE);
DBUG_ASSERT(!(thd->lex->sql_command == SQLCOM_XA_COMMIT &&
thd->lex->xa_opt == XA_ONE_PHASE));
flags2|= thd->lex->sql_command == SQLCOM_XA_PREPARE ?
FL_PREPARED_XA : FL_COMPLETED_XA;

View File

@@ -549,8 +549,8 @@ int main(int argc, char **argv)
if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
die("mysqld.exe did not start");
if (run_tool(P_WAIT, mysqladmin_path, "--protocol=pipe",
socket_param, "ping", NULL) == 0)
if (run_tool(P_WAIT, mysqladmin_path, "--protocol=pipe", socket_param,
"ping", "--no-beep", NULL) == 0)
{
break;
}

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2021, MariaDB
Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1374,12 +1374,13 @@ bool unix_sock_is_online= false;
static int systemd_sock_activation; /* systemd socket activation */
C_MODE_START
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
/**
Error reporter that buffer log messages.
@param level log message level
@param format log message format string
*/
C_MODE_START
static void buffered_option_error_reporter(enum loglevel level,
const char *format, ...)
{
@@ -1391,6 +1392,7 @@ static void buffered_option_error_reporter(enum loglevel level,
va_end(args);
buffered_logs.buffer(level, buffer);
}
#endif
/**
@@ -5501,7 +5503,7 @@ int mysqld_main(int argc, char **argv)
Initialize the array of performance schema instrument configurations.
*/
init_pfs_instrument_array();
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
/*
Logs generated while parsing the command line
options are buffered and printed later.
@@ -5509,7 +5511,7 @@ int mysqld_main(int argc, char **argv)
buffered_logs.init();
my_getopt_error_reporter= buffered_option_error_reporter;
my_charset_error_reporter= buffered_option_error_reporter;
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
pfs_param.m_pfs_instrument= const_cast<char*>("");
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
my_timer_init(&sys_timer_info);
@@ -7923,7 +7925,8 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument,
if (argument)
{
strmake(server_version, argument, sizeof(server_version) - 1);
set_sys_var_value_origin(&server_version_ptr, sys_var::CONFIG);
set_sys_var_value_origin(&server_version_ptr,
*filename ? sys_var::CONFIG : sys_var::COMMAND_LINE, filename);
using_custom_server_version= true;
}
#ifndef EMBEDDED_LIBRARY
@@ -8689,10 +8692,12 @@ void set_server_version(char *buf, size_t size)
{
bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log;
bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0);
bool is_valgrind= IF_VALGRIND(!strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind"), 0);
strxnmov(buf, size - 1,
MYSQL_SERVER_VERSION,
MYSQL_SERVER_SUFFIX_STR,
IF_EMBEDDED("-embedded", ""),
is_valgrind ? "-valgrind" : "",
is_debug ? "-debug" : "",
is_log ? "-log" : "",
NullS);

View File

@@ -471,12 +471,14 @@ void Opt_trace_context::end()
current_trace= NULL;
}
Opt_trace_start::Opt_trace_start(THD *thd, TABLE_LIST *tbl,
enum enum_sql_command sql_command,
List<set_var_base> *set_vars,
const char *query,
size_t query_length,
const CHARSET_INFO *query_charset):ctx(&thd->opt_trace)
void Opt_trace_start::init(THD *thd,
TABLE_LIST *tbl,
enum enum_sql_command sql_command,
List<set_var_base> *set_vars,
const char *query,
size_t query_length,
const CHARSET_INFO *query_charset)
{
/*
if optimizer trace is enabled and the statment we have is traceable,
@@ -496,6 +498,9 @@ Opt_trace_start::Opt_trace_start(THD *thd, TABLE_LIST *tbl,
ctx->set_query(query, query_length, query_charset);
traceable= TRUE;
opt_trace_disable_if_no_tables_access(thd, tbl);
Json_writer *w= ctx->get_current_json();
w->start_object();
w->add_member("steps").start_array();
}
}
@@ -503,6 +508,9 @@ Opt_trace_start::~Opt_trace_start()
{
if (traceable)
{
Json_writer *w= ctx->get_current_json();
w->end_array();
w->end_object();
ctx->end();
traceable= FALSE;
}

View File

@@ -72,14 +72,18 @@ struct Opt_trace_info
*/
class Opt_trace_start {
class Opt_trace_start
{
public:
Opt_trace_start(THD *thd_arg, TABLE_LIST *tbl,
enum enum_sql_command sql_command,
List<set_var_base> *set_vars,
const char *query,
size_t query_length,
const CHARSET_INFO *query_charset);
Opt_trace_start(THD *thd_arg): ctx(&thd_arg->opt_trace), traceable(false) {}
void init(THD *thd, TABLE_LIST *tbl,
enum enum_sql_command sql_command,
List<set_var_base> *set_vars,
const char *query,
size_t query_length,
const CHARSET_INFO *query_charset);
~Opt_trace_start();
private:

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