Skip to content

Commit

Permalink
Merge 10.2 into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 13, 2021
2 parents ff77a09 + 2bb8d7c commit 4a7dfda
Show file tree
Hide file tree
Showing 36 changed files with 358 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ x86/
build/
bld/
[Bb]in/
/cmake-build-debug/
[Oo]bj/

# Roslyn cache directories
Expand Down Expand Up @@ -521,4 +522,5 @@ compile_commands.json
# Visual Studio Code workspace
.vscode/

/.idea/
.cache/clangd
13 changes: 8 additions & 5 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1683,11 +1683,14 @@ static struct my_option my_long_options[] =
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0,
"By default, ASCII '\\0' is disallowed and '\\r\\n' is translated to '\\n'. "
"This switch turns off both features, and also turns off parsing of all client"
"commands except \\C and DELIMITER, in non-interactive mode (for input "
"piped to mysql or loaded using the 'source' command). This is necessary "
"when processing output from mysqlbinlog that may contain blobs.",
"Binary mode allows certain character sequences to be processed as data "
"that would otherwise be treated with a special meaning by the parser. "
"Specifically, this switch turns off parsing of all client commands except "
"\\C and DELIMITER in non-interactive mode (i.e., when binary mode is "
"combined with either 1) piped input, 2) the --batch mysql option, or 3) "
"the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and "
"ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is "
"translated to '\\n' and '\\0' is disallowed in user input.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
Expand Down
3 changes: 2 additions & 1 deletion include/ft_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ void ft_free_stopwords(void);

FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
CHARSET_INFO *, uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *, size_t length,
CHARSET_INFO *cs);

/* Internal symbols for fulltext between maria and MyISAM */

Expand Down
3 changes: 3 additions & 0 deletions include/my_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct my_context {


#ifdef MY_CONTEXT_USE_UCONTEXT
#if defined(__APPLE__) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE
#endif
#include <ucontext.h>

struct my_context {
Expand Down
2 changes: 1 addition & 1 deletion include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
# if defined(__i386__) || defined(__ppc__)
# define SIZEOF_CHARP 4
# define SIZEOF_LONG 4
# elif defined(__x86_64__) || defined(__ppc64__)
# elif defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
# define SIZEOF_CHARP 8
# define SIZEOF_LONG 8
# else
Expand Down
9 changes: 8 additions & 1 deletion man/mysql.1
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ option\&.
.\" binary-mode option: mysql
\fB\-\-binary\-mode\fR
.sp
By default, ASCII '\e0' is disallowed and '\er\en' is translated to '\en'\&. This switch turns off both features, and also turns off parsing of all client commands except \eC and DELIMITER, in non-interactive mode (for input piped to mysql or loaded using the 'source' command)\&. This is necessary when processing output from mysqlbinlog that may contain blobs\&.
Binary mode allows certain character sequences to be processed as data that
would otherwise be treated with a special meaning by the parser\&.
Specifically, this switch turns off parsing of all client commands except \eC
and DELIMITER in non-interactive mode (i\&.e\&., when binary mode is combined
with either 1) piped input, 2) the --batch mysql option, or 3) the 'source'
command)\&. Also, in binary mode, occurrences of '\er\en' and ASCII '\e0' are
preserved within strings, whereas by default, '\er\en' is translated to '\en'
and '\e0' is disallowed in user input\&.
.RE
.sp
.RS 4
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/ctype_utf16_def.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ character_set_server utf16
SHOW VARIABLES LIKE 'ft_stopword_file';
Variable_name Value
ft_stopword_file (built-in)
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
7 changes: 7 additions & 0 deletions mysql-test/main/ctype_utf16_def.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ call mtr.add_suppression("'utf16' can not be used as client character set");
SHOW VARIABLES LIKE 'collation_server';
SHOW VARIABLES LIKE 'character_set_server';
SHOW VARIABLES LIKE 'ft_stopword_file';

--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #

SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
1 change: 1 addition & 0 deletions mysql-test/main/ctype_utf32_def.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--character-set-server=utf32,latin1 --collation-server=utf32_general_ci
6 changes: 6 additions & 0 deletions mysql-test/main/ctype_utf32_def.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
call mtr.add_suppression("'utf32' can not be used as client character set");
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
9 changes: 9 additions & 0 deletions mysql-test/main/ctype_utf32_def.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--source include/have_utf32.inc
call mtr.add_suppression("'utf32' can not be used as client character set");

--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #

SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
9 changes: 9 additions & 0 deletions mysql-test/main/default.result
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,14 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1;
#
# MDEV-18278 Misleading error message in error log upon failed table creation
#
create table t1 (a int as (a));
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
show warnings;
Level Code Message
Error 4029 Expression for field `a` is referring to uninitialized field `a`
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
Expand All @@ -3405,3 +3413,4 @@ length(DEFAULT(h))
25
INSERT INTO t1 () VALUES ();
drop table t1;
# end of 10.3 test
9 changes: 9 additions & 0 deletions mysql-test/main/default.test
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,13 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1;

--echo #
--echo # MDEV-18278 Misleading error message in error log upon failed table creation
--echo #
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int as (a));
show warnings;

--echo # end of 10.2 test

