Skip to content

Commit 81523ba

Browse files
committed
Merge 10.4 into 10.5
2 parents 0b92c7b + 22d2df8 commit 81523ba

15 files changed

+170
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
2-
# Copyright (c) 2008, 2021, MariaDB Corporation.
2+
# Copyright (c) 2008, 2022, MariaDB Corporation.
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -91,9 +91,11 @@ SET(MYSQL_PROJECT_NAME_DOCSTRING "MySQL project name")
9191

9292
IF(CMAKE_VERSION VERSION_LESS "3.1")
9393
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
94+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
9495
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
9596
ENDIF()
9697
ELSE()
98+
SET(CMAKE_C_STANDARD 99)
9799
SET(CMAKE_CXX_STANDARD 11)
98100
ENDIF()
99101

debian/autobake-deb.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
# Exit immediately on any error
1212
set -e
1313

14+
CODENAME="$(lsb_release -sc)"
15+
case "${CODENAME}" in
16+
stretch)
17+
# MDEV-28022 libzstd-dev-1.1.3 minimum version
18+
sed -i -e '/libzstd-dev/d' debian/control
19+
;;
20+
esac
21+
1422
# This file is invoked from Buildbot and Travis-CI to build deb packages.
1523
# As both of those CI systems have many parallel jobs that include different
1624
# parts of the test suite, we don't need to run the mysql-test-run at all when
@@ -80,7 +88,6 @@ source ./VERSION
8088
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
8189
PATCHLEVEL="+maria"
8290
LOGSTRING="MariaDB build"
83-
CODENAME="$(lsb_release -sc)"
8491
EPOCH="1:"
8592
VERSION="${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME}"
8693

mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
104104
SHOW WARNINGS;
105105
Level Code Message
106106
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
107+
CREATE TABLE t3 (a INT(11) DEFAULT NULL);
108+
INSERT INTO t3 VALUES (1);
109+
CREATE TABLE t4 (a INT(11) DEFAULT NULL, b BIGINT(20) DEFAULT uuid_short()) SELECT * FROM t3;
110+
Warnings:
111+
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
112+
SHOW WARNINGS;
113+
Level Code Message
114+
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
115+
CREATE OR REPLACE TABLE t4 (a INT(11) DEFAULT NULL) SELECT * FROM t3;
116+
SHOW WARNINGS;
117+
Level Code Message
107118
DROP FUNCTION sf_bug50192;
108119
DROP TRIGGER tr_bug50192;
109-
DROP TABLE t1, t2;
120+
DROP TABLE t1, t2, t3, t4;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
2+
select @@innodb_autoinc_lock_mode;
3+
@@innodb_autoinc_lock_mode
4+
2
5+
select @@binlog_format;
6+
@@binlog_format
7+
MIXED
8+
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=InnoDB;
9+
insert into t1 values (NULL,1);
10+
include/show_binlog_events.inc
11+
Log_name Pos Event_type Server_id End_log_pos Info
12+
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
13+
master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
14+
master-bin.000001 # Query # # COMMIT
15+
master-bin.000001 # Gtid # # GTID #-#-#
16+
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment,b int, primary key (a)) engine=InnoDB
17+
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
18+
master-bin.000001 # Annotate_rows # # insert into t1 values (NULL,1)
19+
master-bin.000001 # Table_map # # table_id: # (test.t1)
20+
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
21+
master-bin.000001 # Xid # # COMMIT /* XID */
22+
set global binlog_format=STATEMENT;
23+
connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
24+
insert into t1 values (NULL,1);
25+
Warnings:
26+
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
27+
insert into t1 values (NULL,1);
28+
Warnings:
29+
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
30+
disconnect con1;
31+
connection default;
32+
set global binlog_format=MIXED;
33+
DROP TABLE t1;

mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,20 @@ SHOW WARNINGS;
189189
SELECT sf_bug50192();
190190
SHOW WARNINGS;
191191

192+
# The test proves MDEV-24617 fixes leave in force
193+
# unsafe warnings in non-deterministic CREATE..SELECT cases.
194+
# Below an inserted default value to `b` of the target table is replication
195+
# unsafe. A warning must be out.
196+
CREATE TABLE t3 (a INT(11) DEFAULT NULL);
197+
INSERT INTO t3 VALUES (1);
198+
CREATE TABLE t4 (a INT(11) DEFAULT NULL, b BIGINT(20) DEFAULT uuid_short()) SELECT * FROM t3;
199+
SHOW WARNINGS;
200+
# no warning out of a deterministic "rhs" of SELECT
201+
CREATE OR REPLACE TABLE t4 (a INT(11) DEFAULT NULL) SELECT * FROM t3;
202+
SHOW WARNINGS;
203+
192204
# cleanup
193205

