Skip to content

Commit

Permalink
Merge 11.1 into 11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jan 5, 2024
2 parents fef31a2 + 2edc1ad commit f6d21a8
Show file tree
Hide file tree
Showing 111 changed files with 1,531 additions and 460 deletions.
1 change: 1 addition & 0 deletions extra/mariabackup/backup_copy.cc
Expand Up @@ -1618,6 +1618,7 @@ ibx_copy_incremental_over_full()
NULL};
const char *sup_files[] = {MB_BINLOG_INFO,
MB_GALERA_INFO,
XTRABACKUP_DONOR_GALERA_INFO,
MB_SLAVE_INFO,
MB_INFO,
XTRABACKUP_BINLOG_INFO,
Expand Down
1 change: 1 addition & 0 deletions extra/mariabackup/backup_copy.h
Expand Up @@ -9,6 +9,7 @@
/* special files, backward compatibility */
#define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info"
#define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info"
#define XTRABACKUP_DONOR_GALERA_INFO "donor_galera_info"
#define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_info"
#define XTRABACKUP_INFO "xtrabackup_info"
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
Expand Down
28 changes: 26 additions & 2 deletions extra/mariabackup/backup_mysql.cc
Expand Up @@ -1360,6 +1360,7 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
{
char *state_uuid = NULL, *state_uuid55 = NULL;
char *last_committed = NULL, *last_committed55 = NULL;
char *domain_id = NULL, *domain_id55 = NULL;
bool result;

mysql_variable status[] = {
Expand All @@ -1370,6 +1371,12 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
{NULL, NULL}
};

mysql_variable value[] = {
{"Wsrep_gtid_domain_id", &domain_id},
{"wsrep_gtid_domain_id", &domain_id55},
{NULL, NULL}
};

/* When backup locks are supported by the server, we should skip
creating MB_GALERA_INFO file on the backup stage, because
wsrep_local_state_uuid and wsrep_last_committed will be inconsistent
Expand All @@ -1388,9 +1395,26 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
goto cleanup;
}

read_mysql_variables(connection, "SHOW VARIABLES LIKE 'wsrep%'", value, true);

if (domain_id == NULL && domain_id55 == NULL) {
msg("Warning: failed to get master wsrep state from SHOW VARIABLES.");
result = true;
goto cleanup;
}

result = datasink->backup_file_printf(MB_GALERA_INFO,
"%s:%s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55);
"%s:%s %s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55,
domain_id ? domain_id : domain_id55);

if (result)
{
result= datasink->backup_file_printf(XTRABACKUP_DONOR_GALERA_INFO,
"%s:%s %s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55,
domain_id ? domain_id : domain_id55);
}
if (result)
{
write_current_binlog_file(datasink, connection);
Expand Down
10 changes: 6 additions & 4 deletions extra/mariabackup/wsrep.cc
Expand Up @@ -54,6 +54,7 @@ permission notice:
/*! Name of file where Galera info is stored on recovery */
#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
#define MB_GALERA_INFO_FILENAME "mariadb_backup_galera_info"
#define XB_GALERA_DONOR_INFO_FILENAME "donor_galera_info"

/***********************************************************************
Store Galera checkpoint info in the MB_GALERA_INFO_FILENAME file, if that
Expand All @@ -68,7 +69,7 @@ xb_write_galera_info(bool incremental_prepare)
long long seqno;
MY_STAT statinfo;

/* Do not overwrite existing an existing file to be compatible with
/* Do not overwrite an existing file to be compatible with
servers with older server versions */
if (!incremental_prepare &&
(my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL ||
Expand Down Expand Up @@ -103,10 +104,11 @@ xb_write_galera_info(bool incremental_prepare)

seqno = wsrep_xid_seqno(&xid);

msg("mariabackup: Recovered WSREP position: %s:%lld\n",
uuid_str, (long long) seqno);
msg("mariabackup: Recovered WSREP position: %s:%lld domain_id: %lld\n",
uuid_str, (long long) seqno, (long long)wsrep_get_domain_id());

if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
if (fprintf(fp, "%s:%lld %lld", uuid_str, (long long) seqno,
(long long)wsrep_get_domain_id()) < 0) {

die(
"could not write to " MB_GALERA_INFO_FILENAME
Expand Down
4 changes: 2 additions & 2 deletions include/my_pthread.h
Expand Up @@ -673,10 +673,10 @@ extern void my_mutex_end(void);
by GCC 12.3.0, GCC 13.2.0, or clang 16.0.6
would fail ./mtr main.1st when the stack size is 5 MiB.
The minimum is more than 6 MiB for CMAKE_BUILD_TYPE=RelWithDebInfo and
more than 8 MiB for CMAKE_BUILD_TYPE=Debug.
more than 10 MiB for CMAKE_BUILD_TYPE=Debug.
Let us add some safety margin.
*/
# define DEFAULT_THREAD_STACK (10L<<20)
# define DEFAULT_THREAD_STACK (11L<<20)
# else
# define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */
# endif
Expand Down
3 changes: 3 additions & 0 deletions include/mysql/service_wsrep.h
Expand Up @@ -95,6 +95,7 @@ extern struct wsrep_service_st {
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);
uint32 (*wsrep_get_domain_id_func)();
} *wsrep_service;

#define MYSQL_SERVICE_WSREP_INCLUDED
Expand Down Expand Up @@ -144,6 +145,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_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)
#define wsrep_get_domain_id(T) wsrep_service->wsrep_get_domain_id_func(T)
#else

#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
Expand Down Expand Up @@ -253,5 +255,6 @@ 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);
extern "C" uint32 wsrep_get_domain_id();
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */
5 changes: 5 additions & 0 deletions mysql-test/include/galera_sst_method.combinations
@@ -0,0 +1,5 @@
[rsync]
wsrep-sst-method=rsync

[mariabackup]
wsrep_sst_method=mariabackup
4 changes: 4 additions & 0 deletions mysql-test/include/galera_sst_method.inc
@@ -0,0 +1,4 @@
# The goal of including this file is to enable galera_sst_method combinations
# (see include/galera_sst_method.combinations)

--source include/have_innodb.inc
36 changes: 36 additions & 0 deletions mysql-test/main/lowercase_table5.result
Expand Up @@ -11,3 +11,39 @@ Database Create Database
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */
DROP DATABASE mysql_test;
DROP DATABASE mysql_TEST;
#
# Start of 10.4 tests
#
#
# MDEV-33019 The database part is not case sensitive in SP names
#
CREATE DATABASE DB1;
CREATE DATABASE db1;
CREATE PROCEDURE DB1.sp() SELECT 'This is DB1.sp' AS ret;
CREATE PROCEDURE db1.sp() SELECT 'This is db1.sp' AS ret;
CALL DB1.sp();
ret
This is DB1.sp
CALL db1.sp();
ret
This is db1.sp
DROP DATABASE DB1;
CALL DB1.sp();
ERROR 42000: PROCEDURE DB1.sp does not exist
CALL db1.sp();
ret
This is db1.sp
DROP DATABASE db1;
CREATE PROCEDURE SP() SELECT 'This is SP' AS ret;
CREATE PROCEDURE sp() SELECT 'This is sp' AS ret;
ERROR 42000: PROCEDURE sp already exists
CALL SP();
ret
This is SP
CALL sp();
ret
This is SP
DROP PROCEDURE SP;
#
# End of 10.4 tests
#
31 changes: 31 additions & 0 deletions mysql-test/main/lowercase_table5.test
Expand Up @@ -18,3 +18,34 @@ DROP DATABASE mysql_test;
DROP DATABASE mysql_TEST;

# End of 10.0 tests

--echo #
--echo # Start of 10.4 tests
--echo #

--echo #
--echo # MDEV-33019 The database part is not case sensitive in SP names
--echo #

CREATE DATABASE DB1;
CREATE DATABASE db1;
CREATE PROCEDURE DB1.sp() SELECT 'This is DB1.sp' AS ret;
CREATE PROCEDURE db1.sp() SELECT 'This is db1.sp' AS ret;
CALL DB1.sp();
CALL db1.sp();
DROP DATABASE DB1;
--error ER_SP_DOES_NOT_EXIST
CALL DB1.sp();
CALL db1.sp();
DROP DATABASE db1;

CREATE PROCEDURE SP() SELECT 'This is SP' AS ret;
--error ER_SP_ALREADY_EXISTS
CREATE PROCEDURE sp() SELECT 'This is sp' AS ret;
CALL SP();
CALL sp();
DROP PROCEDURE SP;

--echo #
--echo # End of 10.4 tests
--echo #
100 changes: 100 additions & 0 deletions mysql-test/main/subselect4.result
Expand Up @@ -3252,4 +3252,104 @@ FROM x
)
);
ERROR 21000: Operand should contain 2 column(s)
#
# MDEV-29362: Constant subquery used as left part of IN subquery
#
CREATE TABLE t1 (a int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (15), (1), (2);
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (15), (1);
CREATE TABLE t3 (c int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (15), (1);
SET optimizer_switch='condition_pushdown_from_having=off';
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
a
2
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );
a
1
SET optimizer_switch='condition_pushdown_from_having=on';
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
a
2
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );
a
1
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 0.012403489,
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 3,
"cost": 0.010504815,
"filtered": 100,
"attached_condition": "t1.a = <cache>((<in_optimizer>((subquery#2),<exists>(subquery#3))) + 1)"
}
}
],
"subqueries": [
{
"query_block": {
"select_id": 3,
"cost": 0.01034841,
"having_condition": "trigcond(t3.c is null)",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 0.01034841,
"filtered": 100,
"attached_condition": "trigcond(1 = t3.c or t3.c is null)"
}
}
]
}
},
{
"query_block": {
"select_id": 2,
"cost": 0.01034841,
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 0.01034841,
"filtered": 100,
"attached_condition": "t2.b = 1"
}
}
]
}
}
]
}
}
PREPARE stmt FROM "SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1";
EXECUTE stmt;
a
2
EXECUTE stmt;
a
2
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2,t3;
# End of 10.4 tests
36 changes: 36 additions & 0 deletions mysql-test/main/subselect4.test
Expand Up @@ -2637,6 +2637,42 @@ SELECT
)
);

--echo #
--echo # MDEV-29362: Constant subquery used as left part of IN subquery
--echo #

CREATE TABLE t1 (a int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (15), (1), (2);
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (15), (1);
CREATE TABLE t3 (c int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (15), (1);

let $q1=
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
let $q2=
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );

SET optimizer_switch='condition_pushdown_from_having=off';

eval $q1;
eval $q2;

SET optimizer_switch='condition_pushdown_from_having=on';

eval $q1;
eval $q2;

eval EXPLAIN FORMAT=JSON $q1;

eval PREPARE stmt FROM "$q1";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

DROP TABLE t1,t2,t3;

--echo # End of 10.4 tests

3 changes: 2 additions & 1 deletion mysql-test/main/type_timestamp.result
Expand Up @@ -1370,7 +1370,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
#
# End of 10.10 tests
# End of 10.5 tests
#
#
# MDEV-32203 Raise notes when an index cannot be used on data type mismatch
Expand Down Expand Up @@ -1491,3 +1491,4 @@ indexed_col not_indexed_col
DROP TABLE t2;
DROP TABLE t1;
SET note_verbosity=DEFAULT;
# End of 10.6 tests
4 changes: 3 additions & 1 deletion mysql-test/main/type_timestamp.test
Expand Up @@ -921,7 +921,7 @@ show create table t1;
drop table t1;

--echo #
--echo # End of 10.10 tests
--echo # End of 10.5 tests
--echo #

--echo #
Expand All @@ -941,3 +941,5 @@ DELIMITER ;$$
--source unusable_keys_joins.inc
DROP TABLE t1;
SET note_verbosity=DEFAULT;

--echo # End of 10.6 tests

0 comments on commit f6d21a8

Please sign in to comment.