--echo #
Expand All @@ -2126,3 +2133,5 @@ SELECT DEFAULT(h) FROM t1;
SELECT length(DEFAULT(h)) FROM t1;
INSERT INTO t1 () VALUES ();
drop table t1;

--echo # end of 10.3 test
1 change: 1 addition & 0 deletions mysql-test/main/delayed_blob.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--init_connect="set @a='something unique to have MTR start a dedicated mariadbd for this test and shutdown it after the test'"
17 changes: 17 additions & 0 deletions mysql-test/main/delayed_blob.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
#
SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
INSERT DELAYED INTO t1 VALUES (''||'');
ERROR 22007: Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-24467 Memory not freed after failed INSERT DELAYED
#
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
INSERT DELAYED INTO t1 (a) VALUES ('foo');
ERROR 22001: Data too long for column 'a' at row 1
DROP TABLE t1;
21 changes: 21 additions & 0 deletions mysql-test/main/delayed_blob.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--echo #
--echo # MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
--echo #

SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
--error ER_TRUNCATED_WRONG_VALUE
INSERT DELAYED INTO t1 VALUES (''||'');
DROP TABLE t1;
SET sql_mode=DEFAULT;


--echo #
--echo # MDEV-24467 Memory not freed after failed INSERT DELAYED
--echo #

CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
--error ER_DATA_TOO_LONG
INSERT DELAYED INTO t1 (a) VALUES ('foo');
DROP TABLE t1;
12 changes: 12 additions & 0 deletions mysql-test/main/func_str.result
Original file line number Diff line number Diff line change
Expand Up @@ -5014,6 +5014,18 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-24742 Server crashes in Charset::numchars / String::numchars
#
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
NULL
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/main/func_str.test
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,22 @@ DROP TABLE t1;
--echo #


--echo #
--echo # Start of 10.2 tests
--echo #

--echo #
--echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars
--echo #

SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');


--echo #
--echo # End of 10.2 tests
--echo #


--echo #
--echo # Start of 10.3 tests
--echo #
Expand Down
52 changes: 52 additions & 0 deletions mysql-test/suite/innodb/r/mdev-14846.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL,
KEY (f1),
PRIMARY KEY (pk)
) ENGINE=InnoDB;
CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
CREATE TABLE t3 (
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL
) ENGINE=InnoDB;
INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
INSERT INTO t4 VALUES (8),(9);
UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
SET DEBUG_SYNC='now SIGNAL con1_dml';
connect con1,localhost,root,,test;
SET DEBUG_SYNC='now WAIT_FOR con1_dml';
begin;
SELECT * FROM t1 for update;
pk f1 f2 f3
-109 a r NULL
1 k g 6
2 y r 0
3 t q 1
5 z t NULL
SET DEBUG_SYNC='now SIGNAL default_dml';
connection default;
SET DEBUG_SYNC='now WAIT_FOR default_dml';
UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h';
connect con2,localhost,root,,test;
set debug_sync='now WAIT_FOR default_dml';
SET DEBUG_SYNC='now SIGNAL con1_dml2';
disconnect con2;
connection con1;
SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
connection default;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection con1;
COMMIT;
disconnect con1;
connection default;
DROP VIEW v4;
DROP TABLE t1, t2, t3, t4;
set debug_sync= reset;
1 change: 1 addition & 0 deletions mysql-test/suite/innodb/t/mdev-14846.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--loose-innodb_lock_waits
70 changes: 70 additions & 0 deletions mysql-test/suite/innodb/t/mdev-14846.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug_sync.inc

CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL,
KEY (f1),
PRIMARY KEY (pk)
) ENGINE=InnoDB;

CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);

CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');

CREATE TABLE t3 (
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL
) ENGINE=InnoDB;

INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);

CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
INSERT INTO t4 VALUES (8),(9);
UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
SET DEBUG_SYNC='now SIGNAL con1_dml';

--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='now WAIT_FOR con1_dml';
begin;
SELECT * FROM t1 for update; # Holds x lock of all records in the table t1
SET DEBUG_SYNC='now SIGNAL default_dml';

--connection default
SET DEBUG_SYNC='now WAIT_FOR default_dml';
--send UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'
# It holds the lock of all record in t3 and tries to acquire record lock for the table t1.

--connect (con2,localhost,root,,test)
set debug_sync='now WAIT_FOR default_dml';
let $wait_condition=
select count(*) > 0 from information_schema.innodb_lock_waits;
--source include/wait_condition.inc
SET DEBUG_SYNC='now SIGNAL con1_dml2';
disconnect con2;

# Cleanup
--connection con1
SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
# It holds the record lock on table t1 and tries to acquire record lock on t3.
# leads to deadlock (con1 trx is waiting for default trx and vice versa)

--connection default
--error ER_LOCK_DEADLOCK
--reap

connection con1;
COMMIT;
disconnect con1;

--connection default
DROP VIEW v4;
DROP TABLE t1, t2, t3, t4;
set debug_sync= reset;
20 changes: 18 additions & 2 deletions mysql-test/suite/plugins/r/feedback_plugin_send.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
execute stmt;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
execute stmt;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
deallocate prepare stmt;
set global sql_mode=ONLY_FULL_GROUP_BY;
6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
6: feedback plugin: server replied 'ok'
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: server replied 'ok'
Loading

0 comments on commit 4a7dfda

Please sign in to comment.