194206
DROP FUNCTION sf_bug50192;
195207
DROP TRIGGER tr_bug50192;
196-
DROP TABLE t1, t2;
208+
DROP TABLE t1, t2, t3, t4;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--innodb_autoinc_lock_mode=2
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--source include/have_innodb.inc
2+
--source include/have_binlog_format_mixed.inc
3+
4+
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
5+
6+
select @@innodb_autoinc_lock_mode;
7+
select @@binlog_format;
8+
9+
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=InnoDB;
10+
insert into t1 values (NULL,1);
11+
--source include/show_binlog_events.inc
12+
13+
set global binlog_format=STATEMENT;
14+
--connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK)
15+
insert into t1 values (NULL,1);
16+
insert into t1 values (NULL,1);
17+
--disconnect con1
18+
--connection default
19+
20+
set global binlog_format=MIXED;
21+
DROP TABLE t1;

mysql-test/suite/sql_sequence/binlog.result

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ select next value for s1, minimum_value from s1 where maximum_value> 4;
1212
next value for s1 minimum_value
1313
4 1
1414
alter sequence s1 maxvalue 1000;
15+
optimize table s1;
16+
Table Op Msg_type Msg_text
17+
test.s1 optimize note The storage engine for the table doesn't support optimize
18+
analyze table s1;
19+
Table Op Msg_type Msg_text
20+
test.s1 analyze status Engine-independent statistics collected
21+
test.s1 analyze note The storage engine for the table doesn't support analyze
22+
repair table s1;
23+
Table Op Msg_type Msg_text
24+
test.s1 repair status OK
25+
check table s1;
26+
Table Op Msg_type Msg_text
27+
test.s1 check note The storage engine for the table doesn't support check
28+
rename table s1 to tmp_s;
29+
rename table tmp_s to s1;
1530
drop sequence s1;
1631
include/show_binlog_events.inc
1732
Log_name Pos Event_type Server_id End_log_pos Info
@@ -30,4 +45,14 @@ master-bin.000001 # Query # # COMMIT
3045
master-bin.000001 # Gtid # # GTID #-#-#
3146
master-bin.000001 # Query # # use `test`; alter sequence s1 maxvalue 1000
3247
master-bin.000001 # Gtid # # GTID #-#-#
48+
master-bin.000001 # Query # # use `test`; optimize table s1
49+
master-bin.000001 # Gtid # # GTID #-#-#
50+
master-bin.000001 # Query # # use `test`; analyze table s1
51+
master-bin.000001 # Gtid # # GTID #-#-#
52+
master-bin.000001 # Query # # use `test`; repair table s1
53+
master-bin.000001 # Gtid # # GTID #-#-#
54+
master-bin.000001 # Query # # use `test`; rename table s1 to tmp_s
55+
master-bin.000001 # Gtid # # GTID #-#-#
56+
master-bin.000001 # Query # # use `test`; rename table tmp_s to s1
57+
master-bin.000001 # Gtid # # GTID #-#-#
3358
master-bin.000001 # Query # # use `test`; DROP SEQUENCE `s1` /* generated by server */

mysql-test/suite/sql_sequence/binlog.test

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--source include/have_udf.inc
2-
--source include/have_log_bin.inc
1+
--source include/have_sequence.inc
2+
--source include/have_binlog_format_mixed_or_row.inc
33
--source include/binlog_start_pos.inc
44

55
#
@@ -21,6 +21,17 @@ select next value for s1, minimum_value from s1 where maximum_value> 4;
2121
#
2222
alter sequence s1 maxvalue 1000;
2323

24+
# MDEV-24617 OPTIMIZE on a sequence causes unexpected
25+
# ER_BINLOG_UNSAFE_STATEMENT The test below verifies no unsafe
26+
# warnings anymore for any relavant commands that like OPTIMIZE can
27+
# not produce ROW format events therefore the unsafe warning either.
28+
optimize table s1;
29+
analyze table s1;
30+
repair table s1;
31+
check table s1;
32+
rename table s1 to tmp_s;
33+
rename table tmp_s to s1;
34+
2435
drop sequence s1;
2536

2637
--let $binlog_file = LAST

sql/handler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5032,6 +5032,11 @@ class handler :public Sql_alloc
50325032
const uchar *pack_frm_data,
50335033
size_t pack_frm_len)
50345034
{ return HA_ERR_WRONG_COMMAND; }
5035+
/* @return true if it's necessary to switch current statement log format from
5036+
STATEMENT to ROW if binary log format is MIXED and autoincrement values
5037+
are changed in the statement */
5038+
virtual bool autoinc_lock_mode_stmt_unsafe() const
5039+
{ return false; }
50355040
virtual int drop_partitions(const char *path)
50365041
{ return HA_ERR_WRONG_COMMAND; }
50375042
virtual int rename_partitions(const char *path)

0 commit comments

Comments
 (0)