From 36f84744031430747d27bfb2087c7ae51019a70a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 10 Nov 2017 12:48:52 +0100 Subject: [PATCH 01/88] MDEV-14337 mysqld_safe may suppress error messages with --log-output=file don't close stdout/stderr, redirect them to /dev/null instead. otherwise redirections like >&2 fail with "invalid file descriptor" --- scripts/mysqld_safe.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index b644184b1e1..46b37689093 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -868,8 +868,8 @@ if expr "${-}" : '.*x' > /dev/null then : else - exec 1>&- - exec 2>&- + exec 1>/dev/null + exec 2>/dev/null fi while true From b5cb4ae470c80e21cc340c2fa13683d7d31b3da6 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 11 Nov 2017 11:45:59 -0800 Subject: [PATCH 02/88] Fixed bug MDEV-14368 Improper error for a grouping query that uses alias in HAVING when sql_mode = 'ONLY_FULL_GROUP_BY' This patch corrects the patch for bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode added in 2006 by commit 4b7c4cd27f68b9aac1970b9f21c50d4eee35df7d. As a result of incompleteness of the fix in the above commit if a query with GROUP BY contained an aggregate function with an alias and this alias was used in the HAVING clause of the query the server reported an error when sql_mode was set to 'ONLY_FULL_GROUP_BY'. --- mysql-test/r/having.result | 15 +++++++++++++++ mysql-test/t/having.test | 17 +++++++++++++++++ sql/item.cc | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 514abbf5522..18915da1a09 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -697,3 +697,18 @@ id column_1 1 80a12660d24a72460e5e292fe33f870276d7f40a expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR drop table t1; +# +# mdev-14368: grouping query with alias for aggregate function in HAVING +# when sql_mode = 'ONLY_FULL_GROUP_BY' +set @save_sql_mode= @@sql_mode; +set sql_mode = 'ONLY_FULL_GROUP_BY'; +create table t1(a int); +insert t1 values (4),(1),(2),(1), (3),(4); +SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0; +a ct +1 2 +2 1 +3 1 +4 2 +set sql_mode=@save_sql_mode; +drop table t1; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 505fb9ad3cf..a470f462d6a 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -727,3 +727,20 @@ HAVING UPPER(`column_1`) LIKE '8%'; --echo expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR drop table t1; + +--echo # +--echo # mdev-14368: grouping query with alias for aggregate function in HAVING +--echo # when sql_mode = 'ONLY_FULL_GROUP_BY' + + +set @save_sql_mode= @@sql_mode; +set sql_mode = 'ONLY_FULL_GROUP_BY'; + +create table t1(a int); +insert t1 values (4),(1),(2),(1), (3),(4); + +SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0; + +set sql_mode=@save_sql_mode; + +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index fa2e52bfd4a..332e027adf1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4771,7 +4771,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select) if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && select->having_fix_field && - select_ref != not_found_item && !group_by_ref) + select_ref != not_found_item && !group_by_ref && + !ref->alias_name_used) { /* Report the error if fields was found only in the SELECT item list and From d7b2bc98bf55dded58e4d5d4a19e4aa48b30b26b Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Tue, 14 Nov 2017 13:03:54 -0500 Subject: [PATCH 03/88] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5a19a706528..24d355ca91e 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=33 +MYSQL_VERSION_PATCH=34 From f7b110bdc1fb0eb6b383f9647caa299de9d64aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Nov 2017 12:39:41 +0200 Subject: [PATCH 04/88] MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX Imported missing test case from MySQL 5.7 for commit 25781c154396dbbc21023786aa3be070057d6999 Author: Annamalai Gurusami Date: Mon Feb 24 14:00:03 2014 +0530 Bug #17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX MariaDB 5.5 does not seem to be affected. --- .../suite/innodb/r/innodb-replace-debug.result | 9 +++++++++ mysql-test/suite/innodb/t/innodb-replace-debug.test | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb-replace-debug.result create mode 100644 mysql-test/suite/innodb/t/innodb-replace-debug.test diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result new file mode 100644 index 00000000000..0de351efded --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -0,0 +1,9 @@ +# +# Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +# +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), +key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set debug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test new file mode 100644 index 00000000000..250c90ba5b1 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +--echo # +--echo # Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +--echo # + +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), + key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set debug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +drop table t1; From c44ece7342f14498630e4ab403ae125971137457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Nov 2017 12:56:54 +0200 Subject: [PATCH 05/88] MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX MariaDB adjustments to test case innodb-replace-debug. --- mysql-test/suite/innodb/r/innodb-replace-debug.result | 6 +++++- mysql-test/suite/innodb/t/innodb-replace-debug.test | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result index 0de351efded..84bc9dc9769 100644 --- a/mysql-test/suite/innodb/r/innodb-replace-debug.result +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -4,6 +4,10 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set debug = '+d,row_ins_sec_index_entry_timeout'; +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); +select * from t1; +f1 f2 f3 +14 25 34 drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test index 250c90ba5b1..5cec9e1febf 100644 --- a/mysql-test/suite/innodb/t/innodb-replace-debug.test +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -8,6 +8,8 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set debug = '+d,row_ins_sec_index_entry_timeout'; +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); +select * from t1; drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; From 9b53e541f03d74e2777e0d1e7618b6246b81c721 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 20 Nov 2017 09:33:19 +0400 Subject: [PATCH 06/88] MDEV-13788 Server crash when issuing bad SQL partition syntax --- .../suite/parts/inc/part_alter_values.inc | 24 +++++++++++++ .../parts/r/partition_alter_innodb.result | 35 +++++++++++++++++++ .../parts/r/partition_alter_maria.result | 35 +++++++++++++++++++ .../parts/r/partition_alter_myisam.result | 35 +++++++++++++++++++ .../suite/parts/t/partition_alter_innodb.test | 4 +++ .../suite/parts/t/partition_alter_maria.test | 3 ++ .../suite/parts/t/partition_alter_myisam.test | 3 ++ sql/partition_info.cc | 20 +++++++++++ sql/partition_info.h | 1 + sql/sql_partition.cc | 11 ++---- sql/sql_yacc.yy | 14 ++------ 11 files changed, 165 insertions(+), 20 deletions(-) create mode 100644 mysql-test/suite/parts/inc/part_alter_values.inc create mode 100644 mysql-test/suite/parts/r/partition_alter_innodb.result create mode 100644 mysql-test/suite/parts/r/partition_alter_myisam.result create mode 100644 mysql-test/suite/parts/t/partition_alter_innodb.test create mode 100644 mysql-test/suite/parts/t/partition_alter_myisam.test diff --git a/mysql-test/suite/parts/inc/part_alter_values.inc b/mysql-test/suite/parts/inc/part_alter_values.inc new file mode 100644 index 00000000000..f56d81d8930 --- /dev/null +++ b/mysql-test/suite/parts/inc/part_alter_values.inc @@ -0,0 +1,24 @@ +--echo # +--echo # MDEV-13788 Server crash when issuing bad SQL partition syntax +--echo # + +--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE)) +SHOW CREATE TABLE t1; +--error ER_PARTITION_REQUIRES_VALUES_ERROR +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( + PARTITION p2, /* Notice no values */ + PARTITION p3 VALUES LESS THAN (MAXVALUE) +); +DROP TABLE t1; + + +--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3)) +SHOW CREATE TABLE t1; +--error ER_PARTITION_REQUIRES_VALUES_ERROR +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( + PARTITION p2, /* Notice no values */ + PARTITION p3 VALUES IN (4,5,6) +); +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_innodb.result b/mysql-test/suite/parts/r/partition_alter_innodb.result new file mode 100644 index 00000000000..4436ba5e737 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_alter_innodb.result @@ -0,0 +1,35 @@ +# +# MDEV-13788 Server crash when issuing bad SQL partition syntax +# +CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50500 PARTITION BY RANGE COLUMNS(d) +(PARTITION p1 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES LESS THAN (MAXVALUE) +); +ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition +DROP TABLE t1; +CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (id) +(PARTITION p1 VALUES IN (1,2,3) ENGINE = InnoDB) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES IN (4,5,6) +); +ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result index 6343566e408..460d20b9255 100644 --- a/mysql-test/suite/parts/r/partition_alter_maria.result +++ b/mysql-test/suite/parts/r/partition_alter_maria.result @@ -16,3 +16,38 @@ select * from t1; pk dt 1 2017-09-28 15:12:00 drop table t1; +# +# MDEV-13788 Server crash when issuing bad SQL partition syntax +# +CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 +/*!50500 PARTITION BY RANGE COLUMNS(d) +(PARTITION p1 VALUES LESS THAN (MAXVALUE) ENGINE = Aria) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES LESS THAN (MAXVALUE) +); +ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition +DROP TABLE t1; +CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (id) +(PARTITION p1 VALUES IN (1,2,3) ENGINE = Aria) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES IN (4,5,6) +); +ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result new file mode 100644 index 00000000000..050e1d9a519 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -0,0 +1,35 @@ +# +# MDEV-13788 Server crash when issuing bad SQL partition syntax +# +CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50500 PARTITION BY RANGE COLUMNS(d) +(PARTITION p1 VALUES LESS THAN (MAXVALUE) ENGINE = MyISAM) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES LESS THAN (MAXVALUE) +); +ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition +DROP TABLE t1; +CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `d` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (id) +(PARTITION p1 VALUES IN (1,2,3) ENGINE = MyISAM) */ +ALTER TABLE t1 REORGANIZE PARTITION p1 INTO +( +PARTITION p2, /* Notice no values */ +PARTITION p3 VALUES IN (4,5,6) +); +ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_alter_innodb.test b/mysql-test/suite/parts/t/partition_alter_innodb.test new file mode 100644 index 00000000000..451bec05adc --- /dev/null +++ b/mysql-test/suite/parts/t/partition_alter_innodb.test @@ -0,0 +1,4 @@ +--source include/have_innodb.inc +--source include/have_partition.inc +--let $engine=InnoDB +--source inc/part_alter_values.inc diff --git a/mysql-test/suite/parts/t/partition_alter_maria.test b/mysql-test/suite/parts/t/partition_alter_maria.test index db249591158..e21f0dfab82 100644 --- a/mysql-test/suite/parts/t/partition_alter_maria.test +++ b/mysql-test/suite/parts/t/partition_alter_maria.test @@ -16,3 +16,6 @@ select * from t1; alter table t1 drop partition p20181231; select * from t1; drop table t1; + +--let $engine=Aria +--source inc/part_alter_values.inc diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test new file mode 100644 index 00000000000..a53fa333abd --- /dev/null +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -0,0 +1,3 @@ +--source include/have_partition.inc +--let $engine=MyISAM +--source inc/part_alter_values.inc diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 512bf296135..740e5087477 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -2132,6 +2132,24 @@ end: DBUG_RETURN(result); } + +bool partition_info::error_if_requires_values() const +{ + switch (part_type) { + case NOT_A_PARTITION: + case HASH_PARTITION: + break; + case RANGE_PARTITION: + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN"); + return true; + case LIST_PARTITION: + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN"); + return true; + } + return false; +} + + /* The parser generates generic data structures, we need to set them up as the rest of the code expects to find them. This is in reality part @@ -2221,6 +2239,8 @@ int partition_info::fix_parser_data(THD *thd) part_elem= it++; List_iterator list_val_it(part_elem->list_val_list); num_elements= part_elem->list_val_list.elements; + if (!num_elements && error_if_requires_values()) + DBUG_RETURN(true); DBUG_ASSERT(part_type == RANGE_PARTITION ? num_elements == 1U : TRUE); for (j= 0; j < num_elements; j++) diff --git a/sql/partition_info.h b/sql/partition_info.h index cff941a858a..779948eddc9 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -313,6 +313,7 @@ public: void set_show_version_string(String *packet); void report_part_expr_error(bool use_subpart_expr); bool has_same_partitioning(partition_info *new_part_info); + bool error_if_requires_values() const; private: static int list_part_cmp(const void* a, const void* b); bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index ab31a8c1791..01dcc7cc2ac 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4770,16 +4770,11 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), "LIST", "IN"); } - else if (tab_part_info->part_type == RANGE_PARTITION) - { - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "RANGE", "LESS THAN"); - } else { - DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION); - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "LIST", "IN"); + DBUG_ASSERT(tab_part_info->part_type == RANGE_PARTITION || + tab_part_info->part_type == LIST_PARTITION); + (void) tab_part_info->error_if_requires_values(); } goto err; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4805cd4c66a..e1c6b5b6276 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4679,18 +4679,8 @@ opt_part_values: partition_info *part_info= lex->part_info; if (! lex->is_partition_management()) { - if (part_info->part_type == RANGE_PARTITION) - { - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "RANGE", "LESS THAN"); - MYSQL_YYABORT; - } - if (part_info->part_type == LIST_PARTITION) - { - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "LIST", "IN"); - MYSQL_YYABORT; - } + if (part_info->error_if_requires_values()) + MYSQL_YYABORT; } else part_info->part_type= HASH_PARTITION; From b8d1398b1d061566ada0714fb2407cdd45ff42b2 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Thu, 30 Nov 2017 11:56:02 +0200 Subject: [PATCH 07/88] MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields For BIT field null_bit is not set to 0 even for a field defined as NOT NULL. So now in the function TABLE::create_key_part_by_field, if the bit field is not nullable then the null_bit is explicitly set to 0 --- mysql-test/r/join_outer.result | 13 +++++++++++++ mysql-test/r/join_outer_jcl6.result | 13 +++++++++++++ mysql-test/t/join_outer.test | 14 ++++++++++++++ sql/table.cc | 8 ++++++++ 4 files changed, 48 insertions(+) diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 5611b61a7b0..74580e67499 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2339,5 +2339,18 @@ Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (`f1`(`test`.`t2`.`col3`,0) = 0) DROP FUNCTION f1; DROP TABLE t1,t2; +# +# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields +# +CREATE TABLE t1 (b1 BIT NOT NULL); +INSERT INTO t1 VALUES (0),(1); +CREATE TABLE t2 (b2 BIT NOT NULL); +INSERT INTO t2 VALUES (0),(1); +SET SESSION JOIN_CACHE_LEVEL = 3; +SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2; +t1.b1+'0' t2.b2 + '0' +0 0 +1 1 +DROP TABLE t1, t2; # end of 5.5 tests SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 8a1ccc7d5e5..d46a4ee6c7a 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2350,6 +2350,19 @@ Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (`f1`(`test`.`t2`.`col3`,0) = 0) DROP FUNCTION f1; DROP TABLE t1,t2; +# +# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields +# +CREATE TABLE t1 (b1 BIT NOT NULL); +INSERT INTO t1 VALUES (0),(1); +CREATE TABLE t2 (b2 BIT NOT NULL); +INSERT INTO t2 VALUES (0),(1); +SET SESSION JOIN_CACHE_LEVEL = 3; +SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2; +t1.b1+'0' t2.b2 + '0' +0 0 +1 1 +DROP TABLE t1, t2; # end of 5.5 tests SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 9645d8ad82a..896cc137e07 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -1881,6 +1881,20 @@ DROP FUNCTION f1; DROP TABLE t1,t2; +--echo # +--echo # MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields +--echo # + +CREATE TABLE t1 (b1 BIT NOT NULL); +INSERT INTO t1 VALUES (0),(1); + +CREATE TABLE t2 (b2 BIT NOT NULL); +INSERT INTO t2 VALUES (0),(1); + +SET SESSION JOIN_CACHE_LEVEL = 3; +SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2; +DROP TABLE t1, t2; + --echo # end of 5.5 tests SET optimizer_switch=@save_optimizer_switch; diff --git a/sql/table.cc b/sql/table.cc index 9d52d5f87a2..fbcd91f5326 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5987,6 +5987,14 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info, might be reused. */ key_part_info->store_length= key_part_info->length; + /* + For BIT fields null_bit is not set to 0 even if the field is defined + as NOT NULL, look at Field_bit::Field_bit + */ + if (!field->real_maybe_null()) + { + key_part_info->null_bit= 0; + } /* The total store length of the key part is the raw length of the field + From 7603463a46b288c1b5630348e36c622e4c2abb09 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 16 Nov 2017 20:32:33 +0800 Subject: [PATCH 08/88] Remove use of volatile in stored_field_cmp_to_item This was added in c79641594348 but would hurt all other compilers because of Visual Studio. Hopefully this has been fixed now. Signed-off-by: Daniel Black --- sql/item.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 332e027adf1..574e8722c3d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8924,15 +8924,10 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) } return my_time_compare(&field_time, &item_time); } - /* - The patch for Bug#13463415 started using this function for comparing - BIGINTs. That uncovered a bug in Visual Studio 32bit optimized mode. - Prefixing the auto variables with volatile fixes the problem.... - */ - volatile double result= item->val_real(); + double result= item->val_real(); if (item->null_value) return 0; - volatile double field_result= field->val_real(); + double field_result= field->val_real(); if (field_result < result) return -1; else if (field_result > result) From ac61a575dfff6b9510576be920a522c710732c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Wed, 6 Dec 2017 02:16:14 +0200 Subject: [PATCH 09/88] Revert "Remove use of volatile in stored_field_cmp_to_item" This reverts commit 7603463a46b288c1b5630348e36c622e4c2abb09. The commit itself is fine, however when disabling volatile, compiler optimizations mess up our double results due to precision differences. Revert the patch till a proper solution is found. --- sql/item.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 574e8722c3d..332e027adf1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8924,10 +8924,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) } return my_time_compare(&field_time, &item_time); } - double result= item->val_real(); + /* + The patch for Bug#13463415 started using this function for comparing + BIGINTs. That uncovered a bug in Visual Studio 32bit optimized mode. + Prefixing the auto variables with volatile fixes the problem.... + */ + volatile double result= item->val_real(); if (item->null_value) return 0; - double field_result= field->val_real(); + volatile double field_result= field->val_real(); if (field_result < result) return -1; else if (field_result > result) From 20089f5a39fa8f6f08113f12ed87c34e844c4fc6 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 8 Dec 2017 14:40:27 +0400 Subject: [PATCH 10/88] MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..)) --- mysql-test/r/func_set.result | 9 +++++++++ mysql-test/t/func_set.test | 11 +++++++++++ sql/item_cmpfunc.cc | 13 +++++++++++++ sql/item_cmpfunc.h | 1 + 4 files changed, 34 insertions(+) diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 9c4976d46db..ca1ccd71c90 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -220,3 +220,12 @@ NULL 1,2,3,4,5,6,7 DROP TABLE t1; +# +# MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..)) +# +SELECT INTERVAL(ROW(1,1),ROW(1,2)); +ERROR 21000: Operand should contain 1 column(s) +SELECT INTERVAL(1,ROW(1,2)); +ERROR 21000: Operand should contain 1 column(s) +SELECT INTERVAL(ROW(1,2),1); +ERROR 21000: Operand should contain 1 column(s) diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index ba984113fd7..887b1948498 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -136,3 +136,14 @@ SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN; --echo DROP TABLE t1; + +--echo # +--echo # MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..)) +--echo # + +--error ER_OPERAND_COLUMNS +SELECT INTERVAL(ROW(1,1),ROW(1,2)); +--error ER_OPERAND_COLUMNS +SELECT INTERVAL(1,ROW(1,2)); +--error ER_OPERAND_COLUMNS +SELECT INTERVAL(ROW(1,2),1); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ebe088e5092..62e76922c0e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2001,6 +2001,19 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const } +bool Item_func_interval::fix_fields(THD *thd, Item **ref) +{ + if (Item_int_func::fix_fields(thd, ref)) + return true; + for (uint i= 0 ; i < row->cols(); i++) + { + if (row->element_index(i)->check_cols(1)) + return true; + } + return false; +} + + void Item_func_interval::fix_length_and_dec() { uint rows= row->cols(); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index a8befa47b95..7b7ca9223fd 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -728,6 +728,7 @@ public: { allowed_arg_cols= 0; // Fetch this value from first argument } + bool fix_fields(THD *, Item **); longlong val_int(); void fix_length_and_dec(); const char *func_name() const { return "interval"; } From 15219eb08a28261aa730c301583f1c47a92790b8 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 11 Dec 2017 12:41:45 +0200 Subject: [PATCH 11/88] MDEV-14290 Binlog rotate crashes when two commit_checkpoint_notify capable engines. The crash (sometimes assert) in MYSQL_BIN_LOG::mark_xid_done was caused by a fact that log.cc:binlog_background_thread_queue could become a cyclic list. This possibility becomes real with two checkpoint capable engines that may execute TC_LOG_BINLOG::commit_checkpoint_notify() in succession before binlog_background thread gets control and eventually finds a freed memory while otherwise endlessly looping in while(queue). It is fixed with counting the notificaion kind instead of en-listing the same notificaion kind in commit_checkpoint_notify as formerly. The while(queue) of binlog background thread is refined to pay attention to the new counter. In effectno more access to free memory is possible. --- sql/log.cc | 21 +- sql/log.h | 1 + .../rocksdb_rpl/r/rpl_binlog_xid_count.result | 204 ++++++++++++++++++ .../t/rpl_binlog_xid_count-master.opt | 3 + .../rocksdb_rpl/t/rpl_binlog_xid_count.test | 20 ++ 5 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 storage/rocksdb/mysql-test/rocksdb_rpl/r/rpl_binlog_xid_count.result create mode 100644 storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count-master.opt create mode 100644 storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count.test diff --git a/sql/log.cc b/sql/log.cc index 93d7a00c840..3aff3b2c40d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3583,6 +3583,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, new_xid_list_entry->binlog_name= name_mem; new_xid_list_entry->binlog_name_len= len; new_xid_list_entry->xid_count= 0; + new_xid_list_entry->notify_count= 0; /* Find the name for the Initial binlog checkpoint. @@ -9678,9 +9679,20 @@ void TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie) { xid_count_per_binlog *entry= static_cast(cookie); + bool found_entry= false; mysql_mutex_lock(&LOCK_binlog_background_thread); - entry->next_in_queue= binlog_background_thread_queue; - binlog_background_thread_queue= entry; + /* count the same notification kind from different engines */ + for (xid_count_per_binlog *link= binlog_background_thread_queue; + link && !found_entry; link= link->next_in_queue) + { + if ((found_entry= (entry == link))) + entry->notify_count++; + } + if (!found_entry) + { + entry->next_in_queue= binlog_background_thread_queue; + binlog_background_thread_queue= entry; + } mysql_cond_signal(&COND_binlog_background_thread); mysql_mutex_unlock(&LOCK_binlog_background_thread); } @@ -9775,13 +9787,16 @@ binlog_background_thread(void *arg __attribute__((unused))) ); while (queue) { + long count= queue->notify_count; THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify); DEBUG_SYNC(thd, "binlog_background_thread_before_mark_xid_done"); /* Set the thread start time */ thd->set_time(); /* Grab next pointer first, as mark_xid_done() may free the element. */ next= queue->next_in_queue; - mysql_bin_log.mark_xid_done(queue->binlog_id, true); + queue->notify_count= 0; + for (long i= 0; i <= count; i++) + mysql_bin_log.mark_xid_done(queue->binlog_id, true); queue= next; DBUG_EXECUTE_IF("binlog_background_checkpoint_processed", diff --git a/sql/log.h b/sql/log.h index 8484d54c5c2..97e257829b7 100644 --- a/sql/log.h +++ b/sql/log.h @@ -580,6 +580,7 @@ public: ulong binlog_id; /* Total prepared XIDs and pending checkpoint requests in this binlog. */ long xid_count; + long notify_count; /* For linking in requests to the binlog background thread. */ xid_count_per_binlog *next_in_queue; xid_count_per_binlog(); /* Give link error if constructor used. */ diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/r/rpl_binlog_xid_count.result b/storage/rocksdb/mysql-test/rocksdb_rpl/r/rpl_binlog_xid_count.result new file mode 100644 index 00000000000..9b46a5b5227 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/r/rpl_binlog_xid_count.result @@ -0,0 +1,204 @@ +CREATE TABLE `t` ( +`a` text DEFAULT NULL +) ENGINE=ROCKSDB; +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +INSERT INTO t SET a=repeat('a', 4096); +INSERT INTO t SET a=repeat('a', 4096/2); +DROP TABLE t; diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count-master.opt b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count-master.opt new file mode 100644 index 00000000000..ed50a8a3deb --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count-master.opt @@ -0,0 +1,3 @@ +--innodb --max-binlog-size=4096 + + diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count.test b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count.test new file mode 100644 index 00000000000..7667f153cde --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_binlog_xid_count.test @@ -0,0 +1,20 @@ +--source include/have_rocksdb.inc +--source include/have_binlog_format_row.inc + +CREATE TABLE `t` ( + `a` text DEFAULT NULL +) ENGINE=ROCKSDB; + + +--let $size=`SELECT @@GLOBAL.max_binlog_size` +--let $loop_cnt= 100 +while ($loop_cnt) +{ + --eval INSERT INTO t SET a=repeat('a', $size) + --eval INSERT INTO t SET a=repeat('a', $size/2) + + --dec $loop_cnt +} + +# Cleanup +DROP TABLE t; From 273591df0c9917a93bc2d695f61d9f35fa7b1f5c Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Sun, 17 Dec 2017 00:01:55 +0100 Subject: [PATCH 12/88] MDEV-14619: VIEW and GROUP_CONCAT Correctly print separator string in single quotes. --- mysql-test/r/view.result | 14 ++++++++++++++ mysql-test/t/view.test | 12 ++++++++++++ sql/item_sum.cc | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index c1f76ba58a4..8bc33a8860b 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5629,6 +5629,20 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3'; ERROR HY000: Can not insert into join view 'test.v2' without fields list drop view v1,v2; drop table t3; +# +# MDEV-14619: VIEW and GROUP_CONCAT +# +CREATE TABLE t1 (str text); +INSERT INTO t1 VALUES ("My"),("SQL"); +CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1; +SELECT * FROM v1; +GROUP_CONCAT(str SEPARATOR '\\') +My\SQL +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci +drop view v1; +drop table t1; # ----------------------------------------------------------------- # -- End of 5.5 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 79991f89683..0fc7cb6adf7 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5578,6 +5578,18 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3'; drop view v1,v2; drop table t3; +--echo # +--echo # MDEV-14619: VIEW and GROUP_CONCAT +--echo # + +CREATE TABLE t1 (str text); +INSERT INTO t1 VALUES ("My"),("SQL"); +CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1; +SELECT * FROM v1; +SHOW CREATE VIEW v1; +drop view v1; +drop table t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 9a2e2e6cd4c..709c2b6f7b5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3656,7 +3656,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type) } } str->append(STRING_WITH_LEN(" separator \'")); - str->append(*separator); + str->append_for_single_quote(separator->ptr(), separator->length()); str->append(STRING_WITH_LEN("\')")); } From 2fced9e7b643d0c101d0ffde33f51e0a38f7017e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 16 Dec 2017 11:56:16 +0200 Subject: [PATCH 13/88] MDEV-13655: Set role does not properly grant privileges. When granting a role to another role, DB privileges get propagated. If the grantee had no previous DB privileges, an extra ACL_DB entry is created to house those "indirectly received" privileges. If, afterwards, DB privileges are granted to the grantee directly, we must make sure to not create a duplicate ACL_DB entry. --- mysql-test/suite/roles/set_role-13655.result | 50 ++++++++++++++++++++ mysql-test/suite/roles/set_role-13655.test | 49 +++++++++++++++++++ sql/sql_acl.cc | 47 ++++++++++++------ sql/structs.h | 2 +- 4 files changed, 132 insertions(+), 16 deletions(-) create mode 100644 mysql-test/suite/roles/set_role-13655.result create mode 100644 mysql-test/suite/roles/set_role-13655.test diff --git a/mysql-test/suite/roles/set_role-13655.result b/mysql-test/suite/roles/set_role-13655.result new file mode 100644 index 00000000000..1c4841c8afd --- /dev/null +++ b/mysql-test/suite/roles/set_role-13655.result @@ -0,0 +1,50 @@ +# +# MDEV-13655: SET ROLE does not properly grant privileges. +# +# We must test that if aditional db privileges get granted to a role +# which previously inherited privileges from another granted role +# keep the internal memory structures intact. +# +create role simple; +# +# First we create an entry with privileges for databases for the simple role. +# +grant select, insert, update, delete, lock tables, execute on t.* to simple; +create role admin; +# +# Now we grant the simple role to admin. This means that db privileges +# should propagate to admin. +# +grant simple to admin; +show grants for admin; +Grants for admin +GRANT simple TO 'admin' +GRANT USAGE ON *.* TO 'admin' +GRANT USAGE ON *.* TO 'simple' +GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple' +# +# Finally, we give the admin all the available privileges for the db. +# +grant all on t.* to admin; +# +# Create a user to test out the new roles; +# +create user foo; +grant admin to foo; +create database t; +ERROR 42000: Access denied for user 'foo'@'%' to database 't' +set role admin; +show grants; +Grants for foo@% +GRANT admin TO 'foo'@'%' +GRANT USAGE ON *.* TO 'foo'@'%' +GRANT simple TO 'admin' +GRANT USAGE ON *.* TO 'admin' +GRANT ALL PRIVILEGES ON `t`.* TO 'admin' +GRANT USAGE ON *.* TO 'simple' +GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple' +create database t; +drop database t; +drop role simple; +drop role admin; +drop user foo; diff --git a/mysql-test/suite/roles/set_role-13655.test b/mysql-test/suite/roles/set_role-13655.test new file mode 100644 index 00000000000..97a82109276 --- /dev/null +++ b/mysql-test/suite/roles/set_role-13655.test @@ -0,0 +1,49 @@ +source include/not_embedded.inc; + +--echo # +--echo # MDEV-13655: SET ROLE does not properly grant privileges. +--echo # +--echo # We must test that if aditional db privileges get granted to a role +--echo # which previously inherited privileges from another granted role +--echo # keep the internal memory structures intact. +--echo # + +create role simple; + +--echo # +--echo # First we create an entry with privileges for databases for the simple role. +--echo # +grant select, insert, update, delete, lock tables, execute on t.* to simple; +create role admin; + +--echo # +--echo # Now we grant the simple role to admin. This means that db privileges +--echo # should propagate to admin. +--echo # +grant simple to admin; +show grants for admin; + +--echo # +--echo # Finally, we give the admin all the available privileges for the db. +--echo # +grant all on t.* to admin; + +--echo # +--echo # Create a user to test out the new roles; +--echo # +create user foo; +grant admin to foo; + +connect (foo,localhost,foo,,,,,); +--error ER_DBACCESS_DENIED_ERROR +create database t; +set role admin; +show grants; +create database t; +drop database t; + +connection default; + +drop role simple; +drop role admin; +drop user foo; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 177b4517904..1b25871b664 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2129,37 +2129,42 @@ static void acl_insert_user(const char *user, const char *host, } -static void acl_update_db(const char *user, const char *host, const char *db, +static bool acl_update_db(const char *user, const char *host, const char *db, ulong privileges) { mysql_mutex_assert_owner(&acl_cache->lock); + bool updated= false; + for (uint i=0 ; i < acl_dbs.elements ; i++) { ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*); if ((!acl_db->user && !user[0]) || - (acl_db->user && - !strcmp(user,acl_db->user))) + (acl_db->user && + !strcmp(user,acl_db->user))) { if ((!acl_db->host.hostname && !host[0]) || - (acl_db->host.hostname && - !strcmp(host, acl_db->host.hostname))) + (acl_db->host.hostname && + !strcmp(host, acl_db->host.hostname))) { - if ((!acl_db->db && !db[0]) || - (acl_db->db && !strcmp(db,acl_db->db))) + if ((!acl_db->db && !db[0]) || + (acl_db->db && !strcmp(db,acl_db->db))) - { - if (privileges) + { + if (privileges) { acl_db->access= privileges; acl_db->initial_access= acl_db->access; } - else - delete_dynamic_element(&acl_dbs,i); - } + else + delete_dynamic_element(&acl_dbs,i); + updated= true; + } } } } + + return updated; } @@ -3428,9 +3433,21 @@ static int replace_db_table(TABLE *table, const char *db, acl_cache->clear(1); // Clear privilege cache if (old_row_exists) acl_update_db(combo.user.str,combo.host.str,db,rights); - else - if (rights) - acl_insert_db(combo.user.str,combo.host.str,db,rights); + else if (rights) + { + /* + If we did not have an already existing row, for users, we must always + insert an ACL_DB entry. For roles however, it is possible that one was + already created when DB privileges were propagated from other granted + roles onto the current role. For this case, first try to update the + existing entry, otherwise insert a new one. + */ + if (!combo.is_role() || + !acl_update_db(combo.user.str, combo.host.str, db, rights)) + { + acl_insert_db(combo.user.str,combo.host.str,db,rights); + } + } DBUG_RETURN(0); /* This could only happen if the grant tables got corrupted */ diff --git a/sql/structs.h b/sql/structs.h index ee61b8d3b3a..e141a8d7668 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -191,7 +191,7 @@ typedef int *(*update_var)(THD *, struct st_mysql_show_var *); typedef struct st_lex_user { LEX_STRING user, host, password, plugin, auth; - bool is_role() { return user.str[0] && !host.str[0]; } + bool is_role() const { return user.str[0] && !host.str[0]; } void set_lex_string(LEX_STRING *l, char *buf) { if (is_role()) From be758322e299f1dc80898efcf2e71c4c8f4b3f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 17 Dec 2017 18:33:22 +0200 Subject: [PATCH 14/88] MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles Whenever we call merge_role_privileges on a role, we make use of the role->counter variable to check if all it's children have had their privileges merged. Only if all children have had their privileges merged, do we update the privileges on parent. This is done to prevent extra work. The same idea is employed during flush privileges. You only begin merging from "leaf" roles. The recursive calls will merge their parents at some point. A problem arises when we try to "re-merge" a parent. Take the following graph: {noformat} A (0) ---- C (2) ---- D (2) ---- USER / / B (0) ----/ / / E (0) --------------/ {noformat} In parentheses we have the "counter" value right before we start to iterate through the roles hash and propagate values. It represents the number of roles granted to the current role. The order in which we iterate through the roles hash is alphabetical. * First merge A, which leads to decreasing the counter for C to 1. Since C is not 0, we don't proceed with merging into C. * Second we merge B, which leads to decreasing the counter for C to 0. Now we proceed with merging into C. This leads to reducing the counter for D to 1 as part of C merge process. * Third as we iterate through the hash, we see that C has counter 0, thus we start the merge process *again*. This leads to reducing the counter for D to 0! We then attempt to merge D. * Fourth we start merging E. When E sees D as it's parent (according to the code) it attempts to reduce D's counter, which leads to overflow. Now D's counter is a very large number, thus E's privileges are not forwarded to D yet. To correct this behavior we must make sure to only start merging from initial leaf nodes. --- .../suite/roles/flush_roles-12366.result | 539 ++++++++++++++++++ mysql-test/suite/roles/flush_roles-12366.test | 379 ++++++++++++ sql/sql_acl.cc | 30 +- 3 files changed, 936 insertions(+), 12 deletions(-) create mode 100644 mysql-test/suite/roles/flush_roles-12366.result create mode 100644 mysql-test/suite/roles/flush_roles-12366.test diff --git a/mysql-test/suite/roles/flush_roles-12366.result b/mysql-test/suite/roles/flush_roles-12366.result new file mode 100644 index 00000000000..5897e480cd4 --- /dev/null +++ b/mysql-test/suite/roles/flush_roles-12366.result @@ -0,0 +1,539 @@ +# +# MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles +# +# This testcase contains a user, who is granted a master role +# operations_cluster. operations_cluster is granted 8 different roles +# who in turn each have 4 different roles granted to them. +# +# Only the leaf roles contain privileges to access databases. +# Make sure the user has access to all databases if the master role +# is granted to him. +# +CREATE USER u; +CREATE ROLE operations_cluster; +GRANT operations_cluster TO u; +CREATE DATABASE bob_live_sg; +CREATE TABLE bob_live_sg.a (i INT(10)); +CREATE TABLE bob_live_sg.b (i INT(10)); +CREATE TABLE bob_live_sg.c (i INT(10)); +CREATE TABLE bob_live_sg.d (i INT(10)); +CREATE DATABASE oms_live_sg; +CREATE TABLE oms_live_sg.a (i INT(10)); +CREATE TABLE oms_live_sg.b (i INT(10)); +CREATE TABLE oms_live_sg.c (i INT(10)); +CREATE TABLE oms_live_sg.d (i INT(10)); +CREATE DATABASE bob_live_ph; +CREATE TABLE bob_live_ph.a (i INT(10)); +CREATE TABLE bob_live_ph.b (i INT(10)); +CREATE TABLE bob_live_ph.c (i INT(10)); +CREATE TABLE bob_live_ph.d (i INT(10)); +CREATE DATABASE oms_live_ph; +CREATE TABLE oms_live_ph.a (i INT(10)); +CREATE TABLE oms_live_ph.b (i INT(10)); +CREATE TABLE oms_live_ph.c (i INT(10)); +CREATE TABLE oms_live_ph.d (i INT(10)); +CREATE DATABASE bob_live_id; +CREATE TABLE bob_live_id.a (i INT(10)); +CREATE TABLE bob_live_id.b (i INT(10)); +CREATE TABLE bob_live_id.c (i INT(10)); +CREATE TABLE bob_live_id.d (i INT(10)); +CREATE DATABASE oms_live_id; +CREATE TABLE oms_live_id.a (i INT(10)); +CREATE TABLE oms_live_id.b (i INT(10)); +CREATE TABLE oms_live_id.c (i INT(10)); +CREATE TABLE oms_live_id.d (i INT(10)); +CREATE DATABASE bob_live_hk; +CREATE TABLE bob_live_hk.a (i INT(10)); +CREATE TABLE bob_live_hk.b (i INT(10)); +CREATE TABLE bob_live_hk.c (i INT(10)); +CREATE TABLE bob_live_hk.d (i INT(10)); +CREATE DATABASE oms_live_hk; +CREATE TABLE oms_live_hk.a (i INT(10)); +CREATE TABLE oms_live_hk.b (i INT(10)); +CREATE TABLE oms_live_hk.c (i INT(10)); +CREATE TABLE oms_live_hk.d (i INT(10)); +CREATE DATABASE bob_live_vn; +CREATE TABLE bob_live_vn.a (i INT(10)); +CREATE TABLE bob_live_vn.b (i INT(10)); +CREATE TABLE bob_live_vn.c (i INT(10)); +CREATE TABLE bob_live_vn.d (i INT(10)); +CREATE DATABASE oms_live_vn; +CREATE TABLE oms_live_vn.a (i INT(10)); +CREATE TABLE oms_live_vn.b (i INT(10)); +CREATE TABLE oms_live_vn.c (i INT(10)); +CREATE TABLE oms_live_vn.d (i INT(10)); +CREATE DATABASE bob_live_tw; +CREATE TABLE bob_live_tw.a (i INT(10)); +CREATE TABLE bob_live_tw.b (i INT(10)); +CREATE TABLE bob_live_tw.c (i INT(10)); +CREATE TABLE bob_live_tw.d (i INT(10)); +CREATE DATABASE oms_live_tw; +CREATE TABLE oms_live_tw.a (i INT(10)); +CREATE TABLE oms_live_tw.b (i INT(10)); +CREATE TABLE oms_live_tw.c (i INT(10)); +CREATE TABLE oms_live_tw.d (i INT(10)); +CREATE DATABASE bob_live_my; +CREATE TABLE bob_live_my.a (i INT(10)); +CREATE TABLE bob_live_my.b (i INT(10)); +CREATE TABLE bob_live_my.c (i INT(10)); +CREATE TABLE bob_live_my.d (i INT(10)); +CREATE DATABASE oms_live_my; +CREATE TABLE oms_live_my.a (i INT(10)); +CREATE TABLE oms_live_my.b (i INT(10)); +CREATE TABLE oms_live_my.c (i INT(10)); +CREATE TABLE oms_live_my.d (i INT(10)); +CREATE DATABASE bob_live_th; +CREATE TABLE bob_live_th.a (i INT(10)); +CREATE TABLE bob_live_th.b (i INT(10)); +CREATE TABLE bob_live_th.c (i INT(10)); +CREATE TABLE bob_live_th.d (i INT(10)); +CREATE DATABASE oms_live_th; +CREATE TABLE oms_live_th.a (i INT(10)); +CREATE TABLE oms_live_th.b (i INT(10)); +CREATE TABLE oms_live_th.c (i INT(10)); +CREATE TABLE oms_live_th.d (i INT(10)); +CREATE ROLE a_sg; +CREATE ROLE b_sg; +CREATE ROLE c_sg; +CREATE ROLE d_sg; +CREATE ROLE operations_sg; +GRANT a_sg TO operations_sg; +GRANT b_sg TO operations_sg; +GRANT c_sg TO operations_sg; +GRANT d_sg TO operations_sg; +GRANT SELECT ON bob_live_sg.a TO a_sg; +GRANT SELECT ON bob_live_sg.b TO b_sg; +GRANT SELECT ON bob_live_sg.c TO c_sg; +GRANT SELECT ON bob_live_sg.d TO d_sg; +GRANT SELECT ON oms_live_sg.a TO a_sg; +GRANT SELECT ON oms_live_sg.b TO b_sg; +GRANT SELECT ON oms_live_sg.c TO c_sg; +GRANT SELECT ON oms_live_sg.d TO d_sg; +CREATE ROLE a_ph; +CREATE ROLE b_ph; +CREATE ROLE c_ph; +CREATE ROLE d_ph; +CREATE ROLE operations_ph; +GRANT a_ph TO operations_ph; +GRANT b_ph TO operations_ph; +GRANT c_ph TO operations_ph; +GRANT d_ph TO operations_ph; +GRANT SELECT ON bob_live_ph.a TO a_ph; +GRANT SELECT ON bob_live_ph.b TO b_ph; +GRANT SELECT ON bob_live_ph.c TO c_ph; +GRANT SELECT ON bob_live_ph.d TO d_ph; +GRANT SELECT ON oms_live_ph.a TO a_ph; +GRANT SELECT ON oms_live_ph.b TO b_ph; +GRANT SELECT ON oms_live_ph.c TO c_ph; +GRANT SELECT ON oms_live_ph.d TO d_ph; +CREATE ROLE a_id; +CREATE ROLE b_id; +CREATE ROLE c_id; +CREATE ROLE d_id; +CREATE ROLE operations_id; +GRANT a_id TO operations_id; +GRANT b_id TO operations_id; +GRANT c_id TO operations_id; +GRANT d_id TO operations_id; +GRANT SELECT ON bob_live_id.a TO a_id; +GRANT SELECT ON bob_live_id.b TO b_id; +GRANT SELECT ON bob_live_id.c TO c_id; +GRANT SELECT ON bob_live_id.d TO d_id; +GRANT SELECT ON oms_live_id.a TO a_id; +GRANT SELECT ON oms_live_id.b TO b_id; +GRANT SELECT ON oms_live_id.c TO c_id; +GRANT SELECT ON oms_live_id.d TO d_id; +CREATE ROLE a_hk; +CREATE ROLE b_hk; +CREATE ROLE c_hk; +CREATE ROLE d_hk; +CREATE ROLE operations_hk; +GRANT a_hk TO operations_hk; +GRANT b_hk TO operations_hk; +GRANT c_hk TO operations_hk; +GRANT d_hk TO operations_hk; +GRANT SELECT ON bob_live_hk.a TO a_hk; +GRANT SELECT ON bob_live_hk.b TO b_hk; +GRANT SELECT ON bob_live_hk.c TO c_hk; +GRANT SELECT ON bob_live_hk.d TO d_hk; +GRANT SELECT ON oms_live_hk.a TO a_hk; +GRANT SELECT ON oms_live_hk.b TO b_hk; +GRANT SELECT ON oms_live_hk.c TO c_hk; +GRANT SELECT ON oms_live_hk.d TO d_hk; +CREATE ROLE a_vn; +CREATE ROLE b_vn; +CREATE ROLE c_vn; +CREATE ROLE d_vn; +CREATE ROLE operations_vn; +GRANT a_vn TO operations_vn; +GRANT b_vn TO operations_vn; +GRANT c_vn TO operations_vn; +GRANT d_vn TO operations_vn; +GRANT SELECT ON bob_live_vn.a TO a_vn; +GRANT SELECT ON bob_live_vn.b TO b_vn; +GRANT SELECT ON bob_live_vn.c TO c_vn; +GRANT SELECT ON bob_live_vn.d TO d_vn; +GRANT SELECT ON oms_live_vn.a TO a_vn; +GRANT SELECT ON oms_live_vn.b TO b_vn; +GRANT SELECT ON oms_live_vn.c TO c_vn; +GRANT SELECT ON oms_live_vn.d TO d_vn; +CREATE ROLE a_tw; +CREATE ROLE b_tw; +CREATE ROLE c_tw; +CREATE ROLE d_tw; +CREATE ROLE operations_tw; +GRANT a_tw TO operations_tw; +GRANT b_tw TO operations_tw; +GRANT c_tw TO operations_tw; +GRANT d_tw TO operations_tw; +GRANT SELECT ON bob_live_tw.a TO a_tw; +GRANT SELECT ON bob_live_tw.b TO b_tw; +GRANT SELECT ON bob_live_tw.c TO c_tw; +GRANT SELECT ON bob_live_tw.d TO d_tw; +GRANT SELECT ON oms_live_tw.a TO a_tw; +GRANT SELECT ON oms_live_tw.b TO b_tw; +GRANT SELECT ON oms_live_tw.c TO c_tw; +GRANT SELECT ON oms_live_tw.d TO d_tw; +CREATE ROLE a_my; +CREATE ROLE b_my; +CREATE ROLE c_my; +CREATE ROLE d_my; +CREATE ROLE operations_my; +GRANT a_my TO operations_my; +GRANT b_my TO operations_my; +GRANT c_my TO operations_my; +GRANT d_my TO operations_my; +GRANT SELECT ON bob_live_my.a TO a_my; +GRANT SELECT ON bob_live_my.b TO b_my; +GRANT SELECT ON bob_live_my.c TO c_my; +GRANT SELECT ON bob_live_my.d TO d_my; +GRANT SELECT ON oms_live_my.a TO a_my; +GRANT SELECT ON oms_live_my.b TO b_my; +GRANT SELECT ON oms_live_my.c TO c_my; +GRANT SELECT ON oms_live_my.d TO d_my; +CREATE ROLE a_th; +CREATE ROLE b_th; +CREATE ROLE c_th; +CREATE ROLE d_th; +CREATE ROLE operations_th; +GRANT a_th TO operations_th; +GRANT b_th TO operations_th; +GRANT c_th TO operations_th; +GRANT d_th TO operations_th; +GRANT SELECT ON bob_live_th.a TO a_th; +GRANT SELECT ON bob_live_th.b TO b_th; +GRANT SELECT ON bob_live_th.c TO c_th; +GRANT SELECT ON bob_live_th.d TO d_th; +GRANT SELECT ON oms_live_th.a TO a_th; +GRANT SELECT ON oms_live_th.b TO b_th; +GRANT SELECT ON oms_live_th.c TO c_th; +GRANT SELECT ON oms_live_th.d TO d_th; +GRANT operations_sg TO operations_cluster; +GRANT operations_ph TO operations_cluster; +GRANT operations_id TO operations_cluster; +GRANT operations_hk TO operations_cluster; +GRANT operations_vn TO operations_cluster; +GRANT operations_tw TO operations_cluster; +GRANT operations_my TO operations_cluster; +GRANT operations_th TO operations_cluster; +SHOW DATABASES; +Database +information_schema +test +SET ROLE operations_cluster; +SHOW DATABASES; +Database +bob_live_hk +bob_live_id +bob_live_my +bob_live_ph +bob_live_sg +bob_live_th +bob_live_tw +bob_live_vn +information_schema +oms_live_hk +oms_live_id +oms_live_my +oms_live_ph +oms_live_sg +oms_live_th +oms_live_tw +oms_live_vn +test +SELECT COUNT(1) FROM oms_live_sg.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.d; +COUNT(1) +0 +FLUSH PRIVILEGES; +SHOW DATABASES; +Database +information_schema +test +SET ROLE operations_cluster; +SHOW DATABASES; +Database +bob_live_hk +bob_live_id +bob_live_my +bob_live_ph +bob_live_sg +bob_live_th +bob_live_tw +bob_live_vn +information_schema +oms_live_hk +oms_live_id +oms_live_my +oms_live_ph +oms_live_sg +oms_live_th +oms_live_tw +oms_live_vn +test +SELECT COUNT(1) FROM oms_live_sg.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_sg.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_ph.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_id.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_hk.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_vn.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_tw.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_my.d; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.a; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.b; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.c; +COUNT(1) +0 +SELECT COUNT(1) FROM oms_live_th.d; +COUNT(1) +0 +DROP DATABASE bob_live_sg; +DROP DATABASE oms_live_sg; +DROP DATABASE bob_live_ph; +DROP DATABASE oms_live_ph; +DROP DATABASE bob_live_id; +DROP DATABASE oms_live_id; +DROP DATABASE bob_live_hk; +DROP DATABASE oms_live_hk; +DROP DATABASE bob_live_vn; +DROP DATABASE oms_live_vn; +DROP DATABASE bob_live_tw; +DROP DATABASE oms_live_tw; +DROP DATABASE bob_live_my; +DROP DATABASE oms_live_my; +DROP DATABASE bob_live_th; +DROP DATABASE oms_live_th; +DROP ROLE operations_sg; +DROP ROLE a_sg; +DROP ROLE b_sg; +DROP ROLE c_sg; +DROP ROLE d_sg; +DROP ROLE operations_ph; +DROP ROLE a_ph; +DROP ROLE b_ph; +DROP ROLE c_ph; +DROP ROLE d_ph; +DROP ROLE operations_id; +DROP ROLE a_id; +DROP ROLE b_id; +DROP ROLE c_id; +DROP ROLE d_id; +DROP ROLE operations_hk; +DROP ROLE a_hk; +DROP ROLE b_hk; +DROP ROLE c_hk; +DROP ROLE d_hk; +DROP ROLE operations_vn; +DROP ROLE a_vn; +DROP ROLE b_vn; +DROP ROLE c_vn; +DROP ROLE d_vn; +DROP ROLE operations_tw; +DROP ROLE a_tw; +DROP ROLE b_tw; +DROP ROLE c_tw; +DROP ROLE d_tw; +DROP ROLE operations_my; +DROP ROLE a_my; +DROP ROLE b_my; +DROP ROLE c_my; +DROP ROLE d_my; +DROP ROLE operations_th; +DROP ROLE a_th; +DROP ROLE b_th; +DROP ROLE c_th; +DROP ROLE d_th; +DROP USER u; +DROP ROLE operations_cluster; diff --git a/mysql-test/suite/roles/flush_roles-12366.test b/mysql-test/suite/roles/flush_roles-12366.test new file mode 100644 index 00000000000..343ac4abf72 --- /dev/null +++ b/mysql-test/suite/roles/flush_roles-12366.test @@ -0,0 +1,379 @@ +--source include/not_embedded.inc +--echo # +--echo # MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles +--echo # +--echo # This testcase contains a user, who is granted a master role +--echo # operations_cluster. operations_cluster is granted 8 different roles +--echo # who in turn each have 4 different roles granted to them. +--echo # +--echo # Only the leaf roles contain privileges to access databases. +--echo # Make sure the user has access to all databases if the master role +--echo # is granted to him. +--echo # +CREATE USER u; +CREATE ROLE operations_cluster; +GRANT operations_cluster TO u; +CREATE DATABASE bob_live_sg; +CREATE TABLE bob_live_sg.a (i INT(10)); +CREATE TABLE bob_live_sg.b (i INT(10)); +CREATE TABLE bob_live_sg.c (i INT(10)); +CREATE TABLE bob_live_sg.d (i INT(10)); +CREATE DATABASE oms_live_sg; +CREATE TABLE oms_live_sg.a (i INT(10)); +CREATE TABLE oms_live_sg.b (i INT(10)); +CREATE TABLE oms_live_sg.c (i INT(10)); +CREATE TABLE oms_live_sg.d (i INT(10)); +CREATE DATABASE bob_live_ph; +CREATE TABLE bob_live_ph.a (i INT(10)); +CREATE TABLE bob_live_ph.b (i INT(10)); +CREATE TABLE bob_live_ph.c (i INT(10)); +CREATE TABLE bob_live_ph.d (i INT(10)); +CREATE DATABASE oms_live_ph; +CREATE TABLE oms_live_ph.a (i INT(10)); +CREATE TABLE oms_live_ph.b (i INT(10)); +CREATE TABLE oms_live_ph.c (i INT(10)); +CREATE TABLE oms_live_ph.d (i INT(10)); +CREATE DATABASE bob_live_id; +CREATE TABLE bob_live_id.a (i INT(10)); +CREATE TABLE bob_live_id.b (i INT(10)); +CREATE TABLE bob_live_id.c (i INT(10)); +CREATE TABLE bob_live_id.d (i INT(10)); +CREATE DATABASE oms_live_id; +CREATE TABLE oms_live_id.a (i INT(10)); +CREATE TABLE oms_live_id.b (i INT(10)); +CREATE TABLE oms_live_id.c (i INT(10)); +CREATE TABLE oms_live_id.d (i INT(10)); +CREATE DATABASE bob_live_hk; +CREATE TABLE bob_live_hk.a (i INT(10)); +CREATE TABLE bob_live_hk.b (i INT(10)); +CREATE TABLE bob_live_hk.c (i INT(10)); +CREATE TABLE bob_live_hk.d (i INT(10)); +CREATE DATABASE oms_live_hk; +CREATE TABLE oms_live_hk.a (i INT(10)); +CREATE TABLE oms_live_hk.b (i INT(10)); +CREATE TABLE oms_live_hk.c (i INT(10)); +CREATE TABLE oms_live_hk.d (i INT(10)); +CREATE DATABASE bob_live_vn; +CREATE TABLE bob_live_vn.a (i INT(10)); +CREATE TABLE bob_live_vn.b (i INT(10)); +CREATE TABLE bob_live_vn.c (i INT(10)); +CREATE TABLE bob_live_vn.d (i INT(10)); +CREATE DATABASE oms_live_vn; +CREATE TABLE oms_live_vn.a (i INT(10)); +CREATE TABLE oms_live_vn.b (i INT(10)); +CREATE TABLE oms_live_vn.c (i INT(10)); +CREATE TABLE oms_live_vn.d (i INT(10)); +CREATE DATABASE bob_live_tw; +CREATE TABLE bob_live_tw.a (i INT(10)); +CREATE TABLE bob_live_tw.b (i INT(10)); +CREATE TABLE bob_live_tw.c (i INT(10)); +CREATE TABLE bob_live_tw.d (i INT(10)); +CREATE DATABASE oms_live_tw; +CREATE TABLE oms_live_tw.a (i INT(10)); +CREATE TABLE oms_live_tw.b (i INT(10)); +CREATE TABLE oms_live_tw.c (i INT(10)); +CREATE TABLE oms_live_tw.d (i INT(10)); +CREATE DATABASE bob_live_my; +CREATE TABLE bob_live_my.a (i INT(10)); +CREATE TABLE bob_live_my.b (i INT(10)); +CREATE TABLE bob_live_my.c (i INT(10)); +CREATE TABLE bob_live_my.d (i INT(10)); +CREATE DATABASE oms_live_my; +CREATE TABLE oms_live_my.a (i INT(10)); +CREATE TABLE oms_live_my.b (i INT(10)); +CREATE TABLE oms_live_my.c (i INT(10)); +CREATE TABLE oms_live_my.d (i INT(10)); +CREATE DATABASE bob_live_th; +CREATE TABLE bob_live_th.a (i INT(10)); +CREATE TABLE bob_live_th.b (i INT(10)); +CREATE TABLE bob_live_th.c (i INT(10)); +CREATE TABLE bob_live_th.d (i INT(10)); +CREATE DATABASE oms_live_th; +CREATE TABLE oms_live_th.a (i INT(10)); +CREATE TABLE oms_live_th.b (i INT(10)); +CREATE TABLE oms_live_th.c (i INT(10)); +CREATE TABLE oms_live_th.d (i INT(10)); +CREATE ROLE a_sg; +CREATE ROLE b_sg; +CREATE ROLE c_sg; +CREATE ROLE d_sg; +CREATE ROLE operations_sg; +GRANT a_sg TO operations_sg; +GRANT b_sg TO operations_sg; +GRANT c_sg TO operations_sg; +GRANT d_sg TO operations_sg; +GRANT SELECT ON bob_live_sg.a TO a_sg; +GRANT SELECT ON bob_live_sg.b TO b_sg; +GRANT SELECT ON bob_live_sg.c TO c_sg; +GRANT SELECT ON bob_live_sg.d TO d_sg; +GRANT SELECT ON oms_live_sg.a TO a_sg; +GRANT SELECT ON oms_live_sg.b TO b_sg; +GRANT SELECT ON oms_live_sg.c TO c_sg; +GRANT SELECT ON oms_live_sg.d TO d_sg; +CREATE ROLE a_ph; +CREATE ROLE b_ph; +CREATE ROLE c_ph; +CREATE ROLE d_ph; +CREATE ROLE operations_ph; +GRANT a_ph TO operations_ph; +GRANT b_ph TO operations_ph; +GRANT c_ph TO operations_ph; +GRANT d_ph TO operations_ph; +GRANT SELECT ON bob_live_ph.a TO a_ph; +GRANT SELECT ON bob_live_ph.b TO b_ph; +GRANT SELECT ON bob_live_ph.c TO c_ph; +GRANT SELECT ON bob_live_ph.d TO d_ph; +GRANT SELECT ON oms_live_ph.a TO a_ph; +GRANT SELECT ON oms_live_ph.b TO b_ph; +GRANT SELECT ON oms_live_ph.c TO c_ph; +GRANT SELECT ON oms_live_ph.d TO d_ph; +CREATE ROLE a_id; +CREATE ROLE b_id; +CREATE ROLE c_id; +CREATE ROLE d_id; +CREATE ROLE operations_id; +GRANT a_id TO operations_id; +GRANT b_id TO operations_id; +GRANT c_id TO operations_id; +GRANT d_id TO operations_id; +GRANT SELECT ON bob_live_id.a TO a_id; +GRANT SELECT ON bob_live_id.b TO b_id; +GRANT SELECT ON bob_live_id.c TO c_id; +GRANT SELECT ON bob_live_id.d TO d_id; +GRANT SELECT ON oms_live_id.a TO a_id; +GRANT SELECT ON oms_live_id.b TO b_id; +GRANT SELECT ON oms_live_id.c TO c_id; +GRANT SELECT ON oms_live_id.d TO d_id; +CREATE ROLE a_hk; +CREATE ROLE b_hk; +CREATE ROLE c_hk; +CREATE ROLE d_hk; +CREATE ROLE operations_hk; +GRANT a_hk TO operations_hk; +GRANT b_hk TO operations_hk; +GRANT c_hk TO operations_hk; +GRANT d_hk TO operations_hk; +GRANT SELECT ON bob_live_hk.a TO a_hk; +GRANT SELECT ON bob_live_hk.b TO b_hk; +GRANT SELECT ON bob_live_hk.c TO c_hk; +GRANT SELECT ON bob_live_hk.d TO d_hk; +GRANT SELECT ON oms_live_hk.a TO a_hk; +GRANT SELECT ON oms_live_hk.b TO b_hk; +GRANT SELECT ON oms_live_hk.c TO c_hk; +GRANT SELECT ON oms_live_hk.d TO d_hk; +CREATE ROLE a_vn; +CREATE ROLE b_vn; +CREATE ROLE c_vn; +CREATE ROLE d_vn; +CREATE ROLE operations_vn; +GRANT a_vn TO operations_vn; +GRANT b_vn TO operations_vn; +GRANT c_vn TO operations_vn; +GRANT d_vn TO operations_vn; +GRANT SELECT ON bob_live_vn.a TO a_vn; +GRANT SELECT ON bob_live_vn.b TO b_vn; +GRANT SELECT ON bob_live_vn.c TO c_vn; +GRANT SELECT ON bob_live_vn.d TO d_vn; +GRANT SELECT ON oms_live_vn.a TO a_vn; +GRANT SELECT ON oms_live_vn.b TO b_vn; +GRANT SELECT ON oms_live_vn.c TO c_vn; +GRANT SELECT ON oms_live_vn.d TO d_vn; +CREATE ROLE a_tw; +CREATE ROLE b_tw; +CREATE ROLE c_tw; +CREATE ROLE d_tw; +CREATE ROLE operations_tw; +GRANT a_tw TO operations_tw; +GRANT b_tw TO operations_tw; +GRANT c_tw TO operations_tw; +GRANT d_tw TO operations_tw; +GRANT SELECT ON bob_live_tw.a TO a_tw; +GRANT SELECT ON bob_live_tw.b TO b_tw; +GRANT SELECT ON bob_live_tw.c TO c_tw; +GRANT SELECT ON bob_live_tw.d TO d_tw; +GRANT SELECT ON oms_live_tw.a TO a_tw; +GRANT SELECT ON oms_live_tw.b TO b_tw; +GRANT SELECT ON oms_live_tw.c TO c_tw; +GRANT SELECT ON oms_live_tw.d TO d_tw; +CREATE ROLE a_my; +CREATE ROLE b_my; +CREATE ROLE c_my; +CREATE ROLE d_my; +CREATE ROLE operations_my; +GRANT a_my TO operations_my; +GRANT b_my TO operations_my; +GRANT c_my TO operations_my; +GRANT d_my TO operations_my; +GRANT SELECT ON bob_live_my.a TO a_my; +GRANT SELECT ON bob_live_my.b TO b_my; +GRANT SELECT ON bob_live_my.c TO c_my; +GRANT SELECT ON bob_live_my.d TO d_my; +GRANT SELECT ON oms_live_my.a TO a_my; +GRANT SELECT ON oms_live_my.b TO b_my; +GRANT SELECT ON oms_live_my.c TO c_my; +GRANT SELECT ON oms_live_my.d TO d_my; +CREATE ROLE a_th; +CREATE ROLE b_th; +CREATE ROLE c_th; +CREATE ROLE d_th; +CREATE ROLE operations_th; +GRANT a_th TO operations_th; +GRANT b_th TO operations_th; +GRANT c_th TO operations_th; +GRANT d_th TO operations_th; +GRANT SELECT ON bob_live_th.a TO a_th; +GRANT SELECT ON bob_live_th.b TO b_th; +GRANT SELECT ON bob_live_th.c TO c_th; +GRANT SELECT ON bob_live_th.d TO d_th; +GRANT SELECT ON oms_live_th.a TO a_th; +GRANT SELECT ON oms_live_th.b TO b_th; +GRANT SELECT ON oms_live_th.c TO c_th; +GRANT SELECT ON oms_live_th.d TO d_th; +GRANT operations_sg TO operations_cluster; +GRANT operations_ph TO operations_cluster; +GRANT operations_id TO operations_cluster; +GRANT operations_hk TO operations_cluster; +GRANT operations_vn TO operations_cluster; +GRANT operations_tw TO operations_cluster; +GRANT operations_my TO operations_cluster; +GRANT operations_th TO operations_cluster; + +connect(con1,localhost,u,,); +SHOW DATABASES; +SET ROLE operations_cluster; +SHOW DATABASES; +SELECT COUNT(1) FROM oms_live_sg.a; +SELECT COUNT(1) FROM oms_live_sg.b; +SELECT COUNT(1) FROM oms_live_sg.c; +SELECT COUNT(1) FROM oms_live_sg.d; +SELECT COUNT(1) FROM oms_live_ph.a; +SELECT COUNT(1) FROM oms_live_ph.b; +SELECT COUNT(1) FROM oms_live_ph.c; +SELECT COUNT(1) FROM oms_live_ph.d; +SELECT COUNT(1) FROM oms_live_id.a; +SELECT COUNT(1) FROM oms_live_id.b; +SELECT COUNT(1) FROM oms_live_id.c; +SELECT COUNT(1) FROM oms_live_id.d; +SELECT COUNT(1) FROM oms_live_hk.a; +SELECT COUNT(1) FROM oms_live_hk.b; +SELECT COUNT(1) FROM oms_live_hk.c; +SELECT COUNT(1) FROM oms_live_hk.d; +SELECT COUNT(1) FROM oms_live_vn.a; +SELECT COUNT(1) FROM oms_live_vn.b; +SELECT COUNT(1) FROM oms_live_vn.c; +SELECT COUNT(1) FROM oms_live_vn.d; +SELECT COUNT(1) FROM oms_live_tw.a; +SELECT COUNT(1) FROM oms_live_tw.b; +SELECT COUNT(1) FROM oms_live_tw.c; +SELECT COUNT(1) FROM oms_live_tw.d; +SELECT COUNT(1) FROM oms_live_my.a; +SELECT COUNT(1) FROM oms_live_my.b; +SELECT COUNT(1) FROM oms_live_my.c; +SELECT COUNT(1) FROM oms_live_my.d; +SELECT COUNT(1) FROM oms_live_th.a; +SELECT COUNT(1) FROM oms_live_th.b; +SELECT COUNT(1) FROM oms_live_th.c; +SELECT COUNT(1) FROM oms_live_th.d; + + +connect(con2,localhost,root,,); +FLUSH PRIVILEGES; + +connect(con3,localhost,u,,); +SHOW DATABASES; +SET ROLE operations_cluster; +SHOW DATABASES; +SELECT COUNT(1) FROM oms_live_sg.a; +SELECT COUNT(1) FROM oms_live_sg.b; +SELECT COUNT(1) FROM oms_live_sg.c; +SELECT COUNT(1) FROM oms_live_sg.d; +SELECT COUNT(1) FROM oms_live_ph.a; +SELECT COUNT(1) FROM oms_live_ph.b; +SELECT COUNT(1) FROM oms_live_ph.c; +SELECT COUNT(1) FROM oms_live_ph.d; +SELECT COUNT(1) FROM oms_live_id.a; +SELECT COUNT(1) FROM oms_live_id.b; +SELECT COUNT(1) FROM oms_live_id.c; +SELECT COUNT(1) FROM oms_live_id.d; +SELECT COUNT(1) FROM oms_live_hk.a; +SELECT COUNT(1) FROM oms_live_hk.b; +SELECT COUNT(1) FROM oms_live_hk.c; +SELECT COUNT(1) FROM oms_live_hk.d; +SELECT COUNT(1) FROM oms_live_vn.a; +SELECT COUNT(1) FROM oms_live_vn.b; +SELECT COUNT(1) FROM oms_live_vn.c; +SELECT COUNT(1) FROM oms_live_vn.d; +SELECT COUNT(1) FROM oms_live_tw.a; +SELECT COUNT(1) FROM oms_live_tw.b; +SELECT COUNT(1) FROM oms_live_tw.c; +SELECT COUNT(1) FROM oms_live_tw.d; +SELECT COUNT(1) FROM oms_live_my.a; +SELECT COUNT(1) FROM oms_live_my.b; +SELECT COUNT(1) FROM oms_live_my.c; +SELECT COUNT(1) FROM oms_live_my.d; +SELECT COUNT(1) FROM oms_live_th.a; +SELECT COUNT(1) FROM oms_live_th.b; +SELECT COUNT(1) FROM oms_live_th.c; +SELECT COUNT(1) FROM oms_live_th.d; + + +connect(con4,localhost,root,,); + +DROP DATABASE bob_live_sg; +DROP DATABASE oms_live_sg; +DROP DATABASE bob_live_ph; +DROP DATABASE oms_live_ph; +DROP DATABASE bob_live_id; +DROP DATABASE oms_live_id; +DROP DATABASE bob_live_hk; +DROP DATABASE oms_live_hk; +DROP DATABASE bob_live_vn; +DROP DATABASE oms_live_vn; +DROP DATABASE bob_live_tw; +DROP DATABASE oms_live_tw; +DROP DATABASE bob_live_my; +DROP DATABASE oms_live_my; +DROP DATABASE bob_live_th; +DROP DATABASE oms_live_th; +DROP ROLE operations_sg; +DROP ROLE a_sg; +DROP ROLE b_sg; +DROP ROLE c_sg; +DROP ROLE d_sg; +DROP ROLE operations_ph; +DROP ROLE a_ph; +DROP ROLE b_ph; +DROP ROLE c_ph; +DROP ROLE d_ph; +DROP ROLE operations_id; +DROP ROLE a_id; +DROP ROLE b_id; +DROP ROLE c_id; +DROP ROLE d_id; +DROP ROLE operations_hk; +DROP ROLE a_hk; +DROP ROLE b_hk; +DROP ROLE c_hk; +DROP ROLE d_hk; +DROP ROLE operations_vn; +DROP ROLE a_vn; +DROP ROLE b_vn; +DROP ROLE c_vn; +DROP ROLE d_vn; +DROP ROLE operations_tw; +DROP ROLE a_tw; +DROP ROLE b_tw; +DROP ROLE c_tw; +DROP ROLE d_tw; +DROP ROLE operations_my; +DROP ROLE a_my; +DROP ROLE b_my; +DROP ROLE c_my; +DROP ROLE d_my; +DROP ROLE operations_th; +DROP ROLE a_th; +DROP ROLE b_th; +DROP ROLE c_th; +DROP ROLE d_th; +DROP USER u; +DROP ROLE operations_cluster; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1b25871b664..27292105dde 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5362,6 +5362,7 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)), { PRIVS_TO_MERGE *data= (PRIVS_TO_MERGE *)context; + DBUG_ASSERT(grantee->counter > 0); if (--grantee->counter) return 1; // don't recurse into grantee just yet @@ -6554,16 +6555,14 @@ end_index_init: DBUG_RETURN(return_val); } - -my_bool role_propagate_grants_action(void *ptr, void *unused __attribute__((unused))) +static my_bool collect_leaf_roles(void *role_ptr, + void *roles_array) { - ACL_ROLE *role= (ACL_ROLE *)ptr; - if (role->counter) - return 0; - - mysql_mutex_assert_owner(&acl_cache->lock); - PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; - traverse_role_graph_up(role, &data, NULL, merge_role_privileges); + ACL_ROLE *role= static_cast(role_ptr); + Dynamic_array *array= + static_cast *>(roles_array); + if (!role->counter) + array->push(role); return 0; } @@ -6614,7 +6613,7 @@ my_bool grant_reload(THD *thd) obtaining LOCK_grant rwlock. */ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT)) - goto end; + DBUG_RETURN(1); mysql_rwlock_wrlock(&LOCK_grant); grant_version++; @@ -6646,14 +6645,21 @@ my_bool grant_reload(THD *thd) } mysql_mutex_lock(&acl_cache->lock); - my_hash_iterate(&acl_roles, role_propagate_grants_action, NULL); + Dynamic_array leaf_roles; + my_hash_iterate(&acl_roles, collect_leaf_roles, &leaf_roles); + PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; + for (size_t i= 0; i < leaf_roles.elements(); i++) + { + traverse_role_graph_up(leaf_roles.at(i), &data, NULL, + merge_role_privileges); + } + mysql_mutex_unlock(&acl_cache->lock); mysql_rwlock_unlock(&LOCK_grant); close_mysql_tables(thd); -end: DBUG_RETURN(return_val); } From ed7e4b68ed59fb7c34dc06625dfe378e71d1e8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 19 Dec 2017 16:45:10 +0200 Subject: [PATCH 15/88] DEV-14701: install_db shows corruption for rest encryption with innodb_data_file_path=ibdata1:3M Problem was that crypt_data->min_key_version is not a reliable way to detect is tablespace encrypted and could lead that in first page of the second (page 192 and similarly for other files if more configured) system tablespace file used key_version is replaced with zero leading a corruption as in next startup page is though to be corrupted. Note that crypt_data->min_key_version is updated only after all pages from tablespace have been processed (i.e. key rotation is done) and flushed. fil_write_flushed_lsn Use crypt_data->should_encrypt() instead. --- storage/innobase/fil/fil0fil.cc | 4 +++- storage/xtradb/fil/fil0fil.cc | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index ac30f3c7a25..c9ecf3dab0b 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2085,7 +2085,9 @@ fil_write_flushed_lsn( /* If tablespace is not encrypted, stamp flush_lsn to first page of all system tablespace datafiles to avoid unnecessary error messages on possible downgrade. */ - if (!space->crypt_data || space->crypt_data->min_key_version == 0) { + if (!space->crypt_data + || !space->crypt_data->should_encrypt()) { + fil_node_t* node; ulint sum_of_sizes = 0; diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 00f2c44637e..9023b4446b5 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -2136,7 +2136,8 @@ fil_write_flushed_lsn( /* If tablespace is not encrypted, stamp flush_lsn to first page of all system tablespace datafiles to avoid unnecessary error messages on possible downgrade. */ - if (!space->crypt_data || space->crypt_data->min_key_version == 0) { + if (!space->crypt_data + || !space->crypt_data->should_encrypt()) { fil_node_t* node; ulint sum_of_sizes = 0; From 2cd316911309e3db4007aa224f7874bfbeb14032 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 18 Dec 2017 17:15:48 +0400 Subject: [PATCH 16/88] MDEV-14265 - RPMLint warning: shared-lib-calls-exit find_type_or_exit() client helper did exit(1) on error, exit(1) moved to clients. mysql_read_default_options() did exit(1) on error, error is passed through and handled now. my_str_malloc_default() did exit(1) on error, replaced my_str_ allocator functions with normal my_malloc()/my_realloc()/my_free(). sql_connect.cc did many exit(1) on hash initialisation failure. Removed error check since my_hash_init() never fails. my_malloc() did exit(1) on error. Replaced with abort(). my_load_defaults() did exit(1) on error, replaced with return 2. my_load_defaults() still does exit(0) when invoked with --print-defaults. --- client/mysql.cc | 8 ++++-- client/mysqladmin.cc | 8 ++++-- client/mysqlbinlog.cc | 19 ++++++++++--- client/mysqlcheck.c | 8 ++++-- client/mysqldump.c | 8 ++++-- client/mysqlimport.c | 8 ++++-- client/mysqlshow.c | 8 ++++-- client/mysqlslap.c | 8 ++++-- client/mysqltest.cc | 8 ++++-- extra/mariabackup/xtrabackup.cc | 8 ++++-- include/m_string.h | 9 ------ include/mysql.h.pp | 2 -- include/typelib.h | 2 -- libmysqld/libmysqld.c | 3 ++ mysql-test/t/xml.test | 2 +- mysys/my_default.c | 6 ++-- mysys/my_malloc.c | 2 +- mysys/typelib.c | 12 -------- sql-common/client.c | 7 +++-- sql/mysqld.cc | 21 +------------- sql/sql_connect.cc | 49 ++++++++++----------------------- strings/CMakeLists.txt | 2 +- strings/ctype-tis620.c | 8 +++--- strings/my_vsnprintf.c | 6 ++-- strings/str_alloc.c | 41 --------------------------- strings/xml.c | 9 +++--- 26 files changed, 110 insertions(+), 162 deletions(-) delete mode 100644 strings/str_alloc.c diff --git a/client/mysql.cc b/client/mysql.cc index c043d054ea5..977085ebd42 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1793,8 +1793,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } #endif break; case OPT_SERVER_ARG: diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index ffdc73f99ad..897c2eb41c3 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -298,8 +298,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } return 0; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index c103061bbc5..b871a70ef01 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1649,8 +1649,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), remote_opt= 1; break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case OPT_START_DATETIME: start_datetime= convert_str_to_timestamp(start_datetime_str); @@ -1663,8 +1667,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_base64_output_mode= BASE64_OUTPUT_ALWAYS; else { - opt_base64_output_mode= (enum_base64_output_mode) - (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1); + int val; + + if ((val= find_type_with_warning(argument, &base64_output_mode_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } + opt_base64_output_mode= (enum_base64_output_mode) (val - 1); } break; case OPT_REWRITE_DB: // db_from->db_to diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index c4ac58973f8..47cb38751eb 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -367,8 +367,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), print_version(); exit(0); break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } diff --git a/client/mysqldump.c b/client/mysqldump.c index aead4caf506..5c0ec2a5510 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -956,8 +956,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case (int) OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } return 0; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 7f03cb355f8..9c84d4a62a6 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -249,8 +249,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : "d:t:o"); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 6f434d6770d..f851c15106e 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -328,8 +328,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : "d:t:o"); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index a78bf35d51b..6a0b214305c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -779,8 +779,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 155d0c4c092..2200462b2fe 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7292,8 +7292,12 @@ get_one_option(int optid, const struct my_option *opt, char *argument) exit(0); case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } #endif break; case '?': diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index eb1cbf4748d..437fc4aa7f9 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1380,8 +1380,12 @@ xb_get_one_option(int optid, case OPT_PROTOCOL: if (argument) { - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } } break; #include "sslopt-case.h" diff --git a/include/m_string.h b/include/m_string.h index 7437ea8b7cd..d088b510de5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -64,15 +64,6 @@ extern "C" { #endif -/* - my_str_malloc(), my_str_realloc() and my_str_free() are assigned to - implementations in strings/alloc.c, but can be overridden in - the calling program. - */ -extern void *(*my_str_malloc)(size_t); -extern void *(*my_str_realloc)(void *, size_t); -extern void (*my_str_free)(void *); - #ifdef DBUG_OFF #if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) #define strmov(A,B) __builtin_stpcpy((A),(B)) diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 32d87b7391c..8936a716b90 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -221,8 +221,6 @@ typedef struct st_typelib { extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option); -extern int find_type_or_exit(const char *x, TYPELIB *typelib, - const char *option); extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); diff --git a/include/typelib.h b/include/typelib.h index 4504bea4ff7..ab5a0f0d258 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -29,8 +29,6 @@ typedef struct st_typelib { /* Different types saved here */ extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option); -extern int find_type_or_exit(const char *x, TYPELIB *typelib, - const char *option); #define FIND_TYPE_BASIC 0 /** makes @c find_type() require the whole name, no prefix */ #define FIND_TYPE_NO_PREFIX (1 << 0) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 36728cf573c..543ab86643e 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -121,6 +121,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, my_free(mysql->options.my_cnf_file); my_free(mysql->options.my_cnf_group); mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; + + if (mysql->options.protocol == UINT_MAX32) + goto error; } if (!db || !db[0]) diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 371fcb72b0d..ae7e9058e26 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -713,7 +713,7 @@ FROM t1; SELECT UPDATEXML(txt, CONCAT('//', REPEAT('b', 63)), '63/63+') FROM t1; DROP TABLE t1; -# This will call my_str_realloc_mysqld() +# This will call realloc() CREATE TABLE t1 (a TEXT); INSERT INTO t1 VALUES (CONCAT('<', REPEAT('b',128),'>b128<',REPEAT('c',512),'>c512')); SELECT ExtractValue (a, CONCAT('//',REPEAT('c',512))) AS c512 FROM t1; diff --git a/mysys/my_default.c b/mysys/my_default.c index 655e9a57747..dba22c4e58b 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -487,8 +487,7 @@ int load_defaults(const char *conf_file, const char **groups, easily command line options override options in configuration files NOTES - In case of fatal error, the function will print a warning and do - exit(1) + In case of fatal error, the function will print a warning and returns 2 To free used memory one should call free_defaults() with the argument that was put in *argv @@ -641,8 +640,7 @@ int my_load_defaults(const char *conf_file, const char **groups, err: fprintf(stderr,"Fatal error in defaults handling. Program aborted\n"); - exit(1); - return 0; /* Keep compiler happy */ + return 2; } diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index dc02d3896bd..719c13a040e 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -109,7 +109,7 @@ void *my_malloc(size_t size, myf my_flags) my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG + ME_NOREFRESH + ME_FATALERROR),size); if (my_flags & MY_FAE) - exit(1); + abort(); } else { diff --git a/mysys/typelib.c b/mysys/typelib.c index 96842b1a3ad..9ca0847570f 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -45,18 +45,6 @@ int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option) } -int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option) -{ - int res; - if ((res= find_type_with_warning(x, typelib, option)) <= 0) - { - sf_leaking_memory= 1; /* no memory leak reports here */ - exit(1); - } - return res; -} - - /** Search after a string in a list of strings. Endspace in x is not compared. diff --git a/sql-common/client.c b/sql-common/client.c index ea686a79a1f..da18a0fdea1 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1232,11 +1232,12 @@ void mysql_read_default_options(struct st_mysql_options *options, options->max_allowed_packet= atoi(opt_arg); break; case OPT_protocol: - if ((options->protocol= find_type(opt_arg, &sql_protocol_typelib, + if (options->protocol != UINT_MAX32 && + (options->protocol= find_type(opt_arg, &sql_protocol_typelib, FIND_TYPE_BASIC)) <= 0) { fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); - exit(1); + options->protocol= UINT_MAX32; } break; case OPT_shared_memory_base_name: @@ -3133,6 +3134,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, my_free(mysql->options.my_cnf_file); my_free(mysql->options.my_cnf_group); mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; + if (mysql->options.protocol == UINT_MAX32) + goto error; } /* Some empty-string-tests are done because of ODBC */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8b7fdd2f705..227c3eb6f99 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3542,8 +3542,6 @@ void my_message_sql(uint error, const char *str, myf MyFlags) extern "C" void *my_str_malloc_mysqld(size_t size); -extern "C" void my_str_free_mysqld(void *ptr); -extern "C" void *my_str_realloc_mysqld(void *ptr, size_t size); void *my_str_malloc_mysqld(size_t size) { @@ -3551,17 +3549,6 @@ void *my_str_malloc_mysqld(size_t size) } -void my_str_free_mysqld(void *ptr) -{ - my_free(ptr); -} - -void *my_str_realloc_mysqld(void *ptr, size_t size) -{ - return my_realloc(ptr, size, MYF(MY_FAE)); -} - - #ifdef __WIN__ pthread_handler_t handle_shutdown(void *arg) @@ -3617,14 +3604,8 @@ check_enough_stack_size(int recurse_level) } -/* - Initialize my_str_malloc() and my_str_free() -*/ static void init_libstrings() { - my_str_malloc= &my_str_malloc_mysqld; - my_str_free= &my_str_free_mysqld; - my_str_realloc= &my_str_realloc_mysqld; #ifndef EMBEDDED_LIBRARY my_string_stack_guard= check_enough_stack_size; #endif @@ -3635,7 +3616,7 @@ ulonglong my_pcre_frame_size; static void init_pcre() { pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld; - pcre_free= pcre_stack_free= my_str_free_mysqld; + pcre_free= pcre_stack_free= my_free; pcre_stack_guard= check_enough_stack_size_slow; /* See http://pcre.org/original/doc/html/pcrestack.html */ my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0); diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index ac5b6ab29a2..d3ef245209d 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -314,13 +314,9 @@ extern "C" void free_user(struct user_conn *uc) void init_max_user_conn(void) { #ifndef NO_EMBEDDED_ACCESS_CHECKS - if (my_hash_init(&hash_user_connections,system_charset_info,max_connections, - 0,0, (my_hash_get_key) get_key_conn, - (my_hash_free_key) free_user, 0)) - { - sql_print_error("Initializing hash_user_connections failed."); - exit(1); - } + my_hash_init(&hash_user_connections, system_charset_info, max_connections, + 0, 0, (my_hash_get_key) get_key_conn, + (my_hash_free_key) free_user, 0); #endif } @@ -479,24 +475,16 @@ void init_user_stats(USER_STATS *user_stats, void init_global_user_stats(void) { - if (my_hash_init(&global_user_stats, system_charset_info, max_connections, - 0, 0, (my_hash_get_key) get_key_user_stats, - (my_hash_free_key)free_user_stats, 0)) - { - sql_print_error("Initializing global_user_stats failed."); - exit(1); - } + my_hash_init(&global_user_stats, system_charset_info, max_connections, + 0, 0, (my_hash_get_key) get_key_user_stats, + (my_hash_free_key) free_user_stats, 0); } void init_global_client_stats(void) { - if (my_hash_init(&global_client_stats, system_charset_info, max_connections, - 0, 0, (my_hash_get_key) get_key_user_stats, - (my_hash_free_key)free_user_stats, 0)) - { - sql_print_error("Initializing global_client_stats failed."); - exit(1); - } + my_hash_init(&global_client_stats, system_charset_info, max_connections, + 0, 0, (my_hash_get_key) get_key_user_stats, + (my_hash_free_key) free_user_stats, 0); } extern "C" uchar *get_key_table_stats(TABLE_STATS *table_stats, size_t *length, @@ -513,12 +501,9 @@ extern "C" void free_table_stats(TABLE_STATS* table_stats) void init_global_table_stats(void) { - if (my_hash_init(&global_table_stats, system_charset_info, max_connections, - 0, 0, (my_hash_get_key) get_key_table_stats, - (my_hash_free_key)free_table_stats, 0)) { - sql_print_error("Initializing global_table_stats failed."); - exit(1); - } + my_hash_init(&global_table_stats, system_charset_info, max_connections, + 0, 0, (my_hash_get_key) get_key_table_stats, + (my_hash_free_key) free_table_stats, 0); } extern "C" uchar *get_key_index_stats(INDEX_STATS *index_stats, size_t *length, @@ -535,13 +520,9 @@ extern "C" void free_index_stats(INDEX_STATS* index_stats) void init_global_index_stats(void) { - if (my_hash_init(&global_index_stats, system_charset_info, max_connections, - 0, 0, (my_hash_get_key) get_key_index_stats, - (my_hash_free_key)free_index_stats, 0)) - { - sql_print_error("Initializing global_index_stats failed."); - exit(1); - } + my_hash_init(&global_index_stats, system_charset_info, max_connections, + 0, 0, (my_hash_get_key) get_key_index_stats, + (my_hash_free_key) free_index_stats, 0); } diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 32a3f06c861..65eeb457f2d 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -20,7 +20,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c - str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c + str2int.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c strxmov.c strxnmov.c xml.c strmov_overlapp.c my_strchr.c strcont.c strappend.c) diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index bd8efeff1ec..5284109b816 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -524,7 +524,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), tc1= buf; if ((len1 + len2 +2) > (int) sizeof(buf)) - tc1= (uchar*) my_str_malloc(len1+len2+2); + tc1= (uchar*) my_malloc(len1+len2+2, MYF(MY_FAE)); tc2= tc1 + len1+1; memcpy((char*) tc1, (char*) s1, len1); tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */ @@ -534,7 +534,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), thai2sortable(tc2, len2); i= strcmp((char*)tc1, (char*)tc2); if (tc1 != buf) - my_str_free(tc1); + my_free(tc1); return i; } @@ -555,7 +555,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), a= buf; if ((a_length + b_length +2) > (int) sizeof(buf)) - alloced= a= (uchar*) my_str_malloc(a_length+b_length+2); + alloced= a= (uchar*) my_malloc(a_length+b_length+2, MYF(MY_FAE)); b= a + a_length+1; memcpy((char*) a, (char*) a0, a_length); @@ -604,7 +604,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), ret: if (alloced) - my_str_free(alloced); + my_free(alloced); return res; } diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 4178b20789d..134fdfc57b8 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -755,14 +755,14 @@ int my_vfprintf(FILE *stream, const char* format, va_list args) and try again. */ if (alloc) - (*my_str_free)(p); + my_free(p); else alloc= 1; new_len= cur_len*2; if (new_len < cur_len) return 0; /* Overflow */ cur_len= new_len; - p= (*my_str_malloc)(cur_len); + p= my_malloc(cur_len, MYF(MY_FAE)); if (!p) return 0; } @@ -770,7 +770,7 @@ int my_vfprintf(FILE *stream, const char* format, va_list args) if (fputs(p, stream) < 0) ret= -1; if (alloc) - (*my_str_free)(p); + my_free(p); return ret; } diff --git a/strings/str_alloc.c b/strings/str_alloc.c deleted file mode 100644 index 91246603f2e..00000000000 --- a/strings/str_alloc.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2005, 2006 MySQL AB - Copyright (c) 2009-2011, Monty Program Ab - Use is subject to license terms. - Copyright (c) 2009-2011, Monty Program Ab - - 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 - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "strings_def.h" - -static void *my_str_malloc_default(size_t size) -{ - void *ret= malloc(size); - if (!ret) - exit(1); - return ret; -} - -static void my_str_free_default(void *ptr) -{ - free(ptr); -} - -void *my_str_realloc_default(void *ptr, size_t size) -{ - return realloc(ptr, size); -} - -void *(*my_str_malloc)(size_t)= &my_str_malloc_default; -void (*my_str_free)(void *)= &my_str_free_default; -void *(*my_str_realloc)(void *, size_t)= &my_str_realloc_default; diff --git a/strings/xml.c b/strings/xml.c index 4685a04faec..b5fed6a6760 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -17,6 +17,7 @@ #include "strings_def.h" #include "m_string.h" #include "my_xml.h" +#include "my_sys.h" #define MY_XML_UNKNOWN 'U' @@ -231,13 +232,13 @@ static int my_xml_attr_ensure_space(MY_XML_PARSER *st, size_t len) if (!st->attr.buffer) { - st->attr.buffer= (char *) my_str_malloc(st->attr.buffer_size); + st->attr.buffer= (char *) my_malloc(st->attr.buffer_size, MYF(0)); if (st->attr.buffer) memcpy(st->attr.buffer, st->attr.static_buffer, ofs + 1 /*term. zero */); } else - st->attr.buffer= (char *) my_str_realloc(st->attr.buffer, - st->attr.buffer_size); + st->attr.buffer= (char *) my_realloc(st->attr.buffer, + st->attr.buffer_size, MYF(0)); st->attr.start= st->attr.buffer; st->attr.end= st->attr.start + ofs; @@ -507,7 +508,7 @@ void my_xml_parser_free(MY_XML_PARSER *p) { if (p->attr.buffer) { - my_str_free(p->attr.buffer); + my_free(p->attr.buffer); p->attr.buffer= NULL; } } From cfa18e4ae11e77579ee7c577356ed7b4f874c8c7 Mon Sep 17 00:00:00 2001 From: Simon J Mudd Date: Fri, 15 Dec 2017 07:42:04 +0100 Subject: [PATCH 17/88] MDEV-14639: Fix unexpected end of line at 'Normal shutdown' --- sql/share/errmsg-utf8.txt | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 51a9f6e3847..57ff5902178 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -1825,28 +1825,28 @@ ER_WRONG_AUTO_KEY 42000 S1009 ER_UNUSED_2 eng "You should never see it" ER_NORMAL_SHUTDOWN - cze "%s: norm-Bální ukončení\n" - dan "%s: Normal nedlukning\n" - nla "%s: Normaal afgesloten \n" - eng "%s: Normal shutdown\n" - est "%s: MariaDB lõpetas\n" - fre "%s: Arrêt normal du serveur\n" - ger "%s: Normal heruntergefahren\n" - greek "%s: Φυσιολογική διαδικασία shutdown\n" - hun "%s: Normal leallitas\n" - ita "%s: Shutdown normale\n" - kor "%s: 정상적인 shutdown\n" - nor "%s: Normal avslutning\n" - norwegian-ny "%s: Normal nedkopling\n" - pol "%s: Standardowe zakończenie działania\n" - por "%s: 'Shutdown' normal\n" - rum "%s: Terminare normala\n" - rus "%s: Корректная остановка\n" - serbian "%s: Normalno gašenje\n" - slo "%s: normálne ukončenie\n" - spa "%s: Apagado normal\n" - swe "%s: Normal avslutning\n" - ukr "%s: Нормальне завершення\n" + cze "%s: norm-Bální ukončení" + dan "%s: Normal nedlukning" + nla "%s: Normaal afgesloten" + eng "%s: Normal shutdown" + est "%s: MariaDB lõpetas" + fre "%s: Arrêt normal du serveur" + ger "%s: Normal heruntergefahren" + greek "%s: Φυσιολογική διαδικασία shutdown" + hun "%s: Normal leallitas" + ita "%s: Shutdown normale" + kor "%s: 정상적인 shutdown" + nor "%s: Normal avslutning" + norwegian-ny "%s: Normal nedkopling" + pol "%s: Standardowe zakończenie działania" + por "%s: 'Shutdown' normal" + rum "%s: Terminare normala" + rus "%s: Корректная остановка" + serbian "%s: Normalno gašenje" + slo "%s: normálne ukončenie" + spa "%s: Apagado normal" + swe "%s: Normal avslutning" + ukr "%s: Нормальне завершення" ER_GOT_SIGNAL cze "%s: p-Břijat signal %d, končím\n" dan "%s: Fangede signal %d. Afslutter!!\n" From 1a8da003f6d2947d2e6ef0f2edea19394657fa0d Mon Sep 17 00:00:00 2001 From: sjaakola Date: Wed, 4 Oct 2017 22:47:59 +0300 Subject: [PATCH 18/88] MW-416 Changed return code for replicatio error to TRUE. This is aligned with native mysql convention to return TRUE (defined to 1) or FALSE (defined to 0) from a bool function. This is wrong, but follows the mysql conventiosn, at least... --- sql/events.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/events.cc b/sql/events.cc index cdc15f41716..cb81e98a254 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -420,7 +420,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) DBUG_RETURN(ret); #ifdef WITH_WSREP error: - DBUG_RETURN(true); + DBUG_RETURN(TRUE); #endif /* WITH_WSREP */ } From 64e1dda0a007d12e3826252866123c3e790a0357 Mon Sep 17 00:00:00 2001 From: sjaakola Date: Fri, 6 Oct 2017 09:49:42 +0300 Subject: [PATCH 19/88] MW-416 DDL replication moved after acl checking galera_events test shows a regression with the original fix for MW-416 Reason was that Events::drop_event() can be called also from inside event execution, and there we have a speacial treatment for event, which executes "DROP EVENT" statement, and runs TOI replication inside the event processing body. This resulted in executing WSREP_TO_ISOLATION two times for such DROP EVENT statement. Fix is to call WSREP_TO_ISOLATION_BEGIN only in Events::drop_event() --- sql/event_data_objects.cc | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 9e1ee6f30f9..6ef9fa9f8ef 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1472,19 +1472,33 @@ end: bool save_tx_read_only= thd->tx_read_only; thd->tx_read_only= false; - if (WSREP(thd)) - { + /* + This code is processing event execution and does not have client + connection. Here, event execution will now execute a prepared + DROP EVENT statement, but thd->lex->sql_command is set to + SQLCOM_CREATE_PROCEDURE + DROP EVENT will be logged in binlog, and we have to + replicate it to make all nodes have consistent event definitions + Wsrep DDL replication is triggered inside Events::drop_event(), + and here we need to prepare the THD so that DDL replication is + possible, essentially it requires setting sql_command to + SQLCOMM_DROP_EVENT, we will switch sql_command for the duration + of DDL replication only. + */ + const enum_sql_command sql_command_save= thd->lex->sql_command; + const bool sql_command_set= WSREP(thd); + + if (sql_command_set) thd->lex->sql_command = SQLCOM_DROP_EVENT; - WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); - } ret= Events::drop_event(thd, dbname, name, FALSE); - WSREP_TO_ISOLATION_END; + if (sql_command_set) + { + WSREP_TO_ISOLATION_END; + thd->lex->sql_command = sql_command_save; + } -#ifdef WITH_WSREP - error: -#endif thd->tx_read_only= save_tx_read_only; thd->security_ctx->master_access= saved_master_access; } From f7f5c710e478a835196b2fec1f6ae9362eb07cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 20 Dec 2017 09:21:08 +0200 Subject: [PATCH 20/88] Correct a function comment The comment became stale in commit 9f57e595b49744e3c1920f8c46a2ec8e7fc5fd66 which removed the parameter "flags". --- storage/innobase/include/trx0rec.h | 6 ++---- storage/innobase/trx/trx0rec.cc | 6 ++---- storage/xtradb/include/trx0rec.h | 6 ++---- storage/xtradb/trx/trx0rec.cc | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index a6e202d04e4..630818a8648 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -226,10 +226,8 @@ trx_undo_report_row_operation( marking, the record in the clustered index, otherwise NULL */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ - roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the - inserted undo log record, - 0 if BTR_NO_UNDO_LOG - flag was specified */ + roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the + undo log record */ MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result)); /******************************************************************//** Copies an undo record to heap. This function can be called if we know that diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index e3ab15e185f..178f7a19678 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1220,10 +1220,8 @@ trx_undo_report_row_operation( marking, the record in the clustered index, otherwise NULL */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ - roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the - inserted undo log record, - 0 if BTR_NO_UNDO_LOG - flag was specified */ + roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the + undo log record */ { trx_t* trx; trx_undo_t* undo; diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h index a6e202d04e4..630818a8648 100644 --- a/storage/xtradb/include/trx0rec.h +++ b/storage/xtradb/include/trx0rec.h @@ -226,10 +226,8 @@ trx_undo_report_row_operation( marking, the record in the clustered index, otherwise NULL */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ - roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the - inserted undo log record, - 0 if BTR_NO_UNDO_LOG - flag was specified */ + roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the + undo log record */ MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result)); /******************************************************************//** Copies an undo record to heap. This function can be called if we know that diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc index 4e0ba825ed2..8cd51c8066b 100644 --- a/storage/xtradb/trx/trx0rec.cc +++ b/storage/xtradb/trx/trx0rec.cc @@ -1221,10 +1221,8 @@ trx_undo_report_row_operation( marking, the record in the clustered index, otherwise NULL */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ - roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the - inserted undo log record, - 0 if BTR_NO_UNDO_LOG - flag was specified */ + roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the + undo log record */ { trx_t* trx; trx_undo_t* undo; From c58df0cdd40258254b40f501857106c843347e39 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 20 Dec 2017 12:14:49 +0400 Subject: [PATCH 21/88] MDEV-14031 Password policy causes replication failure --- .../r/binlog-simple_plugin_check.result | 19 ++++++++++++ .../plugins/t/binlog-simple_plugin_check.test | 31 +++++++++++++++++++ sql/sql_acl.cc | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/plugins/r/binlog-simple_plugin_check.result create mode 100644 mysql-test/suite/plugins/t/binlog-simple_plugin_check.test diff --git a/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result b/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result new file mode 100644 index 00000000000..6c960ee325c --- /dev/null +++ b/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result @@ -0,0 +1,19 @@ +INSTALL SONAME "simple_password_check"; +SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_NAME='simple_password_check'; +PLUGIN_NAME +simple_password_check +# +# MDEV-14031 Password policy causes replication failure +# +CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85'; +CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85'; +ERROR HY000: Your password does not satisfy the current policy requirements +DROP USER user1@localhost; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85' +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP USER user1@localhost +UNINSTALL PLUGIN simple_password_check; diff --git a/mysql-test/suite/plugins/t/binlog-simple_plugin_check.test b/mysql-test/suite/plugins/t/binlog-simple_plugin_check.test new file mode 100644 index 00000000000..773dafe8a81 --- /dev/null +++ b/mysql-test/suite/plugins/t/binlog-simple_plugin_check.test @@ -0,0 +1,31 @@ +--source include/not_embedded.inc +--source include/have_binlog_format_statement.inc + +if (!$SIMPLE_PASSWORD_CHECK_SO) { + skip No SIMPLE_PASSWORD_CHECK plugin; +} + +INSTALL SONAME "simple_password_check"; +SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_NAME='simple_password_check'; + + +--echo # +--echo # MDEV-14031 Password policy causes replication failure +--echo # + +--disable_query_log +RESET MASTER; # get rid of previous tests binlog +--enable_query_log + +CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85'; + +--error ER_NOT_VALID_PASSWORD +CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85'; + +DROP USER user1@localhost; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; + +UNINSTALL PLUGIN simple_password_check; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 5ccc5f75118..6029f4ed71a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -9507,13 +9507,13 @@ bool mysql_create_user(THD *thd, List &list, bool handle_as_role) } } - binlog= true; if (replace_user_table(thd, tables[USER_TABLE].table, *user_name, 0, 0, 1, 0)) { append_user(thd, &wrong_users, user_name); result= TRUE; continue; } + binlog= true; // every created role is automatically granted to its creator-admin if (handle_as_role) From cb121a047b55403fe271570c928fd95ed64a1c8f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 20 Dec 2017 13:49:27 +0400 Subject: [PATCH 22/88] An after-fix for MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op()) Fixing an additional failure discovered after a merge to 10.2 --- mysql-test/suite/innodb/r/innodb-autoinc.result | 6 ++++++ mysql-test/suite/innodb/t/innodb-autoinc.test | 5 +++++ sql/field.cc | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index 9aa819de22b..4af674adc6a 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -1360,3 +1360,9 @@ SELECT * FROM t1; c1 1e19 DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-1); +SELECT * FROM t1; +a +-1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index ebb6a5d24ff..9835a9779cf 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -692,3 +692,8 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (); SELECT * FROM t1; DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-1); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/sql/field.cc b/sql/field.cc index a3c20ec18f2..f4aaaca69d6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4399,7 +4399,14 @@ longlong Field_double::val_int_from_real(bool want_unsigned_result) float8get(j,ptr); res= double_to_longlong(j, want_unsigned_result, &error); - if (error) + /* + Note, val_uint() is currently used for auto_increment purposes only, + and we want to suppress all warnings in such cases. + If we ever start using val_uint() for other purposes, + val_int_from_real() will need a new separate parameter to + suppress warnings. + */ + if (error && !want_unsigned_result) { ErrConvDouble err(j); push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, From 924db8b4ed3f268cbe91a1734611f4dc2311c7be Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 20 Dec 2017 02:27:03 +0530 Subject: [PATCH 23/88] MDEV-12350: Heap corruption, overrun buffer, ASAN errors, server crash in my_fill_8bit / filesort In the function make_sortkey a tmp buffer was defined and in the absence of param->tmp_buffer, tmp buffer used the sort_keys buffer. sort_keys buffer has a length defined in sort_field->length, while param->tmp_buffer is stored in param->rec_length. Make sure to use the appropriate length based on which buffer we are using otherwise we'll overflow. Also added a type cast to size_t during the calculation of the sort keys buffer size to avoid an oveflow if the buffer size exceeds 32 bits. --- mysql-test/r/group_by.result | 25 +++++++++++++++++++++++++ mysql-test/t/group_by.test | 26 ++++++++++++++++++++++++++ sql/filesort.cc | 7 +++++-- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index b948c9a6f88..52ee73e6612 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2558,3 +2558,28 @@ create table t2 (c1 int, c2 int); select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3; c1 c1 drop table t1, t2; +SET @old_sort_buff_size = @@sort_buffer_size; +SET @@sort_buffer_size=256*1024; +CREATE TABLE t1 (c INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032), +(1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900), +(2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028), +(2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032), +(2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL), +(2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026), +(2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013), +(1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991), +(2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999), +(2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990), +(1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024), +(2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015), +(1984),(1978),(1979),(1989),(2008),(2030); +SELECT ExtractValue('','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP; +f1 f2 + NULL + + NULL +NULL NULL +SET @@sort_buffer_size = @old_sort_buff_size; +DROP TABLE t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 80ecfea539b..43274532b3e 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1741,6 +1741,32 @@ create table t2 (c1 int, c2 int); select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3; drop table t1, t2; +# +# MDEV-12350: Heap corruption, overrun buffer, ASAN errors, server crash in my_fill_8bit / filesort +# + +SET @old_sort_buff_size = @@sort_buffer_size; +SET @@sort_buffer_size=256*1024; +CREATE TABLE t1 (c INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES + (2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032), + (1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900), + (2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028), + (2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032), + (2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL), + (2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026), + (2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013), + (1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991), + (2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999), + (2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990), + (1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024), + (2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015), + (1984),(1978),(1979),(1989),(2008),(2030); + +SELECT ExtractValue('','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP; +SET @@sort_buffer_size = @old_sort_buff_size; +DROP TABLE t1; + # # End of MariaDB 5.5 tests # diff --git a/sql/filesort.cc b/sql/filesort.cc index 38404b01cf7..5674786d8b2 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -210,7 +210,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, { ulonglong keys= memory_available / (param.rec_length + sizeof(char*)); table_sort.keys= (uint) min(num_rows, keys); - sort_buff_sz= table_sort.keys*(param.rec_length+sizeof(char*)); + /* Cast to size_t to avoid overflow when result is greater than uint. */ + sort_buff_sz= ((size_t)table_sort.keys) * + (param.rec_length + sizeof(char*)); set_if_bigger(sort_buff_sz, param.rec_length * MERGEBUFF2); DBUG_EXECUTE_IF("make_sort_keys_alloc_fail", @@ -914,7 +916,8 @@ static void make_sortkey(register SORTPARAM *param, if (maybe_null) *to++=1; char *tmp_buffer= param->tmp_buffer ? param->tmp_buffer : (char*)to; - String tmp(tmp_buffer, param->sort_length, cs); + String tmp(tmp_buffer, param->tmp_buffer ? param->sort_length : + sort_field->length, cs); String *res= item->str_result(&tmp); if (!res) { From 7bbc6c14d1e8fcf1f4737e0a5fcf6237fe18bd23 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 19 May 2017 15:45:07 +0200 Subject: [PATCH 24/88] Generate and install sysusers and tmpfiles configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using systemd we can automate creating users and directories. So generate and install the configuration files. Signed-off-by: Vicențiu Ciorbaru Small change in cmake/install_layout.cmake compared to original contributor patch to also install SYSTEMD_SYSUSERS and SYSTEMD_TMPFILES directories. The variables were being set, but the loop which defines the final install files was not updated. --- cmake/install_layout.cmake | 6 +++++- support-files/CMakeLists.txt | 15 +++++++++++++++ support-files/sysusers.conf.in | 1 + support-files/tmpfiles.conf.in | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 support-files/sysusers.conf.in create mode 100644 support-files/tmpfiles.conf.in diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index d1a261f8cef..5484691e94a 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -162,6 +162,8 @@ SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock") SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") +SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") +SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") # # DEB layout @@ -191,6 +193,8 @@ SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") +SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") +SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") # # SVR4 layout @@ -232,7 +236,7 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # layout is chosen) FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2 INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR - SYSTEMD_UNIT) + SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index 71e9b3fad3d..3b6e86030ab 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -104,6 +104,21 @@ IF(UNIX) ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service DESTINATION ${inst_location}/systemd COMPONENT SupportFiles) + IF(INSTALL_SYSTEMD_SYSUSERSDIR) + CONFIGURE_FILE(sysusers.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf + DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} COMPONENT Server) + ENDIF() + + IF(INSTALL_SYSTEMD_TMPFILESDIR) + get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY) + CONFIGURE_FILE(tmpfiles.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf + DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} COMPONENT Server) + ENDIF() + # @ in directory name broken between CMake version 2.8.12.2 and 3.3 # http://public.kitware.com/Bug/view.php?id=14782 IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM) diff --git a/support-files/sysusers.conf.in b/support-files/sysusers.conf.in new file mode 100644 index 00000000000..a975b29476a --- /dev/null +++ b/support-files/sysusers.conf.in @@ -0,0 +1 @@ +u @MYSQLD_USER@ - "MariaDB" @MYSQL_DATADIR@ diff --git a/support-files/tmpfiles.conf.in b/support-files/tmpfiles.conf.in new file mode 100644 index 00000000000..03d66abc0c7 --- /dev/null +++ b/support-files/tmpfiles.conf.in @@ -0,0 +1 @@ +d @MYSQL_UNIX_DIR@ 0755 @MYSQLD_USER@ @MYSQLD_USER@ - From eb1404238346405edc51b0b916a8e0650f061cf0 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 20 Dec 2017 16:52:02 +0100 Subject: [PATCH 25/88] MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields fix_fields calls fixed. --- mysql-test/r/func_misc.result | 15 +++++++++++++++ mysql-test/t/func_misc.test | 21 +++++++++++++++++++++ sql/item.cc | 6 ++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 0462a1dc48a..218b11a2fc2 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -1523,5 +1523,20 @@ str str1 b c ::10.0.5.9 ::10.0.5.9 1 0 DROP TABLE t1; # +# MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields +# +CREATE TABLE `t1` ( +`numgtfmt` char(10) COLLATE utf8_bin NOT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +create view v1(numgtfmt) +as +select 'x' from t1 +union +select 'x' from t1 ; +SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin'); +numgtfmt +DROP VIEW v1; +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 5d0dc52a6af..e2684ab4957 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -1152,6 +1152,27 @@ INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9'); SELECT str, str1, b,c FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields +--echo # + +CREATE TABLE `t1` ( + `numgtfmt` char(10) COLLATE utf8_bin NOT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +create view v1(numgtfmt) +as +select 'x' from t1 +union +select 'x' from t1 ; + +SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin'); + +# Cleanup +DROP VIEW v1; +DROP TABLE t1; + + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/item.cc b/sql/item.cc index 029f8216bf1..6dcb436baba 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1814,8 +1814,10 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref) String s(buf, sizeof(buf), &my_charset_bin); s.length(0); - if (value_item->fix_fields(thd, &value_item) || - name_item->fix_fields(thd, &name_item) || + if ((!value_item->fixed && + value_item->fix_fields(thd, &value_item)) || + (!name_item->fixed && + name_item->fix_fields(thd, &name_item)) || !value_item->const_item() || !name_item->const_item() || !(item_name= name_item->val_str(&s))) // Can't have a NULL name From 21eed925a0e374c9f643d32544d3468954435ebc Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 20 Dec 2017 19:37:07 +0300 Subject: [PATCH 26/88] Cleanup out of date comments (no real changes). --- storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index a0810fe63ec..1c4bdf1b082 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -68,19 +68,12 @@ lock_wait_timeout_stats: MDEV-13404 compact_deletes: MDEV-12663 : rocksdb.compact_deletes times out and causes other tests to fail blind_delete_without_tx_api: MDEV-12286: rocksdb.blind_delete_without_tx_api test fails -# Enabling these didn't seem to cause any trouble: -# autoinc_vars_thread : MDEV-12474 Regularly fails on buildbot -# unique_check : MDEV-12474 Regularly fails on buildbot -# bloomfilter : MDEV-12474 Regularly fails on buildbot -# unique_sec : Intermittent failures in BB - - ## ## Tests that fail for some other reason ## + information_schema : MariaRocks: requires GTIDs mysqlbinlog_gtid_skip_empty_trans_rocksdb : MariaRocks: requires GTIDs -#read_only_tx : MariaRocks: requires GTIDs rpl_row_triggers : MariaRocks: requires GTIDs From 73fa7aeb203299d8d358f8f6b4cdd58aa9f1d0ec Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 20 Dec 2017 19:49:56 +0300 Subject: [PATCH 27/88] MDEV-14165: not MyRocks -problem in ps-protocol, happens in upstream too Enable the test back, as the fix has been pushed. --- storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index 1c4bdf1b082..91bbe7fe30e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -41,7 +41,6 @@ rocksdb_deadlock_stress_rr: stress test ## persistent_cache: Upstream RocksDB bug https://github.com/facebook/mysql-5.6/issues/579 collation: Fails on gcc 4.8 and before, MDEV-12433 -col_opt_zerofill: MDEV-14165: not MyRocks -problem in ps-protocol, happens in upstream too ## From 2a4faa8ab61bd508e6fa5a477853d0ddeed94fcc Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Wed, 20 Dec 2017 00:06:02 +0530 Subject: [PATCH 28/88] MDEV-13478 Full SST sync fails because of the error in the cleaning part Problem: The command was: find $paths -mindepth 1 -regex $cpat -prune -o -exec rm -rf {} \+ Which was supposed to work as * skipping $paths directories themselves (-mindepth 1) * see if the dir/file name matches $cpat (-regex) * if yes - don't dive into the directory, skip it (-prune) * otherwise (-o) * remove it and everything inside (-exec) Now -exec ... \+ works like this: every new found path is appended to the end of the command line. when accumulated command line length reaches `getconf ARG_MAX` (~2Gb) it's executed, and find continues, appending to a new command line. What happens here, find appends some directory to the command line, then dives into it, and starts appending files from that directory. At some point command line overflows, rm -rf gets executed and removes the whole directory. Now find tries to continue scanning the directory that was already removed. Fix: don't dive into directories that will be recursively removed anyway, use -prune for them. Basically, we should be pruning both paths that have matched $cpat and paths that have not matched it. This is achived by pruning unconditionally, before the regex is tested: find $paths -mindepth 1 -prune -regex $cpat -o -exec rm -rf {} \+ Patch Credit:- Serg --- scripts/wsrep_sst_xtrabackup-v2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index 40e686d4d6b..9284bf78019 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -1072,7 +1072,7 @@ then wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" - find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ + find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ tempdir=$(parse_cnf mysqld log-bin "") if [[ -n ${tempdir:-} ]];then From 85fad60dc77f4c5b85ec1b7e5d4c3bff456a0ada Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 21 Dec 2017 01:50:44 +0300 Subject: [PATCH 29/88] Disable back rocksdb.col_opt_zerofill due to MDEV-14729 --- storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index 91bbe7fe30e..dc2e04b93d7 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -41,6 +41,7 @@ rocksdb_deadlock_stress_rr: stress test ## persistent_cache: Upstream RocksDB bug https://github.com/facebook/mysql-5.6/issues/579 collation: Fails on gcc 4.8 and before, MDEV-12433 +col_opt_zerofill: MDEV-14729 (also MDEV-14165 which was fixed): problem in the client ## From e27e7ec767e6c278c7e6a4db1c1ce0006f72a955 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 21 Dec 2017 02:02:25 +0300 Subject: [PATCH 30/88] Better comments part #1 --- .../rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index 07a2738eee5..3232ff185bb 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -1,5 +1,14 @@ +## +## Tests that require FB/MySQL specific features for which there are +## no plans to port them to MariaDB +## +rpl_no_unique_check_on_lag : unique_check_lag_threshold is not available in MariaDB +rpl_no_unique_check_on_lag_mts : unique_check_lag_threshold is not available in MariaDB -# rpl_rocksdb_2pc_crash_recover + +## +## Tests that are disabled for other reasons +## consistent_snapshot_mixed_engines : Didn't try with MariaDB, yet multiclient_2pc : Didn't try with MariaDB, yet @@ -8,8 +17,6 @@ rpl_ddl_high_priority : Didn't try with MariaDB, yet rpl_gtid_crash_safe : Didn't try with MariaDB, yet rpl_gtid_crash_safe_wal_corrupt : Didn't try with MariaDB, yet rpl_gtid_rocksdb_sys_header : Didn't try with MariaDB, yet -rpl_no_unique_check_on_lag : Didn't try with MariaDB, yet -rpl_no_unique_check_on_lag_mts : Didn't try with MariaDB, yet rpl_rocksdb_snapshot : Didn't try with MariaDB, yet rpl_rocksdb_snapshot_without_gtid : Didn't try with MariaDB, yet rpl_rocksdb_stress_crash : Didn't try with MariaDB, yet From 207976d6b9c42868d982a54a2bdd16b77a3c73da Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 21 Dec 2017 02:34:02 +0300 Subject: [PATCH 31/88] Better comments part #2 --- storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index 3232ff185bb..e46e89517a9 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -4,13 +4,12 @@ ## rpl_no_unique_check_on_lag : unique_check_lag_threshold is not available in MariaDB rpl_no_unique_check_on_lag_mts : unique_check_lag_threshold is not available in MariaDB - +consistent_snapshot_mixed_engines : Tests START TRANSACTION WITH CONSISTENT $ENGINE_NAME SNAPSHOT ## ## Tests that are disabled for other reasons ## -consistent_snapshot_mixed_engines : Didn't try with MariaDB, yet multiclient_2pc : Didn't try with MariaDB, yet rpl_crash_safe_wal_corrupt : Didn't try with MariaDB, yet rpl_ddl_high_priority : Didn't try with MariaDB, yet From 5f896b360429e19f53109ccf14da6ef58d45b179 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Thu, 21 Dec 2017 03:31:39 +0200 Subject: [PATCH 32/88] Updated list of unstable tests for 10.1.30 release --- mysql-test/unstable-tests | 144 +++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 79 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index b5f8f9fffb9..3010c5ddf79 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -26,16 +26,17 @@ main.alter_table : Modified in 10.1.29 main.alter_table_trans : MDEV-12084 - timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result +main.auth_named_pipe : MDEV-14724 - System error 2 main.bootstrap : Include files modified in 10.1.29 main.case : Modified in 10.1.29 -main.count_distinct : Modified in 10.1.27 main.create_delayed : MDEV-10605 - failed with timeout main.ctype_gbk : Modified in 10.1.29 main.ctype_latin1 : Modified in 10.1.29 main.ctype_ucs : Modified in 10.1.29 main.ctype_utf16le : MDEV-10675: timeout or extra warnings main.ctype_utf32 : Modified in 10.1.29 -main.ctype_utf8 : Modified in 10.1.29 +main.ctype_utf8 : Modified in 10.1.30 +main.ctype_utf8mb4 : Modified in 10.1.30 main.delete_returning : Modified in 10.1.29 main.delimiter_command_case_sensitivity : Added in 10.1.29 main.events_2 : MDEV-13277 - Server crash @@ -44,16 +45,19 @@ main.events_restart : MDEV-12236 - Server shutdown problem main.func_in : Modified in 10.1.29 main.func_misc : Modified in 10.1.29 main.func_regexp_pcre : Modified in 10.1.29 +main.func_set : Modified in 10.1.30 +main.func_str : Modified in 10.1.30 main.func_time : Modified in 10.1.29 main.gis-precise : Modified in 10.1.29 +main.group_by : Modified in 10.1.30 +main.having : Modified in 10.1.30 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind main.information_schema : Modified in 10.1.29 main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure -main.insert : Modified in 10.1.27 +main.join_outer : Modified in 10.1.30 main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist -main.log_tables-big : Modified in 10.1.27 main.mdev-504 : MDEV-10607 - sporadic "can't connect" main.mdev13607 : Added in 10.1.29 main.mdev375 : MDEV-10607 - sporadic "can't connect" @@ -63,12 +67,10 @@ main.mysql_upgrade_noengine : MDEV-14355 - Plugin is busy main.mysqlbinlog : Modified in 10.1.29 main.mysqlslap : MDEV-11801 - timeout main.mysqltest : MDEV-9269 - fails on Alpha -main.old-mode : Modified in 10.1.27 main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan main.partition_datatype : Modified in 10.1.29 main.partition_example : Include files modified in 10.1.29 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings -main.partition_symlink : Modified in 10.1.27 main.plugin : Include files modified in 10.1.29 main.plugin_innodb : Include files modified in 10.1.29 main.plugin_load : Include files modified in 10.1.29 @@ -83,31 +85,33 @@ main.read_only : Modified in 10.1.29 main.set_statement : MDEV-13183 - Wrong result main.show_explain : MDEV-10674 - sporadic failure main.show_function_with_pad_char_to_full_length : Added in 10.1.29 -main.sp : Modified in 10.1.27 +main.sp : Modified in 10.1.30 main.sp-security : MDEV-10607 - sporadic "can't connect" main.status : MDEV-8510 - sporadic wrong result main.subselect_exists2in : Modified in 10.1.29 main.subselect_innodb : MDEV-10614 - sporadic wrong results main.subselect_mat_cost_bugs : Modified in 10.1.29 -main.symlink : Modified in 10.1.27 main.table_options-5867 : Include files modified in 10.1.29 -main.tc_heuristic_recover : Added in 10.1.27 +main.trigger : Modified in 10.1.30 main.truncate_badse : Include files modified in 10.1.29 main.type_bit : Modified in 10.1.29 main.type_date : Modified in 10.1.29 main.type_datetime_hires : MDEV-10687 - timeout main.type_varchar : Modified in 10.1.29 main.user_var : Modified in 10.1.29 -main.view : Modified in 10.1.29 -main.xml : Modified in 10.1.29 +main.view : Modified in 10.1.30 +main.xml : Modified in 10.1.30 #---------------------------------------------------------------- -archive.discover : MDEV-10510 - table is marked as crashed +archive.discover : MDEV-10510 - Table is marked as crashed +archive.mysqlhotcopy_archive : MDEV-14726 - Table is marked as crashed #---------------------------------------------------------------- binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed +binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - Wrong error code; added in 10.1.30 +binlog.binlog_gtid_delete_domain_debug : Added in 10.1.30 binlog.binlog_killed : MDEV-12925 - Wrong result binlog.binlog_spurious_ddl_errors : Include files modified in 10.1.29 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint @@ -118,44 +122,20 @@ binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync binlog_encryption.rpl_parallel : MDEV-10653 - Timeout binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning +binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4 binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query #---------------------------------------------------------------- -connect.alter_xml : Modified in 10.1.27 -connect.alter_xml2 : Added in 10.1.27 -connect.infoschema-9739 : Modified in 10.1.27 -connect.infoschema2-9739 : Added in 10.1.27 -connect.jdbc_new : Modified in 10.1.27 -connect.json : Modified in 10.1.27 connect.json_java_2 : Include file modified in 10.1.29 connect.json_java_3 : Include file modified in 10.1.29 connect.json_mongo_c : Include file modified in 10.1.29 -connect.json_udf : Modified in 10.1.27 -connect.json_udf_bin : Modified in 10.1.27 connect.mongo_c : Include file modified in 10.1.29 connect.mongo_java_2 : Include file modified in 10.1.29 connect.mongo_java_3 : Include file modified in 10.1.29 -connect.mul_new : Added in 10.1.27 -connect.mysql_exec : Modified in 10.1.27 -connect.mysql_new : Modified in 10.1.27 -connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results; modified in 10.1.27 -connect.tbl_thread : MDEV-9844, MDEV-10179, MDEV-14214 - sporadic crashes, valgrind warnings, wrong results; added in 10.1.27 -connect.unsigned : Modified in 10.1.27 -connect.upd : Modified in 10.1.27 -connect.xml : Modified in 10.1.27 -connect.xml2 : Added in 10.1.27 -connect.xml2_grant : Added in 10.1.27 -connect.xml2_html : Added in 10.1.27 -connect.xml2_mdev5261 : Added in 10.1.27 -connect.xml2_mult : Added in 10.1.27 -connect.xml2_zip : Added in 10.1.27 -connect.xml_grant : Modified in 10.1.27 -connect.xml_html : Modified in 10.1.27 -connect.xml_mdev5261 : Modified in 10.1.27 -connect.xml_mult : Modified in 10.1.27 -connect.xml_zip : Modified in 10.1.27 -connect.zip : MDEV-13884 - Wrong result; modified in 10.1.27 +connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results +connect.tbl_thread : MDEV-9844, MDEV-10179, MDEV-14214 - sporadic crashes, valgrind warnings, wrong results +connect.zip : MDEV-13884 - Wrong result #---------------------------------------------------------------- @@ -166,8 +146,8 @@ encryption.encryption_force : Modified in 10.1.29 encryption.filekeys_encfile : Include file modified in 10.1.29 encryption.filekeys_encfile_file : Include file modified in 10.1.29 encryption.innodb-bad-key-change2 : MDEV-12632 - Valgrind warnings +encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-discard-import-change : MDEV-12632 - Valgrind warnings -encryption.innodb_encryption : Modified in 10.1.27 encryption.innodb-encryption-alter : Modified in 10.1.29 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts @@ -175,7 +155,7 @@ encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure encryption.innodb_first_page : MDEV-10689 - crashes encryption.innodb-first-page-read : MDEV-14356 - Timeout on wait condition -encryption.innodb_lotoftables : MDEV-11531 - InnoDB error; modified in 10.1.27 +encryption.innodb_lotoftables : MDEV-11531 - InnoDB error encryption.innodb-missing-key : MDEV-9359 - assertion failure encryption.innodb-page_encryption : MDEV-10641 - mutex problem encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup @@ -223,44 +203,37 @@ galera.MW-328A : MDEV-13876 - Wrong result #---------------------------------------------------------------- -innodb.alter_rename_existing : Added in 10.1.27 innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.create-index-debug : Added in 10.1.27 innodb.doublewrite : MDEV-12905, MDEV-14205 - Lost connection to MySQL server -innodb.index_tree_operation : Added in 10.1.27 +innodb_fts.fulltext2 : MDEV-14727 - Long semaphore wait innodb.innodb-16k : Modified in 10.1.29 innodb.innodb-32k : Modified in 10.1.29 innodb.innodb-64k : Modified in 10.1.29 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup innodb.innodb-alter : Modified in 10.1.29 -innodb.innodb-alter-autoinc : Added in 10.1.27 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.1.29 +innodb.innodb-autoinc : Modified in 10.1.30 innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan -innodb.innodb-enlarge-blob : Modified in 10.1.27 +innodb.innodb_bug48024 : MDEV-14352 - Assertion failure innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown innodb.innodb-get-fk : Modified in 10.1.29 -innodb.innodb-index-debug : Added in 10.1.27 -innodb.innodb-index-online : Added in 10.1.27 -innodb.innodb-index-online-delete : Added in 10.1.27 -innodb.innodb-index-online-fk : Added in 10.1.27 -innodb.innodb-index-online-purge : Added in 10.1.27 innodb.innodb-page_compression_lzma : MDEV-14353 - wrong result on Fedora 25 innodb.innodb-page_compression_tables : Modified in 10.1.29 innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem +innodb.innodb-replace-debug : Added in 10.1.30 innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result innodb.innodb-table-online : Modified in 10.1.29 innodb.innodb-wl5522-debug : Modified in 10.1.29 innodb.innodb-wl5980-alter : Modified in 10.1.29 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks -innodb.log_data_file_size : Modified in 10.1.27 -innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; modified in 10.1.29 +innodb.recovery_shutdown : Added in 10.1.30 +innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.1.30 innodb.table_flags : MDEV-14363 - Operating system error number 2 innodb.undo_log : Modified in 10.1.29 -innodb.xa_recovery : Modified in 10.1.27 innodb_fts.concurrent_insert : Added in 10.1.29 innodb_fts.fulltext : Modified in 10.1.29 @@ -271,18 +244,15 @@ innodb_zip.wl5522_debug_zip : Added in 10.1.29 #---------------------------------------------------------------- -maria.maria : Modified in 10.1.29 +maria.maria : MDEV-14430 - Wrong result; modified in 10.1.29 #---------------------------------------------------------------- -mariabackup.apply-log-only : Added in 10.1.27 -mariabackup.apply-log-only-incr : Added in 10.1.27 -mariabackup.auth_plugin_win : Added in 10.1.27 mariabackup.compress_qpress : Added in 10.1.29 mariabackup.data_directory : Added in 10.1.29 mariabackup.incremental_backup : Modified in 10.1.29 +mariabackup.mdev-14447 : Added in 10.1.30 mariabackup.partition_datadir : Added in 10.1.29 -mariabackup.xb_aws_key_management : Modified in 10.1.27 #---------------------------------------------------------------- @@ -297,6 +267,12 @@ mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong resul mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - valgrind warnings mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result +mroonga/storage.variable_query_log_file_disabled_empty_value : Modified in 10.1.30 +mroonga/storage.variable_query_log_file_disabled_null_value : Modified in 10.1.30 +mroonga/storage.variable_query_log_file_enabled_empty_value : Modified in 10.1.30 +mroonga/storage.variable_query_log_file_enabled_null_value : Modified in 10.1.30 +mroonga/storage.variable_query_log_file_new_value : Modified in 10.1.30 +mroonga/storage.variable_query_log_file_same_value : Modified in 10.1.30 #---------------------------------------------------------------- @@ -309,23 +285,18 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h #---------------------------------------------------------------- -parts.partition_alter_maria : Added in 10.1.29 +parts.partition_alter_innodb : Added in 10.1.30 +parts.partition_alter_maria : Modified in 10.1.30 +parts.partition_alter_myisam : Added in 10.1.30 parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query -parts.partition_exch_myisam_innodb : Modified in 10.1.27 -parts.partition_exch_qa_10 : Include files modified in 10.1.27 -parts.partition_exch_qa_11 : Include files modified in 10.1.27 -parts.partition_exch_qa_12 : Include files modified in 10.1.27 -parts.partition_exch_qa_14 : Modified in 10.1.27 -parts.partition_exch_qa_15 : Modified in 10.1.27 -parts.partition_exch_qa_2 : Modified in 10.1.27 -parts.partition_exch_qa_3 : Modified in 10.1.27 -parts.partition_exch_qa_6 : Modified in 10.1.27 +parts.partition_auto_increment_maria : MDEV-14430 - Wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind #---------------------------------------------------------------- perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x +perfschema.misc : Modified in 10.1.30 perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.setup_actors : MDEV-10679 - rare crash perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match @@ -335,6 +306,7 @@ perfschema.threads_mysql : MDEV-10677 - sporadic wrong resul #---------------------------------------------------------------- +plugins.binlog-simple_plugin_check : Added in 10.1.30 plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 @@ -342,6 +314,8 @@ plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc; modified #---------------------------------------------------------------- roles.definer : Modified in 10.1.29 +roles.flush_roles-12366 : Added in 10.1.30 +roles.set_role-13655 : Added in 10.1.30 #---------------------------------------------------------------- @@ -356,7 +330,9 @@ rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result rpl.rpl_gtid_basic : MDEV-10681 - server startup problem rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master +rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout in include; added in 10.1.30 rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings +rpl.rpl_gtid_reconnect : MDEV-14497 - Timeout rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings rpl.rpl_gtid_until : MDEV-10625 - warnings in error log rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips @@ -366,20 +342,29 @@ rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL se rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips +rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_non_direct_row_mixing_engines : MDEV-14491 - Long semaphore wait +rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_parallel : MDEV-10653 - Timeouts rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure -rpl.rpl_parallel_optimistic : MDEV-10511 - timeout +rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout +rpl.rpl_parallel_optimistic : MDEV-10511 - Timeout rpl.rpl_parallel_retry : MDEV-11119 - Server crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings rpl.rpl_plugin_load : Include files modified in 10.1.29 +rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_min : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result +rpl.rpl_row_log : Include file modified in 10.1.30 +rpl.rpl_row_log_innodb : Include file modified in 10.1.30 +rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_semi_sync : MDEV-11220 - Wrong result +rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status @@ -387,12 +372,12 @@ rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock -rpl.rpl_sp_variables : Added in 10.1.27 rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure +rpl.rpl_stm_log : Include file modified in 10.1.30 +rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_sync : MDEV-10633 - Database page corruption rpl.rpl_table_options : Include files modified in 10.1.29 -rpl.rpl_temporal_format_mariadb53_to_mysql56_dst : Added in 10.1.27 rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result @@ -439,8 +424,6 @@ sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.1.29 sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results -sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs -sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs sys_vars.sysvars_wsrep : MDEV-12522 - Dependency on specific wsrep_provider sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result @@ -453,7 +436,7 @@ tokudb.change_column_char : MDEV-12822 - Lost connection to MySQL ser tokudb.cluster_filter : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan -tokudb.dir_per_db : MDEV-11537 - Wrong result; modified in 10.1.27 +tokudb.dir_per_db : MDEV-11537 - Wrong result tokudb.dir_per_db_rename_to_nonexisting_schema : MDEV-14359 - Directory not empty tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash tokudb.hotindex-insert-1 : MDEV-13870 - Lost connection to MySQL server @@ -467,6 +450,9 @@ tokudb_bugs.xa : MDEV-11804 - Lock wait timeout tokudb_mariadb.mdev6657 : MDEV-12737 - Wrong plan, valgrind warnings +rpl-tokudb.rpl_tokudb_row_log : Include file modified in 10.1.30 +rpl-tokudb.rpl_tokudb_stm_log : Include file modified in 10.1.30 + #---------------------------------------------------------------- unit.lf : MDEV-12897 - Signal 11 thrown @@ -481,8 +467,8 @@ vcol.vcol_misc : Modified in 10.1.29 #---------------------------------------------------------------- wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node -wsrep.mdev_6832 : MDEV-14195 - Failure upon check-testcase; option file changed in 10.1.27 -wsrep.mdev_7798 : Option file changed in 10.1.27 +wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node +wsrep.mdev_6832 : MDEV-14195 - Failure upon check-testcase wsrep.pool_of_threads : MDEV-12234 - Library problem on Power wsrep_info.plugin : MDEV-12909 - Wrong result From 1cf28964f50443518d8b665b226c1666274840e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Dec 2017 10:19:49 +0200 Subject: [PATCH 33/88] MDEV-6247 post-fix: Re-enable some debug assertions These assertions were disabled in MariaDB 10.1.1 in commit df4dd593f29aec8e2116aec1775ad4b8833d8c93 with a bogus comment referring to the function wsrep_fake_trx_id() that was introduced in the very same commit. --- storage/innobase/include/trx0sys.ic | 3 --- storage/innobase/trx/trx0sys.cc | 5 ----- storage/xtradb/include/trx0sys.ic | 3 --- storage/xtradb/trx/trx0sys.cc | 5 ----- 4 files changed, 16 deletions(-) diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index 7265a97ae25..e097e29b551 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -445,10 +445,7 @@ trx_id_t trx_sys_get_new_trx_id(void) /*========================*/ { -#ifndef WITH_WSREP - /* wsrep_fake_trx_id violates this assert */ ut_ad(mutex_own(&trx_sys->mutex)); -#endif /* WITH_WSREP */ /* VERY important: after the database is started, max_trx_id value is divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index e9443e93140..0246eaf32a8 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -180,12 +180,7 @@ trx_sys_flush_max_trx_id(void) mtr_t mtr; trx_sysf_t* sys_header; -#ifndef WITH_WSREP - /* wsrep_fake_trx_id violates this assert - * Copied from trx_sys_get_new_trx_id - */ ut_ad(mutex_own(&trx_sys->mutex)); -#endif /* WITH_WSREP */ if (!srv_read_only_mode) { mtr_start(&mtr); diff --git a/storage/xtradb/include/trx0sys.ic b/storage/xtradb/include/trx0sys.ic index 6024c1dc94e..699148cff6d 100644 --- a/storage/xtradb/include/trx0sys.ic +++ b/storage/xtradb/include/trx0sys.ic @@ -474,10 +474,7 @@ trx_id_t trx_sys_get_new_trx_id(void) /*========================*/ { -#ifndef WITH_WSREP - /* wsrep_fake_trx_id violates this assert */ ut_ad(mutex_own(&trx_sys->mutex)); -#endif /* WITH_WSREP */ /* VERY important: after the database is started, max_trx_id value is divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if diff --git a/storage/xtradb/trx/trx0sys.cc b/storage/xtradb/trx/trx0sys.cc index 83bb28b3c07..6108ab7ab94 100644 --- a/storage/xtradb/trx/trx0sys.cc +++ b/storage/xtradb/trx/trx0sys.cc @@ -184,12 +184,7 @@ trx_sys_flush_max_trx_id(void) mtr_t mtr; trx_sysf_t* sys_header; -#ifndef WITH_WSREP - /* wsrep_fake_trx_id violates this assert - * Copied from trx_sys_get_new_trx_id - */ ut_ad(mutex_own(&trx_sys->mutex)); -#endif /* WITH_WSREP */ if (!srv_read_only_mode) { mtr_start(&mtr); From 0202e47274eac1ca3a8be98b7089b1ca3bffe8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Dec 2017 17:19:13 +0200 Subject: [PATCH 34/88] MDEV-12827 Assertion failure when reporting duplicate key error in online table rebuild row_log_table_apply_insert_low(), row_log_table_apply_update(): When reporting the error_key_num, only count the clustered index if it corresponds to a key in the SQL layer. The assertion failure was probably introduced by the (incomplete) MySQL 5.6.28 bug fix Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL WITH INCORRECT KEY NAME which we are improving. Side note: the fix was incorrectly merged to MySQL 5.7.10; incorrect key names will continue to be reported in MySQL 5.7. --- .../suite/innodb/r/innodb-index-debug.result | 22 ++++++++++ .../suite/innodb/t/innodb-index-debug.test | 42 ++++++++++++++++++- storage/innobase/row/row0log.cc | 33 +++++++-------- storage/xtradb/row/row0log.cc | 33 +++++++-------- 4 files changed, 92 insertions(+), 38 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-index-debug.result b/mysql-test/suite/innodb/r/innodb-index-debug.result index d78ba68078d..69dd8742b5b 100644 --- a/mysql-test/suite/innodb/r/innodb-index-debug.result +++ b/mysql-test/suite/innodb/r/innodb-index-debug.result @@ -67,3 +67,25 @@ alter table t1 force, algorithm=inplace; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET DEBUG_DBUG = @saved_debug_dbug; drop table t1, t480; +# +# MDEV-12827 Assertion failure when reporting duplicate key error +# in online table rebuild +# +CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log'; +ALTER TABLE t1 DROP j, FORCE; +SET DEBUG_SYNC='now WAIT_FOR built'; +INSERT INTO t1 (i) VALUES (0),(0); +ERROR 23000: Duplicate entry '0' for key 'i' +SET DEBUG_SYNC='now SIGNAL log'; +ERROR 23000: Duplicate entry '0' for key 'i' +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2'; +ALTER TABLE t1 DROP j, FORCE; +SET DEBUG_SYNC='now WAIT_FOR built2'; +INSERT INTO t1 (i) VALUES (0),(1); +UPDATE t1 SET i=0; +ERROR 23000: Duplicate entry '0' for key 'i' +SET DEBUG_SYNC='now SIGNAL log2'; +ERROR 23000: Duplicate entry '0' for key 'i' +SET DEBUG_SYNC='RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-index-debug.test b/mysql-test/suite/innodb/t/innodb-index-debug.test index d4fcda4f160..e179b969a6a 100644 --- a/mysql-test/suite/innodb/t/innodb-index-debug.test +++ b/mysql-test/suite/innodb/t/innodb-index-debug.test @@ -1,7 +1,6 @@ -- source include/have_debug.inc -- source include/have_innodb.inc - -let $MYSQLD_DATADIR= `select @@datadir`; +-- source include/have_debug_sync.inc let $per_table=`select @@innodb_file_per_table`; let $format=`select @@innodb_file_format`; @@ -82,3 +81,42 @@ SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure'; alter table t1 force, algorithm=inplace; SET DEBUG_DBUG = @saved_debug_dbug; drop table t1, t480; + +--echo # +--echo # MDEV-12827 Assertion failure when reporting duplicate key error +--echo # in online table rebuild +--echo # + +CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB; +--connect (con1,localhost,root,,test) +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log'; +--send +ALTER TABLE t1 DROP j, FORCE; + +--connection default +SET DEBUG_SYNC='now WAIT_FOR built'; +--error ER_DUP_ENTRY +INSERT INTO t1 (i) VALUES (0),(0); +SET DEBUG_SYNC='now SIGNAL log'; + +--connection con1 +--error ER_DUP_ENTRY +reap; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2'; +--send +ALTER TABLE t1 DROP j, FORCE; + +--connection default +SET DEBUG_SYNC='now WAIT_FOR built2'; +INSERT INTO t1 (i) VALUES (0),(1); +--error ER_DUP_ENTRY +UPDATE t1 SET i=0; +SET DEBUG_SYNC='now SIGNAL log2'; + +--connection con1 +--error ER_DUP_ENTRY +reap; +--disconnect con1 +--connection default +SET DEBUG_SYNC='RESET'; +DROP TABLE t1; diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 0b7ef86fdd3..bc256c62d96 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -1520,13 +1520,10 @@ row_log_table_apply_insert_low( return(error); } - do { - n_index++; - - if (!(index = dict_table_get_next_index(index))) { - break; - } + ut_ad(dict_index_is_clust(index)); + for (n_index += index->type != DICT_CLUSTERED; + (index = dict_table_get_next_index(index)); n_index++) { if (index->type & DICT_FTS) { continue; } @@ -1536,12 +1533,13 @@ row_log_table_apply_insert_low( flags, BTR_MODIFY_TREE, index, offsets_heap, heap, entry, trx_id, thr); - /* Report correct index name for duplicate key error. */ - if (error == DB_DUPLICATE_KEY) { - thr_get_trx(thr)->error_key_num = n_index; + if (error != DB_SUCCESS) { + if (error == DB_DUPLICATE_KEY) { + thr_get_trx(thr)->error_key_num = n_index; + } + break; } - - } while (error == DB_SUCCESS); + } return(error); } @@ -2120,17 +2118,16 @@ func_exit_committed: dtuple_big_rec_free(big_rec); } - while ((index = dict_table_get_next_index(index)) != NULL) { - if (error != DB_SUCCESS) { - break; - } - - n_index++; - + for (n_index += index->type != DICT_CLUSTERED; + (index = dict_table_get_next_index(index)); n_index++) { if (index->type & DICT_FTS) { continue; } + if (error != DB_SUCCESS) { + break; + } + if (!row_upd_changes_ord_field_binary( index, update, thr, old_row, NULL)) { continue; diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc index 874c0901451..44b22ee84bb 100644 --- a/storage/xtradb/row/row0log.cc +++ b/storage/xtradb/row/row0log.cc @@ -1520,13 +1520,10 @@ row_log_table_apply_insert_low( return(error); } - do { - n_index++; - - if (!(index = dict_table_get_next_index(index))) { - break; - } + ut_ad(dict_index_is_clust(index)); + for (n_index += index->type != DICT_CLUSTERED; + (index = dict_table_get_next_index(index)); n_index++) { if (index->type & DICT_FTS) { continue; } @@ -1536,12 +1533,13 @@ row_log_table_apply_insert_low( flags, BTR_MODIFY_TREE, index, offsets_heap, heap, entry, trx_id, thr); - /* Report correct index name for duplicate key error. */ - if (error == DB_DUPLICATE_KEY) { - thr_get_trx(thr)->error_key_num = n_index; + if (error != DB_SUCCESS) { + if (error == DB_DUPLICATE_KEY) { + thr_get_trx(thr)->error_key_num = n_index; + } + break; } - - } while (error == DB_SUCCESS); + } return(error); } @@ -2120,17 +2118,16 @@ func_exit_committed: dtuple_big_rec_free(big_rec); } - while ((index = dict_table_get_next_index(index)) != NULL) { - if (error != DB_SUCCESS) { - break; - } - - n_index++; - + for (n_index += index->type != DICT_CLUSTERED; + (index = dict_table_get_next_index(index)); n_index++) { if (index->type & DICT_FTS) { continue; } + if (error != DB_SUCCESS) { + break; + } + if (!row_upd_changes_ord_field_binary( index, update, thr, old_row, NULL)) { continue; From 461cf3e5a3c2d346d75b1407b285f8daf9d01f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Dec 2017 17:40:01 +0200 Subject: [PATCH 35/88] Make a test more robust Sometimes, the test would fail with a result difference for the READ UNCOMMITTED read, because the incremental backup would finish before redo log was written for all the rows that were inserted in the second batch. To fix that, cause a redo log write by creating another transaction. The transaction rollback (which internally does commit) will be flushed to the redo log, and before that, all the preceding changes will be flushed to the redo log as well. --- mysql-test/suite/mariabackup/apply-log-only-incr.result | 4 ++++ mysql-test/suite/mariabackup/apply-log-only-incr.test | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/mysql-test/suite/mariabackup/apply-log-only-incr.result b/mysql-test/suite/mariabackup/apply-log-only-incr.result index 2baed8c1db9..f724d1d1fdc 100644 --- a/mysql-test/suite/mariabackup/apply-log-only-incr.result +++ b/mysql-test/suite/mariabackup/apply-log-only-incr.result @@ -3,6 +3,10 @@ CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) ENGINE INNODB; INSERT INTO t VALUES(0); COMMIT; start transaction; +BEGIN; +DELETE FROM t LIMIT 1; +SET GLOBAL innodb_flush_log_at_trx_commit = 1; +ROLLBACK; NOT FOUND /Rollback of trx with id/ in current_test # expect NOT FOUND NOT FOUND /Rollback of trx with id/ in current_test diff --git a/mysql-test/suite/mariabackup/apply-log-only-incr.test b/mysql-test/suite/mariabackup/apply-log-only-incr.test index aa5110cc51e..81c91d3c452 100644 --- a/mysql-test/suite/mariabackup/apply-log-only-incr.test +++ b/mysql-test/suite/mariabackup/apply-log-only-incr.test @@ -26,6 +26,13 @@ eval INSERT t VALUES(201-$n); dec $n; } --enable_query_log +connect (flush_log,localhost,root,,); +BEGIN; +DELETE FROM t LIMIT 1; +SET GLOBAL innodb_flush_log_at_trx_commit = 1; +ROLLBACK; +disconnect flush_log; +connection default; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir ; From 24efee9100f4666ac61e1ac317e3d0fd12a5265c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 21 Dec 2017 18:00:24 +0200 Subject: [PATCH 36/88] Follow up to MDEV-12366: FLUSH privileges can break hierarchy of roles A suggestion to make role propagation simpler from serg@mariadb.org. Instead of gathering the leaf roles in an array, which for very wide graphs could potentially mean a big part of the whole roles schema, keep the previous logic. When finally merging a role, set its counter to something positive. This will effectively mean that a role has been merged, thus a random pass through roles hash that touches a previously merged role won't cause the problem described in MDEV-12366 any more, as propagate_role_grants_action will stop attempting to merge from that role. --- sql/sql_acl.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 27292105dde..0e4a0cef591 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5366,6 +5366,8 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)), if (--grantee->counter) return 1; // don't recurse into grantee just yet + grantee->counter= 1; // Mark the grantee as merged. + /* if we'll do db/table/routine privileges, create a hash of role names */ role_hash_t role_hash(role_key); if (data->what != PRIVS_TO_MERGE::GLOBAL) @@ -6555,14 +6557,16 @@ end_index_init: DBUG_RETURN(return_val); } -static my_bool collect_leaf_roles(void *role_ptr, - void *roles_array) +static my_bool propagate_role_grants_action(void *role_ptr, + void *ptr __attribute__((unused))) { ACL_ROLE *role= static_cast(role_ptr); - Dynamic_array *array= - static_cast *>(roles_array); - if (!role->counter) - array->push(role); + if (role->counter) + return 0; + + mysql_mutex_assert_owner(&acl_cache->lock); + PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; + traverse_role_graph_up(role, &data, NULL, merge_role_privileges); return 0; } @@ -6645,15 +6649,7 @@ my_bool grant_reload(THD *thd) } mysql_mutex_lock(&acl_cache->lock); - Dynamic_array leaf_roles; - my_hash_iterate(&acl_roles, collect_leaf_roles, &leaf_roles); - PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; - for (size_t i= 0; i < leaf_roles.elements(); i++) - { - traverse_role_graph_up(leaf_roles.at(i), &data, NULL, - merge_role_privileges); - } - + my_hash_iterate(&acl_roles, propagate_role_grants_action, NULL); mysql_mutex_unlock(&acl_cache->lock); mysql_rwlock_unlock(&LOCK_grant); From aed781ef7f0a733264f8a87d8c4f02951f03f78e Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 22 Dec 2017 01:13:43 +0300 Subject: [PATCH 37/88] Cleanup in storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def --- storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index e46e89517a9..1a53f8a6f1a 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -5,6 +5,7 @@ rpl_no_unique_check_on_lag : unique_check_lag_threshold is not available in MariaDB rpl_no_unique_check_on_lag_mts : unique_check_lag_threshold is not available in MariaDB consistent_snapshot_mixed_engines : Tests START TRANSACTION WITH CONSISTENT $ENGINE_NAME SNAPSHOT +rpl_skip_trx_api_binlog_format : requires @@rpl_skip_tx_api ## ## Tests that are disabled for other reasons @@ -19,7 +20,6 @@ rpl_gtid_rocksdb_sys_header : Didn't try with MariaDB, yet rpl_rocksdb_snapshot : Didn't try with MariaDB, yet rpl_rocksdb_snapshot_without_gtid : Didn't try with MariaDB, yet rpl_rocksdb_stress_crash : Didn't try with MariaDB, yet -rpl_skip_trx_api_binlog_format : Didn't try with MariaDB, yet singledelete_idempotent_recovery : Didn't try with MariaDB, yet singledelete_idempotent_table : Didn't try with MariaDB, yet From ab0a7e13b279bb94b20c8d8010b61c410f8a478f Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 22 Dec 2017 02:21:27 +0300 Subject: [PATCH 38/88] More fixes in MyRocks' rocksdb_rpl testsuite - Make my.cnf to include rpl_1slave_base.cnf (needed for tests that actually use replication, i.e. need a functioning slave) - Adjust and enable singledelete_idempotent_table.test - More edits in disabled.def --- storage/rocksdb/mysql-test/rocksdb_rpl/my.cnf | 1 + .../r/singledelete_idempotent_table.result | 10 +++++++--- .../rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 13 +++++++++---- .../rocksdb_rpl/t/singledelete_idempotent_table.cnf | 10 +++------- .../t/singledelete_idempotent_table.test | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/my.cnf b/storage/rocksdb/mysql-test/rocksdb_rpl/my.cnf index 2beaf514cee..ec7370b65f0 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/my.cnf +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/my.cnf @@ -1,3 +1,4 @@ +!include rpl_1slave_base.cnf !include include/default_my.cnf [server] diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/r/singledelete_idempotent_table.result b/storage/rocksdb/mysql-test/rocksdb_rpl/r/singledelete_idempotent_table.result index 609d4a8821a..979e2cbf6c3 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/r/singledelete_idempotent_table.result +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/r/singledelete_idempotent_table.result @@ -1,16 +1,19 @@ include/master-slave.inc -Warnings: -Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] +connection master; drop table if exists r1; create table r1 (id1 int, id2 int, primary key (id1, id2), index i (id2)) engine=rocksdb; insert into r1 values (1, 1000); set sql_log_bin=0; delete from r1 where id1=1 and id2=1000; set sql_log_bin=1; +connection slave; +connection slave; set global rocksdb_force_flush_memtable_now=1; +connection master; insert into r1 values (1, 1000); +connection slave; +connection slave; delete r1 from r1 force index (i) where id2=1000; select id1,id2 from r1 force index (primary); id1 id2 @@ -21,5 +24,6 @@ select id1,id2 from r1 force index (primary); id1 id2 select id2 from r1 force index (i); id2 +connection master; drop table r1; include/rpl_end.inc diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index 1a53f8a6f1a..a082a4a16be 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -6,6 +6,15 @@ rpl_no_unique_check_on_lag : unique_check_lag_threshold is not available in Mar rpl_no_unique_check_on_lag_mts : unique_check_lag_threshold is not available in MariaDB consistent_snapshot_mixed_engines : Tests START TRANSACTION WITH CONSISTENT $ENGINE_NAME SNAPSHOT rpl_skip_trx_api_binlog_format : requires @@rpl_skip_tx_api +rpl_ddl_high_priority : DDL commands with HIGH_PRIORITY syntax are not in MariaDB +rpl_gtid_rocksdb_sys_header : MariaDB doesn't support printing "RocksDB: Last MySQL Gtid UUID" into server stderr on startup + + +## +## Tests that do not fit MariaDB's test environment (Functional tests only, +## can't have stress tests) +## +rpl_rocksdb_stress_crash : Stress test ## ## Tests that are disabled for other reasons @@ -13,13 +22,9 @@ rpl_skip_trx_api_binlog_format : requires @@rpl_skip_tx_api multiclient_2pc : Didn't try with MariaDB, yet rpl_crash_safe_wal_corrupt : Didn't try with MariaDB, yet -rpl_ddl_high_priority : Didn't try with MariaDB, yet rpl_gtid_crash_safe : Didn't try with MariaDB, yet rpl_gtid_crash_safe_wal_corrupt : Didn't try with MariaDB, yet -rpl_gtid_rocksdb_sys_header : Didn't try with MariaDB, yet rpl_rocksdb_snapshot : Didn't try with MariaDB, yet rpl_rocksdb_snapshot_without_gtid : Didn't try with MariaDB, yet -rpl_rocksdb_stress_crash : Didn't try with MariaDB, yet singledelete_idempotent_recovery : Didn't try with MariaDB, yet -singledelete_idempotent_table : Didn't try with MariaDB, yet diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.cnf b/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.cnf index ad4894f5b38..5f1f87d762f 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.cnf +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.cnf @@ -2,14 +2,10 @@ [mysqld.1] log_slave_updates -gtid_mode=ON -enforce_gtid_consistency=ON [mysqld.2] relay_log_recovery=1 -relay_log_info_repository=FILE +#relay_log_info_repository=FILE log_slave_updates -gtid_mode=ON -enforce_gtid_consistency=ON -rbr_idempotent_tables='r1' - +#rbr_idempotent_tables='r1' +slave_exec_mode=IDEMPOTENT diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.test b/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.test index 23d335d6b57..00dce7c2ca9 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.test +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/singledelete_idempotent_table.test @@ -2,7 +2,7 @@ --source include/have_binlog_format_row.inc --source include/have_rocksdb.inc --source include/master-slave.inc ---source include/have_gtid.inc +#--source include/have_gtid.inc --source include/not_valgrind.inc # This is a test case for issue#655 -- SingleDelete on Primary Key may From 5426f6e30fced3087d7851bfbec10a74cc0b3a5b Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 22 Dec 2017 02:30:32 +0300 Subject: [PATCH 39/88] Better comments: explain why slave_use_idempotent_for_recovery is disabled --- storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index a082a4a16be..4f739a558e8 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -8,7 +8,7 @@ consistent_snapshot_mixed_engines : Tests START TRANSACTION WITH CONSISTENT $ENG rpl_skip_trx_api_binlog_format : requires @@rpl_skip_tx_api rpl_ddl_high_priority : DDL commands with HIGH_PRIORITY syntax are not in MariaDB rpl_gtid_rocksdb_sys_header : MariaDB doesn't support printing "RocksDB: Last MySQL Gtid UUID" into server stderr on startup - +slave_use_idempotent_for_recovery: MariaDB doesn't support --slave-use-idempotent-for-recovery ## ## Tests that do not fit MariaDB's test environment (Functional tests only, @@ -26,5 +26,4 @@ rpl_gtid_crash_safe : Didn't try with MariaDB, yet rpl_gtid_crash_safe_wal_corrupt : Didn't try with MariaDB, yet rpl_rocksdb_snapshot : Didn't try with MariaDB, yet rpl_rocksdb_snapshot_without_gtid : Didn't try with MariaDB, yet -singledelete_idempotent_recovery : Didn't try with MariaDB, yet From a76a2522ec4f8c069827e038997387a8b8eb3a3a Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 22 Dec 2017 08:22:10 +0400 Subject: [PATCH 40/88] MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP --- mysql-test/r/ps.result | 29 +++++++++++++++++++++++++++++ mysql-test/t/ps.test | 34 ++++++++++++++++++++++++++++++++++ sql/sql_prepare.cc | 12 ++++++++++++ 3 files changed, 75 insertions(+) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6857ebc68af..5ddc52579bc 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -5074,3 +5074,32 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; +# +# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP +# +CREATE PROCEDURE p1(OUT a VARCHAR(20)) +BEGIN +SET a=10; +END; +$$ +BEGIN NOT ATOMIC +DECLARE a DATETIME; +CALL p1(a); +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +BEGIN NOT ATOMIC +DECLARE a DATETIME; +EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +BEGIN NOT ATOMIC +DECLARE a DATETIME; +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING a; +DEALLOCATE PREPARE stmt; +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +DROP PROCEDURE p1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index a7683b5aae6..f147f4b7e1e 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4529,3 +4529,37 @@ CREATE TABLE t1 AS SELECT @a AS a, @b AS b; SHOW CREATE TABLE t1; DROP TABLE t1; DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(OUT a VARCHAR(20)) +BEGIN + SET a=10; +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + CALL p1(a); +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + PREPARE stmt FROM 'CALL p1(?)'; + EXECUTE stmt USING a; + DEALLOCATE PREPARE stmt; +END; +$$ +DELIMITER ;$$ +DROP PROCEDURE p1; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 19c714cfc01..ae6f0e8f63d 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -4786,7 +4786,19 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) if (error == 0 && this->lex->sql_command == SQLCOM_CALL) { if (is_sql_prepare()) + { + /* + Here we have the diagnostics area status already set to DA_OK. + sent_out_parameters() can raise errors when assigning OUT parameters: + DECLARE a DATETIME; + EXECUTE IMMEDIATE 'CALL p1(?)' USING a; + when the procedure p1 assigns a DATETIME-incompatible value (e.g. 10) + to the out parameter. Allow to overwrite status (to DA_ERROR). + */ + thd->get_stmt_da()->set_overwrite_status(true); thd->protocol_text.send_out_parameters(&this->lex->param_list); + thd->get_stmt_da()->set_overwrite_status(false); + } else thd->protocol->send_out_parameters(&this->lex->param_list); } From 4b8cd4536a2c6376284288cd4617369a5e48236a Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 22 Dec 2017 14:03:25 +0400 Subject: [PATCH 41/88] MDEV-13626 Merge InnoDB test cases from MySQL 5.7 Coverage for temporary tables modifications in read-only transactions. Introduced in 5.7 by 325cdf426 --- mysql-test/suite/innodb/r/innodb.result | 80 +++++++++++++++++++++++++ mysql-test/suite/innodb/t/innodb.test | 70 ++++++++++++++++++++++ 2 files changed, 150 insertions(+) diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index cded1f98fb3..159043a7170 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3143,3 +3143,83 @@ show status like "handler_read_key"; Variable_name Value Handler_read_key 0 drop table t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(0); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +INSERT INTO t2 VALUES(1); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +COMMIT; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +1 +3 +DROP TABLE t2; +CREATE TEMPORARY TABLE t2 ( +c1 INT AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +COMMIT; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +4 1 +7 1 +5 2 +8 2 +6 3 +9 3 +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index b519c48b23d..c3b6ed7d0a7 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -2528,6 +2528,76 @@ select f1 from t1; show status like "handler_read_key"; drop table t1; +# +# Test handling of writes to TEMPORARY tables for read-only transactions +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; + +# Check that the rollback works +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(0); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +ROLLBACK; + +SELECT * FROM t1; +SELECT * FROM t2; + +START TRANSACTION READ ONLY; +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(1); +COMMIT; + +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +COMMIT; + +SELECT * FROM t1; +SELECT * FROM t2; + +DROP TABLE t2; + +# This time with some indexes +CREATE TEMPORARY TABLE t2 ( + c1 INT AUTO_INCREMENT PRIMARY KEY, + c2 INT, INDEX idx(c2)) ENGINE=InnoDB; + +SHOW CREATE TABLE t2; + +# Check that the rollback works +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +ROLLBACK; + +SELECT * FROM t1; +SELECT * FROM t2; + +START TRANSACTION READ ONLY; +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +COMMIT; + +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +COMMIT; + +SHOW CREATE TABLE t2; +SELECT * FROM t1; +SELECT * FROM t2; + +DROP TABLE t1; +DROP TABLE t2; ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # From 8c3a1b15e67869f987349b393b368a503ff6e600 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 22 Dec 2017 13:22:59 +0300 Subject: [PATCH 42/88] Fix a typo in previous commit --- storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def index 4f739a558e8..956355dceee 100644 --- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/disabled.def @@ -8,7 +8,7 @@ consistent_snapshot_mixed_engines : Tests START TRANSACTION WITH CONSISTENT $ENG rpl_skip_trx_api_binlog_format : requires @@rpl_skip_tx_api rpl_ddl_high_priority : DDL commands with HIGH_PRIORITY syntax are not in MariaDB rpl_gtid_rocksdb_sys_header : MariaDB doesn't support printing "RocksDB: Last MySQL Gtid UUID" into server stderr on startup -slave_use_idempotent_for_recovery: MariaDB doesn't support --slave-use-idempotent-for-recovery +singledelete_idempotent_recovery: MariaDB doesn't support --slave-use-idempotent-for-recovery ## ## Tests that do not fit MariaDB's test environment (Functional tests only, From db3bdca7c2982aeb6848eb3517a669686381c760 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Fri, 22 Dec 2017 16:45:20 -0500 Subject: [PATCH 43/88] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 466fdaeb91d..244d28b6ba5 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=30 +MYSQL_VERSION_PATCH=31 From 6e7ca6b0b29a732390f2d50902ef7f6db66989ce Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 23 Dec 2017 14:53:12 +0200 Subject: [PATCH 44/88] MDEV-13719 Assertion `bit < (map)->n_bits' failed in bitmap_is_set Problem was that MAX_SLAVE_ERROR didn't cover all possible errors. --- sql/slave.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/slave.h b/sql/slave.h index ded9d76e49d..d3cbaae03df 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -51,7 +51,7 @@ #define SLAVE_NET_TIMEOUT 60 -#define MAX_SLAVE_ERROR 2000 +#define MAX_SLAVE_ERROR ER_ERROR_LAST+1 #define MAX_REPLICATION_THREAD 64 From f0f3b6549a5924a194e8ce56a0c47443acbb506e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 25 Dec 2017 08:10:48 +0400 Subject: [PATCH 45/88] MDEV-13970 crash in Item_func_json_extract::read_json. Item_func_json_extract::val_int fixed. It wasn't tested yet as it's called in exotic cases only. --- mysql-test/r/func_json.result | 5 +++++ mysql-test/t/func_json.test | 9 +++++++++ sql/item_jsonfunc.cc | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 55e64ea38e3..b60f6e970e1 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -731,3 +731,8 @@ Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_ select JSON_VALID(0x36f0c8dccd83c5eac156da); JSON_VALID(0x36f0c8dccd83c5eac156da) 0 +create table t1(a double not null); +insert into t1 values (2),(1); +select 1 from t1 where json_extract(a,'$','$[81]'); +1 +drop table t1; diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index c6c7c8d3976..0b3cb938098 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -383,3 +383,12 @@ select json_contains_path('{"foo":"bar"}', 'one', '$[]'); # MDEV-13971 crash in skip_num_constant. # select JSON_VALID(0x36f0c8dccd83c5eac156da); + +# +# MDEV-13970 crash in Item_func_json_extract::read_json. +# +create table t1(a double not null); +insert into t1 values (2),(1); +select 1 from t1 where json_extract(a,'$','$[81]'); +drop table t1; + diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index ff062b81a2e..794831ae1a5 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -781,10 +781,10 @@ String *Item_func_json_extract::read_json(String *str, { str->set_charset(js->charset()); str->length(0); - } - if (possible_multiple_values && str->append("[", 1)) - goto error; + if (possible_multiple_values && str->append("[", 1)) + goto error; + } json_get_path_start(&je, js->charset(),(const uchar *) js->ptr(), (const uchar *) js->ptr() + js->length(), &p); From 2fe6186124abeda19f2ae01cd41dd1907ba611b8 Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Mon, 25 Dec 2017 05:09:49 +0530 Subject: [PATCH 46/88] MDEV-10715 Galera: Replicate MariaDB GTID to other nodes in the cluster Problem:- Gtid are not transferred in Galera Cluster. Solution:- We need to transfer gtid in the case on either when cluster is slave/master in async replication. In normal Gtid replication gtid are generated on recieving node itself and it is always on sync with other nodes. Because galera keeps node in sync , So all nodes get same no of event groups. So the issue arises when say galera is slave in async replication. A | (Async replication) D <-> E <-> F {Galera replication} So what should happen is that all node should apply the master gtid but this does node happen, becuase node E, F does not recieve gtid from D in write set , So what E(or F) does is that it applies wsrep_gtid_domain_id, D server-id , E gtid next seq no. This generated gtid does not always work when say A has different domain id. So In this commit, on galera node when we see that this event is recieved from master we simply write Gtid_Log_Event in write_set and send it to other nodes. --- .../suite/galera/r/galera_gtid_slave.result | 26 ++ .../r/galera_gtid_slave_sst_rsync.result | 130 ++++++++ .../suite/galera/t/galera_gtid_slave.cnf | 18 ++ .../suite/galera/t/galera_gtid_slave.test | 78 +++++ .../galera/t/galera_gtid_slave_sst_rsync.cnf | 18 ++ .../galera/t/galera_gtid_slave_sst_rsync.test | 207 +++++++++++++ .../suite/galera_3nodes/galera_2x3nodes.cnf | 122 ++++++++ .../r/galera_gtid_2_cluster.result | 231 ++++++++++++++ .../galera_3nodes/t/galera_gtid_2_cluster.cnf | 28 ++ .../t/galera_gtid_2_cluster.test | 292 ++++++++++++++++++ sql/log.cc | 88 +++++- sql/log.h | 8 +- sql/wsrep_mysqld.cc | 10 + 13 files changed, 1253 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_gtid_slave.result create mode 100644 mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result create mode 100644 mysql-test/suite/galera/t/galera_gtid_slave.cnf create mode 100644 mysql-test/suite/galera/t/galera_gtid_slave.test create mode 100644 mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf create mode 100644 mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test create mode 100644 mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf create mode 100644 mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result new file mode 100644 index 00000000000..40f3f1c0d53 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gtid_slave.result @@ -0,0 +1,26 @@ +START SLAVE; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +begin; +insert into t2 values(21); +insert into t2 values(22); +commit; +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-2 +INSERT INTO t1 VALUES(4); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-2,2-3-3 +DROP TABLE t1,t2; +reset master; +STOP SLAVE; +RESET SLAVE ALL; +reset master; +reset master; diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result new file mode 100644 index 00000000000..81fae57d731 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result @@ -0,0 +1,130 @@ +#Connection 2 +START SLAVE; +#Connection 1 +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB; +INSERT INTO t2 VALUES(1,11); +INSERT INTO t2 VALUES(2,22); +INSERT INTO t2 VALUES(3,33); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +include/save_master_gtid.inc +#Connection 2 +include/sync_with_master_gtid.inc +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +INSERT INTO t2 VALUES(4,44); +INSERT INTO t2 VALUES(5,55); +INSERT INTO t2 VALUES(6,66); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-3 +#Connection 3 +INSERT INTO t2 VALUES(7,77); +INSERT INTO t2 VALUES(8,88); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-3,2-3-5 +#Connection 1 +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +include/save_master_gtid.inc +#Connection 2 +include/sync_with_master_gtid.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +#Connection 3 +Shutting down server ... +#Connection 2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; +#Connection 3 +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node3_committed_after'); +INSERT INTO t1 VALUES ('node3_committed_after'); +COMMIT; +#Connection 2 +Select * from t1 order by f1; +f1 +node1_committed_before +node1_committed_before +node1_committed_during +node1_committed_during +node2_committed_before +node2_committed_before +node3_committed_after +node3_committed_after +#Connection 3 +Select * from t1 order by f1; +f1 +node1_committed_before +node1_committed_before +node1_committed_during +node1_committed_during +node2_committed_before +node2_committed_before +node3_committed_after +node3_committed_after +#Connection 2 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-6,2-2-7,2-3-8 +#Connection 3 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-6,2-2-7,2-3-8 +#Connection 1 +SET AUTOCOMMIT=ON; +#Connection 2 +SET AUTOCOMMIT=ON; +#Connection 3 +SET AUTOCOMMIT=ON; +#Connection 2 +STOP slave; +INSERT INTO t1 VALUES ('node2_slave_stoped'); +#Connection 1 +INSERT INTO t1 VALUES ('node1_normal_entry'); +include/save_master_gtid.inc +#Connection 2 +INSERT INTO t1 VALUES ('node2_slave_stoped_inserted'); +start slave; +include/sync_with_master_gtid.inc +INSERT INTO t1 VALUES ('node2_slave_started'); +SELECT count(*) from t1; +count(*) +12 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-7,2-3-8,2-2-11 +#Connection 3 +SELECT count(*) from t1; +count(*) +12 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-7,2-3-8,2-2-11 +#Connection 1 +DROP TABLE t2,t1; +#Connection 2 +#Connection 3 +#Connection 2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; +#Connection 3 +reset master; +#Connection 1 +reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.cnf b/mysql-test/suite/galera/t/galera_gtid_slave.cnf new file mode 100644 index 00000000000..409d0d1609a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave.cnf @@ -0,0 +1,18 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +log-bin=mysqld-bin +log-slave-updates +binlog-format=ROW + +[mysqld.1] +gtid-domain-id=1 +[mysqld.2] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 +[mysqld.3] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 + diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test new file mode 100644 index 00000000000..8ef87452a5b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave.test @@ -0,0 +1,78 @@ +# +# Test Galera as a slave to a MariaDB master using GTIDs +# +# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes +# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options +# +# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +#multi stmt trans +begin; +insert into t2 values(21); +insert into t2 values(22); +commit; + +SELECT @@global.gtid_binlog_state; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc +--sleep 1 +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +SELECT @@global.gtid_binlog_state; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES(4); +SELECT @@global.gtid_binlog_state; + +--connection node_1 +DROP TABLE t1,t2; +reset master; +# +# Unfortunately without the sleep below the following statement fails with "query returned no rows", which +# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" +# warning is also reported by MTR, which is also weird. +# + +--sleep 1 + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; + +--connection node_3 +reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf new file mode 100644 index 00000000000..bb9c8e84f1b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf @@ -0,0 +1,18 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +log-bin=mysqld-bin +log-slave-updates +binlog-format=ROW +wsrep_sst_method=rsync +[mysqld.1] +gtid-domain-id=1 +[mysqld.2] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 +[mysqld.3] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 + diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test new file mode 100644 index 00000000000..3fe94ad16b7 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -0,0 +1,207 @@ +# +# Test Galera as a slave to a MariaDB master using GTIDs +# +# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes +# +# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster +# + +--source include/big_test.inc +--source include/have_innodb.inc +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--echo #Connection 2 +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1,master_use_gtid=slave_pos; +--enable_query_log +START SLAVE; +--sleep 1 + + +--echo #Connection 1 +--connection node_1 +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB; +INSERT INTO t2 VALUES(1,11); +INSERT INTO t2 VALUES(2,22); +INSERT INTO t2 VALUES(3,33); + +SELECT @@global.gtid_binlog_state; +--source include/save_master_gtid.inc + +--echo #Connection 2 +--connection node_2 +--source include/sync_with_master_gtid.inc +SELECT @@global.gtid_binlog_state; + +INSERT INTO t2 VALUES(4,44); +INSERT INTO t2 VALUES(5,55); +INSERT INTO t2 VALUES(6,66); +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 6 FROM t2; +--source include/wait_condition.inc + +INSERT INTO t2 VALUES(7,77); +INSERT INTO t2 VALUES(8,88); +SELECT @@global.gtid_binlog_state; + +#Perform SST +--echo #Connection 1 +--connection node_1 +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +--source include/save_master_gtid.inc + +--echo #Connection 2 +--connection node_2 +--source include/sync_with_master_gtid.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc +--let $node_1= node_2 +--let $node_2= node_3 +--source include/auto_increment_offset_save.inc +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; + +--echo #Connection 3 +--connection node_3 +--echo Starting server ... +--source include/start_mysqld.inc +--source include/wait_until_ready.inc +--source include/auto_increment_offset_restore.inc + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node3_committed_after'); +INSERT INTO t1 VALUES ('node3_committed_after'); +COMMIT; + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc +Select * from t1 order by f1; + +--echo #Connection 3 +--connection node_3 +Select * from t1 order by f1; + +#SST Done +--sleep 1 +--echo #Connection 2 +--connection node_2 +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connection node_3 +SELECT @@global.gtid_binlog_state; + +--echo #Connection 1 +--connection node_1 +SET AUTOCOMMIT=ON; +#drop table t1; +#CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; + +--echo #Connection 2 +--connection node_2 +SET AUTOCOMMIT=ON; +--echo #Connection 3 +--connection node_3 +SET AUTOCOMMIT=ON; + +# +#stop slave on node 2 +--echo #Connection 2 +--connection node_2 +STOP slave; +--sleep 1 +INSERT INTO t1 VALUES ('node2_slave_stoped'); + +--echo #Connection 1 +--connection node_1 +INSERT INTO t1 VALUES ('node1_normal_entry'); +--source include/save_master_gtid.inc + +#start slave +--echo #Connection 2 +--connection node_2 +INSERT INTO t1 VALUES ('node2_slave_stoped_inserted'); +start slave; +--source include/sync_with_master_gtid.inc +INSERT INTO t1 VALUES ('node2_slave_started'); +SELECT count(*) from t1; +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 12 FROM t1; +--source include/wait_condition.inc +SELECT count(*) from t1; +SELECT @@global.gtid_binlog_state; + +--echo #Connection 1 +--connection node_1 +DROP TABLE t2,t1; + +# Unfortunately without the sleep below the following statement fails with "query returned no rows", which +# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" +# warning is also reported by MTR, which is also weird. +# + +--sleep 3 + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +--source include/wait_condition.inc + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--echo #Connection 2 +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; + +--echo #Connection 3 +--connection node_3 +reset master; + +--echo #Connection 1 +--connection node_1 +reset master; diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf new file mode 100644 index 00000000000..3f39b82f7b7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -0,0 +1,122 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +log-bin +log-slave-updates +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +wsrep_gtid_mode=1 +gtid_ignore_duplicates + +wsrep-on=1 +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep_node_address=127.0.0.1 +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +# wsrep-sync-wait=15 + +[mysqld.1] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep-cluster-address='gcomm://' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + + +[mysqld.4] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port + +wsrep-cluster-address='gcomm://' +wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' + +[mysqld.5] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port' + +[mysqld.6] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket + +NODE_MYPORT_4= @mysqld.4.port +NODE_MYSOCK_4= @mysqld.4.socket + +NODE_MYPORT_5= @mysqld.5.port +NODE_MYSOCK_5= @mysqld.5.socket + +NODE_MYPORT_6= @mysqld.6.port +NODE_MYSOCK_6= @mysqld.6.socket + +NODE_GALERAPORT_1= @mysqld.1.#galera_port +NODE_GALERAPORT_2= @mysqld.2.#galera_port +NODE_GALERAPORT_3= @mysqld.3.#galera_port +NODE_GALERAPORT_4= @mysqld.4.#galera_port +NODE_GALERAPORT_5= @mysqld.5.#galera_port +NODE_GALERAPORT_6= @mysqld.6.#galera_port + +NODE_SSTPORT_1= @mysqld.1.#sst_port +NODE_SSTPORT_2= @mysqld.2.#sst_port +NODE_SSTPORT_3= @mysqld.3.#sst_port +NODE_SSTPORT_4= @mysqld.4.#sst_port +NODE_SSTPORT_5= @mysqld.5.#sst_port +NODE_SSTPORT_6= @mysqld.6.#sst_port diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result new file mode 100644 index 00000000000..35ca84119e7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -0,0 +1,231 @@ +cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +drop table t1; +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +reset master; +reset master; +reset master; +reset master; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 1 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +reset master; +reset master; +reset master; +reset master; diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf new file mode 100644 index 00000000000..dc5535ef34a --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -0,0 +1,28 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# following tests such as galera_3nodes.galera_var_dirty_reads2 + +!include ../galera_2x3nodes.cnf +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 + +[mysqld.3] +wsrep_gtid_domain_id=1 +server-id=13 + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 + +[mysqld.5] +wsrep_gtid_domain_id=2 +server-id=22 + +[mysqld.6] +wsrep_gtid_domain_id=2 +server-id=23 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test new file mode 100644 index 00000000000..c679db1305d --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -0,0 +1,292 @@ +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# | {Circular Async replication} +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +--echo cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connection node_2 +--echo cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +--echo cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +--echo cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 +--connection node_5 +--echo cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 +--connection node_6 +--echo cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +#--disable_parsing +--connection node_1 +--replace_result $NODE_MYPORT_4 NODE_MYPORT_4 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 1 +--connection node_4 +select @@gtid_binlog_state; +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +--sleep 2 + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--connection node_2 +reset master; +--connection node_3 +reset master; +--connection node_5 +reset master; +--connection node_6 +reset master; +#--enable_parsing +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# \ / +# \ / +# / {C->D, F->A , Async normal slave repl} +# / \ +# | \ +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. +--connection node_1 +--replace_result $NODE_MYPORT_6 NODE_MYPORT_6 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_3 NODE_MYPORT_3 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); + +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc +--sleep 2 +--echo cluster 2 node 1 +--connection node_4 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--connection node_2 +reset master; +--connection node_3 +reset master; +--connection node_5 +reset master; +--connection node_6 +reset master; diff --git a/sql/log.cc b/sql/log.cc index 07d4074c3d4..29f8c5639cf 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4947,7 +4947,55 @@ MYSQL_BIN_LOG::is_xidlist_idle_nolock() return true; } +#ifdef WITH_WSREP +inline bool +is_gtid_cached_internal(IO_CACHE *file) +{ + uchar data[EVENT_TYPE_OFFSET+1]; + bool result= false; + my_off_t write_pos= my_b_tell(file); + if (reinit_io_cache(file, READ_CACHE, 0, 0, 0)) + return false; + /* + In the cache we have gtid event if , below condition is true, + */ + my_b_read(file, data, sizeof(data)); + uint event_type= (uchar)data[EVENT_TYPE_OFFSET]; + if (event_type == GTID_LOG_EVENT) + result= true; + /* + Cleanup , Why because we have not read the full buffer + and this will cause next to next reinit_io_cache(called in write_cache) + to make cache empty. + */ + file->read_pos= file->read_end; + if (reinit_io_cache(file, WRITE_CACHE, write_pos, 0, 0)) + return false; + return result; +} +#endif +#ifdef WITH_WSREP +inline bool +MYSQL_BIN_LOG::is_gtid_cached(THD *thd) +{ + binlog_cache_mngr *mngr= (binlog_cache_mngr *) thd_get_ha_data( + thd, binlog_hton); + if (!mngr) + return false; + binlog_cache_data *cache_trans= mngr->get_binlog_cache_data( + use_trans_cache(thd, true)); + binlog_cache_data *cache_stmt= mngr->get_binlog_cache_data( + use_trans_cache(thd, false)); + if (cache_trans && !cache_trans->empty() && + is_gtid_cached_internal(&cache_trans->cache_log)) + return true; + if (cache_stmt && !cache_stmt->empty() && + is_gtid_cached_internal(&cache_stmt->cache_log)) + return true; + return false; +} +#endif /** Create a new log file name. @@ -5544,7 +5592,37 @@ THD::binlog_start_trans_and_stmt() cache_mngr->trx_cache.get_prev_position() == MY_OFF_T_UNDEF) { this->binlog_set_stmt_begin(); - if (in_multi_stmt_transaction_mode()) + bool mstmt_mode= in_multi_stmt_transaction_mode(); +#ifdef WITH_WSREP + /* Write Gtid + Get domain id only when gtid mode is set + If this event is replicate through a master then , + we will forward the same gtid another nodes + We have to do this only one time in mysql transaction. + Since this function is called multiple times , We will check for + ha_info->is_started() + */ + Ha_trx_info *ha_info; + ha_info= this->ha_data[binlog_hton->slot].ha_info + (mstmt_mode ? 1 : 0); + + if (!ha_info->is_started() && wsrep_gtid_mode + && this->variables.gtid_seq_no) + { + binlog_cache_mngr *const cache_mngr= + (binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton); + + IO_CACHE *file= + cache_mngr->get_binlog_cache_log(use_trans_cache(this, true)); + Log_event_writer writer(file); + Gtid_log_event gtid_event(this, this->variables.gtid_seq_no, + this->variables.gtid_domain_id, + true, LOG_EVENT_SUPPRESS_USE_F, + true, 0); + gtid_event.server_id= this->variables.server_id; + writer.write(>id_event); + } +#endif + if (mstmt_mode) trans_register_ha(this, TRUE, binlog_hton); trans_register_ha(this, FALSE, binlog_hton); /* @@ -5826,7 +5904,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone, DBUG_PRINT("enter", ("standalone: %d", standalone)); #ifdef WITH_WSREP - if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode) + if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode && !thd->variables.gtid_seq_no) { domain_id= wsrep_gtid_domain_id; } else { @@ -5878,6 +5956,12 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone, /* Write the event to the binary log. */ DBUG_ASSERT(this == &mysql_bin_log); + +#ifdef WITH_WSREP + if (wsrep_gtid_mode && is_gtid_cached(thd)) + DBUG_RETURN(false); +#endif + if (write_event(>id_event)) DBUG_RETURN(true); status_var_add(thd->status_var.binlog_bytes_written, gtid_event.data_written); diff --git a/sql/log.h b/sql/log.h index 3026ca11e31..2118bd7a059 100644 --- a/sql/log.h +++ b/sql/log.h @@ -559,7 +559,13 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG bool write_transaction_to_binlog_events(group_commit_entry *entry); void trx_group_commit_leader(group_commit_entry *leader); bool is_xidlist_idle_nolock(); - +#ifdef WITH_WSREP + /* + When this mariadb node is slave and galera enabled. So in this case + we write the gtid in wsrep_run_commit itself. + */ + inline bool is_gtid_cached(THD *thd); +#endif public: /* A list of struct xid_count_per_binlog is used to keep track of how many diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index bdc8491080d..285bb520b87 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1227,6 +1227,16 @@ int wsrep_to_buf_helper( if (!ret && writer.write(>id_ev)) ret= 1; } #endif /* GTID_SUPPORT */ + if (wsrep_gtid_mode && thd->variables.gtid_seq_no) + { + Gtid_log_event gtid_event(thd, thd->variables.gtid_seq_no, + thd->variables.gtid_domain_id, + true, LOG_EVENT_SUPPRESS_USE_F, + true, 0); + gtid_event.server_id= thd->variables.server_id; + if (!gtid_event.is_valid()) ret= 0; + ret= writer.write(>id_event); + } /* if there is prepare query, add event for it */ if (!ret && thd->wsrep_TOI_pre_query) From 9631d933fbc2ec998746d49e1c2134d57947705a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 3 Dec 2017 02:17:12 +0100 Subject: [PATCH 47/88] debian: don't be smart about skipping plugins --- debian/rules | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/debian/rules b/debian/rules index 2f385b26455..2041371a409 100755 --- a/debian/rules +++ b/debian/rules @@ -45,11 +45,6 @@ else TESTSUITE_FAIL_CMD:=exit 1 endif -# Skip TokuDB if arch is not amd64 -ifneq ($(ARCH), amd64) - CMAKEFLAGS += -DWITHOUT_TOKUDB=true -endif - # Add support for verbose builds MAKEFLAGS += VERBOSE=1 @@ -119,20 +114,16 @@ override_dh_auto_install: dh_testdir dh_testroot - # If TokuDB plugin was not built skip the package - [ -f $(BUILDDIR)/storage/tokudb/ha_tokudb.so ] || sed -i -e "/Package: mariadb-plugin-tokudb/,+14d" debian/control - - # If Mroonga plugin was not built skip the package - [ -f $(BUILDDIR)/storage/mroonga/ha_mroonga.so ] || sed -i -e "/Package: mariadb-plugin-mroonga/,+13d" debian/control +# Skip TokuDB if arch is not amd64 +ifneq ($(ARCH), amd64) + sed -i -e "/Package: mariadb-plugin-tokudb/,+14d" debian/control +endif # If libthrift-dev was available (manually installed, as it is # not in Debian) and ha_cassandra.so was thus built, create package, # otherwise skip it. [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+16d" debian/control - # If Spider plugin was not built skip the package - [ -f $(BUILDDIR)/storage/spider/ha_spider.so ] || sed -i -e "/Package: mariadb-plugin-spider/,+14d" debian/control - # Copy systemd files to a location available for dh_installinit cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.2.mariadb@.service From 76056559ac7cacfe176f6e131ce3bc7bfc749890 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 29 Nov 2017 18:36:17 +0100 Subject: [PATCH 48/88] MDEV-9869 INSTALL SONAME 'ha_connect' fix 011497bd603 in RPM and DEB: storage engine packages must require the server package of exactly correct version. --- cmake/plugin.cmake | 2 +- debian/autobake-deb.sh | 2 +- debian/control | 27 ++++++++++++++++++++------- debian/rules | 4 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 2a2f206dcef..70b252c16b5 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -230,7 +230,7 @@ MACRO(MYSQL_ADD_PLUGIN) SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} PARENT_SCOPE) IF (NOT ARG_CLIENT) - SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB${ver}" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server${ver}" PARENT_SCOPE) ENDIF() # workarounds for cmake issues #13248 and #12864: SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 92c68c225d7..688698dad8a 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -79,7 +79,7 @@ GCCVERSION=$(gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9] # x86 32 bit. if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] then - sed '/Package: mariadb-plugin-rocksdb/,+7d' -i debian/control + sed '/Package: mariadb-plugin-rocksdb/,+9d' -i debian/control fi if [[ $GCCVERSION -lt 40800 ]] then diff --git a/debian/control b/debian/control index d75d7c40749..79936870579 100644 --- a/debian/control +++ b/debian/control @@ -438,7 +438,7 @@ Description: MariaDB database client (metapackage depending on the latest versio Package: mariadb-plugin-connect Architecture: any Depends: libxml2, - mariadb-server-10.2, + mariadb-server-10.2 (= ${binary:Version}), unixodbc, ${misc:Depends}, ${shlibs:Depends} @@ -452,7 +452,9 @@ Description: Connect storage engine for MariaDB Package: mariadb-plugin-rocksdb Architecture: any -Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Description: RocksDB storage engine for MariaDB The RocksDB storage engine is a high performance storage engine, aimed at maximising storage efficiency while maintaining InnoDB-like performance. @@ -460,7 +462,10 @@ Description: RocksDB storage engine for MariaDB Package: mariadb-plugin-oqgraph Architecture: any -Depends: libjudydebian1, mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: libjudydebian1, + mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2 Replaces: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2 Description: OQGraph storage engine for MariaDB @@ -470,7 +475,9 @@ Description: OQGraph storage engine for MariaDB Package: mariadb-plugin-tokudb Architecture: any -Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2 (<< ${source:Version}) @@ -485,7 +492,9 @@ Description: TokuDB storage engine for MariaDB Package: mariadb-plugin-mroonga Architecture: any -Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2 (<< ${source:Version}) @@ -499,7 +508,9 @@ Description: Mroonga storage engine for MariaDB Package: mariadb-plugin-spider Architecture: any -Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2 (<< ${source:Version}) @@ -514,7 +525,9 @@ Description: Spider storage engine for MariaDB Package: mariadb-plugin-cassandra Architecture: any -Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Depends: mariadb-server-10.2 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2 (<< ${source:Version}) diff --git a/debian/rules b/debian/rules index 2041371a409..16bcf2a0073 100755 --- a/debian/rules +++ b/debian/rules @@ -116,13 +116,13 @@ override_dh_auto_install: # Skip TokuDB if arch is not amd64 ifneq ($(ARCH), amd64) - sed -i -e "/Package: mariadb-plugin-tokudb/,+14d" debian/control + sed -i -e "/Package: mariadb-plugin-tokudb/,+16d" debian/control endif # If libthrift-dev was available (manually installed, as it is # not in Debian) and ha_cassandra.so was thus built, create package, # otherwise skip it. - [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+16d" debian/control + [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+18d" debian/control # Copy systemd files to a location available for dh_installinit cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service From e8182df1425321d67887359d481aaa18ad36e70f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 20 Jul 2017 10:32:25 +1000 Subject: [PATCH 49/88] MDEV-12386: Use AppVeyor for public Windows CI Signed-off-by: Daniel Black --- appveyor.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000000..bc4f4d83528 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,17 @@ +version: 10.2-{build} +before_build: +- md %APPVEYOR_BUILD_FOLDER%\win_build +- cd %APPVEYOR_BUILD_FOLDER%\win_build +- cmake .. -G "Visual Studio 15 2017" -DBOOST_ROOT=C:\Libraries\boost_1_64_0 -DPKG_CONFIG_EXECUTABLE=C:\perl\bin\pkg-config -DBISON_EXECUTABLE=C:\cygwin\bin\bison +- dir +build: + project: win_build\MySQL.sln + parallel: true + verbosity: minimal +configuration: + - Debug +test: +test_script: +- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test +- perl mysql-test-run.pl --force --max-test-fail=20 --parallel=6 --testcase-timeout=2 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup +image: Visual Studio 2017 From c3bd0b0301936d0dcd0918bb8c966c272610d61b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 18 Nov 2017 00:05:22 +0800 Subject: [PATCH 50/88] Appveyor: apply feedback from wlad, timeout=4 PKG_CONFIG does not really work on Windows, Strawberry perl's uses mingw libraries, which VS compiler cannot use, BOOST not used. Tests main.query_cache_debug and main.mdev-504 timed out on debug build at 2 minutes so increase the timeout to 4 minutes. Overall build time was 30 min 44 seconds so plenty of time currently. Signed-off-by: Daniel Black --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bc4f4d83528..a005fc5a93f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ version: 10.2-{build} before_build: - md %APPVEYOR_BUILD_FOLDER%\win_build - cd %APPVEYOR_BUILD_FOLDER%\win_build -- cmake .. -G "Visual Studio 15 2017" -DBOOST_ROOT=C:\Libraries\boost_1_64_0 -DPKG_CONFIG_EXECUTABLE=C:\perl\bin\pkg-config -DBISON_EXECUTABLE=C:\cygwin\bin\bison +- cmake .. -G "Visual Studio 15 2017" -DBISON_EXECUTABLE=C:\cygwin\bin\bison - dir build: project: win_build\MySQL.sln @@ -13,5 +13,5 @@ configuration: test: test_script: - cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test -- perl mysql-test-run.pl --force --max-test-fail=20 --parallel=6 --testcase-timeout=2 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup +- perl mysql-test-run.pl --force --max-test-fail=20 --parallel=6 --testcase-timeout=4 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup image: Visual Studio 2017 From c881d82c931c52e64f7c8d252c12189d299d6c97 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 24 Dec 2017 17:21:50 +0100 Subject: [PATCH 51/88] cleanup: ha_myisam::data_file_name and index_file_name don't allocate them on THD::mem_root on every init(HA_STATUS_CONST) call, do it once in open() (because they don't change) on TABLE::mem_root (so they stay valid until the table is closed) --- storage/myisam/ha_myisam.cc | 47 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 3a9bf45e22f..7f2afc3130a 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -729,6 +729,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) { MI_KEYDEF *keyinfo; MI_COLUMNDEF *recinfo= 0; + char readlink_buf[FN_REFLEN], name_buff[FN_REFLEN]; uint recs; uint i; @@ -783,6 +784,30 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) (void) mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0); info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + + /* + Set data_file_name and index_file_name to point at the symlink value + if table is symlinked (Ie; Real name is not same as generated name) + */ + fn_format(name_buff, file->filename, "", MI_NAME_DEXT, + MY_APPEND_EXT | MY_UNPACK_FILENAME); + if (my_is_symlink(name_buff)) + { + my_readlink(readlink_buf, name_buff, MYF(0)); + data_file_name= strdup_root(&table->mem_root, readlink_buf); + } + else + data_file_name= 0; + fn_format(name_buff, file->filename, "", MI_NAME_IEXT, + MY_APPEND_EXT | MY_UNPACK_FILENAME); + if (my_is_symlink(name_buff)) + { + my_readlink(readlink_buf, name_buff, MYF(0)); + index_file_name= strdup_root(&table->mem_root, readlink_buf); + } + else + index_file_name= 0; + if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED)) (void) mi_extra(file, HA_EXTRA_WAIT_LOCK, 0); if (!table->s->db_record_offset) @@ -1847,7 +1872,6 @@ void ha_myisam::position(const uchar *record) int ha_myisam::info(uint flag) { MI_ISAMINFO misam_info; - char name_buff[FN_REFLEN]; if (!table) return 1; @@ -1895,27 +1919,6 @@ int ha_myisam::info(uint flag) sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); if (table_share->tmp_table == NO_TMP_TABLE) mysql_mutex_unlock(&table_share->LOCK_share); - - /* - Set data_file_name and index_file_name to point at the symlink value - if table is symlinked (Ie; Real name is not same as generated name) - */ - char buf[FN_REFLEN]; - data_file_name= index_file_name= 0; - fn_format(name_buff, file->filename, "", MI_NAME_DEXT, - MY_APPEND_EXT | MY_UNPACK_FILENAME); - if (my_is_symlink(name_buff)) - { - my_readlink(buf, name_buff, MYF(0)); - data_file_name= ha_thd()->strdup(buf); - } - fn_format(name_buff, file->filename, "", MI_NAME_IEXT, - MY_APPEND_EXT | MY_UNPACK_FILENAME); - if (my_is_symlink(name_buff)) - { - my_readlink(buf, name_buff, MYF(0)); - index_file_name= ha_thd()->strdup(buf); - } } if (flag & HA_STATUS_ERRKEY) { From 6d8b1bd6204899afa57121cf1f7adf305118d380 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 24 Dec 2017 18:37:42 +0100 Subject: [PATCH 52/88] cleanup: ha_partition::update_create_info --- sql/ha_partition.cc | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0649d5d44aa..459af18f737 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2180,38 +2180,19 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) DBUG_ASSERT(sub_elem); part= i * num_subparts + j; DBUG_ASSERT(part < m_file_tot_parts && m_file[part]); - if (ha_legacy_type(m_file[part]->ht) == DB_TYPE_INNODB) - { - dummy_info.data_file_name= dummy_info.index_file_name = NULL; - m_file[part]->update_create_info(&dummy_info); - - if (dummy_info.data_file_name || sub_elem->data_file_name) - { - sub_elem->data_file_name = (char*) dummy_info.data_file_name; - } - if (dummy_info.index_file_name || sub_elem->index_file_name) - { - sub_elem->index_file_name = (char*) dummy_info.index_file_name; - } - } + dummy_info.data_file_name= dummy_info.index_file_name = NULL; + m_file[part]->update_create_info(&dummy_info); + sub_elem->data_file_name = (char*) dummy_info.data_file_name; + sub_elem->index_file_name = (char*) dummy_info.index_file_name; } } else { DBUG_ASSERT(m_file[i]); - if (ha_legacy_type(m_file[i]->ht) == DB_TYPE_INNODB) - { - dummy_info.data_file_name= dummy_info.index_file_name= NULL; - m_file[i]->update_create_info(&dummy_info); - if (dummy_info.data_file_name || part_elem->data_file_name) - { - part_elem->data_file_name = (char*) dummy_info.data_file_name; - } - if (dummy_info.index_file_name || part_elem->index_file_name) - { - part_elem->index_file_name = (char*) dummy_info.index_file_name; - } - } + dummy_info.data_file_name= dummy_info.index_file_name= NULL; + m_file[i]->update_create_info(&dummy_info); + part_elem->data_file_name = (char*) dummy_info.data_file_name; + part_elem->index_file_name = (char*) dummy_info.index_file_name; } } DBUG_VOID_RETURN; From 5377242fff5d2260510e65c58e4e52d7c4b222f6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 24 Dec 2017 18:39:00 +0100 Subject: [PATCH 53/88] MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options set data_file_name and index_file_name in HA_CREATE_INFO before calling check_if_incompatible_data() --- mysql-test/r/partition_windows.result | 4 --- .../parts/r/partition_alter_myisam.result | 13 +++++++ .../suite/parts/t/partition_alter_myisam.test | 19 +++++++++++ sql/ha_partition.cc | 34 ++++++++++++++----- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/partition_windows.result b/mysql-test/r/partition_windows.result index dabcedcb3f9..756690925f8 100644 --- a/mysql-test/r/partition_windows.result +++ b/mysql-test/r/partition_windows.result @@ -26,9 +26,5 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data Warnings: Warning 1618 option ignored Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored INSERT INTO t1 VALUES (NULL, "last", 4); DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result index 9f2381039d3..41af6af72fc 100644 --- a/mysql-test/suite/parts/r/partition_alter_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -42,3 +42,16 @@ PARTITION p3 VALUES IN (4,5,6) ); ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition DROP TABLE t1; +create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 +partition by key(c1) ( +partition p01 data directory = 'MYSQL_TMP_DIR' + index directory = 'MYSQL_TMP_DIR', +partition p02 data directory = 'MYSQL_TMP_DIR' + index directory = 'MYSQL_TMP_DIR'); +insert into t1 values (1, 1, repeat('a', 100)); +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +alter online table t1 delay_key_write=0; +alter online table t1 delay_key_write=1; +drop table t1; diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index a53fa333abd..b2bd0e72e4c 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -1,3 +1,22 @@ --source include/have_partition.inc --let $engine=MyISAM --source inc/part_alter_values.inc + +# +# MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options +# + +replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR; +eval create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 + partition by key(c1) ( + partition p01 data directory = '$MYSQL_TMP_DIR' + index directory = '$MYSQL_TMP_DIR', + partition p02 data directory = '$MYSQL_TMP_DIR' + index directory = '$MYSQL_TMP_DIR'); +insert into t1 values (1, 1, repeat('a', 100)); +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +alter online table t1 delay_key_write=0; +alter online table t1 delay_key_write=1; +drop table t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 459af18f737..34c253cc48a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8133,20 +8133,36 @@ uint ha_partition::alter_table_flags(uint flags) bool ha_partition::check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) { - handler **file; - bool ret= COMPATIBLE_DATA_YES; - /* The check for any partitioning related changes have already been done in mysql_alter_table (by fix_partition_func), so it is only up to the underlying handlers. */ - for (file= m_file; *file; file++) - if ((ret= (*file)->check_if_incompatible_data(create_info, - table_changes)) != - COMPATIBLE_DATA_YES) - break; - return ret; + List_iterator part_it(m_part_info->partitions); + HA_CREATE_INFO dummy_info= *create_info; + uint i=0; + while (partition_element *part_elem= part_it++) + { + if (m_is_sub_partitioned) + { + List_iterator subpart_it(part_elem->subpartitions); + while (partition_element *sub_elem= subpart_it++) + { + dummy_info.data_file_name= sub_elem->data_file_name; + dummy_info.index_file_name= sub_elem->index_file_name; + if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes)) + return COMPATIBLE_DATA_NO; + } + } + else + { + dummy_info.data_file_name= part_elem->data_file_name; + dummy_info.index_file_name= part_elem->index_file_name; + if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes)) + return COMPATIBLE_DATA_NO; + } + } + return COMPATIBLE_DATA_YES; } From 02b7dc7bec4ff95c764a244c5037c69f262651e1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 27 Dec 2017 12:30:05 +0400 Subject: [PATCH 54/88] MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event. --- .../suite/rpl/r/rpl_ctype_latin1.result | 28 +++++++++++++ mysql-test/suite/rpl/t/rpl_ctype_latin1.test | 40 +++++++++++++++++++ sql/sp.cc | 4 +- sql/sql_view.cc | 3 +- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_ctype_latin1.result create mode 100644 mysql-test/suite/rpl/t/rpl_ctype_latin1.test diff --git a/mysql-test/suite/rpl/r/rpl_ctype_latin1.result b/mysql-test/suite/rpl/r/rpl_ctype_latin1.result new file mode 100644 index 00000000000..909aa639522 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_ctype_latin1.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.2 tests +# +# +# MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event. +# +SET NAMES latin1; +CREATE TABLE `tё` (`tё` INT); +CREATE VIEW `vё` AS SELECT 'vё'; +CREATE PROCEDURE `pё`() SELECT 'pё'; +connection slave; +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +tё +SHOW TABLES LIKE 'v%'; +Tables_in_test (v%) +vё +SHOW PROCEDURE STATUS LIKE 'p%'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test pё PROCEDURE root@localhost ts ts DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +connection master; +DROP TABLE `tё`; +DROP VIEW `vё`; +DROP PROCEDURE `pё`; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ctype_latin1.test b/mysql-test/suite/rpl/t/rpl_ctype_latin1.test new file mode 100644 index 00000000000..a736d1a6485 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_ctype_latin1.test @@ -0,0 +1,40 @@ +--disable_warnings +--source include/master-slave.inc +--enable_warnings + +--echo # +--echo # Start of 10.2 tests +--echo # + + +--echo # +--echo # MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event. +--echo # + +# +# The below tests uses a sequence of bytes 0xD191, +# which in a utf8 console looks like ё (CYRILIC SMALL LETTER YO). +# Don't be mislead. This sequence is used in latin1 context and +# represents a sequence of two characters: +# U+00D1 CAPITAL LATIN LETTER N WITH TILDE (_latin1 0xD1) +# U+2018 LEFT SINGLE QUOTATION MARK (_latin1 0x91) +# + +SET NAMES latin1; +CREATE TABLE `tё` (`tё` INT); +CREATE VIEW `vё` AS SELECT 'vё'; +CREATE PROCEDURE `pё`() SELECT 'pё'; + +--sync_slave_with_master +SHOW TABLES LIKE 't%'; +SHOW TABLES LIKE 'v%'; +--replace_column 5 ts 6 ts +SHOW PROCEDURE STATUS LIKE 'p%'; + +--connection master +DROP TABLE `tё`; +DROP VIEW `vё`; +DROP PROCEDURE `pё`; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/sql/sp.cc b/sql/sp.cc index fcbf4dc43d4..ef4d0996b78 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1277,8 +1277,8 @@ log: { thd->clear_error(); - String log_query; - log_query.set_charset(system_charset_info); + StringBuffer<128> log_query(thd->variables.character_set_client); + DBUG_ASSERT(log_query.charset()->mbminlen == 1); if (!show_create_sp(thd, &log_query, sp->m_type, diff --git a/sql/sql_view.cc b/sql/sql_view.cc index bba79642d87..c3bd16b974b 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -643,7 +643,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, if (!res && mysql_bin_log.is_open()) { - String buff; + StringBuffer<128> buff(thd->variables.character_set_client); + DBUG_ASSERT(buff.charset()->mbminlen == 1); const LEX_STRING command[3]= {{ C_STRING_WITH_LEN("CREATE ") }, { C_STRING_WITH_LEN("ALTER ") }, From 462808f3b65b60958eaf8013b80857e341cc9f6c Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 20 Dec 2017 13:52:27 +0100 Subject: [PATCH 55/88] MDEV-10657: incorrect result returned with binary protocol (prepared statements) If translation table present when we materialize the derived table then change it to point to the materialized table. Added debug info to see really what happens with what derived. --- mysql-test/r/ps.result | 18 ++++++++++++++++ mysql-test/t/ps.test | 15 +++++++++++++ sql/sql_class.cc | 9 +++++++- sql/sql_derived.cc | 48 ++++++++++++++++++++++++++++++++++++++++-- sql/table.cc | 3 +++ sql/table.h | 6 ++++++ 6 files changed, 96 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 3fed0a5b0d1..209d3d85108 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4316,4 +4316,22 @@ set join_cache_level=@join_cache_level_save; deallocate prepare stmt; drop view v1,v2,v3; drop table t1,t2,t3; +# +# MDEV-10657: incorrect result returned with binary protocol +# (prepared statements) +# +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM +(SELECT CODE, RN +FROM +(SELECT A.CODE, @cnt := @cnt + 1 AS RN +FROM t1 A, (SELECT @cnt := 0) C) T +) X; +CODE RN +LINE1 1 +LINE2 2 +LINE3 3 +drop table t1; # End of 5.5 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 4431f722ae0..ea67e1074f9 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3843,4 +3843,19 @@ deallocate prepare stmt; drop view v1,v2,v3; drop table t1,t2,t3; +--echo # +--echo # MDEV-10657: incorrect result returned with binary protocol +--echo # (prepared statements) +--echo # + +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM + (SELECT CODE, RN + FROM + (SELECT A.CODE, @cnt := @cnt + 1 AS RN + FROM t1 A, (SELECT @cnt := 0) C) T + ) X; +drop table t1; --echo # End of 5.5 tests diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 00d860e7887..b007729494e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2192,6 +2192,8 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value, MEM_ROOT *runtime_memroot) { Item_change_record *change; + DBUG_ENTER("THD::nocheck_register_item_tree_change"); + DBUG_PRINT("enter", ("Register %p <- %p", old_value, (*place))); /* Now we use one node per change, which adds some memory overhead, but still is rather fast as we use alloc_root for allocations. @@ -2204,12 +2206,13 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value, OOM, thd->fatal_error() is called by the error handler of the memroot. Just return. */ - return; + DBUG_VOID_RETURN; } change= new (change_mem) Item_change_record; change->place= place; change->old_value= old_value; change_list.append(change); + DBUG_VOID_RETURN; } /** @@ -2250,7 +2253,11 @@ void THD::rollback_item_tree_changes() DBUG_ENTER("rollback_item_tree_changes"); while ((change= it++)) + { + DBUG_PRINT("info", ("revert %p -> %p", + change->old_value, (*change->place))); *change->place= change->old_value; + } /* We can forget about changes memory: it's allocated in runtime memroot */ change_list.empty(); DBUG_VOID_RETURN; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 6cd4547aaf9..2a6d82c161a 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -361,6 +361,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) SELECT_LEX *parent_lex= derived->select_lex; Query_arena *arena, backup; DBUG_ENTER("mysql_derived_merge"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (derived->merged) DBUG_RETURN(FALSE); @@ -508,6 +511,9 @@ unconditional_materialization: bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_merge_for_insert"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (derived->merged_for_insert) DBUG_RETURN(FALSE); if (derived->init_derived(thd, FALSE)) @@ -554,6 +560,9 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived) { SELECT_LEX_UNIT *unit= derived->get_unit(); DBUG_ENTER("mysql_derived_init"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); // Skip already prepared views/DT if (!unit || unit->prepared) @@ -624,7 +633,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) SELECT_LEX_UNIT *unit= derived->get_unit(); DBUG_ENTER("mysql_derived_prepare"); bool res= FALSE; - DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit)); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); // Skip already prepared views/DT if (!unit || unit->prepared || @@ -781,6 +792,9 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) bool res= FALSE; DBUG_ENTER("mysql_derived_optimize"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (unit->optimized) DBUG_RETURN(FALSE); @@ -846,6 +860,9 @@ err: bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_create"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); TABLE *table= derived->table; SELECT_LEX_UNIT *unit= derived->get_unit(); @@ -895,9 +912,13 @@ bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) { - DBUG_ENTER("mysql_derived_fill"); + Field_iterator_table field_iterator; SELECT_LEX_UNIT *unit= derived->get_unit(); bool res= FALSE; + DBUG_ENTER("mysql_derived_fill"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (unit->executed && !unit->uncacheable && !unit->describe) DBUG_RETURN(FALSE); @@ -937,7 +958,27 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) if (derived_result->flush()) res= TRUE; unit->executed= TRUE; + + if (derived->field_translation) + { + /* reset translation table to materialized table */ + field_iterator.set_table(derived->table); + for (uint i= 0; + !field_iterator.end_of_fields(); + field_iterator.next(), i= i + 1) + { + Item *item; + + if (!(item= field_iterator.create_item(thd))) + { + res= TRUE; + break; + } + thd->change_item_tree(&derived->field_translation[i].item, item); + } + } } + if (res || !lex->describe) unit->cleanup(); lex->current_select= save_current_select; @@ -966,6 +1007,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_reinit"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); st_select_lex_unit *unit= derived->get_unit(); if (derived->table) diff --git a/sql/table.cc b/sql/table.cc index fbcd91f5326..9cade76cb78 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4108,6 +4108,9 @@ bool TABLE_LIST::create_field_translation(THD *thd) Query_arena *arena, backup; bool res= FALSE; DBUG_ENTER("TABLE_LIST::create_field_translation"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); if (thd->stmt_arena->is_conventional() || thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) diff --git a/sql/table.h b/sql/table.h index c981243f28c..98f8c7ad73f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2107,6 +2107,9 @@ struct TABLE_LIST inline void set_merged_derived() { DBUG_ENTER("set_merged_derived"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); derived_type= ((derived_type & DTYPE_MASK) | DTYPE_TABLE | DTYPE_MERGE); set_check_merged(); @@ -2119,6 +2122,9 @@ struct TABLE_LIST void set_materialized_derived() { DBUG_ENTER("set_materialized_derived"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) | DTYPE_TABLE | DTYPE_MATERIALIZE); set_check_materialized(); From bbb8c9d77310860f3f81bfd8b824ce353271fb14 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sun, 24 Dec 2017 14:08:20 -0800 Subject: [PATCH 56/88] Fixed the bug MDEV-14755 Crash when executing prepared statement for a query that uses CTE The first reference to a CTE in the processed query uses the unit built by the parser for the CTE specification. This unit is considered as the specification of the derived table created for the first reference of the CTE. This requires some transformation of the original query tree: the unit of the specification must be moved to a new position as a slave of the select where the first reference to the CTE occurs. The transformation is performed by the function st_select_lex_node::move_as_slave(). There was an obvious bug in this function. As a result of this bug in many cases the moved unit turned out to be lost in the query tree. This could cause different problems. In particular the prepared statements for queries that used CTEs could miss cleanup for some selects that was performed at the end of the preparation/execution of the PSs. If such cleanup is not done for a PS the next execution of the PS causes an assertion abort or a crash. --- mysql-test/r/cte_nonrecursive.result | 118 +++++++++++++++++++++++++++ mysql-test/t/cte_nonrecursive.test | 63 ++++++++++++++ sql/sql_lex.cc | 4 +- 3 files changed, 182 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index ebe1aae1e8f..5164c74a0bc 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -1147,3 +1147,121 @@ SELECT * FROM cte_test; a 1 DROP VIEW cte_test; +# +# mdev-14755 : PS for query using CTE in select with subquery +# +create table t1 (a int); +insert into t1 values +(7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8); +with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from cte where exists( select a from t1 where cte.a=t1.a )) +union +(select a from t1 where a < 2); +a +7 +5 +4 +1 +prepare stmt from "with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from cte where exists( select a from t1 where cte.a=t1.a )) +union +(select a from t1 where a < 2)"; +execute stmt; +a +7 +5 +4 +1 +execute stmt; +a +7 +5 +4 +1 +deallocate prepare stmt; +with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); +a +1 +7 +5 +4 +prepare stmt from "with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a ))"; +execute stmt; +a +1 +7 +5 +4 +execute stmt; +a +1 +7 +5 +4 +deallocate prepare stmt; +with cte as +(select a from t1 where a between 4 and 7) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); +a +1 +7 +5 +4 +prepare stmt from "with cte as +(select a from t1 where a between 4 and 7) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a ))"; +execute stmt; +a +1 +7 +5 +4 +execute stmt; +a +1 +7 +5 +4 +deallocate prepare stmt; +with cte as +(select a from t1 where a between 4 and 7) +(select a from cte +where exists( select a from t1 where t1.a < 2 and cte.a=t1.a )) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); +a +7 +5 +4 +prepare stmt from "with cte as +(select a from t1 where a between 4 and 7) +(select a from cte +where exists( select a from t1 where t1.a < 2 and cte.a=t1.a )) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a ))"; +execute stmt; +a +7 +5 +4 +execute stmt; +a +7 +5 +4 +deallocate prepare stmt; +drop table t1; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 742e8f6e4d7..1f21dbcd36d 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -790,3 +790,66 @@ SHOW CREATE VIEW cte_test; SELECT * FROM cte_test; DROP VIEW cte_test; + +--echo # +--echo # mdev-14755 : PS for query using CTE in select with subquery +--echo # + +create table t1 (a int); +insert into t1 values + (7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8); + +let $q1= +with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from cte where exists( select a from t1 where cte.a=t1.a )) +union +(select a from t1 where a < 2); + +eval $q1; +eval prepare stmt from "$q1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q2= +with cte as +(select a from t1 where a between 4 and 7 group by a) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); + +eval $q2; +eval prepare stmt from "$q2"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q3= +with cte as +(select a from t1 where a between 4 and 7) +(select a from t1 where a < 2) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); + +eval $q3; +eval prepare stmt from "$q3"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q4= +with cte as +(select a from t1 where a between 4 and 7) +(select a from cte + where exists( select a from t1 where t1.a < 2 and cte.a=t1.a )) +union +(select a from cte where exists( select a from t1 where cte.a=t1.a )); + +eval $q4; +eval prepare stmt from "$q4"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop table t1; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d086f36a74b..69931643c7f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2320,10 +2320,8 @@ void st_select_lex_node::move_as_slave(st_select_lex_node *new_master) prev= &curr->next; } else - { prev= &new_master->slave; - new_master->slave= this; - } + *prev= this; next= 0; master= new_master; } From 1300627a5dcffdb005e2c31e0ba88f47fa519742 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 27 Dec 2017 22:10:17 +0100 Subject: [PATCH 57/88] MDEV-14309 MTR tests require perl-Env which is not always in the default installation * don't use Env module in tests, use $ENV{xxx} instead * collateral changes: ** $file in the error message was unset ** $file in the other error message was unset too :) ** source file arguments are conventionally upper-cased ** abort the test (die) on error, don't just echo/exit --- mysql-test/include/truncate_file.inc | 11 +++-------- .../suite/rpl/t/rpl_manual_change_index_file.test | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/mysql-test/include/truncate_file.inc b/mysql-test/include/truncate_file.inc index 2326d6c0b94..fe88cb05bd9 100644 --- a/mysql-test/include/truncate_file.inc +++ b/mysql-test/include/truncate_file.inc @@ -1,16 +1,11 @@ # truncate a giving file, all contents of the file are be cleared -if (!$file) +if (!$TRUNCATE_FILE) { - --echo Please assign a file name to $file!! - exit; + die TRUNCATE_FILE is not set; } -let TRUNCATE_FILE= $file; - perl; -use Env; -Env::import('TRUNCATE_FILE'); -open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file"; +open FILE, '>', $ENV{TRUNCATE_FILE} or die "open(>$ENV{TRUNCATE_FILE}): $!"; close FILE; EOF diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test index 981cecb66ad..1c087c550d0 100644 --- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test +++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test @@ -25,7 +25,7 @@ sync_slave_with_master; connection master; # Delete './master-bin.000001' from index file. let $MYSQLD_DATADIR= `SELECT @@DATADIR`; -let $file= $MYSQLD_DATADIR/master-bin.index; +let TRUNCATE_FILE= $MYSQLD_DATADIR/master-bin.index; source include/truncate_file.inc; if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`) From 7e4c185c774cabaa1912760e143d9385ce959eea Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 13 Sep 2017 21:02:44 +0200 Subject: [PATCH 58/88] MDEV-14272 Mariadb crashes with signal 11 when using federatedx engine and galera cherry-pick e6ce97a5928 --- .../federated/net_thd_crash-12951.result | 11 +++++++++ .../suite/federated/net_thd_crash-12951.test | 23 +++++++++++++++++++ storage/federated/ha_federated.cc | 9 ++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/federated/net_thd_crash-12951.result create mode 100644 mysql-test/suite/federated/net_thd_crash-12951.test diff --git a/mysql-test/suite/federated/net_thd_crash-12951.result b/mysql-test/suite/federated/net_thd_crash-12951.result new file mode 100644 index 00000000000..573ac96efff --- /dev/null +++ b/mysql-test/suite/federated/net_thd_crash-12951.result @@ -0,0 +1,11 @@ +set global query_cache_size= 16*1024*1024; +set global query_cache_type= 1; +create table t1 (i int) engine=innodb; +create table t2 (i int) engine=federated +CONNECTION="mysql://root@localhost:MASTER_MYPORT/test/t1"; +select * from t2; +i +drop table t2; +drop table t1; +set global query_cache_type= default; +set global query_cache_size= default; diff --git a/mysql-test/suite/federated/net_thd_crash-12951.test b/mysql-test/suite/federated/net_thd_crash-12951.test new file mode 100644 index 00000000000..81cd826686e --- /dev/null +++ b/mysql-test/suite/federated/net_thd_crash-12951.test @@ -0,0 +1,23 @@ +# +# MDEV-12951 Server crash [mysqld got exception 0xc0000005] +# + +--source include/have_innodb.inc + +set global query_cache_size= 16*1024*1024; +set global query_cache_type= 1; + +create table t1 (i int) engine=innodb; +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t2 (i int) engine=federated + CONNECTION="mysql://root@localhost:$MASTER_MYPORT/test/t1"; + +select * from t2; + +source include/restart_mysqld.inc; + +drop table t2; +drop table t1; + +set global query_cache_type= default; +set global query_cache_size= default; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 85e41554efc..0e84546764d 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2982,6 +2982,9 @@ int ha_federated::reset(void) } reset_dynamic(&results); + if (mysql) + mysql->net.thd= NULL; + return 0; } @@ -3202,11 +3205,13 @@ int ha_federated::real_query(const char *query, size_t length) int rc= 0; DBUG_ENTER("ha_federated::real_query"); + if (!query || !length) + goto end; + if (!mysql && (rc= real_connect())) goto end; - if (!query || !length) - goto end; + mysql->net.thd= table->in_use; rc= mysql_real_query(mysql, query, (uint) length); From 14de2ad3cb4e1f8f48b83d5e9aafa4e3a366d152 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 28 Dec 2017 11:47:03 +0200 Subject: [PATCH 59/88] Removed curr_bitmap_pos++ from possible macro --- storage/rocksdb/rdb_datadic.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc index df743ff0c48..f6f1406e80c 100644 --- a/storage/rocksdb/rdb_datadic.cc +++ b/storage/rocksdb/rdb_datadic.cc @@ -1461,7 +1461,8 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf, if (has_covered_bitmap && field->real_type() == MYSQL_TYPE_VARCHAR && !m_pack_info[i].m_covered) { covered_column = curr_bitmap_pos < MAX_REF_PARTS && - bitmap_is_set(&covered_bitmap, curr_bitmap_pos++); + bitmap_is_set(&covered_bitmap, curr_bitmap_pos); + curr_bitmap_pos++; } if (fpi->m_unpack_func && covered_column) { /* It is possible to unpack this column. Do it. */ From eef2bc5a5c30eef43eee035e23b87286a8dd50bd Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Thu, 28 Dec 2017 17:13:42 +0200 Subject: [PATCH 60/88] Update mysqladmin man page --- man/mysqladmin.1 | 186 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 184 insertions(+), 2 deletions(-) diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index 65f348cab0c..0d71644e748 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLADMIN\FR" "1" "04/08/2015" "MariaDB 10\&.0" "MariaDB Database System" +.TH "\FBMYSQLADMIN\FR" "1" "28 December 2017" "MariaDB 10\&.0" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -106,6 +106,97 @@ Display the server status variables and their values\&. .sp -1 .IP \(bu 2.3 .\} +flush\-all\-statistics +.sp +Flush all statistics tables\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-all\-status +.sp +Flush all status and statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-binary\-log +.sp +Flush the binary log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-client\-statistics +.sp +Flush client statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-engine\-log +.sp +Flush engine log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-error\-log +.sp +Flush error log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-general\-log +.sp +Flush general query log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-hosts .sp Flush all information in the host cache\&. @@ -119,6 +210,19 @@ Flush all information in the host cache\&. .sp -1 .IP \(bu 2.3 .\} +flush\-index\-statistics +.sp +Flush index statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-logs .sp Flush all logs\&. @@ -146,6 +250,32 @@ reload)\&. .sp -1 .IP \(bu 2.3 .\} +flush\-relay\-log +.sp +Flush relay log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-slow\-log +.sp +Flush slow query log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-status .sp Clear status variables\&. @@ -159,6 +289,19 @@ Clear status variables\&. .sp -1 .IP \(bu 2.3 .\} +flush\-table\-statistics +.sp +Flush table statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-tables .sp Flush all tables\&. @@ -185,6 +328,19 @@ Flush the thread cache\&. .sp -1 .IP \(bu 2.3 .\} +flush\-user\-resources +.sp +Flush user resources\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} kill \fIid\fR,\fIid\fR,\&.\&.\&. .sp Kill server threads\&. If multiple thread ID values are given, there must be no spaces in the list\&. @@ -344,6 +500,19 @@ Stop the server\&. .sp -1 .IP \(bu 2.3 .\} +start\-all\-slaves +.sp +Start all slaves\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} start\-slave .sp Start replication on a slave server\&. @@ -370,6 +539,19 @@ Display a short server status message\&. .sp -1 .IP \(bu 2.3 .\} +stop\-all\-slaves +.sp +Stop all slaves\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} stop\-slave .sp Stop replication on a slave server\&. @@ -821,7 +1003,7 @@ Connect to the MariaDB server on the given host\&. \fB\-\-local\fR, \fB\-l\fR .sp -Suppress the SQL command(s) from being written to the binary log by enabled sql_log_bin=0 for the session\&. +Suppress the SQL command(s) from being written to the binary log by using FLUSH LOCAL or enabling sql_log_bin=0 for the session\&. .RE .sp .RS 4 From 1a9728d90131997d838e981bb4188f152c5df6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 28 Dec 2017 19:27:07 +0200 Subject: [PATCH 61/88] Update Connector/C --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 63f841f78f5..fe129ed39f3 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 63f841f78f520d7f3bcff1fe8cecec9d8c47829d +Subproject commit fe129ed39f33ba2b430aac91473baee84de88b12 From 8e9d8ffd1a215d4c2bf1cdeb24c112bef2ff58dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 28 Dec 2017 19:49:58 +0200 Subject: [PATCH 62/88] Update main.innodb test result post-merge --- mysql-test/suite/innodb/r/innodb.result | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index d44dfa3f9ee..6d635fbcdc0 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3359,7 +3359,7 @@ CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; START TRANSACTION READ ONLY; INSERT INTO t2 VALUES(0); INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction ROLLBACK; SELECT * FROM t1; c1 @@ -3367,14 +3367,14 @@ SELECT * FROM t2; c1 START TRANSACTION READ ONLY; INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction INSERT INTO t2 VALUES(1); COMMIT; SET TRANSACTION READ ONLY; START TRANSACTION; INSERT INTO t2 VALUES(3); INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction COMMIT; SELECT * FROM t1; c1 @@ -3397,7 +3397,7 @@ t2 CREATE TEMPORARY TABLE `t2` ( START TRANSACTION READ ONLY; INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction ROLLBACK; SELECT * FROM t1; c1 @@ -3405,14 +3405,14 @@ SELECT * FROM t2; c1 c2 START TRANSACTION READ ONLY; INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); COMMIT; SET TRANSACTION READ ONLY; START TRANSACTION; INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); INSERT INTO t1 VALUES(0); -ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ERROR 25006: Cannot execute statement in a READ ONLY transaction COMMIT; SHOW CREATE TABLE t2; Table Create Table From 6c4cf79d9497c1d9c7e1af9aaf66ac18a08cdebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 28 Dec 2017 19:29:40 +0200 Subject: [PATCH 63/88] MDEV-13683: crash in Item_window_func::update_used_tables Window definitions are resolved during fix fields. Updating used tables for window functions must be done after all window functions have had a chance to be resolved. There was an additional problem with the implementation: expressions that contained window functions never updated the expression's used tables. To fix both these issues, make sure to call "update_used_tables" on all items that contain window functions after we have passed through all items. --- sql/sql_select.cc | 16 ++++++++++++++++ sql/sql_window.cc | 7 ------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 676b26e7db0..25b64caa530 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -859,6 +859,22 @@ JOIN::prepare(TABLE_LIST *tables_init, } } + /* + After setting up window functions, we may have discovered additional + used tables from the PARTITION BY and ORDER BY list. Update all items + that contain window functions. + */ + if (select_lex->have_window_funcs()) + { + List_iterator_fast it(select_lex->item_list); + Item *item; + while ((item= it++)) + { + if (item->with_window_func) + item->update_used_tables(); + } + } + With_clause *with_clause=select_lex->get_with_clause(); if (with_clause && with_clause->prepare_unreferenced_elements(thd)) DBUG_RETURN(1); diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 7ae967d7077..4e1e64365ae 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -297,13 +297,6 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, } } - List_iterator_fast li(win_funcs); - Item_window_func *win_func_item; - while ((win_func_item= li++)) - { - win_func_item->update_used_tables(); - } - DBUG_RETURN(0); } From 24774fba657077e867b6cd030cf213e6d9d76b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Fri, 29 Dec 2017 09:33:30 +0200 Subject: [PATCH 64/88] Update galera_gtid_slave result file post merge --- mysql-test/suite/galera/r/galera_gtid_slave.result | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result index 40f3f1c0d53..0b6306bdc6a 100644 --- a/mysql-test/suite/galera/r/galera_gtid_slave.result +++ b/mysql-test/suite/galera/r/galera_gtid_slave.result @@ -1,4 +1,7 @@ +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; START SLAVE; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); @@ -9,18 +12,25 @@ commit; SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 1-1-4 +connection node_2; INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(3); SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 1-1-4,2-2-2 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; INSERT INTO t1 VALUES(4); SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 1-1-4,2-2-2,2-3-3 +connection node_1; DROP TABLE t1,t2; reset master; +connection node_2; +connection node_3; +connection node_2; STOP SLAVE; RESET SLAVE ALL; reset master; +connection node_3; reset master; From f5c479565d1d07662f23f0a688add6dffeee5f84 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 26 Dec 2017 14:38:45 +0400 Subject: [PATCH 65/88] MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in Locked_tables_list::unlock_locked_tables Similarly to regular DROP TABLE, don't leave locked tables mode if CREATE OR REPLACE dropped temporary table but failed to cerate new one. The problem is that there's no track of which temporary table was "locked" by LOCK TABLES. --- mysql-test/r/create_or_replace.result | 20 ++++++++++++++++++++ mysql-test/t/create_or_replace.test | 24 ++++++++++++++++++++++++ sql/sql_table.cc | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index 3d9b29ffe27..e26884f1cbf 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -458,3 +458,23 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1(); UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in +# Locked_tables_list::unlock_locked_tables +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2(a INT); +CREATE TABLE t3(a INT); +LOCK TABLE t2 WRITE; +SELECT * FROM t2; +a +CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SELECT * FROM t3; +ERROR HY000: Table 't3' was not locked with LOCK TABLES +CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SELECT * FROM t3; +ERROR HY000: Table 't3' was not locked with LOCK TABLES +UNLOCK TABLES; +DROP TABLE t3; diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test index abf470b62d5..4ef4189694b 100644 --- a/mysql-test/t/create_or_replace.test +++ b/mysql-test/t/create_or_replace.test @@ -396,3 +396,27 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1(); UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; + +--echo # +--echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in +--echo # Locked_tables_list::unlock_locked_tables +--echo # +CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2(a INT); +CREATE TABLE t3(a INT); +LOCK TABLE t2 WRITE; +SELECT * FROM t2; +# drops t2 +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +# make sure we didn't leave locked tables mode +--error ER_TABLE_NOT_LOCKED +SELECT * FROM t3; +# drops t1 +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +# make sure we didn't leave locked tables mode +--error ER_TABLE_NOT_LOCKED +SELECT * FROM t3; +UNLOCK TABLES; +DROP TABLE t3; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bc877613190..ea06beeb560 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5111,7 +5111,7 @@ err: /* Write log if no error or if we already deleted a table */ if (!result || thd->log_current_statement) { - if (result && create_info->table_was_deleted) + if (result && create_info->table_was_deleted && pos_in_locked_tables) { /* Possible locked table was dropped. We should remove meta data locks From e64184134a19579dbe5bf98fc54f0f6236aabbcd Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 23 Dec 2017 16:59:41 +0200 Subject: [PATCH 66/88] mysqlbinlog now prints "# Number of rows" and stops on errors Main problem was that no log-event print function checked for disk full error on the IO_CACHE. All changes in this patch only affects mysqlbinlog, not the server! - Changed all log-event print functions to return 1 on error - Fixed memory usage when not using --flashback. - Added printing of number of rows in row events. Can be disabled with --print-row-count=0 - Print annotated rows when using mysqlbinlog --short-form - Fixed that mysqlbinlog --debug works - Fixed create_drop_binlog.test test failure - Reorganized fields in PRINT_EVENT_INFO to be according to size to optimize storage - Don't change print_row_event_position or print_row_counts if set by user - Remove some testing of argument to my_free is 0 - base64-output=never is now supported and works in all context - Updated help information for --base64-output and --short-form - print_row_count is now on by default. Reset automatically if --short-form is used - Removed obsolote warning for mysql 5.6.0 - More DBUG_PRINT for mysqltest.cc - my_b_write_byte() now checks for flush failures. This fixed a memory overrun on disk full - my_b_printf() now returns 1 on failure, 0 on ok. This simplifies code and no old code was using the old return value of my_b_printf(). - my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok - Fixed some error conditions in log printing that was not previously handled. - Slave_rows_error_report() can now handle longlong positions - Write_on_release_cache() rewritten so that we can detect errors on flush. Not depending on automatic release anymore. - Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS - Fixed that copy_event_cache_to_string_and_reinit() works with strings longer than 4G (Changed to use LEX_STRING instead of String) - Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are anyway restricted to UINT32_MAX - Fixed bug in rpl_binlog_state::write_to_iocache() which hide write failures (duplicate variable name) - Fixed bug in String::append if original string was not allocated - Stop mysqlbinlog output at once if there is an error. - Before printing error message, flush result file. This ensures that the error message is printed last. (Easier to find) --- client/client_priv.h | 1 + client/mysqlbinlog.cc | 215 ++- client/mysqltest.cc | 3 + include/my_sys.h | 13 +- mysql-test/r/create_drop_binlog.result | 1 + mysql-test/r/mysqlbinlog.result | 2 - .../r/mysqlbinlog_row_compressed.result | 8 + mysql-test/r/mysqlbinlog_row_minimal.result | 8 + mysql-test/r/openssl_1.result | 6 +- .../suite/binlog/r/binlog_base64_flag.result | 14 +- .../binlog/r/binlog_mysqlbinlog_row.result | 260 ++- .../r/binlog_mysqlbinlog_row_innodb.result | 20 + .../r/binlog_mysqlbinlog_row_myisam.result | 20 + .../r/binlog_mysqlbinlog_row_trans.result | 12 + .../suite/binlog/r/binlog_row_annotate.result | 26 + .../binlog/r/binlog_row_ctype_ucs.result | 8 + .../r/binlog_row_mysqlbinlog_options.result | 14 + mysql-test/suite/binlog/r/flashback.result | 10 + .../suite/binlog/t/binlog_base64_flag.test | 9 +- .../binlog/t/binlog_mysqlbinlog_row.test | 7 + .../binlog_row_annotate.result | 13 + ...alera_binlog_event_max_size_max-master.opt | 2 +- mysql-test/t/create_drop_binlog.test | 2 + mysql-test/t/mysqlbinlog_row_big.test | 1 - mysql-test/t/openssl_1.test | 2 +- mysys/mf_iocache2.c | 23 +- sql/log.cc | 56 +- sql/log_event.cc | 1613 +++++++++++------ sql/log_event.h | 217 +-- sql/log_event_old.cc | 36 +- sql/log_event_old.h | 10 +- sql/mysqld.cc | 2 +- sql/rpl_gtid.cc | 5 +- sql/sql_string.cc | 2 +- 34 files changed, 1778 insertions(+), 863 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index ba1a1fddfae..1d584efeea7 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -98,6 +98,7 @@ enum options_client OPT_REPORT_PROGRESS, OPT_SKIP_ANNOTATE_ROWS_EVENTS, OPT_SSL_CRL, OPT_SSL_CRLPATH, + OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, OPT_MAX_CLIENT_OPTION /* should be always the last */ }; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index dc237078be8..2f3dbff70d4 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -86,7 +86,8 @@ static char *result_file_name= 0; static const char *output_prefix= ""; #ifndef DBUG_OFF -static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace"; +static const char *default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace"; +const char *current_dbug_option= default_dbug_option; #endif static const char *load_groups[]= { "mysqlbinlog", "client", "client-server", "client-mariadb", 0 }; @@ -106,6 +107,8 @@ static char *opt_base64_output_mode_str= NullS; static char* database= 0; static char* table= 0; static my_bool force_opt= 0, short_form= 0, remote_opt= 0; +static my_bool print_row_count= 0, print_row_event_positions= 0; +static my_bool print_row_count_used= 0, print_row_event_positions_used= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool force_if_open_opt= 1; static my_bool opt_raw_mode= 0, opt_stop_never= 0; @@ -221,14 +224,16 @@ void keep_annotate_event(Annotate_rows_log_event* event) annotate_event= event; } -void print_annotate_event(PRINT_EVENT_INFO *print_event_info) +bool print_annotate_event(PRINT_EVENT_INFO *print_event_info) { + bool error= 0; if (annotate_event) { - annotate_event->print(result_file, print_event_info); + error= annotate_event->print(result_file, print_event_info); delete annotate_event; // the event should not be printed more than once annotate_event= 0; } + return error; } static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *, const char*); @@ -792,7 +797,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev) static void print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev) { - int cur_val; + bool cur_val; cur_val= (ev->flags & LOG_EVENT_SKIP_REPLICATION_F) != 0; if (cur_val == pinfo->skip_replication) @@ -844,8 +849,9 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file, DBUG_ENTER("write_event_header_and_base64"); /* Write header and base64 output to cache */ - ev->print_header(head, print_event_info, FALSE); - ev->print_base64(body, print_event_info, FALSE); + if (ev->print_header(head, print_event_info, FALSE) || + ev->print_base64(body, print_event_info, FALSE)) + DBUG_RETURN(ERROR_STOP); /* Read data from cache and write to result file */ if (copy_event_cache_to_file_and_reinit(head, result_file) || @@ -867,24 +873,20 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev) passed --short-form, because --short-form disables printing row events. */ + if (!print_event_info->printed_fd_event && !short_form && - opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS) + opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS && + opt_base64_output_mode != BASE64_OUTPUT_NEVER) { const char* type_str= ev->get_type_str(); - if (opt_base64_output_mode == BASE64_OUTPUT_NEVER) - error("--base64-output=never specified, but binlog contains a " - "%s event which must be printed in base64.", - type_str); - else - error("malformed binlog: it does not contain any " - "Format_description_log_event. I now found a %s event, which " + error("malformed binlog: it does not contain any " + "Format_description_log_event. Found a %s event, which " "is not safe to process without a " "Format_description_log_event.", type_str); return 1; } - ev->print(result_file, print_event_info); - return print_event_info->head_cache.error == -1; + return ev->print(result_file, print_event_info); } @@ -894,6 +896,8 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, Table_map_log_event *ignored_map= print_event_info->m_table_map_ignored.get_table(table_id); bool skip_event= (ignored_map != NULL); + char ll_buff[21]; + bool result= 0; if (opt_flashback) { @@ -966,19 +970,18 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, return 0; if (!opt_flashback) - return print_base64(print_event_info, ev); + result= print_base64(print_event_info, ev); else { if (is_stmt_end) { - bool res= false; Log_event *e= NULL; // Print the row_event from the last one to the first one for (uint i= events_in_stmt.elements; i > 0; --i) { e= *(dynamic_element(&events_in_stmt, i - 1, Log_event**)); - res= res || print_base64(print_event_info, e); + result= result || print_base64(print_event_info, e); } // Copy all output into the Log_event ev->output_buf.copy(e->output_buf); @@ -989,12 +992,17 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, delete e; } reset_dynamic(&events_in_stmt); - - return res; } } - return 0; + if (is_stmt_end && !result) + { + if (print_event_info->print_row_count) + fprintf(result_file, "# Number of rows: %s\n", + llstr(print_event_info->row_events, ll_buff)); + print_event_info->row_events= 0; + } + return result; } @@ -1025,7 +1033,6 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, Log_event_type ev_type= ev->get_type_code(); my_bool destroy_evt= TRUE; DBUG_ENTER("process_event"); - print_event_info->short_form= short_form; Exit_status retval= OK_CONTINUE; IO_CACHE *const head= &print_event_info->head_cache; @@ -1071,7 +1078,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, retval= OK_STOP; goto end; } - if (!short_form && !opt_flashback) + if (print_row_event_positions) fprintf(result_file, "# at %s\n",llstr(pos,ll_buff)); if (!opt_hexdump) @@ -1112,7 +1119,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, else { print_skip_replication_statement(print_event_info, ev); - ev->print(result_file, print_event_info); + if (ev->print(result_file, print_event_info)) + goto err; } if (head->error == -1) goto err; @@ -1147,8 +1155,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, else { print_skip_replication_statement(print_event_info, ev); - ce->print(result_file, print_event_info, TRUE); - if (head->error == -1) + if (ce->print(result_file, print_event_info, TRUE)) goto err; } // If this binlog is not 3.23 ; why this test?? @@ -1171,8 +1178,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, the subsequent call load_processor.process fails, because the output of Append_block_log_event::print is only a comment. */ - ev->print(result_file, print_event_info); - if (head->error == -1) + if (ev->print(result_file, print_event_info)) goto err; if ((retval= load_processor.process((Append_block_log_event*) ev)) != OK_CONTINUE) @@ -1181,8 +1187,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, case EXEC_LOAD_EVENT: { - ev->print(result_file, print_event_info); - if (head->error == -1) + if (ev->print(result_file, print_event_info)) goto err; Execute_load_log_event *exv= (Execute_load_log_event*)ev; Create_file_log_event *ce= load_processor.grab_event(exv->file_id); @@ -1193,15 +1198,16 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, */ if (ce) { + bool error; /* We must not convert earlier, since the file is used by my_open() in Load_log_processor::append(). */ convert_path_to_forward_slashes((char*) ce->fname); - ce->print(result_file, print_event_info, TRUE); + error= ce->print(result_file, print_event_info, TRUE); my_free((void*)ce->fname); delete ce; - if (head->error == -1) + if (error) goto err; } else @@ -1212,10 +1218,10 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, case FORMAT_DESCRIPTION_EVENT: delete glob_description_event; glob_description_event= (Format_description_log_event*) ev; + destroy_evt= 0; print_event_info->common_header_len= glob_description_event->common_header_len; - ev->print(result_file, print_event_info); - if (head->error == -1) + if (ev->print(result_file, print_event_info)) goto err; if (!remote_opt) { @@ -1245,8 +1251,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, } break; case BEGIN_LOAD_QUERY_EVENT: - ev->print(result_file, print_event_info); - if (head->error == -1) + if (ev->print(result_file, print_event_info)) goto err; if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) != OK_CONTINUE) @@ -1264,11 +1269,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { convert_path_to_forward_slashes(fname); print_skip_replication_statement(print_event_info, ev); - exlq->print(result_file, print_event_info, fname); - if (head->error == -1) + if (exlq->print(result_file, print_event_info, fname)) { - if (fname) - my_free(fname); + my_free(fname); goto err; } } @@ -1276,9 +1279,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, warning("Ignoring Execute_load_query since there is no " "Begin_load_query event for file_id: %u", exlq->file_id); } - - if (fname) - my_free(fname); + my_free(fname); break; } case ANNOTATE_ROWS_EVENT: @@ -1424,7 +1425,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, print the kept Annotate event (if there is any). print_annotate_event() also deletes the kept Annotate event. */ - print_annotate_event(print_event_info); + if (print_annotate_event(print_event_info)) + goto err; size_t len_to= 0; const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to); @@ -1454,10 +1456,18 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { Rows_log_event *e= (Rows_log_event*) ev; bool is_stmt_end= e->get_flags(Rows_log_event::STMT_END_F); + if (!print_event_info->found_row_event) + { + print_event_info->found_row_event= 1; + print_event_info->row_events= 0; + } if (print_row_event(print_event_info, ev, e->get_table_id(), e->get_flags(Rows_log_event::STMT_END_F))) goto err; - if (!is_stmt_end) + DBUG_PRINT("info", ("is_stmt_end: %d", (int) is_stmt_end)); + if (is_stmt_end) + print_event_info->found_row_event= 0; + else if (opt_flashback) destroy_evt= FALSE; break; } @@ -1470,7 +1480,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, if (print_row_event(print_event_info, ev, e->get_table_id(), e->get_flags(Old_rows_log_event::STMT_END_F))) goto err; - if (!is_stmt_end) + DBUG_PRINT("info", ("is_stmt_end: %d", (int) is_stmt_end)); + if (!is_stmt_end && opt_flashback) destroy_evt= FALSE; break; } @@ -1479,8 +1490,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, /* fall through */ default: print_skip_replication_statement(print_event_info, ev); - ev->print(result_file, print_event_info); - if (head->error == -1) + if (ev->print(result_file, print_event_info)) goto err; } } @@ -1491,7 +1501,8 @@ err: retval= ERROR_STOP; end: rec_count++; - + + DBUG_PRINT("info", ("end event processing")); /* Destroy the log_event object. MariaDB MWL#36: mainline does this: @@ -1536,6 +1547,7 @@ end: if (destroy_evt) /* destroy it later if not set (ignored table map) */ delete ev; } + DBUG_PRINT("exit",("return: %d", retval)); DBUG_RETURN(retval); } @@ -1547,14 +1559,15 @@ static struct my_option my_options[] = {"base64-output", OPT_BASE64_OUTPUT_MODE, /* 'unspec' is not mentioned because it is just a placeholder. */ "Determine when the output statements should be base64-encoded BINLOG " - "statements: 'never' disables it and works only for binlogs without " - "row-based events; 'decode-rows' decodes row events into commented SQL " - "statements if the --verbose option is also given; 'auto' prints base64 " - "only when necessary (i.e., for row-based events and format description " - "events); 'always' prints base64 whenever possible. 'always' is " - "deprecated, will be removed in a future version, and should not be used " - "in a production system. --base64-output with no 'name' argument is " - "equivalent to --base64-output=always and is also deprecated. If no " + "statements: 'never' doesn't print binlog row events and should not be " + "used when directing output to a MariaDB master; " + "'decode-rows' decodes row events into commented SQL statements if the " + "--verbose option is also given; " + "'auto' prints base64 only when necessary (i.e., for row-based events and " + "format description events); " + "'always' prints base64 whenever possible. " + "--base64-output with no 'name' argument is equivalent to " + "--base64-output=always and is also deprecated. If no " "--base64-output[=name] option is given at all, the default is 'auto'.", &opt_base64_output_mode_str, &opt_base64_output_mode_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1571,8 +1584,8 @@ static struct my_option my_options[] = &database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DBUG_OFF - {"debug", '#', "Output debug log.", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log.", ¤t_dbug_option, + ¤t_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", &debug_check_flag, &debug_check_flag, 0, @@ -1654,6 +1667,14 @@ static struct my_option my_options[] = &flashback_review_tablename, &flashback_review_tablename, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"print-row-count", OPT_PRINT_ROW_COUNT, + "Print row counts for each row events", + &print_row_count, &print_row_count, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, + 0, 0}, + {"print-row-event-positions", OPT_PRINT_ROW_EVENT_POSITIONS, + "Print row event positions", + &print_row_event_positions, &print_row_event_positions, 0, GET_BOOL, + NO_ARG, 1, 0, 0, 0, 0, 0}, {"server-id", 0, "Extract only binlog entries created by the server having the given id.", &server_id, &server_id, 0, GET_ULONG, @@ -1667,10 +1688,11 @@ static struct my_option my_options[] = &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"short-form", 's', "Just show regular queries: no extra info and no " - "row-based events. This is for testing only, and should not be used in " - "production systems. If you want to suppress base64-output, consider " - "using --base64-output=never instead.", + {"short-form", 's', "Just show regular queries: no extra info, no " + "row-based events and no row counts. This is mainly for testing only, " + "and should not be used to feed to the MariaDB server. " + "If you want to just suppress base64-output, you can instead " + "use --base64-output=never", &short_form, &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -1772,9 +1794,12 @@ Example: rewrite-db='from->to'.", */ static void error_or_warning(const char *format, va_list args, const char *msg) { + if (result_file) + fflush(result_file); fprintf(stderr, "%s: ", msg); vfprintf(stderr, format, args); fprintf(stderr, "\n"); + fflush(stderr); } /** @@ -1827,6 +1852,7 @@ static void warning(const char *format,...) */ static void cleanup() { + DBUG_ENTER("cleanup"); my_free(pass); my_free(database); my_free(table); @@ -1840,12 +1866,13 @@ static void cleanup() delete glob_description_event; if (mysql) mysql_close(mysql); + DBUG_VOID_RETURN; } static void print_version() { - printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); + printf("%s Ver 3.4 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } @@ -1896,7 +1923,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), switch (optid) { #ifndef DBUG_OFF case '#': - DBUG_PUSH(argument ? argument : default_dbug_option); + if (!argument) + argument= (char*) default_dbug_option; + current_dbug_option= argument; + DBUG_PUSH(argument); break; #endif #include @@ -1998,6 +2028,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), binlog_filter->add_db_rewrite(key, val); break; } + case OPT_PRINT_ROW_COUNT: + print_row_count_used= 1; + break; + case OPT_PRINT_ROW_EVENT_POSITIONS: + print_row_event_positions_used= 1; + break; case 'v': if (argument == disabled_my_option) verbose= 0; @@ -2130,11 +2166,30 @@ static Exit_status dump_log_entries(const char* logname) fprintf(result_file, "DELIMITER /*!*/;\n"); strmov(print_event_info.delimiter, "/*!*/;"); - print_event_info.verbose= short_form ? 0 : verbose; + if (short_form) + { + if (!print_row_event_positions_used) + print_row_event_positions= 0; + if (!print_row_count_used) + print_row_count = 0; + } + if (opt_flashback) + { + if (!print_row_event_positions_used) + print_row_event_positions= 0; + } + print_event_info.verbose= short_form ? 0 : verbose; + print_event_info.short_form= short_form; + print_event_info.print_row_count= print_row_count; + print_event_info.file= result_file; + fflush(result_file); rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) : dump_local_log_entries(&print_event_info, logname)); + if (rc == ERROR_STOP) + return rc; + /* Set delimiter back to semicolon */ if (!opt_raw_mode && !opt_flashback) fprintf(result_file, "DELIMITER ;\n"); @@ -2205,6 +2260,8 @@ static Exit_status check_master_version() } delete glob_description_event; + glob_description_event= NULL; + switch (version) { case 3: glob_description_event= new Format_description_log_event(1); @@ -2223,7 +2280,6 @@ static Exit_status check_master_version() glob_description_event= new Format_description_log_event(3); break; default: - glob_description_event= NULL; error("Could not find server version: " "Master reported unrecognized MySQL version '%s'.", row[0]); goto err; @@ -2464,6 +2520,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info, error("Could not write into log file '%s'", out_file_name); DBUG_RETURN(ERROR_STOP); } + print_event_info->file= result_file; delete glob_description_event; glob_description_event= (Format_description_log_event*) ev; @@ -2962,13 +3019,6 @@ int main(int argc, char** argv) if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC) opt_base64_output_mode= BASE64_OUTPUT_AUTO; - if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS) - warning("The --base64-output=always flag and the --base64-output flag " - "(with '=MODE' omitted), are deprecated. " - "The output generated when these flags are used cannot be " - "parsed by mysql 5.6.0 and later. " - "The flags will be removed in a future version. " - "Please use --base64-output=auto instead."); my_set_max_open_files(open_files_limit); @@ -3081,7 +3131,7 @@ int main(int argc, char** argv) If enable flashback, need to print the events from the end to the beginning */ - if (opt_flashback) + if (opt_flashback && retval != ERROR_STOP) { for (uint i= binlog_events.elements; i > 0; --i) { @@ -3096,12 +3146,15 @@ int main(int argc, char** argv) } /* Set delimiter back to semicolon */ - if (!stop_event_string.is_empty()) - fprintf(result_file, "%s", stop_event_string.ptr()); - if (!opt_raw_mode && opt_flashback) - fprintf(result_file, "DELIMITER ;\n"); + if (retval != ERROR_STOP) + { + if (!stop_event_string.is_empty()) + fprintf(result_file, "%s", stop_event_string.ptr()); + if (!opt_raw_mode && opt_flashback) + fprintf(result_file, "DELIMITER ;\n"); + } - if (!opt_raw_mode) + if (retval != ERROR_STOP && !opt_raw_mode) { /* Issue a ROLLBACK in case the last printed binlog was crashed and had half diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b8a7673996a..743a53edf57 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -701,6 +701,8 @@ public: void write(DYNAMIC_STRING* ds) { DBUG_ENTER("LogFile::write"); + DBUG_PRINT("enter", ("length: %u", (uint) ds->length)); + DBUG_ASSERT(m_file); if (ds->length == 0) @@ -6930,6 +6932,7 @@ int read_command(struct st_command** command_ptr) if (parser.current_line < parser.read_lines) { get_dynamic(&q_lines, command_ptr, parser.current_line) ; + DBUG_PRINT("info", ("query: %s", (*command_ptr)->query)); DBUG_RETURN(0); } if (!(*command_ptr= command= diff --git a/include/my_sys.h b/include/my_sys.h index adb7f4826f6..99c1dacfcaa 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -552,12 +552,13 @@ static inline int my_b_get(IO_CACHE *info) return _my_b_get(info); } -/* my_b_write_byte dosn't have any err-check */ -static inline void my_b_write_byte(IO_CACHE *info, uchar chr) +static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr) { if (info->write_pos >= info->write_end) - my_b_flush_io_cache(info, 1); + if (my_b_flush_io_cache(info, 1)) + return 1; *info->write_pos++= chr; + return 0; } /** @@ -825,9 +826,9 @@ extern int end_io_cache(IO_CACHE *info); extern void my_b_seek(IO_CACHE *info,my_off_t pos); extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); extern my_off_t my_b_filelength(IO_CACHE *info); -extern size_t my_b_write_backtick_quote(IO_CACHE *info, const char *str, - size_t len); -extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...); +extern my_bool my_b_write_backtick_quote(IO_CACHE *info, const char *str, + size_t len); +extern my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...); extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, const char *prefix, size_t cache_size, diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result index 9dd5d43125b..be40fcc140a 100644 --- a/mysql-test/r/create_drop_binlog.result +++ b/mysql-test/r/create_drop_binlog.result @@ -1,3 +1,4 @@ +reset master; CREATE OR REPLACE DATABASE d1; CREATE OR REPLACE DATABASE d1; DROP DATABASE d1; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index bac33753d4c..668952d20d7 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -879,9 +879,7 @@ ROLLBACK /* added by mysqlbinlog */; End of 5.0 tests End of 5.1 tests # Expect deprecation warning. -WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. # Expect deprecation warning again. -WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. RESET MASTER; CREATE DATABASE test1; USE test1; diff --git a/mysql-test/r/mysqlbinlog_row_compressed.result b/mysql-test/r/mysqlbinlog_row_compressed.result index 24fff723ec8..705683322f8 100644 --- a/mysql-test/r/mysqlbinlog_row_compressed.result +++ b/mysql-test/r/mysqlbinlog_row_compressed.result @@ -73,6 +73,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 967 # server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -101,6 +102,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +# Number of rows: 1 # at 1281 # server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -129,6 +131,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 1596 # server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -157,6 +160,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 1909 # server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -218,6 +222,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 4 # at 2225 # server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -298,6 +303,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 3 # at 2561 # server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -359,6 +365,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 4 # at 2861 # server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -420,6 +427,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 4 # at 3154 # server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result index ca8e43bfb33..a030f202f45 100644 --- a/mysql-test/r/mysqlbinlog_row_minimal.result +++ b/mysql-test/r/mysqlbinlog_row_minimal.result @@ -71,6 +71,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 1015 # server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -99,6 +100,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +# Number of rows: 1 # at 1330 # server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -127,6 +129,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 1646 # server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -155,6 +158,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at 1962 # server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -216,6 +220,7 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 4 # at 2354 # server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -251,6 +256,7 @@ BEGIN ### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ ### SET ### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at 2665 # server id 1 end_log_pos 2738 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -280,6 +286,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 4 # at 2927 # server id 1 end_log_pos 3000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; @@ -309,6 +316,7 @@ BEGIN ### DELETE FROM `test`.`t2` ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 4 # at 3189 # server id 1 end_log_pos 3262 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 5495f8ffd34..40455f04c8c 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -228,8 +228,4 @@ End of 5.1 tests /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -DELIMITER ; -# End of log file -ROLLBACK /* added by mysqlbinlog */; -/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +ERROR: Failed on connect: SSL connection error: No such file or directory diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 735a27919ea..db7b175d6bd 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -33,10 +33,10 @@ a /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 -<#>ROLLBACK/*!*/; -# at 102 -<#>use `test`/*!*/; +<#> +ROLLBACK/*!*/; +<#> +use `test`/*!*/; SET TIMESTAMP=1196959712/*!*/; <#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/; SET @@session.sql_mode=0/*!*/; @@ -47,7 +47,11 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int) engine= myisam /*!*/; -# at 203 +<#> +<#> +<#> +<#> +<#> DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index 47069b81a15..4422a00335b 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -327,6 +327,7 @@ INSERT INTO t2 SET a=1; INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; +flush logs; INSERT INTO t1dec102 VALUES (-999.99); INSERT INTO t1dec102 VALUES (0); INSERT INTO t1dec102 VALUES (999.99); @@ -386,6 +387,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -406,6 +408,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -442,6 +445,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000001' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -462,6 +466,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000010' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -482,6 +487,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000100' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -502,6 +508,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0001000' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -522,6 +529,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -542,6 +550,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0100000' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -562,6 +571,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'1000000' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -582,6 +592,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -602,6 +613,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -624,6 +636,7 @@ BEGIN ### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */ ### SET ### @1=b'0001111' /* BIT(7) meta=7 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -661,6 +674,7 @@ BEGIN ### SET ### @1=b'00010010010010001001' /* BIT(20) meta=516 nullable=1 is_null=0 */ ### @2='ab' /* STRING(2) meta=65026 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -697,6 +711,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000000000001' /* BIT(64) meta=2048 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -717,6 +732,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000000000010' /* BIT(64) meta=2048 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -737,6 +753,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000010000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -757,6 +774,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -799,6 +817,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -819,6 +838,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -841,6 +861,7 @@ BEGIN ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ ### SET ### @1=2 /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -861,6 +882,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -900,6 +922,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -920,6 +943,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -956,6 +980,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -976,6 +1001,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1012,6 +1038,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1032,6 +1059,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1071,6 +1099,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1093,6 +1122,7 @@ BEGIN ### @1=-32768 (32768) /* SHORTINT meta=0 nullable=1 is_null=0 */ ### SET ### @1=2 /* SHORTINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1113,6 +1143,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1149,6 +1180,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1169,6 +1201,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1208,6 +1241,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1230,6 +1264,7 @@ BEGIN ### @1=-8388608 (8388608) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ ### SET ### @1=2 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1250,6 +1285,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1286,6 +1322,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=123456 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1306,6 +1343,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=123456 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1345,6 +1383,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1367,6 +1406,7 @@ BEGIN ### @1=-2147483648 (2147483648) /* INT meta=0 nullable=1 is_null=0 */ ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1387,6 +1427,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1423,6 +1464,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1443,6 +1485,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1482,6 +1525,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1504,6 +1548,7 @@ BEGIN ### @1=-9223372036854775808 (9223372036854775808) /* LONGINT meta=0 nullable=1 is_null=0 */ ### SET ### @1=2 /* LONGINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1524,6 +1569,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1560,6 +1606,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1580,6 +1627,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1616,6 +1664,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1636,6 +1685,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1672,6 +1722,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=124.45000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1692,6 +1743,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=-543.21000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1712,6 +1764,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=124.45000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1748,6 +1801,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1768,6 +1822,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1804,6 +1859,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='2001-02-03 10:20:30' /* DATETIME(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1824,6 +1880,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='2001-02-03 10:20:30' /* DATETIME(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1860,6 +1917,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=981184830 /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1881,6 +1939,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=981184830 /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1917,6 +1976,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='11:22:33' /* TIME(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1937,6 +1997,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='11:22:33' /* TIME(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1973,6 +2034,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1993,6 +2055,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2029,6 +2092,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2049,6 +2113,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2085,6 +2150,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2105,6 +2171,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2141,6 +2208,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2161,6 +2229,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2197,6 +2266,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2217,6 +2287,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2253,6 +2324,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2273,6 +2345,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2309,6 +2382,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2329,6 +2403,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2365,6 +2440,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2385,6 +2461,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2421,6 +2498,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* STRING(765) meta=57085 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2441,6 +2519,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2464,6 +2543,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2500,6 +2580,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2520,6 +2601,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2556,6 +2638,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2576,6 +2659,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2612,6 +2696,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2632,6 +2717,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2668,6 +2754,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(510) meta=61182 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2688,6 +2775,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' /* STRING(510) meta=61182 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2711,6 +2799,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' /* STRING(510) meta=61182 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2747,6 +2836,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2767,6 +2857,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2803,6 +2894,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2823,6 +2915,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2859,6 +2952,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2879,6 +2973,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2915,6 +3010,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2935,6 +3031,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2971,6 +3068,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2991,6 +3089,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3027,6 +3126,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3047,6 +3147,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3083,6 +3184,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3103,6 +3205,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3126,6 +3229,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3162,6 +3266,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3182,6 +3287,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3205,6 +3311,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3241,6 +3348,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3261,6 +3369,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3297,6 +3406,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3317,6 +3427,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3353,6 +3464,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3373,6 +3485,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3409,6 +3522,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3429,6 +3543,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3465,6 +3580,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3485,6 +3601,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3505,6 +3622,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3525,6 +3643,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3561,6 +3680,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3581,6 +3701,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3617,6 +3738,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3637,6 +3759,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3657,6 +3780,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3677,6 +3801,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3713,6 +3838,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3733,6 +3859,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3753,6 +3880,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3773,6 +3901,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3809,6 +3938,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3829,6 +3959,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3865,6 +3996,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3885,6 +4017,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3905,6 +4038,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3925,6 +4059,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3961,6 +4096,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3981,6 +4117,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4001,6 +4138,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4021,6 +4159,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4057,6 +4196,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4077,6 +4217,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4113,6 +4254,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4133,6 +4275,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4169,6 +4312,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4189,6 +4333,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4225,6 +4370,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4245,6 +4391,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4281,6 +4428,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4301,6 +4449,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4337,6 +4486,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4357,6 +4507,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4393,6 +4544,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4413,6 +4565,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4449,6 +4602,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4469,6 +4623,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4505,6 +4660,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4525,6 +4681,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4561,6 +4718,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4581,6 +4739,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4617,6 +4776,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4637,6 +4797,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4673,6 +4834,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4693,6 +4855,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4729,6 +4892,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4749,6 +4913,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4785,6 +4950,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4805,6 +4971,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00000101' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4825,6 +4992,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4845,6 +5013,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4865,6 +5034,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00001111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4885,6 +5055,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00011111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4905,6 +5076,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1=b'00111111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4925,6 +5097,7 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4970,6 +5143,7 @@ BEGIN ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4991,6 +5165,7 @@ BEGIN ### SET ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5012,6 +5187,7 @@ BEGIN ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5033,6 +5209,7 @@ BEGIN ### SET ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5082,6 +5259,7 @@ BEGIN ### SET ### @1=20 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ +# Number of rows: 4 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5096,7 +5274,29 @@ SET TIMESTAMP=1000000000/*!*/; DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 4:46:40 +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Gtid list [0-1-316] +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000001 +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +# at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-317 +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=317*//*!*/; BEGIN /*!*/; @@ -5109,61 +5309,5 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1dec102` ### SET -### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-318 -/*!100001 SET @@session.gtid_seq_no=318*//*!*/; -BEGIN -/*!*/; -# at # -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: -#Q> INSERT INTO t1dec102 VALUES (0) -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1dec102` mapped to number # -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F -### INSERT INTO `test`.`t1dec102` -### SET -### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-319 -/*!100001 SET @@session.gtid_seq_no=319*//*!*/; -BEGIN -/*!*/; -# at # -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: -#Q> INSERT INTO t1dec102 VALUES (999.99) -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1dec102` mapped to number # -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F -### INSERT INTO `test`.`t1dec102` -### SET -### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-320 ddl -/*!100001 SET @@session.gtid_seq_no=320*//*!*/; -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -DROP TABLE `t1dec102` /* generated by server */ -/*!*/; -# at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4 -DELIMITER ; -# End of log file -ROLLBACK /* added by mysqlbinlog */; -/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +### @1= +Error: Found Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 365fcff2a72..3dcaad61897 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -2543,6 +2543,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -2724,6 +2725,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -3071,6 +3073,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -3410,6 +3413,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -3754,6 +3758,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -4096,6 +4101,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -4441,6 +4447,7 @@ BEGIN ### @77=NULL /* ENUM(1 byte) meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* SET(1 bytes) meta=63489 nullable=1 is_null=1 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -4620,6 +4627,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -4796,6 +4804,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -4975,6 +4984,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5152,6 +5162,7 @@ BEGIN ### @77=NULL /* ENUM(1 byte) meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* SET(1 bytes) meta=63489 nullable=1 is_null=1 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5345,6 +5356,7 @@ BEGIN ### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=9 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5423,6 +5435,7 @@ BEGIN ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 7 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5473,6 +5486,7 @@ BEGIN ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 7 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5766,6 +5780,7 @@ BEGIN ### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=19 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5835,6 +5850,7 @@ BEGIN ### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=29 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -5904,6 +5920,7 @@ BEGIN ### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=39 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -6093,6 +6110,7 @@ BEGIN ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 18 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -6207,6 +6225,7 @@ BEGIN ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 18 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -6338,6 +6357,7 @@ BEGIN ### @1=5 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index 7c6c21625f2..a4d929148e8 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -2543,6 +2543,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -2727,6 +2728,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3076,6 +3078,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3417,6 +3420,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -3763,6 +3767,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4107,6 +4112,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4454,6 +4460,7 @@ BEGIN ### @77=NULL /* ENUM(1 byte) meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* SET(1 bytes) meta=63489 nullable=1 is_null=1 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4635,6 +4642,7 @@ BEGIN ### @77=3 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4813,6 +4821,7 @@ BEGIN ### @77=1 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -4994,6 +5003,7 @@ BEGIN ### @77=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ ### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5173,6 +5183,7 @@ BEGIN ### @77=NULL /* ENUM(1 byte) meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* SET(1 bytes) meta=63489 nullable=1 is_null=1 */ ### @79=4 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5368,6 +5379,7 @@ BEGIN ### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=9 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5448,6 +5460,7 @@ BEGIN ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 7 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5500,6 +5513,7 @@ BEGIN ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 7 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5795,6 +5809,7 @@ BEGIN ### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=19 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5866,6 +5881,7 @@ BEGIN ### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=29 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -5937,6 +5953,7 @@ BEGIN ### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=39 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 9 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -6128,6 +6145,7 @@ BEGIN ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 18 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -6244,6 +6262,7 @@ BEGIN ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 18 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -6377,6 +6396,7 @@ BEGIN ### @1=5 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result index c6c7684f4c8..6a0c6b0532f 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result @@ -193,6 +193,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: @@ -221,6 +222,7 @@ BEGIN ### SET ### @1=13 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: @@ -232,6 +234,7 @@ BEGIN ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -275,6 +278,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -313,6 +317,7 @@ BEGIN ### SET ### @1=13 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -334,6 +339,7 @@ BEGIN ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -363,6 +369,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: @@ -391,6 +398,7 @@ BEGIN ### SET ### @1=13 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: @@ -402,6 +410,7 @@ BEGIN ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -445,6 +454,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -483,6 +493,7 @@ BEGIN ### SET ### @1=13 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -504,6 +515,7 @@ BEGIN ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result index 8a37200a2e3..25a9b295301 100644 --- a/mysql-test/suite/binlog/r/binlog_row_annotate.result +++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result @@ -162,6 +162,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -188,6 +189,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -214,6 +216,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -255,6 +258,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -281,6 +285,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -309,6 +314,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -386,6 +392,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -551,6 +558,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -575,6 +583,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -599,6 +608,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -636,6 +646,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -660,6 +671,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -684,6 +696,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -773,6 +786,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -799,6 +813,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -825,6 +840,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -866,6 +882,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -892,6 +909,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -920,6 +938,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -997,6 +1016,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1161,6 +1181,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1184,6 +1205,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1207,6 +1229,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1243,6 +1266,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1266,6 +1290,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -1289,6 +1314,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index da51ec1e3b6..343b21160fd 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -18,6 +18,8 @@ DELIMITER /*!*/; ROLLBACK/*!*/; BEGIN /*!*/; +# Annotate_rows: +#Q> insert into t2 values (@v) SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; @@ -114,6 +116,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; @@ -134,6 +137,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; @@ -154,6 +158,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; @@ -174,6 +179,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; @@ -194,6 +200,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; @@ -214,6 +221,7 @@ BEGIN ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result index e48dd2c89b4..1114902bae1 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result @@ -79,6 +79,7 @@ BEGIN ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -111,6 +112,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -132,6 +134,7 @@ BEGIN ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -164,6 +167,7 @@ BEGIN ### INSERT INTO `new_test3`.`t3` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -185,6 +189,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -223,6 +228,7 @@ BEGIN ### SET ### @1=6 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 5 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -243,6 +249,7 @@ BEGIN ### DELETE FROM `new_test3`.`t3` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -313,6 +320,7 @@ BEGIN ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -345,6 +353,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -366,6 +375,7 @@ BEGIN ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -398,6 +408,7 @@ BEGIN ### INSERT INTO `new_test3`.`t3` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -419,6 +430,7 @@ BEGIN ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -457,6 +469,7 @@ BEGIN ### SET ### @1=6 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 5 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -477,6 +490,7 @@ BEGIN ### DELETE FROM `new_test3`.`t3` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result index c96eaebe838..24c9b735fe5 100644 --- a/mysql-test/suite/binlog/r/flashback.result +++ b/mysql-test/suite/binlog/r/flashback.result @@ -100,6 +100,7 @@ BEGIN ### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */ ### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -125,6 +126,7 @@ BEGIN ### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */ ### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -150,6 +152,7 @@ BEGIN ### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */ ### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 # at # #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -203,6 +206,7 @@ BEGIN ### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */ ### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 2 # at # #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -248,6 +252,7 @@ BEGIN ### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */ ### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # COMMIT/*!*/; @@ -272,18 +277,23 @@ ROLLBACK/*!*/; #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES(0,0,0,0,0,'','','') #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# Number of rows: 1 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES(1,2,3,4,5, "abc", "abcdefg", "abcedfghijklmnopqrstuvwxyz") #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# Number of rows: 1 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES(127, 32767, 8388607, 2147483647, 9223372036854775807, repeat('a', 10), repeat('a', 20), repeat('a', 255)) #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# Number of rows: 1 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> UPDATE t1 SET c01=100 WHERE c02=0 OR c03=3 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# Number of rows: 2 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> DELETE FROM t1 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# Number of rows: 3 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4 #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = # BEGIN/*!*/; diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test index f8333315088..f17b51166e9 100644 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test @@ -68,15 +68,12 @@ TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA== select * from t1; -# Test that mysqlbinlog stops with an error message when the -# --base64-output=never flag is used on a binlog with base64 events. +# New mysqlbinlog supports --base64-output=never --echo ==== Test --base64-output=never on a binlog with row events ==== # mysqlbinlog should fail ---replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/ -error 1; -exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001; -# the above line should output the query log event and then stop +--replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] \N*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/ +exec $MYSQL_BINLOG --base64-output=never --print-row-count=0 --print-row-event-positions=0 suite/binlog/std_data/bug32407.001; # Test that the following fails cleanly: "First, read a diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test index 750bf10901f..9cc8e3f22a7 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test @@ -438,6 +438,8 @@ INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; +flush logs; + let $MYSQLD_DATADIR= `select @@datadir`; --copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm @@ -455,3 +457,8 @@ flush logs; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ +--error 1 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000002 2>&1 diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result index e72fc9faa6e..790fe225d7a 100644 --- a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result @@ -163,6 +163,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -189,6 +190,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -215,6 +217,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -256,6 +259,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -282,6 +286,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -310,6 +315,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -387,6 +393,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -551,6 +558,7 @@ BEGIN ### INSERT INTO `test1`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -574,6 +582,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -597,6 +606,7 @@ BEGIN ### INSERT INTO `test3`.`t3` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -633,6 +643,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 6 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -656,6 +667,7 @@ BEGIN ### INSERT INTO `test2`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; @@ -679,6 +691,7 @@ BEGIN ### DELETE FROM `test2`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# Number of rows: 3 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt index a36d21315a6..576829cfef8 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt @@ -1 +1 @@ ---binlog-row-event-max-size=4294967295 +--binlog-row-event-max-size=4294967040 diff --git a/mysql-test/t/create_drop_binlog.test b/mysql-test/t/create_drop_binlog.test index d31ccd73429..6b2b1bbf1f5 100644 --- a/mysql-test/t/create_drop_binlog.test +++ b/mysql-test/t/create_drop_binlog.test @@ -2,6 +2,8 @@ --source include/have_log_bin.inc --source include/binlog_start_pos.inc +reset master; + --let $pos=`select $binlog_start_pos + 73` --let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test index 44bceaad66b..229cc8a31fc 100644 --- a/mysql-test/t/mysqlbinlog_row_big.test +++ b/mysql-test/t/mysqlbinlog_row_big.test @@ -146,4 +146,3 @@ DROP TABLE t1; # NOTE: If you want to see the *huge* mysqlbinlog output, disable next line: # --remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output - diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 35bb7aca085..55f60880fbc 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -261,7 +261,7 @@ set global sql_mode=default; # --error 1 ---exec $MYSQL_BINLOG --read-from-remote-server --ssl-ca --user=root --host=localhost nobinlog.111111 +--exec $MYSQL_BINLOG --read-from-remote-server --ssl-ca --user=root --host=localhost nobinlog.111111 2>&1 # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 2499094037d..5c888d840e2 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -249,18 +249,16 @@ my_off_t my_b_filelength(IO_CACHE *info) } -size_t +my_bool my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len) { const uchar *start; const uchar *p= (const uchar *)str; const uchar *end= p + len; size_t count; - size_t total= 0; if (my_b_write(info, (uchar *)"`", 1)) - return (size_t)-1; - ++total; + return 1; for (;;) { start= p; @@ -269,34 +267,31 @@ my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len) count= p - start; if (count && my_b_write(info, start, count)) return (size_t)-1; - total+= count; if (p >= end) break; if (my_b_write(info, (uchar *)"``", 2)) return (size_t)-1; - total+= 2; ++p; } - if (my_b_write(info, (uchar *)"`", 1)) - return (size_t)-1; - ++total; - return total; + return (my_b_write(info, (uchar *)"`", 1)); } /* Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu" - Used for logging in MySQL - returns number of written character, or (size_t) -1 on error + Used for logging in MariaDB + + @return 0 ok + 1 error */ -size_t my_b_printf(IO_CACHE *info, const char* fmt, ...) +my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...) { size_t result; va_list args; va_start(args,fmt); result=my_b_vprintf(info, fmt, args); va_end(args); - return result; + return result == (size_t) -1; } diff --git a/sql/log.cc b/sql/log.cc index 34533b23ac5..36239cfa055 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2992,7 +2992,6 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, mysql_mutex_lock(&LOCK_log); if (is_open()) { // Safety agains reopen - int tmp_errno= 0; char buff[80], *end; char query_time_buff[22+7], lock_time_buff[22+7]; size_t buff_len; @@ -3014,16 +3013,13 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, /* Note that my_b_write() assumes it knows the length for this */ if (my_b_write(&log_file, (uchar*) buff, buff_len)) - tmp_errno= errno; + goto err; } const uchar uh[]= "# User@Host: "; - if (my_b_write(&log_file, uh, sizeof(uh) - 1)) - tmp_errno= errno; - if (my_b_write(&log_file, (uchar*) user_host, user_host_len)) - tmp_errno= errno; - if (my_b_write(&log_file, (uchar*) "\n", 1)) - tmp_errno= errno; - } + if (my_b_write(&log_file, uh, sizeof(uh) - 1) || + my_b_write(&log_file, (uchar*) user_host, user_host_len) || + my_b_write(&log_file, (uchar*) "\n", 1)) + goto err; /* For slow query log */ sprintf(query_time_buff, "%.6f", ulonglong2double(query_utime)/1000000.0); @@ -3039,9 +3035,9 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, (ulong) thd->get_examined_row_count(), thd->get_stmt_da()->is_ok() ? (ulong) thd->get_stmt_da()->affected_rows() : - 0) == (size_t) -1) - tmp_errno= errno; - if ((thd->variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_QUERY_PLAN) && + 0)) + goto err; + if ((thd->variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_QUERY_PLAN) && (thd->query_plan_flags & (QPLAN_FULL_SCAN | QPLAN_FULL_JOIN | QPLAN_TMP_TABLE | QPLAN_TMP_DISK | QPLAN_FILESORT | QPLAN_FILESORT_DISK)) && @@ -3060,21 +3056,22 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, thd->query_plan_fsort_passes, ((thd->query_plan_flags & QPLAN_FILESORT_PRIORITY_QUEUE) ? "Yes" : "No") - ) == (size_t) -1) - tmp_errno= errno; + )) + goto err; if (thd->variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_EXPLAIN && thd->lex->explain) { StringBuffer<128> buf; DBUG_ASSERT(!thd->free_list); if (!print_explain_for_slow_log(thd->lex, thd, &buf)) - my_b_printf(&log_file, "%s", buf.c_ptr_safe()); + if (my_b_printf(&log_file, "%s", buf.c_ptr_safe())) + goto err; thd->free_items(); } if (thd->db && strcmp(thd->db, db)) { // Database changed - if (my_b_printf(&log_file,"use %s;\n",thd->db) == (size_t) -1) - tmp_errno= errno; + if (my_b_printf(&log_file,"use %s;\n",thd->db)) + goto err; strmov(db,thd->db); } if (thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt) @@ -3110,7 +3107,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, *end='\n'; if (my_b_write(&log_file, (uchar*) "SET ", 4) || my_b_write(&log_file, (uchar*) buff + 1, (uint) (end-buff))) - tmp_errno= errno; + goto err; } if (is_command) { @@ -3119,24 +3116,27 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, DBUG_EXECUTE_IF("simulate_slow_log_write_error", {DBUG_SET("+d,simulate_file_write_error");}); if(my_b_write(&log_file, (uchar*) buff, buff_len)) - tmp_errno= errno; + goto err; } if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) || my_b_write(&log_file, (uchar*) ";\n",2) || flush_io_cache(&log_file)) - tmp_errno= errno; - if (tmp_errno) - { - error= 1; - if (! write_error) - { - write_error= 1; - sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, tmp_errno); - } + goto err; + } } +end: mysql_mutex_unlock(&LOCK_log); DBUG_RETURN(error); + +err: + error= 1; + if (! write_error) + { + write_error= 1; + sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, errno); + } + goto end; } diff --git a/sql/log_event.cc b/sql/log_event.cc index ebcfe98521a..ab8c1a1acad 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -216,7 +216,7 @@ is_parallel_retry_error(rpl_group_info *rgi, int err) static void inline slave_rows_error_report(enum loglevel level, int ha_error, rpl_group_info *rgi, THD *thd, TABLE *table, const char * type, - const char *log_name, ulong pos) + const char *log_name, my_off_t pos) { const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL); char buff[MAX_SLAVE_ERRMSG], *slider; @@ -250,14 +250,14 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, rli->report(level, errcode, rgi->gtid_info(), "Could not execute %s event on table %s.%s;" "%s handler error %s; " - "the event's master log %s, end_log_pos %lu", + "the event's master log %s, end_log_pos %llu", type, table->s->db.str, table->s->table_name.str, buff, handler_error == NULL ? "" : handler_error, log_name, pos); else rli->report(level, errcode, rgi->gtid_info(), "Could not execute %s event on table %s.%s;" - "%s the event's master log %s, end_log_pos %lu", + "%s the event's master log %s, end_log_pos %llu", type, table->s->db.str, table->s->table_name.str, buff, log_name, pos); } @@ -290,10 +290,9 @@ public: flags Flags for the cache DESCRIPTION - - Class used to guarantee copy of cache to file before exiting the - current block. On successful copy of the cache, the cache will - be reinited as a WRITE_CACHE. + Cache common parameters and ensure common flush_data() code + on successful copy of the cache, the cache will be reinited as a + WRITE_CACHE. Currently, a pointer to the cache is provided in the constructor, but it would be possible to create a subclass @@ -305,28 +304,35 @@ public: reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE); } - ~Write_on_release_cache() + ~Write_on_release_cache() {} + + bool flush_data() { #ifdef MYSQL_CLIENT - if(m_ev == NULL) + if (m_ev == NULL) { - copy_event_cache_to_file_and_reinit(m_cache, m_file); - if (m_flags & FLUSH_F) - fflush(m_file); + if (copy_event_cache_to_file_and_reinit(m_cache, m_file)) + return 1; + if ((m_flags & FLUSH_F) && fflush(m_file)) + return 1; } else // if m_ev<>NULL, then storing the output in output_buf { LEX_STRING tmp_str; + bool res; if (copy_event_cache_to_string_and_reinit(m_cache, &tmp_str)) - exit(1); - m_ev->output_buf.append(tmp_str.str, tmp_str.length); + return 1; + res= m_ev->output_buf.append(tmp_str.str, tmp_str.length) != 0; my_free(tmp_str.str); + return res ? res : 0; } #else /* MySQL_SERVER */ - copy_event_cache_to_file_and_reinit(m_cache, m_file); - if (m_flags & FLUSH_F) - fflush(m_file); + if (copy_event_cache_to_file_and_reinit(m_cache, m_file)) + return 1; + if ((m_flags & FLUSH_F) && fflush(m_file)) + return 1; #endif + return 0; } /* @@ -364,27 +370,36 @@ private: */ #ifdef MYSQL_CLIENT -static void pretty_print_str(IO_CACHE* cache, const char* str, int len) +static bool pretty_print_str(IO_CACHE* cache, const char* str, int len) { const char* end = str + len; - my_b_write_byte(cache, '\''); + if (my_b_write_byte(cache, '\'')) + goto err; + while (str < end) { char c; + int error; + switch ((c=*str++)) { - case '\n': my_b_write(cache, (uchar*)"\\n", 2); break; - case '\r': my_b_write(cache, (uchar*)"\\r", 2); break; - case '\\': my_b_write(cache, (uchar*)"\\\\", 2); break; - case '\b': my_b_write(cache, (uchar*)"\\b", 2); break; - case '\t': my_b_write(cache, (uchar*)"\\t", 2); break; - case '\'': my_b_write(cache, (uchar*)"\\'", 2); break; - case 0 : my_b_write(cache, (uchar*)"\\0", 2); break; + case '\n': error= my_b_write(cache, (uchar*)"\\n", 2); break; + case '\r': error= my_b_write(cache, (uchar*)"\\r", 2); break; + case '\\': error= my_b_write(cache, (uchar*)"\\\\", 2); break; + case '\b': error= my_b_write(cache, (uchar*)"\\b", 2); break; + case '\t': error= my_b_write(cache, (uchar*)"\\t", 2); break; + case '\'': error= my_b_write(cache, (uchar*)"\\'", 2); break; + case 0 : error= my_b_write(cache, (uchar*)"\\0", 2); break; default: - my_b_write_byte(cache, c); + error= my_b_write_byte(cache, c); break; } + if (error) + goto err; } - my_b_write_byte(cache, '\''); + return my_b_write_byte(cache, '\''); + +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -1144,19 +1159,25 @@ int append_query_string(CHARSET_INFO *csinfo, String *to, #ifdef MYSQL_CLIENT -static void print_set_option(IO_CACHE* file, uint32 bits_changed, +static bool print_set_option(IO_CACHE* file, uint32 bits_changed, uint32 option, uint32 flags, const char* name, bool* need_comma) { if (bits_changed & option) { if (*need_comma) - my_b_write(file, (uchar*)", ", 2); - my_b_printf(file, "%s=%d", name, MY_TEST(flags & option)); + if (my_b_write(file, (uchar*)", ", 2)) + goto err; + if (my_b_printf(file, "%s=%d", name, MY_TEST(flags & option))) + goto err; *need_comma= 1; } + return 0; +err: + return 1; } #endif + /************************************************************************** Log_event methods (= the parent class of all events) **************************************************************************/ @@ -1327,7 +1348,7 @@ Log_event::Log_event(const char* buf, */ log_pos+= data_written; /* purecov: inspected */ } - DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); + DBUG_PRINT("info", ("log_pos: %llu", log_pos)); flags= uint2korr(buf + FLAGS_OFFSET); if (((uchar)buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT) || @@ -1456,7 +1477,7 @@ void Log_event::init_show_field_list(THD *thd, List* field_list) mem_root); field_list->push_back(new (mem_root) Item_return_int(thd, "Pos", - MY_INT32_NUM_DECIMAL_DIGITS, + MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG), mem_root); field_list->push_back(new (mem_root) @@ -1468,7 +1489,7 @@ void Log_event::init_show_field_list(THD *thd, List* field_list) mem_root); field_list->push_back(new (mem_root) Item_return_int(thd, "End_log_pos", - MY_INT32_NUM_DECIMAL_DIGITS, + MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG), mem_root); field_list->push_back(new (mem_root) Item_empty_string(thd, "Info", 20), @@ -2246,7 +2267,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, #ifdef MYSQL_CLIENT -static void hexdump_minimal_header_to_io_cache(IO_CACHE *file, +static bool hexdump_minimal_header_to_io_cache(IO_CACHE *file, my_off_t offset, uchar *ptr) { @@ -2259,15 +2280,18 @@ static void hexdump_minimal_header_to_io_cache(IO_CACHE *file, more headers (which must be printed by other methods, if desired). */ char emit_buf[120]; // Enough for storing one line - my_b_printf(file, - "# " - "|Timestamp " - "|Type " - "|Master ID " - "|Size " - "|Master Pos " - "|Flags\n"); - size_t const emit_buf_written= + size_t emit_buf_written; + + if (my_b_printf(file, + "# " + "|Timestamp " + "|Type " + "|Master ID " + "|Size " + "|Master Pos " + "|Flags\n")) + goto err; + emit_buf_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8llx " /* Position */ "|%02x %02x %02x %02x " /* Timestamp */ @@ -2285,8 +2309,13 @@ static void hexdump_minimal_header_to_io_cache(IO_CACHE *file, ptr[17], ptr[18]); /* Flags */ DBUG_ASSERT(static_cast(emit_buf_written) < sizeof(emit_buf)); - my_b_write(file, reinterpret_cast(emit_buf), emit_buf_written); - my_b_write(file, (uchar*)"#\n", 2); + if (my_b_write(file, reinterpret_cast(emit_buf), emit_buf_written) || + my_b_write(file, (uchar*)"#\n", 2)) + goto err; + + return 0; +err: + return 1; } @@ -2311,7 +2340,7 @@ static void format_hex_line(char *emit_buff) HEXDUMP_BYTES_PER_LINE + 2]= '\0'; } -static void hexdump_data_to_io_cache(IO_CACHE *file, +static bool hexdump_data_to_io_cache(IO_CACHE *file, my_off_t offset, uchar *ptr, my_off_t size) @@ -2333,7 +2362,7 @@ static void hexdump_data_to_io_cache(IO_CACHE *file, my_off_t i; if (size == 0) - return; + return 0; // ok, nothing to do format_hex_line(emit_buffer); /* @@ -2363,8 +2392,9 @@ static void hexdump_data_to_io_cache(IO_CACHE *file, (ulonglong) starting_offset); /* remove \0 left after printing address */ emit_buffer[2 + emit_buf_written]= ' '; - my_b_write(file, reinterpret_cast(emit_buffer), - sizeof(emit_buffer) - 1); + if (my_b_write(file, reinterpret_cast(emit_buffer), + sizeof(emit_buffer) - 1)) + goto err; c= emit_buffer + 2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2; h= emit_buffer + 2 + 8 + 2; format_hex_line(emit_buffer); @@ -2399,17 +2429,23 @@ static void hexdump_data_to_io_cache(IO_CACHE *file, /* pad unprinted area */ memset(h, ' ', (HEXDUMP_BYTES_PER_LINE * 3 + 1) - (h - (emit_buffer + 2 + 8 + 2))); - my_b_write(file, reinterpret_cast(emit_buffer), - c - emit_buffer); + if (my_b_write(file, reinterpret_cast(emit_buffer), + c - emit_buffer)) + goto err; } - my_b_write(file, (uchar*)"#\n", 2); + if (my_b_write(file, (uchar*)"#\n", 2)) + goto err; + + return 0; +err: + return 1; } /* Log_event::print_header() */ -void Log_event::print_header(IO_CACHE* file, +bool Log_event::print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, bool is_more __attribute__((unused))) { @@ -2417,10 +2453,11 @@ void Log_event::print_header(IO_CACHE* file, my_off_t hexdump_from= print_event_info->hexdump_from; DBUG_ENTER("Log_event::print_header"); - my_b_write_byte(file, '#'); - print_timestamp(file); - my_b_printf(file, " server id %lu end_log_pos %s ", (ulong) server_id, - llstr(log_pos,llbuff)); + if (my_b_write_byte(file, '#') || + print_timestamp(file) || + my_b_printf(file, " server id %lu end_log_pos %s ", (ulong) server_id, + llstr(log_pos,llbuff))) + goto err; /* print the checksum */ @@ -2430,8 +2467,10 @@ void Log_event::print_header(IO_CACHE* file, char checksum_buf[BINLOG_CHECKSUM_LEN * 2 + 4]; // to fit to "%p " size_t const bytes_written= my_snprintf(checksum_buf, sizeof(checksum_buf), "0x%08x ", crc); - my_b_printf(file, "%s ", get_type(&binlog_checksum_typelib, checksum_alg)); - my_b_printf(file, checksum_buf, bytes_written); + if (my_b_printf(file, "%s ", get_type(&binlog_checksum_typelib, + checksum_alg)) || + my_b_printf(file, checksum_buf, bytes_written)) + goto err; } /* mysqlbinlog --hexdump */ @@ -2444,24 +2483,32 @@ void Log_event::print_header(IO_CACHE* file, size-= hdr_len; - my_b_printf(file, "# Position\n"); + if (my_b_printf(file, "# Position\n")) + goto err; /* Write the header, nicely formatted by field. */ - hexdump_minimal_header_to_io_cache(file, hexdump_from, ptr); + if (hexdump_minimal_header_to_io_cache(file, hexdump_from, ptr)) + goto err; ptr+= hdr_len; hexdump_from+= hdr_len; /* Print the rest of the data, mimicking "hexdump -C" output. */ - hexdump_data_to_io_cache(file, hexdump_from, ptr, size); + if (hexdump_data_to_io_cache(file, hexdump_from, ptr, size)) + goto err; /* Prefix the next line so that the output from print_helper() will appear as a comment. */ - my_b_write(file, (uchar*)"# Event: ", 9); + if (my_b_write(file, (uchar*)"# Event: ", 9)) + goto err; } - DBUG_VOID_RETURN; + + DBUG_RETURN(0); + +err: + DBUG_RETURN(1); } @@ -2469,7 +2516,7 @@ void Log_event::print_header(IO_CACHE* file, Prints a quoted string to io cache. Control characters are displayed as hex sequence, e.g. \x00 Single-quote and backslash characters are escaped with a \ - + @param[in] file IO cache @param[in] prt Pointer to string @param[in] length String length @@ -2556,12 +2603,14 @@ my_b_write_quoted_with_length(IO_CACHE *file, const uchar *ptr, uint length) @param[in] sl Signed number @param[in] ul Unsigned number */ -static void +static bool my_b_write_sint32_and_uint32(IO_CACHE *file, int32 si, uint32 ui) { - my_b_printf(file, "%d", si); + bool res= my_b_printf(file, "%d", si); if (si < 0) - my_b_printf(file, " (%u)", ui); + if (my_b_printf(file, " (%u)", ui)) + res= 1; + return res; } @@ -2580,8 +2629,8 @@ my_b_write_sint32_and_uint32(IO_CACHE *file, int32 si, uint32 ui) */ static size_t -log_event_print_value(IO_CACHE *file, const uchar *ptr, - uint type, uint meta, +log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, + const uchar *ptr, uint type, uint meta, char *typestr, size_t typestr_length) { uint32 length= 0; @@ -2964,19 +3013,15 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr, return my_b_write_quoted_with_length(file, ptr, length); case MYSQL_TYPE_DECIMAL: - my_b_printf(file, - "!! Old DECIMAL (mysql-4.1 or earlier). " - "Not enough metadata to display the value. "); + print_event_info->flush_for_error(); + fprintf(stderr, "\nError: Found Old DECIMAL (mysql-4.1 or earlier). " + "Not enough metadata to display the value.\n"); break; - default: - { - char tmp[5]; - my_snprintf(tmp, sizeof(tmp), "%04x", meta); - my_b_printf(file, - "!! Don't know how to handle column type=%d meta=%d (%s)", - type, meta, tmp); - } + print_event_info->flush_for_error(); + fprintf(stderr, + "\nError: Don't know how to handle column type: %d meta: %d (%04x)\n", + type, meta, meta); break; } *typestr= 0; @@ -2997,7 +3042,8 @@ return_null: @param[in] value Pointer to packed row @param[in] prefix Row's SQL clause ("SET", "WHERE", etc) - @retval - number of bytes scanned. + @retval 0 error + # number of bytes scanned. */ @@ -3027,7 +3073,8 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, value+= (bitmap_bits_set(cols_bitmap) + 7) / 8; if (!no_fill_output) - my_b_printf(file, "%s", prefix); + if (my_b_printf(file, "%s", prefix)) + goto err; for (size_t i= 0; i < td->size(); i ++) { @@ -3039,7 +3086,8 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, continue; if (!no_fill_output) - my_b_printf(file, "### @%d=", static_cast(i + 1)); + if (my_b_printf(file, "### @%d=", static_cast(i + 1))) + goto err; if (!is_null) { @@ -3047,8 +3095,9 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, if (value + fsize > m_rows_end) { if (!no_fill_output) - my_b_printf(file, "***Corrupted replication event was detected." - " Not printing the value***\n"); + if (my_b_printf(file, "***Corrupted replication event was detected." + " Not printing the value***\n")) + goto err; value+= fsize; return 0; } @@ -3056,7 +3105,7 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, if (!no_fill_output) { - size= log_event_print_value(file,is_null? NULL: value, + size= log_event_print_value(file, print_event_info, is_null? NULL: value, td->type(i), td->field_metadata(i), typestr, sizeof(typestr)); #ifdef WHEN_FLASHBACK_REVIEW_READY @@ -3067,12 +3116,14 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, // Using a tmp IO_CACHE to get the value output open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP)); - size= log_event_print_value(&tmp_cache, is_null? NULL: value, + size= log_event_print_value(&tmp_cache, print_event_info, + is_null ? NULL: value, td->type(i), td->field_metadata(i), typestr, sizeof(typestr)); - if (copy_event_cache_to_string_and_reinit(&tmp_cache, &review_str)) - exit(1); + error= copy_event_cache_to_string_and_reinit(&tmp_cache, &review_str); close_cached_file(&tmp_cache); + if (error) + return 0; switch (td->type(i)) // Converting a string to HEX format { @@ -3090,12 +3141,14 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, exit(1); } octet2hex((char*) hex_str.ptr(), tmp_str.ptr(), tmp_str.length()); - my_b_printf(review_sql, ", UNHEX('%s')", hex_str.ptr()); + if (my_b_printf(review_sql, ", UNHEX('%s')", hex_str.ptr())) + goto err; break; default: tmp_str.free(); - tmp_str.append(review_str.str, review_str.length); - my_b_printf(review_sql, ", %s", tmp_str.ptr()); + if (tmp_str.append(review_str.str, review_str.length) || + my_b_printf(review_sql, ", %s", tmp_str.ptr())) + goto err; break; } my_free(revieww_str.str); @@ -3106,36 +3159,40 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, { IO_CACHE tmp_cache; open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP)); - size= log_event_print_value(&tmp_cache,is_null? NULL: value, + size= log_event_print_value(&tmp_cache, print_event_info, + is_null ? NULL: value, td->type(i), td->field_metadata(i), typestr, sizeof(typestr)); close_cached_file(&tmp_cache); } if (!size) - return 0; + goto err; if (!is_null) value+= size; if (print_event_info->verbose > 1 && !no_fill_output) { - my_b_write(file, (uchar*)" /* ", 4); - - my_b_printf(file, "%s ", typestr); - - my_b_printf(file, "meta=%d nullable=%d is_null=%d ", - td->field_metadata(i), - td->maybe_null(i), is_null); - my_b_write(file, (uchar*)"*/", 2); + if (my_b_write(file, (uchar*)" /* ", 4) || + my_b_printf(file, "%s ", typestr) || + my_b_printf(file, "meta=%d nullable=%d is_null=%d ", + td->field_metadata(i), + td->maybe_null(i), is_null) || + my_b_write(file, (uchar*)"*/", 2)) + goto err; } if (!no_fill_output) - my_b_write_byte(file, '\n'); + if (my_b_write_byte(file, '\n')) + goto err; null_bit_index++; } return value - value0; + +err: + return 0; } @@ -3174,10 +3231,10 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf if (!(length1= print_verbose_one_row(NULL, td, print_event_info, &m_cols, value, (const uchar*) "", TRUE))) - { - fprintf(stderr, "\nError row length: %zu\n", length1); - exit(1); - } + { + fprintf(stderr, "\nError row length: %zu\n", length1); + exit(1); + } value+= length1; swap_buff1= (uchar *) my_malloc(length1, MYF(0)); @@ -3256,14 +3313,221 @@ end: delete td; } +/** + Calc length of a packed value of the given SQL type + + @param[in] ptr Pointer to string + @param[in] type Column type + @param[in] meta Column meta information + + @retval - number of bytes scanned from ptr. + Except in case of NULL, in which case we return 1 to indicate ok +*/ + +static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta) +{ + uint32 length= 0; + + if (type == MYSQL_TYPE_STRING) + { + if (meta >= 256) + { + uint byte0= meta >> 8; + uint byte1= meta & 0xFF; + + if ((byte0 & 0x30) != 0x30) + { + /* a long CHAR() field: see #37426 */ + length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4); + type= byte0 | 0x30; + } + else + length = meta & 0xFF; + } + else + length= meta; + } + + switch (type) { + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_TIMESTAMP: + return 4; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_YEAR: + return 1; + case MYSQL_TYPE_SHORT: + return 2; + case MYSQL_TYPE_INT24: + case MYSQL_TYPE_TIME: + case MYSQL_TYPE_NEWDATE: + case MYSQL_TYPE_DATE: + return 3; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_DATETIME: + return 8; + case MYSQL_TYPE_NEWDECIMAL: + { + uint precision= meta >> 8; + uint decimals= meta & 0xFF; + uint bin_size= my_decimal_get_binary_size(precision, decimals); + return bin_size; + } + case MYSQL_TYPE_FLOAT: + return 4; + case MYSQL_TYPE_DOUBLE: + return 8; + case MYSQL_TYPE_BIT: + { + /* Meta-data: bit_len, bytes_in_rec, 2 bytes */ + uint nbits= ((meta >> 8) * 8) + (meta & 0xFF); + length= (nbits + 7) / 8; + return length; + } + case MYSQL_TYPE_TIMESTAMP2: + return my_timestamp_binary_length(meta); + case MYSQL_TYPE_DATETIME2: + return my_datetime_binary_length(meta); + case MYSQL_TYPE_TIME2: + return my_time_binary_length(meta); + case MYSQL_TYPE_ENUM: + switch (meta & 0xFF) { + case 1: + case 2: + return (meta & 0xFF); + default: + /* Unknown ENUM packlen=%d", meta & 0xFF */ + return 0; + } + break; + case MYSQL_TYPE_SET: + return meta & 0xFF; + case MYSQL_TYPE_BLOB: + return (meta <= 4 ? meta : 0); + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + length= meta; + return length < 256 ? length + 1 : length + 2; + case MYSQL_TYPE_DECIMAL: + break; + default: + break; + } + return 0; +} + + +size_t +Rows_log_event::calc_row_event_length(table_def *td, + PRINT_EVENT_INFO *print_event_info, + MY_BITMAP *cols_bitmap, + const uchar *value) +{ + const uchar *value0= value; + const uchar *null_bits= value; + uint null_bit_index= 0; + + /* + Skip metadata bytes which gives the information about nullabity of master + columns. Master writes one bit for each affected column. + */ + + value+= (bitmap_bits_set(cols_bitmap) + 7) / 8; + + for (size_t i= 0; i < td->size(); i ++) + { + int is_null; + is_null= (null_bits[null_bit_index / 8] >> (null_bit_index % 8)) & 0x01; + + if (bitmap_is_set(cols_bitmap, i) == 0) + continue; + + if (!is_null) + { + size_t size; + size_t fsize= td->calc_field_size((uint)i, (uchar*) value); + if (value + fsize > m_rows_end) + { + /* Corrupted replication event was detected, skipping entry */ + return 0; + } + if (!(size= calc_field_event_length(value, td->type(i), + td->field_metadata(i)))) + return 0; + value+= size; + } + null_bit_index++; + } + return value - value0; +} + /** - Print a row event into IO cache in human readable form (in SQL format) - + Calculate how many rows there are in the event + @param[in] file IO cache @param[in] print_event_into Print parameters */ -void Rows_log_event::print_verbose(IO_CACHE *file, + +void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info) +{ + Table_map_log_event *map; + table_def *td; + uint row_events; + Log_event_type general_type_code= get_general_type_code(); + + switch (general_type_code) { + case WRITE_ROWS_EVENT: + case DELETE_ROWS_EVENT: + row_events= 1; + break; + case UPDATE_ROWS_EVENT: + row_events= 2; + break; + default: + DBUG_ASSERT(0); /* Not possible */ + return; + } + + if (!(map= print_event_info->m_table_map.get_table(m_table_id)) || + !(td= map->create_table_def())) + { + /* Row event for unknown table */ + return; + } + + for (const uchar *value= m_rows_buf; value < m_rows_end; ) + { + size_t length; + print_event_info->row_events++; + + /* Print the first image */ + if (!(length= calc_row_event_length(td, print_event_info, + &m_cols, value))) + break; + value+= length; + + /* Print the second image (for UPDATE only) */ + if (row_events == 2) + { + if (!(length= calc_row_event_length(td, print_event_info, + &m_cols_ai, value))) + break; + value+= length; + } + } + delete td; +} + + +/** + Print a row event into IO cache in human readable form (in SQL format) + + @param[in] file IO cache + @param[in] print_event_into Print parameters +*/ + +bool Rows_log_event::print_verbose(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info) { Table_map_log_event *map; @@ -3281,9 +3545,10 @@ void Rows_log_event::print_verbose(IO_CACHE *file, uint8 extra_payload_len= extra_data_len - EXTRA_ROW_INFO_HDR_BYTES; assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES); - my_b_printf(file, "### Extra row data format: %u, len: %u :", - m_extra_row_data[EXTRA_ROW_INFO_FORMAT_OFFSET], - extra_payload_len); + if (my_b_printf(file, "### Extra row data format: %u, len: %u :", + m_extra_row_data[EXTRA_ROW_INFO_FORMAT_OFFSET], + extra_payload_len)) + goto err; if (extra_payload_len) { /* @@ -3294,9 +3559,11 @@ void Rows_log_event::print_verbose(IO_CACHE *file, char buff[buff_len]; str_to_hex(buff, (const char*) &m_extra_row_data[EXTRA_ROW_INFO_HDR_BYTES], extra_payload_len); - my_b_printf(file, "%s", buff); + if (my_b_printf(file, "%s", buff)) + goto err; } - my_b_printf(file, "\n"); + if (my_b_printf(file, "\n")) + goto err; } switch (general_type_code) { @@ -3323,41 +3590,45 @@ void Rows_log_event::print_verbose(IO_CACHE *file, sql_command_short= ""; DBUG_ASSERT(0); /* Not possible */ } - + if (!(map= print_event_info->m_table_map.get_table(m_table_id)) || !(td= map->create_table_def())) { - my_b_printf(file, "### Row event for unknown table #%lu", - (ulong) m_table_id); - return; + return (my_b_printf(file, "### Row event for unknown table #%lu", + (ulong) m_table_id)); } /* If the write rows event contained no values for the AI */ if (((general_type_code == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end))) { - my_b_printf(file, "### INSERT INTO %`s.%`s VALUES ()\n", - map->get_db_name(), map->get_table_name()); + if (my_b_printf(file, "### INSERT INTO %`s.%`s VALUES ()\n", + map->get_db_name(), map->get_table_name())) + goto err; goto end; } for (const uchar *value= m_rows_buf; value < m_rows_end; ) { size_t length; - my_b_printf(file, "### %s %`s.%`s\n", - sql_command, - map->get_db_name(), map->get_table_name()); + print_event_info->row_events++; + if (my_b_printf(file, "### %s %`s.%`s\n", + sql_command, + map->get_db_name(), map->get_table_name())) + goto err; #ifdef WHEN_FLASHBACK_REVIEW_READY if (need_flashback_review) - my_b_printf(review_sql, "\nINSERT INTO `%s`.`%s` VALUES ('%s'", - map->get_review_dbname(), map->get_review_tablename(), sql_command_short); + if (my_b_printf(review_sql, "\nINSERT INTO `%s`.`%s` VALUES ('%s'", + map->get_review_dbname(), map->get_review_tablename(), + sql_command_short)) + goto err; #endif /* Print the first image */ if (!(length= print_verbose_one_row(file, td, print_event_info, &m_cols, value, (const uchar*) sql_clause1))) - goto end; + goto err; value+= length; /* Print the second image (for UPDATE only) */ @@ -3366,7 +3637,7 @@ void Rows_log_event::print_verbose(IO_CACHE *file, if (!(length= print_verbose_one_row(file, td, print_event_info, &m_cols_ai, value, (const uchar*) sql_clause2))) - goto end; + goto err; value+= length; } #ifdef WHEN_FLASHBACK_REVIEW_READY @@ -3374,16 +3645,22 @@ void Rows_log_event::print_verbose(IO_CACHE *file, { if (need_flashback_review) for (size_t i= 0; i < td->size(); i ++) - my_b_printf(review_sql, ", NULL"); + if (my_b_printf(review_sql, ", NULL")) + goto err; } if (need_flashback_review) - my_b_printf(review_sql, ")%s\n", print_event_info->delimiter); + if (my_b_printf(review_sql, ")%s\n", print_event_info->delimiter)) + goto err; #endif } end: delete td; + return 0; +err: + delete td; + return 1; } void free_table_map_log_event(Table_map_log_event *event) @@ -3391,7 +3668,7 @@ void free_table_map_log_event(Table_map_log_event *event) delete event; } -void Log_event::print_base64(IO_CACHE* file, +bool Log_event::print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, bool more) { @@ -3399,14 +3676,6 @@ void Log_event::print_base64(IO_CACHE* file, uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET); DBUG_ENTER("Log_event::print_base64"); - size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size); - char *const tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME)); - if (!tmp_str) { - fprintf(stderr, "\nError: Out of memory. " - "Could not print correct binlog event.\n"); - DBUG_VOID_RETURN; - } - if (is_flashback) { uint tmp_size= size; @@ -3452,27 +3721,41 @@ void Log_event::print_base64(IO_CACHE* file, delete ev; } - if (my_base64_encode(ptr, (size_t) size, tmp_str)) + if (print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER && + print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS && + ! print_event_info->short_form) { - DBUG_ASSERT(0); - } + size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size); + bool error= 0; + char *tmp_str; + if (!(tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME)))) + goto err; + + if (my_base64_encode(ptr, (size_t) size, tmp_str)) + { + DBUG_ASSERT(0); + } - if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS) - { if (my_b_tell(file) == 0) - my_b_write_string(file, "\nBINLOG '\n"); - - my_b_printf(file, "%s\n", tmp_str); - - if (!more) - my_b_printf(file, "'%s\n", print_event_info->delimiter); + if (my_b_write_string(file, "\nBINLOG '\n")) + error= 1; + if (!error && my_b_printf(file, "%s\n", tmp_str)) + error= 1; + if (!more && !error) + if (my_b_printf(file, "'%s\n", print_event_info->delimiter)) + error= 1; + my_free(tmp_str); + if (error) + goto err; } #ifdef WHEN_FLASHBACK_REVIEW_READY - if (print_event_info->verbose || need_flashback_review) + if (print_event_info->verbose || print_event_info->print_row_count || + need_flashback_review) #else // Flashback need the table_map to parse the event - if (print_event_info->verbose || is_flashback) + if (print_event_info->verbose || print_event_info->print_row_count || + is_flashback) #endif { Rows_log_event *ev= NULL; @@ -3547,27 +3830,49 @@ void Log_event::print_base64(IO_CACHE* file, if (ev) { + bool error= 0; + #ifdef WHEN_FLASHBACK_REVIEW_READY ev->need_flashback_review= need_flashback_review; if (print_event_info->verbose) - ev->print_verbose(file, print_event_info); + { + if (ev->print_verbose(file, print_event_info)) + goto err; + } else { IO_CACHE tmp_cache; - open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP)); - ev->print_verbose(&tmp_cache, print_event_info); + + if (open_cached_file(&tmp_cache, NULL, NULL, 0, + MYF(MY_WME | MY_NABP))) + { + delete ev; + goto err; + } + + error= ev->print_verbose(&tmp_cache, print_event_info); close_cached_file(&tmp_cache); + if (error) + { + delete ev; + goto err; + } } #else if (print_event_info->verbose) - ev->print_verbose(file, print_event_info); + error= ev->print_verbose(file, print_event_info); + else + ev->count_row_events(print_event_info); #endif delete ev; + if (error) + goto err; } } + DBUG_RETURN(0); - my_free(tmp_str); - DBUG_VOID_RETURN; +err: + DBUG_RETURN(1); } @@ -3575,7 +3880,7 @@ void Log_event::print_base64(IO_CACHE* file, Log_event::print_timestamp() */ -void Log_event::print_timestamp(IO_CACHE* file, time_t* ts) +bool Log_event::print_timestamp(IO_CACHE* file, time_t* ts) { struct tm *res; time_t my_when= when; @@ -3584,14 +3889,13 @@ void Log_event::print_timestamp(IO_CACHE* file, time_t* ts) ts = &my_when; res=localtime(ts); - my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d", - res->tm_year % 100, - res->tm_mon+1, - res->tm_mday, - res->tm_hour, - res->tm_min, - res->tm_sec); - DBUG_VOID_RETURN; + DBUG_RETURN(my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d", + res->tm_year % 100, + res->tm_mon+1, + res->tm_mday, + res->tm_hour, + res->tm_min, + res->tm_sec)); } #endif /* MYSQL_CLIENT */ @@ -4750,7 +5054,7 @@ Query_log_event::begin_event(String *packet, ulong ev_offset, @todo print the catalog ?? */ -void Query_log_event::print_query_header(IO_CACHE* file, +bool Query_log_event::print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info) { // TODO: print the catalog ?? @@ -4760,10 +5064,12 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (!print_event_info->short_form) { - print_header(file, print_event_info, FALSE); - my_b_printf(file, "\t%s\tthread_id=%lu\texec_time=%lu\terror_code=%d\n", - get_type_str(), (ulong) thread_id, (ulong) exec_time, - error_code); + if (print_header(file, print_event_info, FALSE) || + my_b_printf(file, + "\t%s\tthread_id=%lu\texec_time=%lu\terror_code=%d\n", + get_type_str(), (ulong) thread_id, (ulong) exec_time, + error_code)) + goto err; } if ((flags & LOG_EVENT_SUPPRESS_USE_F)) @@ -4777,7 +5083,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (different_db) memcpy(print_event_info->db, db, db_len + 1); if (db[0] && different_db) - my_b_printf(file, "use %`s%s\n", db, print_event_info->delimiter); + if (my_b_printf(file, "use %`s%s\n", db, print_event_info->delimiter)) + goto err; } end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); @@ -4788,15 +5095,17 @@ void Query_log_event::print_query_header(IO_CACHE* file, } end= strmov(end, print_event_info->delimiter); *end++='\n'; - my_b_write(file, (uchar*) buff, (uint) (end-buff)); + if (my_b_write(file, (uchar*) buff, (uint) (end-buff))) + goto err; if ((!print_event_info->thread_id_printed || ((flags & LOG_EVENT_THREAD_SPECIFIC_F) && thread_id != print_event_info->thread_id))) { // If --short-form, print deterministic value instead of pseudo_thread_id. - my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n", - short_form ? 999999999 : (ulong)thread_id, - print_event_info->delimiter); + if (my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n", + short_form ? 999999999 : (ulong)thread_id, + print_event_info->delimiter)) + goto err; print_event_info->thread_id= thread_id; print_event_info->thread_id_printed= 1; } @@ -4821,18 +5130,20 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (unlikely(tmp)) /* some bits have changed */ { bool need_comma= 0; - my_b_write_string(file, "SET "); - print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2, - "@@session.foreign_key_checks", &need_comma); - print_set_option(file, tmp, OPTION_AUTO_IS_NULL, flags2, - "@@session.sql_auto_is_null", &need_comma); - print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2, - "@@session.unique_checks", &need_comma); - print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2, - "@@session.autocommit", &need_comma); - print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS, ~flags2, - "@@session.check_constraint_checks", &need_comma); - my_b_printf(file,"%s\n", print_event_info->delimiter); + if (my_b_write_string(file, "SET ") || + print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2, + "@@session.foreign_key_checks", &need_comma)|| + print_set_option(file, tmp, OPTION_AUTO_IS_NULL, flags2, + "@@session.sql_auto_is_null", &need_comma) || + print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2, + "@@session.unique_checks", &need_comma) || + print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2, + "@@session.autocommit", &need_comma) || + print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS, + ~flags2, + "@@session.check_constraint_checks", &need_comma) || + my_b_printf(file,"%s\n", print_event_info->delimiter)) + goto err; print_event_info->flags2= flags2; } } @@ -4855,17 +5166,19 @@ void Query_log_event::print_query_header(IO_CACHE* file, !print_event_info->sql_mode_inited))) { char llbuff[22]; - my_b_printf(file,"SET @@session.sql_mode=%s%s\n", - ullstr(sql_mode, llbuff), print_event_info->delimiter); + if (my_b_printf(file,"SET @@session.sql_mode=%s%s\n", + ullstr(sql_mode, llbuff), print_event_info->delimiter)) + goto err; print_event_info->sql_mode= sql_mode; print_event_info->sql_mode_inited= 1; } if (print_event_info->auto_increment_increment != auto_increment_increment || print_event_info->auto_increment_offset != auto_increment_offset) { - my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n", - auto_increment_increment,auto_increment_offset, - print_event_info->delimiter); + if (my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n", + auto_increment_increment,auto_increment_offset, + print_event_info->delimiter)) + goto err; print_event_info->auto_increment_increment= auto_increment_increment; print_event_info->auto_increment_offset= auto_increment_offset; } @@ -4880,18 +5193,20 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (cs_info) { /* for mysql client */ - my_b_printf(file, "/*!\\C %s */%s\n", - cs_info->csname, print_event_info->delimiter); + if (my_b_printf(file, "/*!\\C %s */%s\n", + cs_info->csname, print_event_info->delimiter)) + goto err; } - my_b_printf(file,"SET " - "@@session.character_set_client=%d," - "@@session.collation_connection=%d," - "@@session.collation_server=%d" - "%s\n", - uint2korr(charset), - uint2korr(charset+2), - uint2korr(charset+4), - print_event_info->delimiter); + if (my_b_printf(file,"SET " + "@@session.character_set_client=%d," + "@@session.collation_connection=%d," + "@@session.collation_server=%d" + "%s\n", + uint2korr(charset), + uint2korr(charset+2), + uint2korr(charset+4), + print_event_info->delimiter)) + goto err; memcpy(print_event_info->charset, charset, 6); print_event_info->charset_inited= 1; } @@ -4900,31 +5215,40 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (memcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1)) { - my_b_printf(file,"SET @@session.time_zone='%s'%s\n", - time_zone_str, print_event_info->delimiter); + if (my_b_printf(file,"SET @@session.time_zone='%s'%s\n", + time_zone_str, print_event_info->delimiter)) + goto err; memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1); } } if (lc_time_names_number != print_event_info->lc_time_names_number) { - my_b_printf(file, "SET @@session.lc_time_names=%d%s\n", - lc_time_names_number, print_event_info->delimiter); + if (my_b_printf(file, "SET @@session.lc_time_names=%d%s\n", + lc_time_names_number, print_event_info->delimiter)) + goto err; print_event_info->lc_time_names_number= lc_time_names_number; } if (charset_database_number != print_event_info->charset_database_number) { if (charset_database_number) - my_b_printf(file, "SET @@session.collation_database=%d%s\n", - charset_database_number, print_event_info->delimiter); - else - my_b_printf(file, "SET @@session.collation_database=DEFAULT%s\n", - print_event_info->delimiter); + { + if (my_b_printf(file, "SET @@session.collation_database=%d%s\n", + charset_database_number, print_event_info->delimiter)) + goto err; + } + else if (my_b_printf(file, "SET @@session.collation_database=DEFAULT%s\n", + print_event_info->delimiter)) + goto err; print_event_info->charset_database_number= charset_database_number; } + return 0; + +err: + return 1; } -void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file, 0, this); @@ -4934,25 +5258,32 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) */ DBUG_EXECUTE_IF ("simulate_file_write_error", {(&cache)->write_pos= (&cache)->write_end- 500;}); - print_query_header(&cache, print_event_info); + if (print_query_header(&cache, print_event_info)) + goto err; if (!is_flashback) { - my_b_write(&cache, (uchar*) query, q_len); - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); + if (my_b_write(&cache, (uchar*) query, q_len) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; } else // is_flashback == 1 { if (strcmp("BEGIN", query) == 0) { - my_b_write(&cache, (uchar*) "COMMIT", 6); - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); + if (my_b_write(&cache, (uchar*) "COMMIT", 6) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; } else if (strcmp("COMMIT", query) == 0) { - my_b_write(&cache, (uchar*) "BEGIN", 5); - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); + if (my_b_write(&cache, (uchar*) "BEGIN", 5) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; } } + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -5561,7 +5892,7 @@ void Start_log_event_v3::pack_info(Protocol *protocol) */ #ifdef MYSQL_CLIENT -void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { DBUG_ENTER("Start_log_event_v3::print"); @@ -5570,16 +5901,21 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) if (!print_event_info->short_form) { - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\tStart: binlog v %d, server v %s created ", - binlog_version, server_version); - print_timestamp(&cache); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\tStart: binlog v %d, server v %s created ", + binlog_version, server_version) || + print_timestamp(&cache)) + goto err; if (created) - my_b_printf(&cache," at startup"); - my_b_printf(&cache, "\n"); + if (my_b_printf(&cache," at startup")) + goto err; + if (my_b_printf(&cache, "\n")) + goto err; if (flags & LOG_EVENT_BINLOG_IN_USE_F) - my_b_printf(&cache, "# Warning: this binlog is either in use or was not " - "closed properly.\n"); + if (my_b_printf(&cache, + "# Warning: this binlog is either in use or was not " + "closed properly.\n")) + goto err; } if (!is_artificial_event() && created) { @@ -5590,9 +5926,12 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) and rollback unfinished transaction. Probably this can be done with RESET CONNECTION (syntax to be defined). */ - my_b_printf(&cache,"RESET CONNECTION%s\n", print_event_info->delimiter); + if (my_b_printf(&cache,"RESET CONNECTION%s\n", + print_event_info->delimiter)) + goto err; #else - my_b_printf(&cache,"ROLLBACK%s\n", print_event_info->delimiter); + if (my_b_printf(&cache,"ROLLBACK%s\n", print_event_info->delimiter)) + goto err; #endif } if (temp_buf && @@ -5600,11 +5939,15 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) !print_event_info->short_form) { if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS) - my_b_printf(&cache, "BINLOG '\n"); - print_base64(&cache, print_event_info, FALSE); + if (my_b_printf(&cache, "BINLOG '\n")) + goto err; + if (print_base64(&cache, print_event_info, FALSE)) + goto err; print_event_info->printed_fd_event= TRUE; } - DBUG_VOID_RETURN; + DBUG_RETURN(cache.flush_data()); +err: + DBUG_RETURN(1); } #endif /* MYSQL_CLIENT */ @@ -6287,7 +6630,7 @@ int Start_encryption_log_event::do_update_pos(rpl_group_info *rgi) #endif #ifndef MYSQL_SERVER -void Start_encryption_log_event::print(FILE* file, +bool Start_encryption_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file); @@ -6299,7 +6642,9 @@ void Start_encryption_log_event::print(FILE* file, buf.append(STRING_WITH_LEN(", nonce: ")); buf.append_hex(nonce, BINLOG_NONCE_LENGTH); buf.append(STRING_WITH_LEN("\n# The rest of the binlog is encrypted!\n")); - my_b_write(&cache, (uchar*)buf.ptr(), buf.length()); + if (my_b_write(&cache, (uchar*)buf.ptr(), buf.length())) + return 1; + return (cache.flush_data()); } #endif /************************************************************************** @@ -6324,7 +6669,7 @@ void Start_encryption_log_event::print(FILE* file, */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -void Load_log_event::print_query(THD *thd, bool need_db, const char *cs, +bool Load_log_event::print_query(THD *thd, bool need_db, const char *cs, String *buf, my_off_t *fn_start, my_off_t *fn_end, const char *qualify_db) { @@ -6420,6 +6765,7 @@ void Load_log_event::print_query(THD *thd, bool need_db, const char *cs, } buf->append(STRING_WITH_LEN(")")); } + return 0; } @@ -6663,26 +7009,27 @@ err: */ #ifdef MYSQL_CLIENT -void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { - print(file, print_event_info, 0); + return print(file, print_event_info, 0); } -void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, +bool Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, bool commented) { Write_on_release_cache cache(&print_event_info->head_cache, file_arg); - + bool different_db= 1; DBUG_ENTER("Load_log_event::print"); + if (!print_event_info->short_form) { - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\tQuery\tthread_id=%ld\texec_time=%ld\n", - thread_id, exec_time); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\tQuery\tthread_id=%ld\texec_time=%ld\n", + thread_id, exec_time)) + goto err; } - bool different_db= 1; if (db) { /* @@ -6695,69 +7042,86 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, !commented) memcpy(print_event_info->db, db, db_len + 1); } - + if (db && db[0] && different_db) - my_b_printf(&cache, "%suse %`s%s\n", - commented ? "# " : "", - db, print_event_info->delimiter); + if (my_b_printf(&cache, "%suse %`s%s\n", + commented ? "# " : "", + db, print_event_info->delimiter)) + goto err; if (flags & LOG_EVENT_THREAD_SPECIFIC_F) - my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n", - commented ? "# " : "", (ulong)thread_id, - print_event_info->delimiter); - my_b_printf(&cache, "%sLOAD DATA ", - commented ? "# " : ""); + if (my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n", + commented ? "# " : "", (ulong)thread_id, + print_event_info->delimiter)) + goto err; + if (my_b_printf(&cache, "%sLOAD DATA ", + commented ? "# " : "")) + goto err; if (check_fname_outside_temp_buf()) - my_b_write_string(&cache, "LOCAL "); - my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname); + if (my_b_write_string(&cache, "LOCAL ")) + goto err; + if (my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname)) + goto err; if (sql_ex.opt_flags & REPLACE_FLAG) - my_b_write_string(&cache, "REPLACE "); + { + if (my_b_write_string(&cache, "REPLACE ")) + goto err; + } else if (sql_ex.opt_flags & IGNORE_FLAG) - my_b_write_string(&cache, "IGNORE "); - - my_b_printf(&cache, "INTO TABLE `%s`", table_name); - my_b_write_string(&cache, " FIELDS TERMINATED BY "); - pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len); + if (my_b_write_string(&cache, "IGNORE ")) + goto err; + + if (my_b_printf(&cache, "INTO TABLE `%s`", table_name) || + my_b_write_string(&cache, " FIELDS TERMINATED BY ") || + pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len)) + goto err; if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG) - my_b_write_string(&cache, " OPTIONALLY "); - my_b_write_string(&cache, " ENCLOSED BY "); - pretty_print_str(&cache, sql_ex.enclosed, sql_ex.enclosed_len); - - my_b_write_string(&cache, " ESCAPED BY "); - pretty_print_str(&cache, sql_ex.escaped, sql_ex.escaped_len); - - my_b_write_string(&cache, " LINES TERMINATED BY "); - pretty_print_str(&cache, sql_ex.line_term, sql_ex.line_term_len); - + if (my_b_write_string(&cache, " OPTIONALLY ")) + goto err; + if (my_b_write_string(&cache, " ENCLOSED BY ") || + pretty_print_str(&cache, sql_ex.enclosed, sql_ex.enclosed_len) || + my_b_write_string(&cache, " ESCAPED BY ") || + pretty_print_str(&cache, sql_ex.escaped, sql_ex.escaped_len) || + my_b_write_string(&cache, " LINES TERMINATED BY ") || + pretty_print_str(&cache, sql_ex.line_term, sql_ex.line_term_len)) + goto err; if (sql_ex.line_start) { - my_b_write_string(&cache," STARTING BY "); - pretty_print_str(&cache, sql_ex.line_start, sql_ex.line_start_len); + if (my_b_write_string(&cache," STARTING BY ") || + pretty_print_str(&cache, sql_ex.line_start, sql_ex.line_start_len)) + goto err; } if ((long) skip_lines > 0) - my_b_printf(&cache, " IGNORE %ld LINES", (long) skip_lines); + if (my_b_printf(&cache, " IGNORE %ld LINES", (long) skip_lines)) + goto err; if (num_fields) { uint i; const char* field = fields; - my_b_write_string(&cache, " ("); + if (my_b_write_string(&cache, " (")) + goto err; for (i = 0; i < num_fields; i++) { if (i) - my_b_write_byte(&cache, ','); - my_b_printf(&cache, "%`s", field); - + if (my_b_write_byte(&cache, ',')) + goto err; + if (my_b_printf(&cache, "%`s", field)) + goto err; field += field_lens[i] + 1; } - my_b_write_byte(&cache, ')'); + if (my_b_write_byte(&cache, ')')) + goto err; } - my_b_printf(&cache, "%s\n", print_event_info->delimiter); - DBUG_VOID_RETURN; + if (my_b_printf(&cache, "%s\n", print_event_info->delimiter)) + goto err; + DBUG_RETURN(cache.flush_data()); +err: + DBUG_RETURN(1); } #endif /* MYSQL_CLIENT */ @@ -7116,19 +7480,25 @@ void Rotate_log_event::pack_info(Protocol *protocol) */ #ifdef MYSQL_CLIENT -void Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + char buf[22]; Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); - - if (print_event_info->short_form) - return; - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tRotate to "); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tRotate to ")) + goto err; if (new_log_ident) - my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len); - my_b_printf(&cache, " pos: %s\n", llstr(pos, buf)); + if (my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len)) + goto err; + if (my_b_printf(&cache, " pos: %s\n", llstr(pos, buf))) + goto err; + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -7333,18 +7703,21 @@ Binlog_checkpoint_log_event::do_shall_skip(rpl_group_info *rgi) #ifdef MYSQL_CLIENT -void Binlog_checkpoint_log_event::print(FILE *file, +bool Binlog_checkpoint_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); - if (print_event_info->short_form) - return; - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tBinlog checkpoint "); - my_b_write(&cache, (uchar*)binlog_file_name, binlog_file_len); - my_b_write_byte(&cache, '\n'); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tBinlog checkpoint ") || + my_b_write(&cache, (uchar*)binlog_file_name, binlog_file_len) || + my_b_write_byte(&cache, '\n')) + return 1; + return cache.flush_data(); } #endif /* MYSQL_CLIENT */ @@ -7662,7 +8035,7 @@ Gtid_log_event::do_shall_skip(rpl_group_info *rgi) #else /* !MYSQL_SERVER */ -void +bool Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file, @@ -7674,26 +8047,34 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { print_header(&cache, print_event_info, FALSE); longlong10_to_str(seq_no, buf, 10); - my_b_printf(&cache, "\tGTID %u-%u-%s", domain_id, server_id, buf); + if (my_b_printf(&cache, "\tGTID %u-%u-%s", domain_id, server_id, buf)) + goto err; if (flags2 & FL_GROUP_COMMIT_ID) { longlong10_to_str(commit_id, buf2, 10); - my_b_printf(&cache, " cid=%s", buf2); + if (my_b_printf(&cache, " cid=%s", buf2)) + goto err; } if (flags2 & FL_DDL) - my_b_write_string(&cache, " ddl"); + if (my_b_write_string(&cache, " ddl")) + goto err; if (flags2 & FL_TRANSACTIONAL) - my_b_write_string(&cache, " trans"); + if (my_b_write_string(&cache, " trans")) + goto err; if (flags2 & FL_WAITED) - my_b_write_string(&cache, " waited"); - my_b_printf(&cache, "\n"); + if (my_b_write_string(&cache, " waited")) + goto err; + if (my_b_printf(&cache, "\n")) + goto err; if (!print_event_info->allow_parallel_printed || print_event_info->allow_parallel != !!(flags2 & FL_ALLOW_PARALLEL)) { - my_b_printf(&cache, + if (my_b_printf(&cache, "/*!100101 SET @@session.skip_parallel_replication=%u*/%s\n", - !(flags2 & FL_ALLOW_PARALLEL), print_event_info->delimiter); + !(flags2 & FL_ALLOW_PARALLEL), + print_event_info->delimiter)) + goto err; print_event_info->allow_parallel= !!(flags2 & FL_ALLOW_PARALLEL); print_event_info->allow_parallel_printed= true; } @@ -7701,8 +8082,10 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) if (!print_event_info->domain_id_printed || print_event_info->domain_id != domain_id) { - my_b_printf(&cache, "/*!100001 SET @@session.gtid_domain_id=%u*/%s\n", - domain_id, print_event_info->delimiter); + if (my_b_printf(&cache, + "/*!100001 SET @@session.gtid_domain_id=%u*/%s\n", + domain_id, print_event_info->delimiter)) + goto err; print_event_info->domain_id= domain_id; print_event_info->domain_id_printed= true; } @@ -7710,18 +8093,25 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) if (!print_event_info->server_id_printed || print_event_info->server_id != server_id) { - my_b_printf(&cache, "/*!100001 SET @@session.server_id=%u*/%s\n", - server_id, print_event_info->delimiter); + if (my_b_printf(&cache, "/*!100001 SET @@session.server_id=%u*/%s\n", + server_id, print_event_info->delimiter)) + goto err; print_event_info->server_id= server_id; print_event_info->server_id_printed= true; } if (!is_flashback) - my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n", - buf, print_event_info->delimiter); + if (my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n", + buf, print_event_info->delimiter)) + goto err; } if (!(flags2 & FL_STANDALONE)) - my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter); + if (my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter)) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_SERVER */ @@ -7957,28 +8347,37 @@ Gtid_list_log_event::pack_info(Protocol *protocol) #else /* !MYSQL_SERVER */ -void +bool Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { - if (!print_event_info->short_form) - { - Write_on_release_cache cache(&print_event_info->head_cache, file, - Write_on_release_cache::FLUSH_F); - char buf[21]; - uint32 i; + if (print_event_info->short_form) + return 0; - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\tGtid list ["); - for (i= 0; i < count; ++i) - { - longlong10_to_str(list[i].seq_no, buf, 10); - my_b_printf(&cache, "%u-%u-%s", list[i].domain_id, - list[i].server_id, buf); - if (i < count-1) - my_b_printf(&cache, ",\n# "); - } - my_b_printf(&cache, "]\n"); + Write_on_release_cache cache(&print_event_info->head_cache, file, + Write_on_release_cache::FLUSH_F); + char buf[21]; + uint32 i; + + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\tGtid list [")) + goto err; + + for (i= 0; i < count; ++i) + { + longlong10_to_str(list[i].seq_no, buf, 10); + if (my_b_printf(&cache, "%u-%u-%s", list[i].domain_id, + list[i].server_id, buf)) + goto err; + if (i < count-1) + if (my_b_printf(&cache, ",\n# ")) + goto err; } + if (my_b_printf(&cache, "]\n")) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_SERVER */ @@ -8110,7 +8509,7 @@ bool Intvar_log_event::write() */ #ifdef MYSQL_CLIENT -void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { char llbuff[22]; const char *UNINIT_VAR(msg); @@ -8119,11 +8518,13 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) if (!print_event_info->short_form) { - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tIntvar\n"); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tIntvar\n")) + goto err; } - my_b_printf(&cache, "SET "); + if (my_b_printf(&cache, "SET ")) + goto err; switch (type) { case LAST_INSERT_ID_EVENT: msg="LAST_INSERT_ID"; @@ -8136,8 +8537,13 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) msg="INVALID_INT"; break; } - my_b_printf(&cache, "%s=%s%s\n", - msg, llstr(val,llbuff), print_event_info->delimiter); + if (my_b_printf(&cache, "%s=%s%s\n", + msg, llstr(val,llbuff), print_event_info->delimiter)) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif @@ -8236,7 +8642,7 @@ bool Rand_log_event::write() #ifdef MYSQL_CLIENT -void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); @@ -8244,12 +8650,18 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) char llbuff[22],llbuff2[22]; if (!print_event_info->short_form) { - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tRand\n"); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tRand\n")) + goto err; } - my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n", - llstr(seed1, llbuff),llstr(seed2, llbuff2), - print_event_info->delimiter); + if (my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n", + llstr(seed1, llbuff),llstr(seed2, llbuff2), + print_event_info->delimiter)) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -8361,7 +8773,7 @@ bool Xid_log_event::write() #ifdef MYSQL_CLIENT -void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F, this); @@ -8371,10 +8783,17 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) char buf[64]; longlong10_to_str(xid, buf, 10); - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\tXid = %s\n", buf); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\tXid = %s\n", buf)) + goto err; } - my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n", print_event_info->delimiter); + if (my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n", + print_event_info->delimiter)) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -8762,23 +9181,26 @@ bool User_var_log_event::write() */ #ifdef MYSQL_CLIENT -void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); if (!print_event_info->short_form) { - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tUser_var\n"); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tUser_var\n")) + goto err; } - my_b_write_string(&cache, "SET @"); - my_b_write_backtick_quote(&cache, name, name_len); + if (my_b_write_string(&cache, "SET @") || + my_b_write_backtick_quote(&cache, name, name_len)) + goto err; if (is_null) { - my_b_printf(&cache, ":=NULL%s\n", print_event_info->delimiter); + if (my_b_printf(&cache, ":=NULL%s\n", print_event_info->delimiter)) + goto err; } else { @@ -8788,13 +9210,17 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) char real_buf[FMT_G_BUFSIZE(14)]; float8get(real_val, val); sprintf(real_buf, "%.14g", real_val); - my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter); + if (my_b_printf(&cache, ":=%s%s\n", real_buf, + print_event_info->delimiter)) + goto err; break; case INT_RESULT: char int_buf[22]; longlong10_to_str(uint8korr(val), int_buf, ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10)); - my_b_printf(&cache, ":=%s%s\n", int_buf, print_event_info->delimiter); + if (my_b_printf(&cache, ":=%s%s\n", int_buf, + print_event_info->delimiter)) + goto err; break; case DECIMAL_RESULT: { @@ -8810,7 +9236,9 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) bin2decimal((uchar*) val+2, &dec, precision, scale); decimal2string(&dec, str_buf, &str_len, 0, 0, 0); str_buf[str_len]= 0; - my_b_printf(&cache, ":=%s%s\n", str_buf, print_event_info->delimiter); + if (my_b_printf(&cache, ":=%s%s\n", str_buf, + print_event_info->delimiter)) + goto err; break; } case STRING_RESULT: @@ -8831,11 +9259,12 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) */ char *hex_str; CHARSET_INFO *cs; + bool error; // 2 hex digits / byte hex_str= (char *) my_malloc(2 * val_len + 1 + 3, MYF(MY_WME)); if (!hex_str) - return; + goto err; str_to_hex(hex_str, val, val_len); /* For proper behaviour when mysqlbinlog|mysql, we need to explicitly @@ -8844,24 +9273,31 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) character set. But there's not much to do about this and it's unlikely. */ if (!(cs= get_charset(charset_number, MYF(0)))) - /* + { /* Generate an unusable command (=> syntax error) is probably the best thing we can do here. */ - my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter); + error= my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter); + } else - my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n", - cs->csname, hex_str, cs->name, - print_event_info->delimiter); + error= my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n", + cs->csname, hex_str, cs->name, + print_event_info->delimiter); my_free(hex_str); - } + if (error) + goto err; break; + } case ROW_RESULT: default: DBUG_ASSERT(0); - return; + break; } } + + return cache.flush_data(); +err: + return 1; } #endif @@ -8984,19 +9420,25 @@ User_var_log_event::do_shall_skip(rpl_group_info *rgi) #ifdef HAVE_REPLICATION #ifdef MYSQL_CLIENT -void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info) +bool Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file_arg); - if (print_event_info->short_form) - return; if (what != ENCRYPTED) { - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n# Unknown event\n"); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\n# Unknown event\n")) + goto err; } - else - my_b_printf(&cache, "# Encrypted event\n"); + else if (my_b_printf(&cache, "# Encrypted event\n")) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif @@ -9009,16 +9451,18 @@ void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info */ #ifdef MYSQL_CLIENT -void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F, this); - if (print_event_info->short_form) - return; - - print_header(&cache, print_event_info, FALSE); - my_b_write_string(&cache, "\tStop\n"); + if (print_header(&cache, print_event_info, FALSE) || + my_b_write_string(&cache, "\tStop\n")) + return 1; + return cache.flush_data(); } #endif /* MYSQL_CLIENT */ @@ -9200,22 +9644,25 @@ Create_file_log_event::Create_file_log_event(const char* buf, uint len, */ #ifdef MYSQL_CLIENT -void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info, +bool Create_file_log_event::print(FILE* file, + PRINT_EVENT_INFO* print_event_info, bool enable_local) { - Write_on_release_cache cache(&print_event_info->head_cache, file); - if (print_event_info->short_form) { if (enable_local && check_fname_outside_temp_buf()) - Load_log_event::print(file, print_event_info); - return; + return Load_log_event::print(file, print_event_info); + return 0; } + Write_on_release_cache cache(&print_event_info->head_cache, file); + if (enable_local) { - Load_log_event::print(file, print_event_info, - !check_fname_outside_temp_buf()); + if (Load_log_event::print(file, print_event_info, + !check_fname_outside_temp_buf())) + goto err; + /** reduce the size of io cache so that the write function is called for every call to my_b_printf(). @@ -9227,16 +9674,24 @@ void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info That one is for "file_id: etc" below: in mysqlbinlog we want the #, in SHOW BINLOG EVENTS we don't. */ - my_b_write_byte(&cache, '#'); + if (my_b_write_byte(&cache, '#')) + goto err; } - my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len); + if (my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len)) + goto err; + + return cache.flush_data(); +err: + return 1; + } -void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) +bool Create_file_log_event::print(FILE* file, + PRINT_EVENT_INFO* print_event_info) { - print(file, print_event_info, 0); + return print(file, print_event_info, 0); } #endif /* MYSQL_CLIENT */ @@ -9302,7 +9757,7 @@ int Create_file_log_event::do_apply_event(rpl_group_info *rgi) fname_buf); goto err; } - + // a trick to avoid allocating another buffer fname= fname_buf; fname_len= (uint) (strmov(ext, ".data") - fname); @@ -9317,7 +9772,7 @@ int Create_file_log_event::do_apply_event(rpl_group_info *rgi) } end_io_cache(&file); mysql_file_close(fd, MYF(0)); - + // fname_buf now already has .data, not .info, because we did our trick /* old copy may exist already */ mysql_file_delete(key_file_log_event_data, fname_buf, MYF(0)); @@ -9415,16 +9870,22 @@ bool Append_block_log_event::write() */ #ifdef MYSQL_CLIENT -void Append_block_log_event::print(FILE* file, +bool Append_block_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file); - if (print_event_info->short_form) - return; - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n#%s: file_id: %d block_len: %d\n", - get_type_str(), file_id, block_len); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\n#%s: file_id: %d block_len: %d\n", + get_type_str(), file_id, block_len)) + goto err; + + return cache.flush_data(); +err: + return 1; } #endif /* MYSQL_CLIENT */ @@ -9574,15 +10035,19 @@ bool Delete_file_log_event::write() */ #ifdef MYSQL_CLIENT -void Delete_file_log_event::print(FILE* file, +bool Delete_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file); - if (print_event_info->short_form) - return; - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n#Delete_file: file_id=%u\n", file_id); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\n#Delete_file: file_id=%u\n", file_id)) + return 1; + + return cache.flush_data(); } #endif /* MYSQL_CLIENT */ @@ -9674,16 +10139,20 @@ bool Execute_load_log_event::write() */ #ifdef MYSQL_CLIENT -void Execute_load_log_event::print(FILE* file, +bool Execute_load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + if (print_event_info->short_form) + return 0; + Write_on_release_cache cache(&print_event_info->head_cache, file); - if (print_event_info->short_form) - return; - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n#Exec_load: file_id=%d\n", - file_id); + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\n#Exec_load: file_id=%d\n", + file_id)) + return 1; + + return cache.flush_data(); } #endif @@ -9906,22 +10375,24 @@ Execute_load_query_log_event::write_post_header_for_derived() #ifdef MYSQL_CLIENT -void Execute_load_query_log_event::print(FILE* file, +bool Execute_load_query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { - print(file, print_event_info, 0); + return print(file, print_event_info, 0); } /** Prints the query as LOAD DATA LOCAL and with rewritten filename. */ -void Execute_load_query_log_event::print(FILE* file, +bool Execute_load_query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info, const char *local_fname) { Write_on_release_cache cache(&print_event_info->head_cache, file); - print_query_header(&cache, print_event_info); + if (print_query_header(&cache, print_event_info)) + goto err; + /** reduce the size of io cache so that the write function is called for every call to my_b_printf(). @@ -9932,24 +10403,33 @@ void Execute_load_query_log_event::print(FILE* file, if (local_fname) { - my_b_write(&cache, (uchar*) query, fn_pos_start); - my_b_write_string(&cache, " LOCAL INFILE "); - pretty_print_str(&cache, local_fname, strlen(local_fname)); + if (my_b_write(&cache, (uchar*) query, fn_pos_start) || + my_b_write_string(&cache, " LOCAL INFILE ") || + pretty_print_str(&cache, local_fname, strlen(local_fname))) + goto err; if (dup_handling == LOAD_DUP_REPLACE) - my_b_write_string(&cache, " REPLACE"); - my_b_write_string(&cache, " INTO"); - my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end); - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); + if (my_b_write_string(&cache, " REPLACE")) + goto err; + + if (my_b_write_string(&cache, " INTO") || + my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; } else { - my_b_write(&cache, (uchar*) query, q_len); - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); + if (my_b_write(&cache, (uchar*) query, q_len) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; } if (!print_event_info->short_form) my_b_printf(&cache, "# file_id: %d \n", file_id); + + return cache.flush_data(); +err: + return 1; } #endif @@ -10929,7 +11409,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) if (global_system_variables.log_warnings) slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table, get_type_str(), - RPL_LOG_NAME, (ulong) log_pos); + RPL_LOG_NAME, log_pos); thd->clear_error(1); error= 0; if (idempotent_error == 0) @@ -10981,7 +11461,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) if (global_system_variables.log_warnings) slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table, get_type_str(), - RPL_LOG_NAME, (ulong) log_pos); + RPL_LOG_NAME, log_pos); thd->clear_error(1); error= 0; } @@ -10992,7 +11472,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) { slave_rows_error_report(ERROR_LEVEL, error, rgi, thd, table, get_type_str(), - RPL_LOG_NAME, (ulong) log_pos); + RPL_LOG_NAME, log_pos); /* @todo We should probably not call reset_current_stmt_binlog_format_row() from here. @@ -11022,7 +11502,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) thd->is_error() ? 0 : error, rgi, thd, table, get_type_str(), - RPL_LOG_NAME, (ulong) log_pos); + RPL_LOG_NAME, log_pos); DBUG_RETURN(error); err: @@ -11262,7 +11742,7 @@ void Rows_log_event::pack_info(Protocol *protocol) #endif #ifdef MYSQL_CLIENT -void Rows_log_event::print_helper(FILE *file, +bool Rows_log_event::print_helper(FILE *file, PRINT_EVENT_INFO *print_event_info, char const *const name) { @@ -11271,33 +11751,51 @@ void Rows_log_event::print_helper(FILE *file, #ifdef WHEN_FLASHBACK_REVIEW_READY IO_CACHE *const sql= &print_event_info->review_sql_cache; #endif + bool const last_stmt_event= get_flags(STMT_END_F); if (!print_event_info->short_form) { - bool const last_stmt_event= get_flags(STMT_END_F); print_header(head, print_event_info, !last_stmt_event); - my_b_printf(head, "\t%s: table id %lu%s\n", - name, m_table_id, - last_stmt_event ? " flags: STMT_END_F" : ""); - print_base64(body, print_event_info, !last_stmt_event); + if (my_b_printf(head, "\t%s: table id %lu%s\n", + name, m_table_id, + last_stmt_event ? " flags: STMT_END_F" : "")) + goto err; } + if (!print_event_info->short_form || print_event_info->print_row_count) + if (print_base64(body, print_event_info, !last_stmt_event)) + goto err; - if (get_flags(STMT_END_F)) + if (last_stmt_event) { - LEX_STRING tmp_str; - - copy_event_cache_to_string_and_reinit(head, &tmp_str); - output_buf.append(&tmp_str); - my_free(tmp_str.str); - copy_event_cache_to_string_and_reinit(body, &tmp_str); - output_buf.append(&tmp_str); - my_free(tmp_str.str); + if (!is_flashback) + { + if (copy_event_cache_to_file_and_reinit(head, file) || + copy_event_cache_to_file_and_reinit(body, file)) + goto err; + } + else + { + LEX_STRING tmp_str; + if (copy_event_cache_to_string_and_reinit(head, &tmp_str)) + return 1; + output_buf.append(&tmp_str); + my_free(tmp_str.str); + if (copy_event_cache_to_string_and_reinit(body, &tmp_str)) + return 1; + output_buf.append(&tmp_str); + my_free(tmp_str.str); #ifdef WHEN_FLASHBACK_REVIEW_READY - copy_event_cache_to_string_and_reinit(sql, &tmp_str); - output_buf.append(&tmp_str); - my_free(tmp_str.str); + if (copy_event_cache_to_string_and_reinit(sql, &tmp_str)) + return 1; + output_buf.append(&tmp_str); + my_free(tmp_str.str); #endif + } } + + return 0; +err: + return 1; } #endif @@ -11385,25 +11883,28 @@ void Annotate_rows_log_event::pack_info(Protocol* protocol) #endif #ifdef MYSQL_CLIENT -void Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) +bool Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) { - if (pinfo->short_form) - return; - - print_header(&pinfo->head_cache, pinfo, TRUE); - my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n"); - char *pbeg; // beginning of the next line char *pend; // end of the next line uint cnt= 0; // characters counter + if (!pinfo->short_form) + { + if (print_header(&pinfo->head_cache, pinfo, TRUE) || + my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n")) + goto err; + } + else if (my_b_printf(&pinfo->head_cache, "# Annotate_rows:\n")) + goto err; + for (pbeg= m_query_txt; ; pbeg= pend) { // skip all \r's and \n's at the beginning of the next line for (;; pbeg++) { if (++cnt > m_query_len) - return; + return 0; if (*pbeg != '\r' && *pbeg != '\n') break; @@ -11416,10 +11917,15 @@ void Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) ; // print next line - my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4); - my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg); - my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1); + if (my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4) || + my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg) || + my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1)) + goto err; } + + return 0; +err: + return 1; } #endif @@ -11716,7 +12222,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, ptr_after_colcnt= ptr_after_colcnt + m_colcnt; bytes_read= (uint) (ptr_after_colcnt - (uchar *)buf); - DBUG_PRINT("info", ("Bytes read: %d.\n", bytes_read)); + DBUG_PRINT("info", ("Bytes read: %d", bytes_read)); if (bytes_read < event_len) { m_field_metadata_size= net_field_length(&ptr_after_colcnt); @@ -12154,19 +12660,29 @@ void Table_map_log_event::pack_info(Protocol *protocol) #ifdef MYSQL_CLIENT -void Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) +bool Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { if (!print_event_info->short_form) { print_header(&print_event_info->head_cache, print_event_info, TRUE); - my_b_printf(&print_event_info->head_cache, - "\tTable_map: %`s.%`s mapped to number %lu%s\n", - m_dbnam, m_tblnam, m_table_id, - ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? - " (has triggers)" : "")); - print_base64(&print_event_info->body_cache, print_event_info, TRUE); - copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, file); + if (my_b_printf(&print_event_info->head_cache, + "\tTable_map: %`s.%`s mapped to number %lu%s\n", + m_dbnam, m_tblnam, m_table_id, + ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? + " (has triggers)" : ""))) + goto err; } + if (!print_event_info->short_form || print_event_info->print_row_count) + { + if (print_base64(&print_event_info->body_cache, print_event_info, TRUE) || + copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, + file)) + goto err; + } + + return 0; +err: + return 1; } #endif @@ -12736,14 +13252,14 @@ Write_rows_log_event::do_exec_row(rpl_group_info *rgi) #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #ifdef MYSQL_CLIENT -void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) +bool Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { DBUG_EXECUTE_IF("simulate_cache_read_error", {DBUG_SET("+d,simulate_my_b_fill_error");}); - Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Delete_rows" : "Write_rows"); + return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Delete_rows" : "Write_rows"); } -void Write_rows_compressed_log_event::print(FILE *file, +bool Write_rows_compressed_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { char *new_buf; @@ -12755,14 +13271,20 @@ void Write_rows_compressed_log_event::print(FILE *file, { free_temp_buf(); register_temp_buf(new_buf, true); - Rows_log_event::print_helper(file, print_event_info, - "Write_compressed_rows"); + if (Rows_log_event::print_helper(file, print_event_info, + "Write_compressed_rows")) + goto err; } else { - my_b_printf(&print_event_info->head_cache, - "ERROR: uncompress write_compressed_rows failed\n"); + if (my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress write_compressed_rows failed\n")) + goto err; } + + return 0; +err: + return 1; } #endif @@ -13411,13 +13933,13 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi) #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #ifdef MYSQL_CLIENT -void Delete_rows_log_event::print(FILE *file, +bool Delete_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { - Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Write_rows" : "Delete_rows"); + return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Write_rows" : "Delete_rows"); } -void Delete_rows_compressed_log_event::print(FILE *file, +bool Delete_rows_compressed_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { char *new_buf; @@ -13429,14 +13951,20 @@ void Delete_rows_compressed_log_event::print(FILE *file, { free_temp_buf(); register_temp_buf(new_buf, true); - Rows_log_event::print_helper(file, print_event_info, - "Delete_compressed_rows"); + if (Rows_log_event::print_helper(file, print_event_info, + "Delete_compressed_rows")) + goto err; } else { - my_b_printf(&print_event_info->head_cache, - "ERROR: uncompress delete_compressed_rows failed\n"); + if (my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress delete_compressed_rows failed\n")) + goto err; } + + return 0; +err: + return 1; } #endif @@ -13672,13 +14200,15 @@ err: #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #ifdef MYSQL_CLIENT -void Update_rows_log_event::print(FILE *file, +bool Update_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { - Rows_log_event::print_helper(file, print_event_info, "Update_rows"); + return Rows_log_event::print_helper(file, print_event_info, "Update_rows"); } -void Update_rows_compressed_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) +bool +Update_rows_compressed_log_event::print(FILE *file, + PRINT_EVENT_INFO *print_event_info) { char *new_buf; ulong len; @@ -13689,14 +14219,20 @@ void Update_rows_compressed_log_event::print(FILE *file, PRINT_EVENT_INFO *print { free_temp_buf(); register_temp_buf(new_buf, true); - Rows_log_event::print_helper(file, print_event_info, - "Update_compressed_rows"); + if (Rows_log_event::print_helper(file, print_event_info, + "Update_compressed_rows")) + goto err; } else { - my_b_printf(&print_event_info->head_cache, - "ERROR: uncompress update_compressed_rows failed\n"); + if (my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress update_compressed_rows failed\n")) + goto err; } + + return 0; +err: + return 1; } #endif @@ -13835,16 +14371,18 @@ err: #ifdef MYSQL_CLIENT -void -Incident_log_event::print(FILE *file, - PRINT_EVENT_INFO *print_event_info) +bool Incident_log_event::print(FILE *file, + PRINT_EVENT_INFO *print_event_info) { if (print_event_info->short_form) - return; + return 0; Write_on_release_cache cache(&print_event_info->head_cache, file); - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n# Incident: %s\nRELOAD DATABASE; # Shall generate syntax error\n", description()); + + if (print_header(&cache, print_event_info, FALSE) || + my_b_printf(&cache, "\n# Incident: %s\nRELOAD DATABASE; # Shall generate syntax error\n", description())) + return 1; + return cache.flush_data(); } #endif @@ -13920,19 +14458,20 @@ void Ignorable_log_event::pack_info(Protocol *protocol) #ifdef MYSQL_CLIENT /* Print for its unrecognized ignorable event */ -void -Ignorable_log_event::print(FILE *file, - PRINT_EVENT_INFO *print_event_info) +bool Ignorable_log_event::print(FILE *file, + PRINT_EVENT_INFO *print_event_info) { if (print_event_info->short_form) - return; + return 0; - print_header(&print_event_info->head_cache, print_event_info, FALSE); - my_b_printf(&print_event_info->head_cache, "\tIgnorable\n"); - my_b_printf(&print_event_info->head_cache, - "# Ignorable event type %d (%s)\n", number, description); - copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, - file); + if (print_header(&print_event_info->head_cache, print_event_info, FALSE) || + my_b_printf(&print_event_info->head_cache, "\tIgnorable\n") || + my_b_printf(&print_event_info->head_cache, + "# Ignorable event type %d (%s)\n", number, description) || + copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, + file)) + return 1; + return 0; } #endif @@ -13944,15 +14483,8 @@ Ignorable_log_event::print(FILE *file, they will always be printed for the first event. */ st_print_event_info::st_print_event_info() - :flags2_inited(0), sql_mode_inited(0), sql_mode(0), - auto_increment_increment(0),auto_increment_offset(0), charset_inited(0), - lc_time_names_number(~0), - charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER), - thread_id(0), thread_id_printed(false), server_id(0), - server_id_printed(false), domain_id(0), domain_id_printed(false), - allow_parallel(true), allow_parallel_printed(false), skip_replication(0), - base64_output_mode(BASE64_OUTPUT_UNSPEC), printed_fd_event(FALSE) { + myf const flags = MYF(MY_WME | MY_NABP); /* Currently we only use static PRINT_EVENT_INFO objects, so zeroed at program's startup, but these explicit bzero() is for the day someone @@ -13963,14 +14495,67 @@ st_print_event_info::st_print_event_info() bzero(time_zone_str, sizeof(time_zone_str)); delimiter[0]= ';'; delimiter[1]= 0; - myf const flags = MYF(MY_WME | MY_NABP); + flags2_inited= 0; + sql_mode_inited= 0; + row_events= 0; + sql_mode= 0; + auto_increment_increment= 0; + auto_increment_offset= 0; + charset_inited= 0; + lc_time_names_number= ~0; + charset_database_number= ILLEGAL_CHARSET_INFO_NUMBER; + thread_id= 0; + server_id= 0; + domain_id= 0; + thread_id_printed= false; + server_id_printed= false; + domain_id_printed= false; + allow_parallel= true; + allow_parallel_printed= false; + found_row_event= false; + print_row_count= false; + short_form= false; + skip_replication= 0; + printed_fd_event=FALSE; + file= 0; + base64_output_mode=BASE64_OUTPUT_UNSPEC; open_cached_file(&head_cache, NULL, NULL, 0, flags); open_cached_file(&body_cache, NULL, NULL, 0, flags); #ifdef WHEN_FLASHBACK_REVIEW_READY open_cached_file(&review_sql_cache, NULL, NULL, 0, flags); #endif } -#endif + + +bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to) +{ + reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE); + if (!(to->str= (char*) my_malloc((to->length= cache->end_of_file), MYF(0)))) + { + perror("Out of memory: can't allocate memory in copy_event_cache_to_string_and_reinit()."); + goto err; + } + if (my_b_read(cache, (uchar*) to->str, to->length)) + { + my_free(to->str); + perror("Can't read data from IO_CACHE"); + return true; + } + reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE); + return false; + +err: + to->str= 0; + to->length= 0; + return true; +} +#endif /* MYSQL_CLIENT */ + +bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file) +{ + return (my_b_copy_to_file(cache, file) || + reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE)); +} #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len, @@ -14045,4 +14630,4 @@ bool event_that_should_be_ignored(const char *buf) return 1; return 0; } -#endif +#endif /* MYSQL_SERVER */ diff --git a/sql/log_event.h b/sql/log_event.h index 428616fcb0d..6b43dcaa763 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -802,6 +802,8 @@ class Format_description_log_event; class Relay_log_info; class binlog_cache_data; +bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file); + #ifdef MYSQL_CLIENT enum enum_base64_output_mode { BASE64_OUTPUT_NEVER= 0, @@ -813,6 +815,8 @@ enum enum_base64_output_mode { BASE64_OUTPUT_MODE_COUNT }; +bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to); + /* A structure for mysqlbinlog to know how to print events @@ -832,33 +836,63 @@ typedef struct st_print_event_info that was printed. We cache these so that we don't have to print them if they are unchanged. */ - // TODO: have the last catalog here ?? char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is - bool flags2_inited; - uint32 flags2; - bool sql_mode_inited; - sql_mode_t sql_mode; /* must be same as THD.variables.sql_mode */ - ulong auto_increment_increment, auto_increment_offset; - bool charset_inited; char charset[6]; // 3 variables, each of them storable in 2 bytes char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; + char delimiter[16]; + sql_mode_t sql_mode; /* must be same as THD.variables.sql_mode */ + my_thread_id thread_id; + ulonglong row_events; + ulong auto_increment_increment, auto_increment_offset; uint lc_time_names_number; uint charset_database_number; - my_thread_id thread_id; - bool thread_id_printed; + uint verbose; + uint32 flags2; uint32 server_id; - bool server_id_printed; uint32 domain_id; + uint8 common_header_len; + enum_base64_output_mode base64_output_mode; + my_off_t hexdump_from; + + table_mapping m_table_map; + table_mapping m_table_map_ignored; + bool flags2_inited; + bool sql_mode_inited; + bool charset_inited; + bool thread_id_printed; + bool server_id_printed; bool domain_id_printed; bool allow_parallel; bool allow_parallel_printed; - + bool found_row_event; + bool print_row_count; + /* Settings on how to print the events */ + bool short_form; + /* + This is set whenever a Format_description_event is printed. + Later, when an event is printed in base64, this flag is tested: if + no Format_description_event has been seen, it is unsafe to print + the base64 event, so an error message is generated. + */ + bool printed_fd_event; /* Track when @@skip_replication changes so we need to output a SET statement for it. */ - int skip_replication; + bool skip_replication; + /* + These two caches are used by the row-based replication events to + collect the header information and the main body of the events + making up a statement. + */ + IO_CACHE head_cache; + IO_CACHE body_cache; +#ifdef WHEN_FLASHBACK_REVIEW_READY + /* Storing the SQL for reviewing */ + IO_CACHE review_sql_cache; +#endif + FILE *file; st_print_event_info(); ~st_print_event_info() { @@ -874,37 +908,12 @@ typedef struct st_print_event_info && my_b_inited(&review_sql_cache) #endif ; } - - - /* Settings on how to print the events */ - bool short_form; - enum_base64_output_mode base64_output_mode; - /* - This is set whenever a Format_description_event is printed. - Later, when an event is printed in base64, this flag is tested: if - no Format_description_event has been seen, it is unsafe to print - the base64 event, so an error message is generated. - */ - bool printed_fd_event; - my_off_t hexdump_from; - uint8 common_header_len; - char delimiter[16]; - - uint verbose; - table_mapping m_table_map; - table_mapping m_table_map_ignored; - - /* - These two caches are used by the row-based replication events to - collect the header information and the main body of the events - making up a statement. - */ - IO_CACHE head_cache; - IO_CACHE body_cache; -#ifdef WHEN_FLASHBACK_REVIEW_READY - /* Storing the SQL for reviewing */ - IO_CACHE review_sql_cache; -#endif + void flush_for_error() + { + if (!copy_event_cache_to_file_and_reinit(&head_cache, file)) + copy_event_cache_to_file_and_reinit(&body_cache, file); + fflush(file); + } } PRINT_EVENT_INFO; #endif @@ -1250,11 +1259,11 @@ public: Log_event() : temp_buf(0), when(0), flags(0) {} ha_checksum crc; /* print*() functions are used by mysqlbinlog */ - virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0; - void print_timestamp(IO_CACHE* file, time_t *ts = 0); - void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, + virtual bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0; + bool print_timestamp(IO_CACHE* file, time_t *ts = 0); + bool print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, bool is_more); - void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, + bool print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, bool is_more); #endif /* MYSQL_SERVER */ @@ -2113,8 +2122,8 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Query_log_event(); @@ -2453,7 +2462,7 @@ protected: const Format_description_log_event* description_event); public: - void print_query(THD *thd, bool need_db, const char *cs, String *buf, + bool print_query(THD *thd, bool need_db, const char *cs, String *buf, my_off_t *fn_start, my_off_t *fn_end, const char *qualify_db); my_thread_id thread_id; @@ -2519,8 +2528,8 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); - void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented); #endif /* @@ -2617,7 +2626,7 @@ public: #endif /* HAVE_REPLICATION */ #else Start_log_event_v3() {} - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Start_log_event_v3(const char* buf, uint event_len, @@ -2686,7 +2695,7 @@ public: write_data(nonce, BINLOG_NONCE_LENGTH); } #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Start_encryption_log_event( @@ -2874,7 +2883,7 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg, void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Intvar_log_event(const char* buf, @@ -2955,7 +2964,7 @@ class Rand_log_event: public Log_event void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Rand_log_event(const char* buf, @@ -3005,7 +3014,7 @@ class Xid_log_event: public Log_event void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Xid_log_event(const char* buf, @@ -3067,7 +3076,7 @@ public: } void pack_info(Protocol* protocol); #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif User_var_log_event(const char* buf, uint event_len, @@ -3115,7 +3124,7 @@ public: Stop_log_event() :Log_event() {} #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Stop_log_event(const char* buf, @@ -3211,7 +3220,7 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Rotate_log_event(const char* buf, uint event_len, @@ -3251,7 +3260,7 @@ public: void pack_info(Protocol *protocol); #endif #else - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif Binlog_checkpoint_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); @@ -3376,7 +3385,7 @@ public: virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); #endif #else - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif Gtid_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); @@ -3490,7 +3499,7 @@ public: void pack_info(Protocol *protocol); #endif #else - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif Gtid_list_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); @@ -3554,8 +3563,8 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); - void print(FILE* file, PRINT_EVENT_INFO* print_event_info, + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local); #endif @@ -3627,7 +3636,7 @@ public: virtual int get_create_or_append() const; #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Append_block_log_event(const char* buf, uint event_len, @@ -3667,8 +3676,8 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); - void print(FILE* file, PRINT_EVENT_INFO* print_event_info, + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local); #endif @@ -3708,7 +3717,7 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Execute_load_log_event(const char* buf, uint event_len, @@ -3804,9 +3813,9 @@ public: void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); /* Prints the query as LOAD DATA LOCAL and with rewritten filename */ - void print(FILE* file, PRINT_EVENT_INFO* print_event_info, + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, const char *local_fname); #endif Execute_load_query_log_event(const char* buf, uint event_len, @@ -3851,7 +3860,7 @@ public: /* constructor for hopelessly corrupted events */ Unknown_log_event(): Log_event(), what(ENCRYPTED) {} ~Unknown_log_event() {} - void print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); Log_event_type get_type_code() { return UNKNOWN_EVENT;} bool is_valid() const { return 1; } }; @@ -3896,7 +3905,7 @@ public: #endif #ifdef MYSQL_CLIENT - virtual void print(FILE*, PRINT_EVENT_INFO*); + virtual bool print(FILE*, PRINT_EVENT_INFO*); #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -4316,7 +4325,7 @@ public: #endif #ifdef MYSQL_CLIENT - virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif @@ -4437,15 +4446,21 @@ public: #ifdef MYSQL_CLIENT /* not for direct call, each derived has its own ::print() */ - virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; + virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; void change_to_flashback_event(PRINT_EVENT_INFO *print_event_info, uchar *rows_buff, Log_event_type ev_type); - void print_verbose(IO_CACHE *file, + bool print_verbose(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info); size_t print_verbose_one_row(IO_CACHE *file, table_def *td, PRINT_EVENT_INFO *print_event_info, MY_BITMAP *cols_bitmap, const uchar *ptr, const uchar *prefix, const my_bool no_fill_output= 0); // if no_fill_output=1, then print result is unnecessary + size_t calc_row_event_length(table_def *td, + PRINT_EVENT_INFO *print_event_info, + MY_BITMAP *cols_bitmap, + const uchar *value); + void count_row_events(PRINT_EVENT_INFO *print_event_info); + #endif #ifdef MYSQL_SERVER @@ -4552,7 +4567,7 @@ protected: void uncompress_buf(); #ifdef MYSQL_CLIENT - void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); + bool print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); #endif #ifdef MYSQL_SERVER @@ -4756,7 +4771,7 @@ private: virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -4780,7 +4795,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif }; @@ -4843,7 +4858,7 @@ protected: virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -4867,7 +4882,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif }; @@ -4927,7 +4942,7 @@ protected: virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -4950,7 +4965,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif }; @@ -5044,7 +5059,7 @@ public: virtual ~Incident_log_event(); #ifdef MYSQL_CLIENT - virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -5111,7 +5126,7 @@ public: #endif #ifdef MYSQL_CLIENT - virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif virtual Log_event_type get_type_code() { return IGNORABLE_LOG_EVENT; } @@ -5121,38 +5136,6 @@ public: virtual int get_data_size() { return IGNORABLE_HEADER_LEN; } }; - -static inline bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to) -{ - String tmp; - - reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE); - if (tmp.append(cache, (uint32)cache->end_of_file)) - goto err; - reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE); - - /* - Can't change the order, because the String::release() will clear the - length. - */ - to->length= tmp.length(); - to->str= tmp.release(); - - return false; - -err: - perror("Out of memory: can't allocate memory in copy_event_cache_to_string_and_reinit()."); - return true; -} - -static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, - FILE *file) -{ - return - my_b_copy_to_file(cache, file) || - reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE); -} - #ifdef MYSQL_SERVER /***************************************************************************** diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 68ffa32fafe..bda9a345790 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1845,7 +1845,7 @@ void Old_rows_log_event::pack_info(Protocol *protocol) #ifdef MYSQL_CLIENT -void Old_rows_log_event::print_helper(FILE *file, +bool Old_rows_log_event::print_helper(FILE *file, PRINT_EVENT_INFO *print_event_info, char const *const name) { @@ -1854,18 +1854,23 @@ void Old_rows_log_event::print_helper(FILE *file, if (!print_event_info->short_form) { bool const last_stmt_event= get_flags(STMT_END_F); - print_header(head, print_event_info, !last_stmt_event); - my_b_printf(head, "\t%s: table id %lu%s\n", - name, m_table_id, - last_stmt_event ? " flags: STMT_END_F" : ""); - print_base64(body, print_event_info, !last_stmt_event); + if (print_header(head, print_event_info, !last_stmt_event) || + my_b_printf(head, "\t%s: table id %lu%s\n", + name, m_table_id, + last_stmt_event ? " flags: STMT_END_F" : "") || + print_base64(body, print_event_info, !last_stmt_event)) + goto err; } if (get_flags(STMT_END_F)) { - copy_event_cache_to_file_and_reinit(head, file); - copy_event_cache_to_file_and_reinit(body, file); + if (copy_event_cache_to_file_and_reinit(head, file) || + copy_event_cache_to_file_and_reinit(body, file)) + goto err; } + return 0; +err: + return 1; } #endif @@ -2491,10 +2496,11 @@ Write_rows_log_event_old::do_exec_row(rpl_group_info *rgi) #ifdef MYSQL_CLIENT -void Write_rows_log_event_old::print(FILE *file, +bool Write_rows_log_event_old::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { - Old_rows_log_event::print_helper(file, print_event_info, "Write_rows_old"); + return Old_rows_log_event::print_helper(file, print_event_info, + "Write_rows_old"); } #endif @@ -2598,10 +2604,11 @@ int Delete_rows_log_event_old::do_exec_row(rpl_group_info *rgi) #ifdef MYSQL_CLIENT -void Delete_rows_log_event_old::print(FILE *file, +bool Delete_rows_log_event_old::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { - Old_rows_log_event::print_helper(file, print_event_info, "Delete_rows_old"); + return Old_rows_log_event::print_helper(file, print_event_info, + "Delete_rows_old"); } #endif @@ -2736,9 +2743,10 @@ Update_rows_log_event_old::do_exec_row(rpl_group_info *rgi) #ifdef MYSQL_CLIENT -void Update_rows_log_event_old::print(FILE *file, +bool Update_rows_log_event_old::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { - Old_rows_log_event::print_helper(file, print_event_info, "Update_rows_old"); + return Old_rows_log_event::print_helper(file, print_event_info, + "Update_rows_old"); } #endif diff --git a/sql/log_event_old.h b/sql/log_event_old.h index 40e01d37318..d18c980bdfe 100644 --- a/sql/log_event_old.h +++ b/sql/log_event_old.h @@ -116,7 +116,7 @@ public: #ifdef MYSQL_CLIENT /* not for direct call, each derived has its own ::print() */ - virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; + virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; #endif #ifndef MYSQL_CLIENT @@ -166,7 +166,7 @@ protected: const Format_description_log_event *description_event); #ifdef MYSQL_CLIENT - void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); + bool print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); #endif #ifndef MYSQL_CLIENT @@ -379,7 +379,7 @@ public: private: #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -455,7 +455,7 @@ public: protected: #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -529,7 +529,7 @@ public: protected: #ifdef MYSQL_CLIENT - void print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c1e14974c35..320771a859b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7259,7 +7259,7 @@ struct my_option my_long_options[]= "The value has to be a multiple of 256.", &opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0, GET_ULONG, REQUIRED_ARG, - /* def_value */ 8192, /* min_value */ 256, /* max_value */ ULONG_MAX, + /* def_value */ 8192, /* min_value */ 256, /* max_value */ UINT32_MAX-1, /* sub_size */ 0, /* block_size */ 256, /* app_type */ 0 }, diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 7f7e53c79e4..edd93143048 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -1460,7 +1460,6 @@ rpl_binlog_state::write_to_iocache(IO_CACHE *dest) mysql_mutex_lock(&LOCK_binlog_state); for (i= 0; i < hash.records; ++i) { - size_t res; element *e= (element *)my_hash_element(&hash, i); if (!e->last_gtid) { @@ -1480,8 +1479,8 @@ rpl_binlog_state::write_to_iocache(IO_CACHE *dest) gtid= e->last_gtid; longlong10_to_str(gtid->seq_no, buf, 10); - res= my_b_printf(dest, "%u-%u-%s\n", gtid->domain_id, gtid->server_id, buf); - if (res == (size_t) -1) + if (my_b_printf(dest, "%u-%u-%s\n", gtid->domain_id, gtid->server_id, + buf)) { res= 1; goto end; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index e07a1cd6820..a24eaaa6fde 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -607,7 +607,7 @@ bool String::append(IO_CACHE* file, uint32 arg_length) return TRUE; if (my_b_read(file, (uchar*) Ptr + str_length, arg_length)) { - shrink(str_length); + shrink(str_length ? str_length : 1); return TRUE; } str_length+=arg_length; From afbb72b3b6988f4c5242d46588754517724b2950 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 29 Dec 2017 13:22:34 +0200 Subject: [PATCH 67/88] Made IO_CACHE safe for reading big blocks (> 2G) The reason for adding this was that while testing mysqlbinlog on a replication event with 3G event output, Linux failed reading the whole file in memory with one read (only got 2G on first read even if file had just been written). - Don't reset info->error on write error in IO_CACHE. - In case of write_error in IO_CACHE , always return -1 - Fixed wrong result from my_read when using MY_FULL_IO. Also don't give an error in case of retry. --- mysys/mf_iocache.c | 11 +++++++---- mysys/my_read.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index a52ea2c5c40..4dd0f7500aa 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -115,6 +115,7 @@ init_functions(IO_CACHE* info) DBUG_ASSERT(!(info->myflags & MY_ENCRYPT)); info->read_function = info->share ? _my_b_cache_read_r : _my_b_cache_read; info->write_function = info->share ? _my_b_cache_write_r : _my_b_cache_write; + info->myflags&= ~MY_FULL_IO; break; case TYPE_NOT_SET: DBUG_ASSERT(0); @@ -455,6 +456,8 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, { info->read_end=info->write_pos; info->end_of_file=my_b_tell(info); + /* Ensure we will read all data */ + info->myflags|= MY_FULL_IO; /* Trigger a new seek only if we have a valid file handle. @@ -469,6 +472,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, info->seek_not_done=1; } info->end_of_file = ~(my_off_t) 0; + info->myflags&= ~MY_FULL_IO; } pos=info->request_pos+(seek_offset-info->pos_in_file); if (type == WRITE_CACHE) @@ -1917,13 +1921,12 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) { if (append_cache) { - if (mysql_file_write(info->file, info->write_buffer, length, info->myflags | MY_NABP)) + { info->error= -1; - else - info->error= 0; - + DBUG_RETURN(-1); + } info->end_of_file+= info->write_pos - info->append_read_pos; info->append_read_pos= info->write_buffer; DBUG_ASSERT(info->end_of_file == mysql_file_tell(info->file, MYF(0))); diff --git a/mysys/my_read.c b/mysys/my_read.c index 922da5a7e95..89b368e9800 100644 --- a/mysys/my_read.c +++ b/mysys/my_read.c @@ -35,11 +35,10 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) { - size_t readbytes, save_count; + size_t readbytes, save_count= 0; DBUG_ENTER("my_read"); DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %lu", Filedes, Buffer, (ulong) Count, MyFlags)); - save_count= Count; if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP))) MyFlags|= my_global_flags; @@ -61,47 +60,52 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) if (readbytes != Count) { - my_errno= errno; - if (errno == 0 || (readbytes != (size_t) -1 && - (MyFlags & (MY_NABP | MY_FNABP)))) - my_errno= HA_ERR_FILE_TOO_SHORT; + int got_errno= my_errno= errno; DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", (int) readbytes, (ulong) Count, Filedes, - my_errno)); + got_errno)); - if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) + if (got_errno == 0 || (readbytes != (size_t) -1 && + (MyFlags & (MY_NABP | MY_FNABP)))) + my_errno= HA_ERR_FILE_TOO_SHORT; + + if ((readbytes == 0 || (int) readbytes == -1) && got_errno == EINTR) { DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", (long) readbytes)); continue; /* Interrupted */ } + /* Do a read retry if we didn't get enough data on first read */ + if (readbytes != (size_t) -1 && readbytes != 0 && + (MyFlags & MY_FULL_IO)) + { + Buffer+= readbytes; + Count-= readbytes; + save_count+= readbytes; + continue; + } + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { if (readbytes == (size_t) -1) my_error(EE_READ, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), - my_filename(Filedes),my_errno); + my_filename(Filedes), got_errno); else if (MyFlags & (MY_NABP | MY_FNABP)) my_error(EE_EOFERR, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), - my_filename(Filedes),my_errno); + my_filename(Filedes), got_errno); } if (readbytes == (size_t) -1 || ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ - if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO)) - { - Buffer+= readbytes; - Count-= readbytes; - continue; - } } if (MyFlags & (MY_NABP | MY_FNABP)) readbytes= 0; /* Ok on read */ - else if (MyFlags & MY_FULL_IO) - readbytes= save_count; + else + readbytes+= save_count; break; } DBUG_RETURN(readbytes); From 8bcbcac053b96a39465e4651f51e625c37f94964 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 29 Dec 2017 17:25:21 +0200 Subject: [PATCH 68/88] Updated list of unstable tests for 10.2.12 --- mysql-test/unstable-tests | 219 +++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 123 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 36ee91694a4..dff89fdf60d 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,56 +23,55 @@ # ############################################################################## -# Based on 10.2 e2dd4e32063b2526d951e5f4ddfdb8b0d69ef634 +# Based on 10.2 f5c479565d1d07662f23f0a688add6dffeee5f84 -main.alter_table : Modified in 10.2.10 main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.case : Modified in 10.2.10 +main.auth_named_pipe : MDEV-14724 - System error 2 main.connect2 : MDEV-13885 - Server crash +main.create_or_replace : Modified in 10.2.12 main.cte_grant : Modified in 10.2.11 -main.cte_nonrecursive : Modified in 10.2.11 -main.cte_recursive : Modified in 10.2.11 -main.ctype_gbk : Modified in 10.2.10 -main.ctype_latin1 : Modified in 10.2.10 -main.ctype_ucs : Modified in 10.2.10 -main.ctype_utf32 : Modified in 10.2.10 -main.ctype_utf8 : Modified in 10.2.10 -main.delete_returning : Modified in 10.2.10 +main.cte_nonrecursive : Modified in 10.2.12 +main.cte_recursive : Modified in 10.2.12 +main.ctype_latin1 : Modified in 10.2.12 +main.ctype_like_range : Modified in 10.2.12 +main.ctype_ucs2_uca : Modified in 10.2.12 +main.ctype_utf16_uca : Modified in 10.2.12 +main.ctype_utf32_uca : Modified in 10.2.12 +main.ctype_utf8 : Modified in 10.2.12 +main.ctype_utf8_uca : Modified in 10.2.12 +main.ctype_utf8mb4 : Modified in 10.2.12 +main.ctype_utf8mb4_uca : Modified in 10.2.12 main.delimiter_command_case_sensitivity : Added in 10.2.11 main.derived_cond_pushdown : Modified in 10.2.11 main.distinct : MDEV-14194 - Crash main.events_2 : MDEV-13277 - Crash -main.func_in : Modified in 10.2.10 -main.func_json : MDEV-11648 - Crash, valgrind; modified in 10.2.11 -main.func_misc : Modified in 10.2.11 -main.func_regexp_pcre : Modified in 10.2.10 -main.func_time : Modified in 10.2.10 +main.events_slowlog : MDEV-12821 - Wrong result +main.func_json : Modified in 10.2.12 +main.func_misc : Modified in 10.2.12 +main.func_set : Modified in 10.2.12 +main.func_str : Modified in 10.2.12 main.gis-json : Modified in 10.2.11 -main.gis-precise : Modified in 10.2.10 -main.gis2 : Modified in 10.2.10 -main.having : Modified in 10.2.11 +main.group_by : Modified in 10.2.12 +main.having : Modified in 10.2.12 main.index_merge_innodb : MDEV-7142 - Plan mismatch -main.information_schema : Modified in 10.2.10 main.innodb_mysql_lock : MDEV-7861 - Wrong result +main.join_outer : Modified in 10.2.12 main.kill-2 : MDEV-13257 - Wrong result main.log_slow : MDEV-13263 - Wrong result -main.mdev13607 : Added in 10.2.10 -main.myisam : Modified in 10.2.10 main.mysql_client_test_nonblock : CONC-208 - Error on Power main.mysql_upgrade_noengine : MDEV-14355 - Wrong result main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error main.mysqlbinlog : Modified in 10.2.11 +main.mysqldump : MDEV-14800 - Stack smashing detected main.mysqld_option_err : MDEV-12747 - Timeout main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug main.mysqltest : MDEV-13887 - Wrong result main.openssl_1 : MDEV-13492 - Unknown SSL error main.order_by : Modified in 10.2.11 main.order_by_innodb : Modified in 10.2.11 -main.partition_datatype : Modified in 10.2.10 -main.ps : Modified in 10.2.11 -main.range_vs_index_merge : Modified in 10.2.10 +main.ps : MDEV-11017 - Wrong result; modified in 10.2.12 main.shm : MDEV-12727 - Mismatch, ERROR 2013 -main.show_function_with_pad_char_to_full_length : Added in 10.2.10 +main.show_explain : MDEV-10674 - Wrong result code main.sp : MDEV-7866 - Mismatch; modified in 10.2.11 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cert_verify : MDEV-13735 - Server crash @@ -81,21 +80,18 @@ main.ssl_timeout : MDEV-11244 - Crash main.stat_tables_par : MDEV-13266 - Wrong result main.status : MDEV-13255 - Wrong result main.subselect_exists2in : Modified in 10.2.11 -main.subselect_mat_cost_bugs : Modified in 10.2.10 -main.tc_heuristic_recover : MDEV-14189 - Wrong result; modified in 10.2.10 +main.subselect_innodb : MDEV-10614 - Wrong result +main.tc_heuristic_recover : MDEV-14189 - Wrong result main.trigger : Modified in 10.2.11 main.type_bit : Modified in 10.2.11 main.type_date : Modified in 10.2.11 -main.type_float : Modified in 10.2.10 main.type_time : Modified in 10.2.11 -main.type_varchar : Modified in 10.2.10 -main.user_var : Modified in 10.2.10 main.userstat : MDEV-12904 - SSL errors -main.xml : Modified in 10.2.10 +main.view : Modified in 10.2.12 +main.win : Modified in 10.2.12 #---------------------------------------------------------------- -archive.archive-big : MDEV-10615 - Table marked as crashed archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug #---------------------------------------------------------------- @@ -117,15 +113,11 @@ binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgrind binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts binlog_encryption.rpl_stm_relay_ign_space : MDEV-13278 - Wrong result (test assertion) +binlog_encryption.rpl_sync : MDEV-13830 - Assertion failure #---------------------------------------------------------------- -connect.json_java_2 : Include file modified in 10.2.10 -connect.json_java_3 : Include file modified in 10.2.10 -connect.json_mongo_c : Include file modified in 10.2.10 -connect.mongo_c : Include file modified in 10.2.10 -connect.mongo_java_2 : Include file modified in 10.2.10 -connect.mongo_java_3 : Include file modified in 10.2.10 +connect.pivot : MDEV-14803 - Failed to discover table connect.tbl : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash connect.tbl_thread : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash, MDEV-14214 - Syntax error connect.vcol : MDEV-12374 - Fails on Windows @@ -139,13 +131,16 @@ encryption.encryption_force : Modified in 10.2.11 encryption.filekeys_encfile : Modified in 10.2.11 encryption.filekeys_encfile_file : Modified in 10.2.11 encryption.innochecksum : MDEV-13644 - Assertion failure +encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-discard-import-change : MDEV-12632 - Valgrind encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.11 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result, MDEV-14045 - Error 192 encryption.innodb_encryption_filekeys : MDEV-9962 - Timeout +encryption.innodb_encryption-page-compression : MDEV-14814 - Timeout in wait condition encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition encryption.innodb_lotoftables : MDEV-11531 - Operation on a dropped tablespace +encryption.innodb-missing-key : MDEV-9359 - assertion failure encryption.innodb-redo-badkey : MDEV-13893 - Page cannot be decrypted encryption.innodb-spatial-index : MDEV-13746 - Wrong result; modified in 10.2.11 @@ -155,6 +150,7 @@ engines/rr_trx.* : MDEV-10998 - Not maintained #---------------------------------------------------------------- +federated.federated_bug_585688 : MDEV-14805 - Server crash, MDEV-12907 - Valgrind federated.federated_innodb : MDEV-10617 - Wrong checksum federated.federated_transactions : MDEV-10617 - Wrong checksum federated.federatedx : MDEV-10617 - Wrong checksum @@ -174,23 +170,18 @@ gcol.innodb_virtual_basic : Modified in 10.2.11 gcol.innodb_virtual_debug : Modified in 10.2.11 gcol.innodb_virtual_debug_purge : MDEV-13568 - Wrong result gcol.innodb_virtual_rebuild : Added in 10.2.11 +gcol.innodb_virtual_stats : Added in 10.2.12 #---------------------------------------------------------------- innodb.101_compatibility : MDEV-13891 - Wrong result -innodb.alter_table : Modified in 10.2.10 innodb.deadlock_detect : MDEV-13262 - Wrong error code -innodb.defrag_mdl-9155 : Re-enabled in 10.2.10 -innodb_defragment_fill_factor : Re-enabled in 10.2.10 innodb.doublewrite : MDEV-12905 - Server crash innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure -innodb.innodb-16k : Modified in 10.2.10 -innodb.innodb-32k : Modified in 10.2.10 -innodb.innodb-64k : Modified in 10.2.10 -innodb.innodb-alter : Modified in 10.2.10 -innodb.innodb-alter-table : Modified in 10.2.10 +innodb.innodb : Modified in 10.2.12 innodb.innodb-alter-tempfile : MDEV-14485 - Server deadlock on startup +innodb.innodb-autoinc : Modified in 10.2.12 innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt innodb.innodb_bug59641 : MDEV-13830 - Assertion failure innodb.innodb_bulk_create_index : Added in 10.2.11 @@ -198,94 +189,58 @@ innodb.innodb_bulk_create_index_debug : Added in 10.2.11 innodb.innodb_bulk_create_index_flush : Added in 10.2.11 innodb.innodb_bulk_create_index_replication : Added in 10.2.11 innodb.innodb_bulk_create_index_small : Added in 10.2.11 -innodb.innodb_defrag_binlog : Re-enabled in 10.2.10 -innodb.innodb_defrag_concurrent : Re-enabled in 10.2.10 -innodb.innodb_defrag_stats : Re-enabled in 10.2.10 -innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full; re-enabled in 10.2.10 -innodb.innodb_defragment : Re-enabled in 10.2.10 -innodb.innodb_defragment_fill_factor : Re-enabled in 10.2.10 -innodb.innodb_defragment_small : Re-enabled in 10.2.10 -innodb.innodb-get-fk : MDEV-13276 - Server crash; modified in 10.2.10 +innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full +innodb.innodb-get-fk : MDEV-13276 - Server crash +innodb.innodb-index-debug : Modified in 10.2.12 +innodb.innodb-index-online : MDEV-14809 - Cannot save statistics innodb.innodb_information_schema : MDEV-8851 - Wrong result +innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed; modified in 10.2.12 +innodb.innodb_max_recordsize_64k : Modified in 10.2.12 innodb.innodb-on-duplicate-update : Added in 10.2.11 -innodb.innodb-online-alter-gis : Modified in 10.2.10 innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result innodb.innodb-page_compression_tables : Modified in 10.2.11 innodb.innodb-replace-debug : Added in 10.2.11 +innodb.innodb_stats_debug : Modified in 10.2.12 +innodb.innodb_stats_drop_locked : Modified in 10.2.12 +innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb-table-online : MDEV-13894 - Wrong result; modified in 10.2.11 -innodb.innodb-truncate : Modified in 10.2.10 innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno -innodb.innodb-wl5980-alter : Modified in 10.2.10 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Extra warnings innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable +innodb.lock_deleted : Added in 10.2.12 innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start innodb.log_file_name : MDEV-14193 - Exception -innodb.log_file_size : Modified in 10.2.10 innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash +innodb.recovery_shutdown : Added in 10.2.12 innodb.row_format_redundant : MDEV-14485 - Server deadlock on startup -innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; added in 10.2.10 +innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.2.12 innodb.table_flags : MDEV-13572 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate_debug : Modified in 10.2.10 -innodb.truncate_restart : Added in 10.2.11 -innodb.undo_log : Added in 10.2.10 -innodb.update_time : Added in 10.2.11 +innodb.truncate_restart : Modified in 10.2.12 +innodb.update_time : MDEV-14804 - Wrong result; modified in 10.2.12 innodb.update_time_wl6658 : Added in 10.2.11 -innodb-wl5980-alter : Re-enabled in 10.2.10 -innodb_fts.concurrent_insert : Added in 10.2.10 -innodb_fts.fulltext : Modified in 10.2.10 +innodb_fts.fulltext2 : MDEV-14727 - Long semaphore wait innodb_fts.fulltext_misc : MDEV-12636 - Valgrind innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed -innodb_fts.sync : Added in 10.2.10 -innodb_fts.sync_block : Added in 10.2.10 -innodb_fts.truncate : Added in 10.2.10 +innodb_fts.sync : MDEV-14808 - Wrong result -innodb_gis.alter_spatial_index : Modified in 10.2.10 -innodb_gis.bug16236208 : Added in 10.2.10 -innodb_gis.bug16266012 : Added in 10.2.10 -innodb_gis.bug17057168 : Added in 10.2.10 -innodb_gis.geometry : Added in 10.2.10 -innodb_gis.gis_split_inf : Added in 10.2.10 -innodb_gis.gis_split_nan : Added in 10.2.10 -innodb_gis.kill_server : MDEV-14218 - Assertion failure; added in 10.2.10 -innodb_gis.multi_pk : Added in 10.2.10 -innodb_gis.point_basic : Added in 10.2.10 -innodb_gis.point_big : Added in 10.2.10 -innodb_gis.repeatable_spatial : Added in 10.2.10 -innodb_gis.rollback : Added in 10.2.10 -innodb_gis.row_format : Added in 10.2.10 -innodb_gis.rtree_compress : MDEV-14207 - Missing include; added in 10.2.10 -innodb_gis.rtree_compress2 : MDEV-14207 - Missing include; added in 10.2.10 -innodb_gis.rtree_concurrent_srch : Added in 10.2.10 -innodb_gis.rtree_create_inplace : Added in 10.2.10 -innodb_gis.rtree_debug : MDEV-14209 - Huge error log; added in 10.2.10 -innodb_gis.rtree_drop_index : Added in 10.2.10 -innodb_gis.rtree_estimate : Added in 10.2.10 -innodb_gis.rtree_multi_pk : Added in 10.2.10 -innodb_gis.rtree_old : Added in 10.2.10 -innodb_gis.rtree_purge : MDEV-14207 - Missing include; added in 10.2.10 -innodb_gis.rtree_recovery : Added in 10.2.10 -innodb_gis.rtree_rollback1 : Added in 10.2.10 -innodb_gis.rtree_rollback2 : Added in 10.2.10 -innodb_gis.rtree_search : Added in 10.2.10 -innodb_gis.rtree_split : MDEV-14208 - Too many arguments; MDEV-14209 - Huge error log; added in 10.2.10 -innodb_gis.rtree_undo : Added in 10.2.10 -innodb_gis.types : Added in 10.2.10 -innodb_gis.update_root : Added in 10.2.10 - -innodb_zip.16k : Modified in 10.2.10 -innodb_zip.4k : Modified in 10.2.10 -innodb_zip.8k : Modified in 10.2.10 +innodb_gis.kill_server : MDEV-14218 - Assertion failure; modified in 10.2.12 +innodb_gis.rtree_compress : MDEV-14207 - Missing include +innodb_gis.rtree_compress2 : MDEV-14207 - Missing include; modified in 10.2.12 +innodb_gis.rtree_debug : MDEV-14209 - Huge error log +innodb_gis.rtree_purge : MDEV-14207 - Missing include +innodb_gis.rtree_recovery : Modified in 10.2.12 +innodb_gis.rtree_split : MDEV-14208 - Too many arguments; MDEV-14209 - Huge error log +innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file +innodb_gis.types : Modified in 10.2.12 innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings -innodb_zip.index_large_prefix_4k : Modified in 10.2.10 -innodb_zip.index_large_prefix_8k : Modified in 10.2.10 innodb_zip.prefix_index_liftedlimit : MDEV-14238 - Assertion failure innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket @@ -295,21 +250,22 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error #---------------------------------------------------------------- maria.insert_select : MDEV-12757 - Timeout -maria.maria : MDEV-14430 - Extra warning; modified in 10.2.10 +maria.maria : MDEV-14430 - Extra warning #---------------------------------------------------------------- mariabackup.apply-log-only : MDEV-14192 - Assertion failure -mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure -mariabackup.compress_qpress : Added in 10.2.10 +mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure; modified in 10.2.12 mariabackup.data_directory : Added in 10.2.11 mariabackup.full_backup : MDEV-13889 - Timeout mariabackup.incremental_backup : MDEV-14192 - Assertion failure; modified in 10.2.11 mariabackup.incremental_encrypted : MDEV-14188 - Wrong result +mariabackup.log_checksum_mismatch : Added in 10.2.12 mariabackup.mdev-14447 : Added in 10.2.11 -mariabackup.partition_datadir : Added in 10.2.11 -mariabackup.xb_file_key_management : Modified in 10.2.10 +mariabackup.partition_datadir : MDEV-14802 - Timeout; added in 10.2.11 mariabackup.xbstream : MDEV-14192 - Crash +mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 +mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault #---------------------------------------------------------------- @@ -328,9 +284,11 @@ multi_source.simple : MDEV-4633 - Wrong result #---------------------------------------------------------------- -parts.partition_alter_maria : Added in 10.2.10 +parts.partition_alter_innodb : Added in 10.2.12 +parts.partition_alter_maria : Modified in 10.2.12 +parts.partition_alter_myisam : Added in 10.2.12 parts.partition_auto_increment_maria : MDEV-14430 - Extra warning -parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket +parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket #---------------------------------------------------------------- @@ -345,8 +303,11 @@ perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash +perfschema.misc : Modified in 10.2.12 perfschema.setup_actors : MDEV-10679 - Crash +perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result perfschema.stage_mdl_procedure : MDEV-11545 - Missing row +perfschema.threads_mysql : MDEV-10677 - Wrong result #---------------------------------------------------------------- @@ -354,6 +315,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained #---------------------------------------------------------------- +plugins.binlog-simple_plugin_check : Added in 10.2.12 plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such plugins.server_audit : Modified in 10.2.11 plugins.thread_pool_server : Modified in 10.2.11 @@ -365,12 +327,14 @@ rocksdb.* : MyRocks is alpha-quality and tests are uns #---------------------------------------------------------------- -roles.definer : Modified in 10.2.10 +roles.flush_roles-12366 : Added in 10.2.12 +roles.set_role-13655 : Added in 10.2.12 #---------------------------------------------------------------- rpl.rpl_binlog_errors : MDEV-12742 - Crash rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master +rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac; added in 10.2.12 rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning @@ -381,6 +345,9 @@ rpl.rpl_gtid_reconnect : MDEV-14497 - Crash rpl.rpl_gtid_stop_start : MDEV-11621 - Table marked as crashed rpl.rpl_manual_change_index_file : MDEV-14309 - Requires Env package rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog +rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_non_direct_row_mixing_engines : MDEV-14491 - Long semaphore wait rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_master rpl.rpl_parallel : MDEV-12730 - Assertion failure rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure @@ -388,9 +355,12 @@ rpl.rpl_parallel_optimistic_nobinlog : MDEV-12746 - Timeouts, mismatch rpl.rpl_parallel_retry : MDEV-11119 - Crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result +rpl.rpl_row_log : Included test modified in 10.2.12 +rpl.rpl_row_log_innodb : Included test modified in 10.2.12 rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait rpl.rpl_semi_sync : MDEV-11220 - Wrong result rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result +rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning rpl.rpl_show_slave_hosts : MDEV-10681 - Crash rpl.rpl_skip_replication : MDEV-13258 - Extra warning @@ -399,8 +369,11 @@ rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 - Extra warning rpl.rpl_slow_query_log : MDEV-13250 - Test abort rpl.rpl_sp_effects : MDEV-13249 - Crash rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout +rpl.rpl_stm_log : Included test modified in 10.2.12 +rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash +rpl.rpl_sync : MDEV-13830 - Assertion failure rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master rpl.rpl_upgrade_master_info : MDEV-11620 - Table marked as crashed @@ -427,15 +400,14 @@ storage_engine.* : Not always timely maintained #---------------------------------------------------------------- -sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.2.10 -sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.2.10 -sys_vars.host_cache_size_auto : Modified in 10.2.10 sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.2.11 sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.2.11 sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.2.11 sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion sys_vars.slow_query_log_func : MDEV-14273 - Wrong result +sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result +sys_vars.wsrep_on_basic : Opt file added in 10.2.12 #---------------------------------------------------------------- @@ -450,6 +422,9 @@ tokudb.rows-32m-seq-insert : MDEV-12640 - Crash tokudb_mariadb.mdev6657 : MDEV-12737 - Mismatch or valgrind +tokudb-rpl.rpl_tokudb_row_log : Included test modified in 10.2.12 +tokudb-rpl.rpl_tokudb_stm_log : Included test modified in 10.2.12 + tokudb_backup.* : MDEV-11001 - Missing include file tokudb_sys_vars.* : MDEV-11001 - Missing include file tokudb_rpl.* : MDEV-11001 - Missing include file @@ -458,16 +433,14 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection #---------------------------------------------------------------- +unit.conc_misc : MDEV-14811 - not ok 12 - test_conc49 unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236 unit.lf : MDEV-12897 - Signal 11 thrown #---------------------------------------------------------------- -vcol.vcol_misc : Modified in 10.2.10 - -#---------------------------------------------------------------- - wsrep.binlog_format : MDEV-11532 - Could not execute check-testcase +wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-12234 - GLIBCXX_3.4.20 not found wsrep.variables : MDEV-14311 - Wrong result From a118c20c8151a4e95f133b6d5bf92bafc7835e23 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Sat, 30 Dec 2017 10:18:22 +0530 Subject: [PATCH 69/88] MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort Currently explain format=json does not show the order direction of fields used during filesort. This patch would remove this limitation --- mysql-test/r/explain_json.result | 60 ++++++++++++++++++++++++++++++++ mysql-test/r/win.result | 2 +- mysql-test/t/explain_json.test | 11 ++++++ sql/sql_explain.cc | 8 ++++- sql/sql_explain.h | 1 + 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index b83334c8b08..db792f4f2b6 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -1582,3 +1582,63 @@ EXPLAIN } } drop table t0,t1; +# +# MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort +# +create table t1 (a int, b int); +insert into t1 values (1,2),(3,4),(2,3); +explain format=json select * from t1 order by a, b desc; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "read_sorted_file": { + "filesort": { + "sort_key": "t1.a, t1.b desc", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +explain format=json select * from t1 order by a desc, b desc; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "read_sorted_file": { + "filesort": { + "sort_key": "t1.a desc, t1.b desc", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +explain format=json select * from t1 order by a desc, b ; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "read_sorted_file": { + "filesort": { + "sort_key": "t1.a desc, t1.b", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +drop table t1; diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index cfe3ebe6a3c..7e0c86b1668 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -1779,7 +1779,7 @@ EXPLAIN "query_block": { "select_id": 1, "filesort": { - "sort_key": "row_number() over ( order by t1.s1,t1.s2)", + "sort_key": "row_number() over ( order by t1.s1,t1.s2) desc", "window_functions_computation": { "sorts": { "filesort": { diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test index d253b8380e9..c3665b1818b 100644 --- a/mysql-test/t/explain_json.test +++ b/mysql-test/t/explain_json.test @@ -406,3 +406,14 @@ explain format=json select a, (select max(a) from t1 where t0.a<5 and t1.border; ord; ord= ord->next) { sort_items.push_back(ord->item[0], mem_root); + sort_directions.push_back(&ord->direction, mem_root); } filesort->tracker= &tracker; } @@ -940,10 +941,13 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer, str.length(0); List_iterator_fast it(sort_items); - Item *item; + List_iterator_fast it_dir(sort_directions); + Item* item; + ORDER::enum_order *direction; bool first= true; while ((item= it++)) { + direction= it_dir++; if (first) first= false; else @@ -951,6 +955,8 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer, str.append(", "); } append_item_to_str(&str, item); + if (*direction == ORDER::ORDER_DESC) + str.append(" desc"); } writer->add_member("sort_key").add_str(str.c_ptr_safe()); diff --git a/sql/sql_explain.h b/sql/sql_explain.h index bfddf40ff33..a4698908755 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -282,6 +282,7 @@ public: class Explain_aggr_filesort : public Explain_aggr_node { List sort_items; + List sort_directions; public: enum_explain_aggr_node_type get_type() { return AGGR_OP_FILESORT; } Filesort_tracker tracker; From 7703095d2e26a15d4ecbd3683f9779b97f851c98 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Sun, 31 Dec 2017 16:18:39 +0200 Subject: [PATCH 70/88] MDEV-12458: Variable and log records to indicate RocksDB version are missing Added a system variabe rocsdb_git_hash to MyRocks which tell us the version of RocksDB being used --- cmake/make_dist.cmake.in | 3 +++ storage/rocksdb/CMakeLists.txt | 15 +++++++++++++++ storage/rocksdb/ha_rocksdb.cc | 8 ++++++++ .../rocksdb/mysql-test/rocksdb/r/rocksdb.result | 1 + storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test | 2 ++ .../t/rocksdb_git_hash_basic.test | 6 ++++++ storage/rocksdb/rdb_source_revision.h.in | 1 + 7 files changed, 36 insertions(+) create mode 100644 storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_git_hash_basic.test create mode 100644 storage/rocksdb/rdb_source_revision.h.in diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 3cc93d10fb8..2e3dbb987f0 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -52,6 +52,9 @@ IF(GIT_EXECUTABLE) ENDIF() ENDIF() +CONFIGURE_FILE(${CMAKE_BINARY_DIR}/storage/rocksdb/rdb_source_revision.h + ${PACKAGE_DIR}/storage/rocksdb/rdb_source_revision.h COPYONLY) + IF(NOT GIT_EXECUTABLE) MESSAGE(STATUS "git not found or source dir is not a repo, use CPack") diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 1e20e0fa4a3..6cb7eb1d439 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -220,3 +220,18 @@ IF(MSVC) # Some checks in C++ runtime that make debug build much slower ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0) ENDIF() + +IF(GIT_EXECUTABLE) + EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb + OUTPUT_VARIABLE OUT RESULT_VARIABLE RES) + IF(RES EQUAL 0) + STRING(REGEX REPLACE "\n$" "" ROCKSDB_GIT_HASH "${OUT}") + ENDIF() +ENDIF() +IF(ROCKSDB_GIT_HASH OR + (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rdb_source_revision.h)) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/rdb_source_revision.h.in + ${CMAKE_CURRENT_BINARY_DIR}/rdb_source_revision.h ) +ENDIF() diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 8857b2e8cba..4a0a3eddb1a 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -70,6 +70,7 @@ #include "rocksdb/utilities/memory_util.h" #include "rocksdb/utilities/sim_cache.h" #include "util/stop_watch.h" +#include "./rdb_source_revision.h" /* MyRocks includes */ #include "./event_listener.h" @@ -494,6 +495,7 @@ static uint32_t rocksdb_table_stats_sampling_pct; static my_bool rocksdb_enable_bulk_load_api = 1; static my_bool rocksdb_print_snapshot_conflict_queries = 0; static my_bool rocksdb_large_prefix = 0; +static char* rocksdb_git_hash; char *compression_types_val= const_cast(get_rocksdb_supported_compression_types()); @@ -650,6 +652,11 @@ static MYSQL_SYSVAR_BOOL(enable_bulk_load_api, rocksdb_enable_bulk_load_api, "Enables using SstFileWriter for bulk loading", nullptr, nullptr, rocksdb_enable_bulk_load_api); +static MYSQL_SYSVAR_STR(git_hash, rocksdb_git_hash, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Git revision of the RocksDB library used by MyRocks", + nullptr, nullptr, ROCKSDB_GIT_HASH); + static MYSQL_THDVAR_STR(tmpdir, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC, "Directory for temporary files during DDL operations.", nullptr, nullptr, ""); @@ -1633,6 +1640,7 @@ static struct st_mysql_sys_var *rocksdb_system_variables[] = { MYSQL_SYSVAR(table_stats_sampling_pct), MYSQL_SYSVAR(large_prefix), + MYSQL_SYSVAR(git_hash), nullptr}; static rocksdb::WriteOptions diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result index d791cf98bb0..9b084e63cd5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result @@ -924,6 +924,7 @@ rocksdb_force_compute_memtable_stats_cachetime 0 rocksdb_force_flush_memtable_and_lzero_now OFF rocksdb_force_flush_memtable_now OFF rocksdb_force_index_records_in_range 0 +rocksdb_git_hash # rocksdb_hash_index_allow_collision ON rocksdb_index_type kBinarySearch rocksdb_info_log_level error_level diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test index 5c8fa9ed443..9199c572933 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test @@ -786,6 +786,8 @@ drop table t45; --echo # Now it fails if there is data overlap with what --echo # already exists --echo # + +--replace_regex /[a-f0-9]{40}/#/ show variables where variable_name like 'rocksdb%' and diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_git_hash_basic.test b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_git_hash_basic.test new file mode 100644 index 00000000000..7b314e47d4b --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_git_hash_basic.test @@ -0,0 +1,6 @@ +--source include/have_rocksdb.inc + +--let $sys_var=ROCKSDB_GIT_HASH +--let $read_only=1 +--let $session=0 +--source include/rocksdb_sys_var.inc diff --git a/storage/rocksdb/rdb_source_revision.h.in b/storage/rocksdb/rdb_source_revision.h.in new file mode 100644 index 00000000000..617b39c9186 --- /dev/null +++ b/storage/rocksdb/rdb_source_revision.h.in @@ -0,0 +1 @@ +#define ROCKSDB_GIT_HASH "@ROCKSDB_GIT_HASH@" From 322c637c1c7717b5d33e4d7670a39eae17040e3c Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 1 Jan 2018 14:10:22 +0200 Subject: [PATCH 71/88] Fixed compiler warnings about possible uninitialized variables --- sql/log.cc | 2 +- sql/opt_range.cc | 2 +- sql/sql_cte.cc | 2 +- sql/sql_partition.cc | 10 ++++++++-- sql/table.cc | 8 +++----- storage/maria/ma_open.c | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index a905e2b8caf..23873922368 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2420,7 +2420,7 @@ static int find_uniq_filename(char *name, ulong next_log_number) char buff[FN_REFLEN], ext_buf[FN_REFLEN]; struct st_my_dir *dir_info; reg1 struct fileinfo *file_info; - ulong max_found, next, number; + ulong max_found, next, UNINIT_VAR(number); size_t buf_length, length; char *start, *end; int error= 0; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 04d2059eb62..7d57bbf4cb8 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -6729,7 +6729,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool update_tbl_stats, double read_time) { - uint idx, best_idx; + uint idx, UNINIT_VAR(best_idx); SEL_ARG *key_to_read= NULL; ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */ uint UNINIT_VAR(best_mrr_flags), /* protected by key_to_read */ diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index e1bd455830d..601c1928d58 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -664,7 +664,7 @@ void With_element::move_anchors_ahead() { st_select_lex *next_sl; st_select_lex *new_pos= spec->first_select(); - st_select_lex *last_sl; + st_select_lex *UNINIT_VAR(last_sl); new_pos->linkage= UNION_TYPE; for (st_select_lex *sl= new_pos; sl; sl= next_sl) { diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index de14829329b..fd8d23f5187 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -8071,8 +8071,11 @@ int create_partition_name(char *out, size_t outlen, const char *in1, end= strxnmov(out, outlen-1, in1, "#P#", transl_part, NullS); else if (name_variant == TEMP_PART_NAME) end= strxnmov(out, outlen-1, in1, "#P#", transl_part, "#TMP#", NullS); - else if (name_variant == RENAMED_PART_NAME) + else + { + DBUG_ASSERT(name_variant == RENAMED_PART_NAME); end= strxnmov(out, outlen-1, in1, "#P#", transl_part, "#REN#", NullS); + } if (end - out == static_cast(outlen-1)) { my_error(ER_PATH_LENGTH, MYF(0), longest_str(in1, transl_part)); @@ -8112,9 +8115,12 @@ int create_subpartition_name(char *out, size_t outlen, else if (name_variant == TEMP_PART_NAME) end= strxnmov(out, outlen-1, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, "#TMP#", NullS); - else if (name_variant == RENAMED_PART_NAME) + else + { + DBUG_ASSERT(name_variant == RENAMED_PART_NAME); end= strxnmov(out, outlen-1, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, "#REN#", NullS); + } if (end - out == static_cast(outlen-1)) { my_error(ER_PATH_LENGTH, MYF(0), diff --git a/sql/table.cc b/sql/table.cc index 811094ccc76..00debaec84e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -997,7 +997,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, Virtual_column_info **check_constraint_ptr= table->check_constraints; sql_mode_t saved_mode= thd->variables.sql_mode; Query_arena backup_arena; - Virtual_column_info *vcol; + Virtual_column_info *vcol= 0; StringBuffer expr_str; bool res= 1; DBUG_ENTER("parse_vcol_defs"); @@ -1168,7 +1168,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, uint new_frm_ver, field_pack_length, new_field_pack_flag; uint interval_count, interval_parts, read_length, int_length; uint db_create_options, keys, key_parts, n_length; - uint com_length, null_bit_pos, mysql57_vcol_null_bit_pos, bitmap_count; + uint com_length, null_bit_pos, UNINIT_VAR(mysql57_vcol_null_bit_pos), bitmap_count; uint i; bool use_hash, mysql57_null_bits= 0; char *keynames, *names, *comment_pos; @@ -2104,6 +2104,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, } } + key_first_info= keyinfo; for (uint key=0 ; key < keys ; key++,keyinfo++) { uint usable_parts= 0; @@ -2121,9 +2122,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, keyinfo->name_length+1); } - if (!key) - key_first_info= keyinfo; - if (ext_key_parts > share->key_parts && key) { KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part + diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index 5a0c81d3e3e..8b3fa921cf1 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -280,7 +280,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) size_t info_length; char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN], data_name[FN_REFLEN]; - uchar *disk_cache, *disk_pos, *end_pos; + uchar *UNINIT_VAR(disk_cache), *disk_pos, *end_pos; MARIA_HA info, *UNINIT_VAR(m_info), *old_info; MARIA_SHARE share_buff,*share; double *rec_per_key_part; From 08ff39dca2ae8510dd2d2f9720b17eec9b23b38a Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 1 Jan 2018 14:12:18 +0200 Subject: [PATCH 72/88] Write location of core when doing core dump --- sql/signal_handler.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 6e21d6249ab..68e801d5885 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -298,7 +298,9 @@ extern "C" sig_handler handle_fatal_signal(int sig) #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) { - my_safe_printf_stderr("%s", "Writing a core file\n"); + char buff[80]; + my_getwd(buff, sizeof(buff), 0); + my_safe_printf_stderr("Writing a core file at %s\n", buff); fflush(stderr); my_write_core(sig); } From 7e882a60bfb116e40df89e793c2b71decbe82f6d Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 1 Jan 2018 14:44:20 +0200 Subject: [PATCH 73/88] Ensure that table->vcol_set is properly restored if used Code in QUICK_RANGE_SELECT::init_ror_merged_scan() could theoretically have caused crashes if this was ever called from an update or delete This also found a bug in the vcol/range.result. file. --- mysql-test/suite/vcol/r/range.result | 4 ++-- sql/filesort.cc | 23 ++++++++++++++--------- sql/opt_range.cc | 7 +++++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/mysql-test/suite/vcol/r/range.result b/mysql-test/suite/vcol/r/range.result index ad7a39bc11c..5b081a5dbe8 100644 --- a/mysql-test/suite/vcol/r/range.result +++ b/mysql-test/suite/vcol/r/range.result @@ -4,6 +4,6 @@ create table t2 (a int, b int) engine=myisam; insert into t2 values (1,2),(2,4); select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk ); pk i v a b -1 1 0 1 2 -2 2 0 2 4 +1 1 2 1 2 +2 2 4 2 4 drop table t1, t2; diff --git a/sql/filesort.cc b/sql/filesort.cc index d4b28e47a39..d6bdebee3d3 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -712,6 +712,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, handler *file; MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set; Item *sort_cond; + ha_rows retval; DBUG_ENTER("find_all_keys"); DBUG_PRINT("info",("using: %s", (select ? select->quick ? "ranges" : "where": @@ -769,7 +770,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, if (quick_select) { if (select->quick->reset()) - DBUG_RETURN(HA_POS_ERROR); + goto err; } DEBUG_SYNC(thd, "after_index_merge_phase1"); @@ -806,7 +807,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, (void) file->extra(HA_EXTRA_NO_CACHE); file->ha_rnd_end(); } - DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ + goto err; /* purecov: inspected */ } bool write_record= false; @@ -854,7 +855,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, if (idx == param->max_keys_per_buffer) { if (write_keys(param, fs_info, idx, buffpek_pointers, tempfile)) - DBUG_RETURN(HA_POS_ERROR); + goto err; idx= 0; indexpos++; } @@ -880,12 +881,12 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, file->ha_rnd_end(); } - if (thd->is_error()) - DBUG_RETURN(HA_POS_ERROR); - /* Signal we should use orignal column read and write maps */ sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); + if (thd->is_error()) + DBUG_RETURN(HA_POS_ERROR); + DBUG_PRINT("test",("error: %d indexpos: %d",error,indexpos)); if (error != HA_ERR_END_OF_FILE) { @@ -895,11 +896,15 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, if (indexpos && idx && write_keys(param, fs_info, idx, buffpek_pointers, tempfile)) DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ - const ha_rows retval= - my_b_inited(tempfile) ? - (ha_rows) (my_b_tell(tempfile)/param->rec_length) : idx; + retval= (my_b_inited(tempfile) ? + (ha_rows) (my_b_tell(tempfile)/param->rec_length) : + idx); DBUG_PRINT("info", ("find_all_keys return %llu", (ulonglong) retval)); DBUG_RETURN(retval); + +err: + sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); + DBUG_RETURN(HA_POS_ERROR); } /* find_all_keys */ diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 7d57bbf4cb8..560e24e33c5 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1540,7 +1540,7 @@ end: head->file= org_file; /* Restore head->read_set (and write_set) to what they had before the call */ - head->column_bitmaps_set(save_read_set, save_write_set); + head->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); if (reset()) { @@ -11364,7 +11364,10 @@ int QUICK_RANGE_SELECT::reset() buf_size/= 2; } if (!mrr_buf_desc) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); + { + error= HA_ERR_OUT_OF_MEM; + goto err; + } /* Initialize the handler buffer. */ mrr_buf_desc->buffer= mrange_buff; From aed2050e40cb332d54e8d40eb7242309b962c4e1 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 1 Jan 2018 15:01:20 +0200 Subject: [PATCH 74/88] Ignore generated file rdb_source_revision.h --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b5cc5abdb0b..c8b6e22078d 100644 --- a/.gitignore +++ b/.gitignore @@ -190,6 +190,7 @@ storage/myisam/sp_test storage/rocksdb/ldb storage/rocksdb/mysql_ldb storage/rocksdb/sst_dump +storage/rocksdb/rdb_source_revision.h storage/tokudb/PerconaFT/buildheader/db.h storage/tokudb/PerconaFT/buildheader/make_tdb storage/tokudb/PerconaFT/buildheader/runcat.sh From b32b22babacc3c45e1e03a7e6efa066079d8a993 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 1 Jan 2018 19:38:58 +0200 Subject: [PATCH 75/88] Disable warnings in partion_alter_myisam Disabled warnings for directory option as this is depending on compilation options. --- mysql-test/suite/parts/t/partition_alter_myisam.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index b2bd0e72e4c..d3abb8842e1 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -7,12 +7,14 @@ # replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR; +--disable_warnings eval create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 partition by key(c1) ( partition p01 data directory = '$MYSQL_TMP_DIR' index directory = '$MYSQL_TMP_DIR', partition p02 data directory = '$MYSQL_TMP_DIR' index directory = '$MYSQL_TMP_DIR'); +--enable_warnings insert into t1 values (1, 1, repeat('a', 100)); insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; From 14e01bd86813b692cc69f38879f3ac3105ea9cf3 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 2 Jan 2018 02:03:12 +0200 Subject: [PATCH 76/88] Fixed simple failures: - openssl_1 errors where system dependent - Used not portable UINT32_MAX instead of UINT_MAX32 --- mysql-test/r/openssl_1.result | 2 +- mysql-test/t/openssl_1.test | 1 + sql/mysqld.cc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 40455f04c8c..ca8d71895e2 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -228,4 +228,4 @@ End of 5.1 tests /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -ERROR: Failed on connect: SSL connection error: No such file or directory +ERROR: Failed on connect: SSL connection error \ No newline at end of file diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 55f60880fbc..a3db700f787 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -260,6 +260,7 @@ set global sql_mode=default; # MDEV-9605 mysqlbinlog does not accept ssl-ca option as expected. # +--replace_regex /SSL connection error:.*/SSL connection error/ --error 1 --exec $MYSQL_BINLOG --read-from-remote-server --ssl-ca --user=root --host=localhost nobinlog.111111 2>&1 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5f10d980910..82ca7860195 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7240,7 +7240,7 @@ struct my_option my_long_options[]= "The value has to be a multiple of 256.", &opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0, GET_ULONG, REQUIRED_ARG, - /* def_value */ 8192, /* min_value */ 256, /* max_value */ UINT32_MAX-1, + /* def_value */ 8192, /* min_value */ 256, /* max_value */ UINT_MAX32-1, /* sub_size */ 0, /* block_size */ 256, /* app_type */ 0 }, From d384ead0f024995787b1f29bc672c33b0d3d40a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 2 Jan 2018 19:11:10 +0200 Subject: [PATCH 77/88] MDEV-14799 After UPDATE of indexed columns, old values will not be purged from secondary indexes This is a regression caused by MDEV-14051 'Undo log record is too big.' Purge in the secondary index is wrongly skipped in row_purge_upd_exist_or_extern() because node->row only does not contain all indexed columns. trx_undo_rec_get_partial_row(): Add the parameter for node->update so that the updated columns will be copied from the initial part of the undo log record. --- storage/innobase/include/trx0rec.h | 2 ++ storage/innobase/row/row0purge.c | 3 ++- storage/innobase/trx/trx0rec.c | 14 +++++++++++++- storage/xtradb/include/trx0rec.h | 2 ++ storage/xtradb/row/row0purge.c | 3 ++- storage/xtradb/trx/trx0rec.c | 14 +++++++++++++- 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index a6e54d6dfd1..6e3233c685b 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2017, 2018, 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 the Free Software @@ -193,6 +194,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c index 7b25612ba4b..f099eeb9aa9 100644 --- a/storage/innobase/row/row0purge.c +++ b/storage/innobase/row/row0purge.c @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2018, 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 the Free Software @@ -730,7 +731,7 @@ err_exit: if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { ptr = trx_undo_rec_get_partial_row( - ptr, clust_index, &node->row, + ptr, clust_index, node->update, &node->row, type == TRX_UNDO_UPD_DEL_REC, node->heap); } diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c index 94e22d688ca..19e934fc667 100644 --- a/storage/innobase/trx/trx0rec.c +++ b/storage/innobase/trx/trx0rec.c @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 the Free Software @@ -1072,6 +1072,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used @@ -1081,6 +1082,8 @@ trx_undo_rec_get_partial_row( { const byte* end_ptr; ulint row_len; + const upd_field_t* uf = update->fields; + const upd_field_t* const ue = update->fields + update->n_fields; ut_ad(index); ut_ad(ptr); @@ -1094,6 +1097,15 @@ trx_undo_rec_get_partial_row( dict_table_copy_types(*row, index->table); + + for (; uf != ue; uf++) { + ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; + ut_ad(uf->orig_len == UNIV_SQL_NULL + || uf->orig_len < UNIV_EXTERN_STORAGE_FIELD); + ut_ad(!dfield_is_ext(&uf->new_val)); + *dtuple_get_nth_field(*row, c) = uf->new_val; + } + end_ptr = ptr + mach_read_from_2(ptr); ptr += 2; diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h index a6e54d6dfd1..6e3233c685b 100644 --- a/storage/xtradb/include/trx0rec.h +++ b/storage/xtradb/include/trx0rec.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2017, 2018, 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 the Free Software @@ -193,6 +194,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used diff --git a/storage/xtradb/row/row0purge.c b/storage/xtradb/row/row0purge.c index 77d60edb71f..07ed57f55dd 100644 --- a/storage/xtradb/row/row0purge.c +++ b/storage/xtradb/row/row0purge.c @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2018, 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 the Free Software @@ -730,7 +731,7 @@ err_exit: if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { ptr = trx_undo_rec_get_partial_row( - ptr, clust_index, &node->row, + ptr, clust_index, node->update, &node->row, type == TRX_UNDO_UPD_DEL_REC, node->heap); } diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c index f3f1d9a2d96..17d51ecf8d2 100644 --- a/storage/xtradb/trx/trx0rec.c +++ b/storage/xtradb/trx/trx0rec.c @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 the Free Software @@ -1085,6 +1085,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used @@ -1094,6 +1095,8 @@ trx_undo_rec_get_partial_row( { const byte* end_ptr; ulint row_len; + const upd_field_t* uf = update->fields; + const upd_field_t* const ue = update->fields + update->n_fields; ut_ad(index); ut_ad(ptr); @@ -1107,6 +1110,15 @@ trx_undo_rec_get_partial_row( dict_table_copy_types(*row, index->table); + + for (; uf != ue; uf++) { + ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; + ut_ad(uf->orig_len == UNIV_SQL_NULL + || uf->orig_len < UNIV_EXTERN_STORAGE_FIELD); + ut_ad(!dfield_is_ext(&uf->new_val)); + *dtuple_get_nth_field(*row, c) = uf->new_val; + } + end_ptr = ptr + mach_read_from_2(ptr); ptr += 2; From 20fab71b144f85be9e2ccc145d24d257b0e9df7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 2 Jan 2018 21:41:39 +0200 Subject: [PATCH 78/88] Follow-up to MDEV-14799: Remove bogus debug assertions trx_undo_rec_get_partial_row(): When the PRIMARY KEY includes a column prefix of an externally stored column, the already parsed part of the undo log record may contain a reference to an off-page column. This is the case in the bug58912 test in innodb.innodb. --- storage/innobase/trx/trx0rec.c | 3 --- storage/xtradb/trx/trx0rec.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c index 19e934fc667..aba5e707c4f 100644 --- a/storage/innobase/trx/trx0rec.c +++ b/storage/innobase/trx/trx0rec.c @@ -1100,9 +1100,6 @@ trx_undo_rec_get_partial_row( for (; uf != ue; uf++) { ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; - ut_ad(uf->orig_len == UNIV_SQL_NULL - || uf->orig_len < UNIV_EXTERN_STORAGE_FIELD); - ut_ad(!dfield_is_ext(&uf->new_val)); *dtuple_get_nth_field(*row, c) = uf->new_val; } diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c index 17d51ecf8d2..167e6b356d3 100644 --- a/storage/xtradb/trx/trx0rec.c +++ b/storage/xtradb/trx/trx0rec.c @@ -1113,9 +1113,6 @@ trx_undo_rec_get_partial_row( for (; uf != ue; uf++) { ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; - ut_ad(uf->orig_len == UNIV_SQL_NULL - || uf->orig_len < UNIV_EXTERN_STORAGE_FIELD); - ut_ad(!dfield_is_ext(&uf->new_val)); *dtuple_get_nth_field(*row, c) = uf->new_val; } From b2115ce2353db77b1f89fd7acf83df205098f05e Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 2 Jan 2018 21:50:40 +0200 Subject: [PATCH 79/88] Rocksdb fails to build when the source and build directory are not the same. This is a follow up fix for MDEV-12458 --- storage/rocksdb/build_rocksdb.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index dd23304a223..5810412f566 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -6,6 +6,7 @@ endif() SET(ROCKSDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb) INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_BINARY_DIR} ${ROCKSDB_SOURCE_DIR} ${ROCKSDB_SOURCE_DIR}/include ${ROCKSDB_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src From 22b4f469caefeb255aaaa18956afcbae210a1fad Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 2 Jan 2018 18:18:47 +0200 Subject: [PATCH 80/88] MDEV-14813 rpl.rpl_ctype_latin1 fails in buildbot on Mac with wrong result Make rpl_ctype_latin1 more portable by printing names in hex Also only run if lower_case_table_names is 0, as this affects the result --- mysql-test/suite/rpl/r/rpl_ctype_latin1.result | 18 ++++++++++++------ mysql-test/suite/rpl/t/rpl_ctype_latin1.test | 8 ++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_ctype_latin1.result b/mysql-test/suite/rpl/r/rpl_ctype_latin1.result index 909aa639522..5399581ac26 100644 --- a/mysql-test/suite/rpl/r/rpl_ctype_latin1.result +++ b/mysql-test/suite/rpl/r/rpl_ctype_latin1.result @@ -10,13 +10,19 @@ SET NAMES latin1; CREATE TABLE `tё` (`tё` INT); CREATE VIEW `vё` AS SELECT 'vё'; CREATE PROCEDURE `pё`() SELECT 'pё'; +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "t%"; +hex(table_name) +74C391E28098 +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "v%"; +hex(table_name) +76C391E28098 connection slave; -SHOW TABLES LIKE 't%'; -Tables_in_test (t%) -tё -SHOW TABLES LIKE 'v%'; -Tables_in_test (v%) -vё +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "t%"; +hex(table_name) +74C391E28098 +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "v%"; +hex(table_name) +76C391E28098 SHOW PROCEDURE STATUS LIKE 'p%'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test pё PROCEDURE root@localhost ts ts DEFINER latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/suite/rpl/t/rpl_ctype_latin1.test b/mysql-test/suite/rpl/t/rpl_ctype_latin1.test index a736d1a6485..a85254214d2 100644 --- a/mysql-test/suite/rpl/t/rpl_ctype_latin1.test +++ b/mysql-test/suite/rpl/t/rpl_ctype_latin1.test @@ -1,3 +1,4 @@ +--source include/have_lowercase0.inc --disable_warnings --source include/master-slave.inc --enable_warnings @@ -25,9 +26,12 @@ CREATE TABLE `tё` (`tё` INT); CREATE VIEW `vё` AS SELECT 'vё'; CREATE PROCEDURE `pё`() SELECT 'pё'; +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "t%"; +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "v%"; + --sync_slave_with_master -SHOW TABLES LIKE 't%'; -SHOW TABLES LIKE 'v%'; +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "t%"; +select hex(table_name) from information_schema.tables where table_schema="test" and table_name like "v%"; --replace_column 5 ts 6 ts SHOW PROCEDURE STATUS LIKE 'p%'; From 83a8b0e9d3cbc43d2a574db31f593f299200dc75 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 2 Jan 2018 20:42:42 +0200 Subject: [PATCH 81/88] Fixed compiler warning --- extra/mariabackup/xtrabackup.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 04e33fa389e..375d8845a2a 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3030,7 +3030,7 @@ xb_validate_name( exit(EXIT_FAILURE); } p = strpbrk(name, "/\\~"); - if (p && p - name < NAME_LEN) { + if (p && (uint) (p - name) < NAME_LEN) { msg("mariabackup: name `%s` is not valid.\n", name); exit(EXIT_FAILURE); } From 6f28f78429da8c63a47286e28fab9a613387497d Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 2 Jan 2018 20:43:29 +0200 Subject: [PATCH 82/88] More output in galera.query_cache.test This is to be able to better track where things goes wrong --- mysql-test/suite/galera/r/query_cache.result | 150 ++++++++++++++----- mysql-test/suite/galera/t/query_cache.test | 89 +++++++---- 2 files changed, 170 insertions(+), 69 deletions(-) diff --git a/mysql-test/suite/galera/r/query_cache.result b/mysql-test/suite/galera/r/query_cache.result index 4aaae2997f3..d497fc87544 100644 --- a/mysql-test/suite/galera/r/query_cache.result +++ b/mysql-test/suite/galera/r/query_cache.result @@ -820,6 +820,9 @@ Qcache_queries_in_cache 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 9 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 21 insert delayed into t1 values (4); select a from t1; a @@ -870,6 +873,9 @@ Qcache_queries_in_cache 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 9 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 22 # On node-2 connection node_2; show global variables like "query_cache_min_res_unit"; @@ -916,12 +922,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 24 # On node-2 connection node_2; select * from t1; @@ -944,12 +953,12 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 10 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 10 drop table t1; select a from t2; a @@ -961,12 +970,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 18 set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; Variable_name Value @@ -983,12 +995,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 25 drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -1010,6 +1025,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 27 # On node-2 connection node_2; select "aaa" from t1; @@ -1024,6 +1042,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 20 drop table t1; # On node-1 connection node_1; @@ -1322,6 +1343,9 @@ select count(*) from t1; count(*) 140 drop table t1; +# +# INTO OUTFILE/DUMPFILE test +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1342,7 +1366,13 @@ Qcache_queries_in_cache 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 36 drop table t1; +# +# Test of SQL_SELECT_LIMIT +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1367,6 +1397,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 38 SET SQL_SELECT_LIMIT=DEFAULT; # On node-2 connection node_2; @@ -1392,6 +1425,9 @@ Variable_name Value Qcache_hits 11 SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; +# +# WRITE LOCK & QC +# # On node-1 connection node_1; create table t1 (a int not null) engine=innodb; @@ -1408,6 +1444,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 40 lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; Variable_name Value @@ -1431,6 +1470,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 41 unlock table; drop view v1; set query_cache_wlock_invalidate=default; @@ -1471,10 +1513,16 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 34 unlock table; drop view v1; set query_cache_wlock_invalidate=default; drop table t1,t2; +# +# Hiding real table stored in query cache by temporary table +# # On node-1 connection node_1; create table t1 (id int primary key) engine=innodb; @@ -1498,92 +1546,119 @@ SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â'  0  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 43 set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â'  0  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 44 set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ? '?'='?' ? 1 ? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 3 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 45 set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ? 'â'='Â' ? 1 ? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 4 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 46 SET NAMES default; # On node-2 connection node_2; +# +# Run select +# SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â' ?  0 ?  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; a ?? 'â'='Â' ? ?? 1 ? ?? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 36 set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ?? '??'='?' ? ?? 1 ? ?? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 3 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 37 set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ? 'â'='Â' ? 1 ? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 4 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 38 drop table t1; +# +# Comments before command +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1634,6 +1709,9 @@ show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 drop table t1; +# +# Information schema & query cache test +# # On node-1 connection node_1; set session query_cache_type = 2; diff --git a/mysql-test/suite/galera/t/query_cache.test b/mysql-test/suite/galera/t/query_cache.test index e024b308fab..13b21eca6e7 100644 --- a/mysql-test/suite/galera/t/query_cache.test +++ b/mysql-test/suite/galera/t/query_cache.test @@ -448,6 +448,7 @@ select * from t1; select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; insert delayed into t1 values (4); --sleep 5 # Wait for insert delayed to be executed. select a from t1; @@ -474,6 +475,7 @@ show status like "Qcache_hits"; --connection node_1 show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Test of min result data unit size changing @@ -497,8 +499,9 @@ select * from t1; select * from t1; select * from t2; select * from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; --echo # On node-2 --connection node_2 @@ -506,13 +509,14 @@ select * from t1; select * from t1; select * from t2; select * from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; drop table t1; select a from t2; select a from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -520,8 +524,9 @@ show global variables like "query_cache_min_res_unit"; --connection node_1 select a from t2; select a from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -537,6 +542,7 @@ select "aaa" from t1; select "AAA" from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; --echo # On node-2 --connection node_2 @@ -544,6 +550,7 @@ select "aaa" from t1; select "AAA" from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; # @@ -728,9 +735,9 @@ select count(*) from t1; drop table t1; -# -# INTO OUTFILE/DUMPFILE test -# +--echo # +--echo # INTO OUTFILE/DUMPFILE test +--echo # --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -743,14 +750,15 @@ select * from t1 into outfile "query_cache.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; let $datadir=`select @@datadir`; --remove_file $datadir/test/query_cache.dump.file --remove_file $datadir/test/query_cache.out.file -# -# Test of SQL_SELECT_LIMIT -# +--echo # +--echo # Test of SQL_SELECT_LIMIT +--echo # --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -762,6 +770,7 @@ SET SQL_SELECT_LIMIT=1; select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; SET SQL_SELECT_LIMIT=DEFAULT; --echo # On node-2 @@ -777,9 +786,9 @@ SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; -# -# WRITE LOCK & QC -# +--echo # +--echo # WRITE LOCK & QC +--echo # --echo # On node-1 --connection node_1 create table t1 (a int not null) engine=innodb; @@ -791,6 +800,7 @@ select * from t1; select * from t2; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -802,6 +812,7 @@ show status like "Qcache_hits"; lock table v1 write; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; unlock table; drop view v1; set query_cache_wlock_invalidate=default; @@ -825,15 +836,16 @@ show status like "Qcache_hits"; lock table v1 write; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; unlock table; drop view v1; set query_cache_wlock_invalidate=default; drop table t1,t2; -# -# Hiding real table stored in query cache by temporary table -# +--echo # +--echo # Hiding real table stored in query cache by temporary table +--echo # --echo # On node-1 --connection node_1 create table t1 (id int primary key) engine=innodb; @@ -866,66 +878,76 @@ INSERT INTO t1 VALUES (_koi8r 0xc3),(_koi8r 0xc3); # Run select # SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; SET NAMES default; --echo # On node-2 --connection node_2 -# -# Run select -# + +--echo # +--echo # Run select +--echo # + SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; # # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; -# -# Comments before command -# +--echo # +--echo # Comments before command +--echo # + --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -951,9 +973,10 @@ show status like "Qcache_hits"; drop table t1; -# -# Information schema & query cache test -# +--echo # +--echo # Information schema & query cache test +--echo # + --echo # On node-1 --connection node_1 set session query_cache_type = 2; From 16cd55a33aa14849fe25a4b9224fa4904041733c Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 3 Jan 2018 01:05:25 +0200 Subject: [PATCH 83/88] Fixed crashing bug in mysqlbinlog - The fix in mf_iocache2.c was just to fix a compiler warning --- mysys/mf_iocache2.c | 4 ++-- sql/log_event.cc | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 5c888d840e2..ef163ee24d3 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -266,11 +266,11 @@ my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len) ++p; count= p - start; if (count && my_b_write(info, start, count)) - return (size_t)-1; + return 1; if (p >= end) break; if (my_b_write(info, (uchar *)"``", 2)) - return (size_t)-1; + return 1; ++p; } return (my_b_write(info, (uchar *)"`", 1)); diff --git a/sql/log_event.cc b/sql/log_event.cc index ab8c1a1acad..7f65a2727f9 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3405,9 +3405,12 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta) return (meta <= 4 ? meta : 0); case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: length= meta; - return length < 256 ? length + 1 : length + 2; + /* Fall trough */ + case MYSQL_TYPE_STRING: + if (length < 256) + return (uint) *ptr + 1; + return uint2korr(ptr) + 2; case MYSQL_TYPE_DECIMAL: break; default: @@ -3506,6 +3509,7 @@ void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info) &m_cols, value))) break; value+= length; + DBUG_ASSERT(value <= m_rows_end); /* Print the second image (for UPDATE only) */ if (row_events == 2) @@ -3514,6 +3518,7 @@ void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info) &m_cols_ai, value))) break; value+= length; + DBUG_ASSERT(value <= m_rows_end); } } delete td; @@ -3531,7 +3536,7 @@ bool Rows_log_event::print_verbose(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info) { Table_map_log_event *map; - table_def *td; + table_def *td= 0; const char *sql_command, *sql_clause1, *sql_clause2; const char *sql_command_short __attribute__((unused)); Log_event_type general_type_code= get_general_type_code(); From 7a9fee9853c19c1d6d547cd17f87e9bd8f4ebbaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 2 Jan 2018 09:25:37 +0200 Subject: [PATCH 84/88] MDEV-13568 gcol.innodb_virtual_debug_purge failed in buildbot with wrong result The InnoDB background tasks can modify tables while LOCK TABLES...WRITE is in effect. The purge of InnoDB history always worked like this in MariaDB, but in MySQL 5.7 it sometimes yields to LOCK TABLES. Also, make gcol.innodb_virtual_index run the purge for an UPDATE before DROP TABLE is executed. --- mysql-test/suite/gcol/disabled.def | 1 - .../suite/gcol/r/innodb_virtual_debug_purge.result | 11 +++-------- mysql-test/suite/gcol/r/innodb_virtual_index.result | 4 ++++ .../suite/gcol/t/innodb_virtual_debug_purge.test | 7 +++---- mysql-test/suite/gcol/t/innodb_virtual_index.test | 6 ++++++ mysql-test/unstable-tests | 3 ++- 6 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 mysql-test/suite/gcol/disabled.def diff --git a/mysql-test/suite/gcol/disabled.def b/mysql-test/suite/gcol/disabled.def deleted file mode 100644 index 37209a4c353..00000000000 --- a/mysql-test/suite/gcol/disabled.def +++ /dev/null @@ -1 +0,0 @@ -innodb_virtual_debug_purge : MDEV-13568 should purge yield to LOCK TABLES? diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result index 7d1d1d30198..ac4be0dcc6c 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -143,20 +143,15 @@ connect prevent_purge, localhost, root; start transaction with consistent snapshot; connection default; update t set a = repeat('m', 16000) where a like "aaa%"; -connect con1, localhost, root; +connect lock_table, localhost, root; lock table t write; disconnect prevent_purge; connection default; -select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; -variable_value>1 -1 -disconnect con1; +InnoDB 0 transactions not purged +disconnect lock_table; start transaction with consistent snapshot; commit; InnoDB 0 transactions not purged -select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; -variable_value>1 -0 set global debug_dbug=@old_dbug; drop table t; set debug_sync=reset; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result index 375c62bd173..b1f7976c6c0 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_index.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -1,3 +1,5 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; # # Bug 21922176 - PREBUILT->SEARCH_TUPLE CREATED WITHOUT INCLUDING # THE NUMBER OF VIRTUAL COLUMNS @@ -86,6 +88,7 @@ DISTINCT I1.c14 AS y FROM t1 AS I1 ORDER BY I1.c14); SET @@SESSION.sql_mode=default; +InnoDB 0 transactions not purged DROP TABLE t1, t2, t3; # # Bug 22650296 - ASSERTION IN INNOBASE_BUILD_COL_MAP, ALTER @@ -194,3 +197,4 @@ ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col1 % col2) VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 2668e26c976..1862de268af 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -182,16 +182,15 @@ connect(prevent_purge, localhost, root); start transaction with consistent snapshot; connection default; update t set a = repeat('m', 16000) where a like "aaa%"; -connect(con1, localhost, root); +connect(lock_table, localhost, root); lock table t write; disconnect prevent_purge; connection default; -select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; -disconnect con1; +--source ../../innodb/include/wait_all_purged.inc +disconnect lock_table; start transaction with consistent snapshot; commit; --source ../../innodb/include/wait_all_purged.inc -select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; set global debug_dbug=@old_dbug; drop table t; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test index 4c4cb2a2d05..432faeb65ae 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_index.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +# Ensure that the history list length will actually be decremented by purge. +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + --echo # --echo # Bug 21922176 - PREBUILT->SEARCH_TUPLE CREATED WITHOUT INCLUDING --echo # THE NUMBER OF VIRTUAL COLUMNS @@ -96,6 +100,7 @@ FROM t1 AS I1 ORDER BY I1.c14); SET @@SESSION.sql_mode=default; +--source ../../innodb/include/wait_all_purged.inc DROP TABLE t1, t2, t3; @@ -218,3 +223,4 @@ ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col1 % col2) VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index dff89fdf60d..4940faa944a 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -168,7 +168,8 @@ galera_3nodes.* : Suite is not stable yet gcol.innodb_virtual_basic : Modified in 10.2.11 gcol.innodb_virtual_debug : Modified in 10.2.11 -gcol.innodb_virtual_debug_purge : MDEV-13568 - Wrong result +gcol.innodb_virtual_debug_purge : Modified in 10.2.12 +gcol.innodb_virtual_index : Modified in 10.2.12 gcol.innodb_virtual_rebuild : Added in 10.2.11 gcol.innodb_virtual_stats : Added in 10.2.12 From 9eb3fcc9fbccfb13ad26e5d9faa0f70b580f291e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 3 Jan 2018 14:30:58 +0200 Subject: [PATCH 85/88] Follow-up fix of MDEV-14717 RENAME TABLE in InnoDB is not crash-safe trx_undo_page_report_rename(): Return a pointer to the start of the undo log record, not to the start of the (not yet written) next free record. The wrong return value would sometimes cause ROLLBACK to crash in an assertion failure (trying to parse garbage from the free area at the end of the insert_undo log page) if the TRX_UNDO_RENAME_TABLE record was the very last thing that was written to the insert_undo log. This would occasionally happen when an ALTER TABLE operation is rolled back due to invalid FOREIGN KEY constraints in the innodb.innodb test. In these tests, the error ER_ERROR_ON_RENAME (1025) would be returned at the end of the ALGORITHM=COPY operation of ALTER TABLE. --- storage/innobase/trx/trx0rec.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 0b04c5c4ea0..4ef63938e70 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1866,8 +1866,9 @@ ulint trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table, buf_block_t* block, mtr_t* mtr) { - ulint first_free = mach_read_from_2(block->frame + TRX_UNDO_PAGE_HDR - + TRX_UNDO_PAGE_FREE); + byte* ptr_first_free = TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE + + block->frame; + ulint first_free = mach_read_from_2(ptr_first_free); ut_ad(first_free >= TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE); ut_ad(first_free <= UNIV_PAGE_SIZE); byte* start = block->frame + first_free; @@ -1895,11 +1896,10 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table, ptr += 2; ulint offset = page_offset(ptr); mach_write_to_2(start, offset); - mach_write_to_2(block->frame + TRX_UNDO_PAGE_HDR - + TRX_UNDO_PAGE_FREE, offset); + mach_write_to_2(ptr_first_free, offset); trx_undof_page_add_undo_rec_log(block->frame, first_free, offset, mtr); - return offset; + return first_free; } /** Report a RENAME TABLE operation. From 84c9c8b2e9d68d7014e8b3e17e0d6df8efb3215b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 3 Jan 2018 15:01:17 +0200 Subject: [PATCH 86/88] Silence some -Wimplicit-fallthrough by proper spelling --- sql/sql_cache.cc | 2 +- storage/maria/ma_search.c | 14 +++++++------- storage/myisam/mi_search.c | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index ad0472cfc2c..2ec870f314f 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1757,7 +1757,7 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) sql++; continue; } - /* fall trough */ + /* fall through */ default: break; } diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c index d38bc7af26c..5b0e19b1837 100644 --- a/storage/maria/ma_search.c +++ b/storage/maria/ma_search.c @@ -747,11 +747,11 @@ void _ma_kpointer(register MARIA_HA *info, register uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; @@ -883,13 +883,13 @@ void _ma_dpointer(MARIA_SHARE *share, uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 8: *buff++=0; - /* fall trough */ + /* fall through */ case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 01fa10de7a3..be39849afd4 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -608,11 +608,11 @@ void _mi_kpointer(register MI_INFO *info, register uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; @@ -729,13 +729,13 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 8: *buff++=0; - /* fall trough */ + /* fall through */ case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; From af0ba43838b6d9592a464073719472c71289c7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 3 Jan 2018 22:21:32 +0200 Subject: [PATCH 87/88] Do not misspell "fall through" --- sql/sql_trigger.cc | 2 +- sql/table.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 21a79967244..0d0f8c4c309 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1595,7 +1595,7 @@ err_with_lex_cleanup: thd->spcont= save_spcont; thd->variables.sql_mode= save_sql_mode; thd->reset_db(save_db.str, save_db.length); - /* Fall trough to error */ + /* Fall through to error */ } } diff --git a/sql/table.cc b/sql/table.cc index ff8f590b1a6..33f408f958a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -7419,7 +7419,6 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) swap_values= 1; break; case VCOL_UPDATE_FOR_DELETE: - /* Fall trough */ case VCOL_UPDATE_FOR_WRITE: update= bitmap_is_set(vcol_set, vf->field_index); break; From 1a1bda2222e0c2ab41baed1510f6fbca80c20d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 3 Jan 2018 22:43:41 +0200 Subject: [PATCH 88/88] Do not misspell "fall through" --- sql/log_event.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 7f65a2727f9..d884947390a 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3406,7 +3406,7 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta) case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: length= meta; - /* Fall trough */ + /* fall through */ case MYSQL_TYPE_STRING: if (length < 256) return (uint) *ptr + 1;