Commit 7c477360 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

New upstream version 10.1.34

parent 5a2d9853
...@@ -45,6 +45,13 @@ extern void free_defaults(char **argv); ...@@ -45,6 +45,13 @@ extern void free_defaults(char **argv);
extern void my_print_default_files(const char *conf_file); extern void my_print_default_files(const char *conf_file);
extern void print_defaults(const char *conf_file, const char **groups); extern void print_defaults(const char *conf_file, const char **groups);
/** Simplify load_defaults() common use */
#define load_defaults_or_exit(A, B, C, D) switch (load_defaults(A, B, C, D)) { \
case 0: break; \
case 4: my_end(0); exit(0); \
default: my_end(0); exit(1); }
C_MODE_END C_MODE_END
#endif /* MY_DEFAULT_INCLUDED */ #endif /* MY_DEFAULT_INCLUDED */
...@@ -593,8 +593,15 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -593,8 +593,15 @@ typedef SOCKET_SIZE_TYPE size_socket;
#ifndef O_CLOEXEC #ifndef O_CLOEXEC
#define O_CLOEXEC 0 #define O_CLOEXEC 0
#endif #endif
#ifdef __GLIBC__
#define STR_O_CLOEXEC "e"
#else
#define STR_O_CLOEXEC ""
#endif
#ifndef SOCK_CLOEXEC #ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0 #define SOCK_CLOEXEC 0
#else
#define HAVE_SOCK_CLOEXEC
#endif #endif
/* additional file share flags for win32 */ /* additional file share flags for win32 */
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
*/ */
#ifndef MY_SYSTEMD_INCLUDED #ifndef MY_SERVICE_MANAGER_INCLUDED
#define MY_SYSTEMD_INCLUDED #define MY_SERVICE_MANAGER_INCLUDED
#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY) #if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY)
/* /*
...@@ -26,9 +26,14 @@ ...@@ -26,9 +26,14 @@
*/ */
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <systemd/sd-daemon.h> #include <systemd/sd-daemon.h>
/** INTERVAL in seconds followed by printf style status */
#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \
sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000)
#else #else
#define sd_notify(X, Y) #define sd_notify(X, Y)
#define sd_notifyf(E, F, ...) #define sd_notifyf(E, F, ...)
#define service_manager_extend_timeout(I, FMTSTR, ...)
#endif #endif
#endif /* MY_SYSTEMD_INCLUDED */ #endif /* MY_SERVICE_MANAGER_INCLUDED */
...@@ -112,6 +112,7 @@ typedef struct my_aio_result { ...@@ -112,6 +112,7 @@ typedef struct my_aio_result {
#define ME_JUST_INFO 1024 /**< not error but just info */ #define ME_JUST_INFO 1024 /**< not error but just info */
#define ME_JUST_WARNING 2048 /**< not error but just warning */ #define ME_JUST_WARNING 2048 /**< not error but just warning */
#define ME_FATALERROR 4096 /* Fatal statement error */ #define ME_FATALERROR 4096 /* Fatal statement error */
#define ME_LOG_AS_WARN 8192 /* is error but error-logged as warning */
/* Bits in last argument to fn_format */ /* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len) # define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
#elif defined(__SANITIZE_ADDRESS__) #elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h> # include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len) # define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len) # define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
......
...@@ -562,6 +562,12 @@ inline_mysql_socket_socket ...@@ -562,6 +562,12 @@ inline_mysql_socket_socket
(key, (const my_socket*)&mysql_socket.fd, NULL, 0); (key, (const my_socket*)&mysql_socket.fd, NULL, 0);
} }
#endif #endif
/* SOCK_CLOEXEC isn't always a number - can't preprocessor compare */
#if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) && !defined(HAVE_SOCK_CLOEXEC)
(void) fcntl(mysql_socket.fd, F_SETFD, FD_CLOEXEC);
#endif
return mysql_socket; return mysql_socket;
} }
......
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. /* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
......
#ifndef SQL_COMMON_INCLUDED #ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED #define SQL_COMMON_INCLUDED
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates. /* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
......
...@@ -32,345 +32,97 @@ INSERT INTO tt_2(ddl_case) VALUES(0); ...@@ -32,345 +32,97 @@ INSERT INTO tt_2(ddl_case) VALUES(0);
--echo # CHECK IMPLICT COMMIT --echo # CHECK IMPLICT COMMIT
--echo ######################################################################### --echo #########################################################################
SET AUTOCOMMIT= 0; SET AUTOCOMMIT= 0;
let $ddl_cases= 43;
while ($ddl_cases >= 1)
{
--echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
let $in_temporary= no;
let $ok= yes;
#
# In SBR and MIXED modes, the commit event is usually the third event in the
# binary log:
#
# 1: BEGIN
# 2: INSERT
# 3: COMMIT
# 4: DDL EVENT which triggered the previous commmit.
#
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
let $commit_event_row_number= 3;
}
#
# In RBR mode, the commit event is usually the fourth event in the binary log:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
# 5: DDL EVENT which triggered the previous commmit.
#
if (`select @@binlog_format = 'ROW'`)
{
let $commit_event_row_number= 4;
}
let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1);
--enable_query_log
eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases);
if ($ddl_cases == 43) INSERT INTO tt_1(ddl_case) VALUES (43);
{ replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB;
let $cmd= CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
} INSERT INTO tt_1(ddl_case) VALUES (42);
if ($ddl_cases == 42) DROP FUNCTION myfunc_int;
{ INSERT INTO tt_1(ddl_case) VALUES (41);
let $cmd= DROP FUNCTION myfunc_int; LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES;
} INSERT INTO tt_1(ddl_case) VALUES (40);
if ($ddl_cases == 41) LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES;
{ INSERT INTO tt_1(ddl_case) VALUES (39);
let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; ANALYZE TABLE nt_1;
} INSERT INTO tt_1(ddl_case) VALUES (38);
if ($ddl_cases == 40) CHECK TABLE nt_1;
{ INSERT INTO tt_1(ddl_case) VALUES (37);
let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES; OPTIMIZE TABLE nt_1;
} INSERT INTO tt_1(ddl_case) VALUES (36);
if ($ddl_cases == 39) REPAIR TABLE nt_1;
{ INSERT INTO tt_1(ddl_case) VALUES (35);
let $cmd= ANALYZE TABLE nt_1; LOCK TABLES tt_1 WRITE;
} INSERT INTO tt_1(ddl_case) VALUES (34);
if ($ddl_cases == 38) UNLOCK TABLES;
{ INSERT INTO tt_1(ddl_case) VALUES (33);
let $cmd= CHECK TABLE nt_1; CREATE USER 'user'@'localhost';
} INSERT INTO tt_1(ddl_case) VALUES (32);
if ($ddl_cases == 37) GRANT ALL ON *.* TO 'user'@'localhost';
{ INSERT INTO tt_1(ddl_case) VALUES (31);
let $cmd= OPTIMIZE TABLE nt_1; SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass');
} INSERT INTO tt_1(ddl_case) VALUES (30);
if ($ddl_cases == 36) REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
{ INSERT INTO tt_1(ddl_case) VALUES (29);
let $cmd= REPAIR TABLE nt_1; RENAME USER 'user'@'localhost' TO 'user_new'@'localhost';
} INSERT INTO tt_1(ddl_case) VALUES (28);
if ($ddl_cases == 35) DROP USER 'user_new'@'localhost';
{ INSERT INTO tt_1(ddl_case) VALUES (27);
let $cmd= LOCK TABLES tt_1 WRITE; CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
} INSERT INTO tt_1(ddl_case) VALUES (26);
if ($ddl_cases == 34) ALTER EVENT evt COMMENT 'evt';
{ INSERT INTO tt_1(ddl_case) VALUES (25);
let $cmd= UNLOCK TABLES; DROP EVENT evt;
} INSERT INTO tt_1(ddl_case) VALUES (24);
if ($ddl_cases == 33) CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
{ INSERT INTO tt_1(ddl_case) VALUES (23);
let $cmd= CREATE USER 'user'@'localhost'; DROP TRIGGER tr;
} INSERT INTO tt_1(ddl_case) VALUES (22);
if ($ddl_cases == 32) CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
{ INSERT INTO tt_1(ddl_case) VALUES (21);
let $cmd= GRANT ALL ON *.* TO 'user'@'localhost'; ALTER FUNCTION fc COMMENT 'fc';
} INSERT INTO tt_1(ddl_case) VALUES (20);
if ($ddl_cases == 31) DROP FUNCTION fc;
{ INSERT INTO tt_1(ddl_case) VALUES (19);
let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass'); CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
} INSERT INTO tt_1(ddl_case) VALUES (18);
if ($ddl_cases == 30) ALTER PROCEDURE pc COMMENT 'pc';
{ INSERT INTO tt_1(ddl_case) VALUES (17);
let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost'; DROP PROCEDURE pc;
} INSERT INTO tt_1(ddl_case) VALUES (16);
if ($ddl_cases == 29) CREATE VIEW v AS SELECT * FROM tt_1;
{ INSERT INTO tt_1(ddl_case) VALUES (15);
let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost'; ALTER VIEW v AS SELECT * FROM tt_1;
} INSERT INTO tt_1(ddl_case) VALUES (14);
if ($ddl_cases == 28) DROP VIEW v;
{ INSERT INTO tt_1(ddl_case) VALUES (13);
let $cmd= DROP USER 'user_new'@'localhost'; CREATE INDEX ix ON tt_1(ddl_case);
} INSERT INTO tt_1(ddl_case) VALUES (12);
if ($ddl_cases == 27) DROP INDEX ix ON tt_1;
{ INSERT INTO tt_1(ddl_case) VALUES (11);
let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; CREATE TEMPORARY TABLE tt_xx (a int);
} INSERT INTO tt_1(ddl_case) VALUES (10);
if ($ddl_cases == 26) ALTER TABLE tt_xx ADD COLUMN (b int);
{ INSERT INTO tt_1(ddl_case) VALUES (9);
let $cmd= ALTER EVENT evt COMMENT 'evt'; ALTER TABLE tt_xx RENAME new_tt_xx;
} INSERT INTO tt_1(ddl_case) VALUES (8);
if ($ddl_cases == 25) DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
{ INSERT INTO tt_1(ddl_case) VALUES (7);
let $cmd= DROP EVENT evt; CREATE TABLE tt_xx (a int);
} INSERT INTO tt_1(ddl_case) VALUES (6);
if ($ddl_cases == 24) ALTER TABLE tt_xx ADD COLUMN (b int);
{ INSERT INTO tt_1(ddl_case) VALUES (5);
let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case; RENAME TABLE tt_xx TO new_tt_xx;
} INSERT INTO tt_1(ddl_case) VALUES (4);
if ($ddl_cases == 23) TRUNCATE TABLE new_tt_xx;
{ INSERT INTO tt_1(ddl_case) VALUES (3);
let $cmd= DROP TRIGGER tr; DROP TABLE IF EXISTS tt_xx, new_tt_xx;
# INSERT INTO tt_1(ddl_case) VALUES (2);
# In RBR mode, due to the trigger the tt_2 is also updated: CREATE DATABASE db;
# INSERT INTO tt_1(ddl_case) VALUES (1);
# 1: BEGIN DROP DATABASE IF EXISTS db;
# 2: TABLE MAP EVENT
# 3: TABLE MAP EVENT source include/show_binlog_events.inc;
# 4: ROW EVENT
# 5: COMMIT
# 6: DDL EVENT which triggered the previous commmit.
#
if (`select @@binlog_format = 'ROW'`)
{
let $commit_event_row_number= 5;
}
}
if ($ddl_cases == 22)
{
let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
}
if ($ddl_cases == 21)
{
let $cmd= ALTER FUNCTION fc COMMENT 'fc';
}
if ($ddl_cases == 20)
{
let $cmd= DROP FUNCTION fc;
}
if ($ddl_cases == 19)
{
let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
}
if ($ddl_cases == 18)
{
let $cmd= ALTER PROCEDURE pc COMMENT 'pc';
}
if ($ddl_cases == 17)
{
let $cmd= DROP PROCEDURE pc;
}
if ($ddl_cases == 16)
{
let $cmd= CREATE VIEW v AS SELECT * FROM tt_1;
}
if ($ddl_cases == 15)
{
let $cmd= ALTER VIEW v AS SELECT * FROM tt_1;
}
if ($ddl_cases == 14)
{
let $cmd= DROP VIEW v;
}
if ($ddl_cases == 13)
{
let $cmd= CREATE INDEX ix ON tt_1(ddl_case);
}
if ($ddl_cases == 12)
{
let $cmd= DROP INDEX ix ON tt_1;
}
if ($ddl_cases == 11)
{
let $cmd= CREATE TEMPORARY TABLE tt_xx (a int);
let $in_temporary= yes;
# In SBR and MIXED modes, the DDL statement is written to the binary log but
# does not commit the current transaction.
#
# 1: BEGIN
# 2: CREATE TEMPORARY
# 3: INSERT
# 4: COMMIT
#
# In RBR the transaction is not committed either and the statement is not
# written to the binary log:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
#
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'` )
{
let $commit_event_row_number= 4;
}
}
if ($ddl_cases == 10)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
#
# In MIXED mode, the changes are logged as rows and we have what follows:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
# 5: DDL EVENT which triggered the previous commmit.
#
if (`select @@binlog_format = 'MIXED'`)
{
let $commit_event_row_number= 4;
}
}
if ($ddl_cases == 9)
{
let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx;
#
# In MIXED mode, the changes are logged as rows and we have what follows:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
# 5: DDL EVENT which triggered the previous commmit.
#
if (`select @@binlog_format = 'MIXED'`)
{
let $commit_event_row_number= 4;
}
}
if ($ddl_cases == 8)
{
let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
let $in_temporary= yes;
#
# In SBR and MIXED modes, the DDL statement is written to the binary log
# but does not commit the current transaction:
#
# In SBR, we have what follows:
#
# 1: BEGIN
# 2: INSERT
# 3: DROP TEMPORARY
# 4: COMMIT
#
# In RBR the transaction is not committed either and the statement is not
# written to the binary log:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
#
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'ROW'`)
{
let $commit_event_row_number= 4;
}
# In MIXED mode, the changes are logged as rows and we have what follows:
#
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: DROP TEMPORARY
# 5: COMMIT
#
if (`select @@binlog_format = 'MIXED'`)
{
let $commit_event_row_number= 5;
}
}
if ($ddl_cases == 7)
{
let $cmd= CREATE TABLE tt_xx (a int);
}
if ($ddl_cases == 6)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
}
if ($ddl_cases == 5)
{
let $cmd= RENAME TABLE tt_xx TO new_tt_xx;
}
if ($ddl_cases == 4)
{
let $cmd= TRUNCATE TABLE new_tt_xx;
}
if ($ddl_cases == 3)
{
let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx;
}
if ($ddl_cases == 2)
{
let $cmd= CREATE DATABASE db;
}
if ($ddl_cases == 1)
{
let $cmd= DROP DATABASE IF EXISTS db;
}
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
--eval $cmd
--disable_query_log
#
# When a temporary table is either created or dropped, there is no implicit
# commit. The flag in_temporary is used to avoid aborting the test in such
# cases. Thus we force the commit.
#
if ($in_temporary == yes)
{
--eval COMMIT
}
let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number);
if (`SELECT SUBSTRING("$event_commit",1,6) != "COMMIT"`)
{
if ($ok == yes)
{
--echo it *does not* commit the current transaction.
--echo $cmd
--echo $event_commit
SHOW BINLOG EVENTS;
exit;
}
}
--echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
let $binlog_start= $first_binlog_position;
--echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
--source include/show_binlog_events.inc
--echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
--echo
dec $ddl_cases;
}
SET AUTOCOMMIT= 1; SET AUTOCOMMIT= 1;
--echo ################################################################################### --echo ###################################################################################
......
let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'ON'; # include/galera_wait_ready.inc
--source include/wait_condition.inc #
# Waits for galera node to transition to READY state.
#
--enable_reconnect
--disable_query_log
--disable_result_log
let $wait_counter = 600;
while ($wait_counter)
{
--disable_abort_on_error
let $success = `SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'`;
--enable_abort_on_error
if ($success)
{
let $wait_counter = 0;
}
if (!$success)
{
real_sleep 0.1;
dec $wait_counter;
}
}
if (!$success)
{
die "Server did not transition to READY state";
}
--disable_reconnect
--enable_query_log
--enable_result_log
[redundant]
innodb_default_row_format=redundant
[compact]
innodb_default_row_format=compact
[dynamic]
innodb_default_row_format=dynamic
# The goal of including this file is to enable innodb_default_row_format
# combinations (see include/innodb_row_format.combinations)
--source include/have_innodb.inc
[debug]
--enable-gdb
[release]
--disable-gdb
# include file for test files that can be run with and without debug
# having debug and non-debug tests.
let $have_debug=`select version() like '%debug%'`;
...@@ -50,9 +50,6 @@ if (!$restart_parameters) ...@@ -50,9 +50,6 @@ if (!$restart_parameters)
# Call script that will poll the server waiting for it to be back online again # Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
# Wait for wsrep
--source include/wait_wsrep_ready.inc
# Turn off reconnect again # Turn off reconnect again
--disable_reconnect --disable_reconnect
...@@ -16,9 +16,6 @@ if (!$restart_parameters) ...@@ -16,9 +16,6 @@ if (!$restart_parameters)
# Call script that will poll the server waiting for it to be back online again # Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
# Wait for wsrep
--source include/wait_wsrep_ready.inc
# Turn off reconnect again # Turn off reconnect again
--disable_reconnect --disable_reconnect
...@@ -39,7 +39,7 @@ let $wait_timeout= 0; ...@@ -39,7 +39,7 @@ let $wait_timeout= 0;
let $wait_condition_reps= 0; let $wait_condition_reps= 0;
while ($wait_counter) while ($wait_counter)
{ {
--error 0,ER_NO_SUCH_TABLE,ER_LOCK_WAIT_TIMEOUT,ER_UNKNOWN_COM_ERROR --error 0,ER_NO_SUCH_TABLE,ER_LOCK_WAIT_TIMEOUT,ER_UNKNOWN_COM_ERROR,ER_LOCK_DEADLOCK
let $success= `$wait_condition`; let $success= `$wait_condition`;
inc $wait_condition_reps; inc $wait_condition_reps;
if ($success) if ($success)
......
...@@ -14,7 +14,7 @@ while ($mysql_errno) ...@@ -14,7 +14,7 @@ while ($mysql_errno)
# Strangely enough, the server might return "Too many connections" # Strangely enough, the server might return "Too many connections"
# while being shutdown, thus 1040 is an "allowed" error # while being shutdown, thus 1040 is an "allowed" error
# See BUG#36228 # See BUG#36228
--error 0,1040,1053,2002,2003,2005,2006,2013,1927 --error 0,ER_CON_COUNT_ERROR,ER_SERVER_SHUTDOWN,ER_LOCK_WAIT_TIMEOUT,ER_CONNECTION_KILLED,2002,2003,2005,2006,2013
show status; show status;
dec $counter; dec $counter;
...@@ -26,3 +26,9 @@ while ($mysql_errno) ...@@ -26,3 +26,9 @@ while ($mysql_errno)
} }
--enable_query_log --enable_query_log
--enable_result_log --enable_result_log
# WSREP: SHOW STATUS queries are allowed even if wsrep
# is not ready. Make sure wsrep is ready before
# returning from this script
--source include/wait_wsrep_ready.inc
...@@ -186,8 +186,10 @@ sub create_process { ...@@ -186,8 +186,10 @@ sub create_process {
# it and any childs(that hasn't changed group themself) # it and any childs(that hasn't changed group themself)
setpgrp(0,0) if $opts{setpgrp}; setpgrp(0,0) if $opts{setpgrp};
if ( $output and !open(STDOUT, $open_mode, $output) ) { if ( $output ) {
croak("can't redirect STDOUT to '$output': $!"); close STDOUT;
open(STDOUT, $open_mode, $output)
or croak "can't redirect STDOUT to '$output': $!";
} }
if ( $error ) { if ( $error ) {
...@@ -196,8 +198,10 @@ sub create_process { ...@@ -196,8 +198,10 @@ sub create_process {
croak("can't dup STDOUT: $!"); croak("can't dup STDOUT: $!");
} }
} }
elsif ( ! open(STDERR, $open_mode, $error) ) { else {
croak("can't redirect STDERR to '$error': $!"); close STDERR;
open(STDERR, $open_mode, $error)
or croak "can't redirect STDERR to '$error': $!";
} }
} }
......
...@@ -89,7 +89,7 @@ static void die(const char* fmt, ...) ...@@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
} }
static void kill_child(bool was_killed) static int kill_child(bool was_killed)
{ {
int status= 0; int status= 0;
...@@ -108,15 +108,15 @@ static void kill_child(bool was_killed) ...@@ -108,15 +108,15 @@ static void kill_child(bool was_killed)
exit_code= WEXITSTATUS(status); exit_code= WEXITSTATUS(status);
message("Child exit: %d", exit_code); message("Child exit: %d", exit_code);
// Exit with exit status of the child // Exit with exit status of the child
exit(exit_code); return exit_code;
} }
if (WIFSIGNALED(status)) if (WIFSIGNALED(status))
message("Child killed by signal: %d", WTERMSIG(status)); message("Child killed by signal: %d", WTERMSIG(status));
exit(exit_code); return exit_code;
} }
exit(5); return 5;
} }
...@@ -136,7 +136,7 @@ extern "C" void handle_signal(int sig) ...@@ -136,7 +136,7 @@ extern "C" void handle_signal(int sig)
terminated= 1; terminated= 1;
if (child_pid > 0) if (child_pid > 0)
kill_child(sig == SIGCHLD); _exit(kill_child(sig == SIGCHLD));
// Ignore further signals // Ignore further signals
signal(SIGTERM, SIG_IGN); signal(SIGTERM, SIG_IGN);
...@@ -300,8 +300,6 @@ int main(int argc, char* const argv[] ) ...@@ -300,8 +300,6 @@ int main(int argc, char* const argv[] )
/* Wait for parent or child to die */ /* Wait for parent or child to die */
sleep(1); sleep(1);
} }
kill_child(0); return kill_child(0);
return 4;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment