summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-01-13 09:28:25 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2023-01-13 09:28:25 +0200
commit71e8e4934db06c02db1b51716e9d4b3992505161 (patch)
treeb10867d38205b2cf55365491d3533cb34facb5b7
parent12618cfb28cb2843dc74bb3a176dae76acdb698a (diff)
parent7a98d232e42b66efc759d584b05214e91681c346 (diff)
downloadmariadb-git-71e8e4934db06c02db1b51716e9d4b3992505161.tar.gz
Merge 10.3 into 10.4
-rw-r--r--mysql-test/main/join_outer.result85
-rw-r--r--mysql-test/main/join_outer.test85
-rw-r--r--mysql-test/main/join_outer_jcl6.result85
-rw-r--r--mysql-test/suite/binlog/r/binlog_verbose_compressed_fields.result15
-rw-r--r--mysql-test/suite/binlog/t/binlog_verbose_compressed_fields.test70
-rw-r--r--mysql-test/suite/versioning/r/foreign.result39
-rw-r--r--mysql-test/suite/versioning/t/foreign.test46
-rw-r--r--scripts/mysqlaccess.sh2
-rw-r--r--scripts/wsrep_sst_common.sh132
-rw-r--r--scripts/wsrep_sst_mariabackup.sh51
-rw-r--r--scripts/wsrep_sst_rsync.sh104
-rw-r--r--sql/item.h8
-rw-r--r--sql/log_event.cc17
-rw-r--r--sql/opt_range.h8
-rw-r--r--sql/sql_cache.h2
-rw-r--r--sql/sql_insert.cc1
-rw-r--r--sql/sys_vars.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/lock/lock0lock.cc8
-rw-r--r--storage/perfschema/pfs_timer.cc4
20 files changed, 688 insertions, 80 deletions
diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result
index b7fcb55e4fe..8048df5f1f5 100644
--- a/mysql-test/main/join_outer.result
+++ b/mysql-test/main/join_outer.result
@@ -1,4 +1,5 @@
drop table if exists t0,t1,t2,t3,t4,t5;
+drop view if exists v0,v1,v2,v3;
SET @org_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off');
set join_cache_level=1;
@@ -2825,5 +2826,89 @@ WHERE t3.pk IN (2);
1
drop view v4;
drop table t1,t2,t3,t4;
+#
+# MDEV-28602 Wrong result with outer join, merged derived table and view
+#
+create table t1 (
+Election int(10) unsigned NOT NULL
+);
+insert into t1 (Election) values (1);
+create table t2 (
+VoteID int(10),
+ElectionID int(10),
+UserID int(10)
+);
+insert into t2 (ElectionID, UserID) values (2, 30), (3, 30);
+create view v1 as select * from t1
+left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T
+on T.ElectionID = t1.Election
+limit 9;
+select * from v1;
+Election Voted ElectionID
+1 NULL NULL
+drop table t1, t2;
+drop view v1;
+#
+# and another contrived example showing a bit of heirarchy
+#
+create table t10 (a int);
+create table t20 (b int);
+insert into t10 values (1),(2);
+insert into t20 values (1),(3);
+create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3;
+create table t30 (c int);
+insert into t30 values (1),(3);
+create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6;
+select * from v20 limit 9;
+c x u y b
+1 X U Y 1
+3 NULL NULL NULL NULL
+drop view v10, v20;
+drop table t10, t20, t30;
+#
+# More complex testcase
+#
+create table t2 (b int);
+insert into t2 values (3),(7),(1);
+create table t3 (c int);
+insert into t3 values (3),(1);
+create table t1 (a int);
+insert into t1 values (1),(2),(7),(1);
+select * from
+(
+select * from
+(select 'Z' as z, t1.a from t1) dt1
+left join
+(select 'Y' as y, t2.b from t2) dt2
+left join
+(select 'X' as x, t3.c from t3) dt3
+on dt2.b=dt3.c
+on dt1.a=dt2.b
+limit 9
+) dt;
+z a y b x c
+Z 1 Y 1 X 1
+Z 2 NULL NULL NULL NULL
+Z 7 Y 7 NULL NULL
+Z 1 Y 1 X 1
+create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3;
+create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2;
+create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c;
+create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9;
+select * from v1;
+z a y b x c
+Z 1 Y 1 X 1
+Z 2 NULL NULL NULL NULL
+Z 7 Y 7 NULL NULL
+Z 1 Y 1 X 1
+set statement join_cache_level=0 for
+select * from v1;
+z a y b x c
+Z 1 Y 1 X 1
+Z 2 NULL NULL NULL NULL
+Z 7 Y 7 NULL NULL
+Z 1 Y 1 X 1
+drop view v0, v1, v2, v3;
+drop table t1, t2, t3;
# end of 10.3 tests
SET optimizer_switch=@org_optimizer_switch;
diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test
index ff74e5280e7..5e1e83e4049 100644
--- a/mysql-test/main/join_outer.test
+++ b/mysql-test/main/join_outer.test
@@ -6,6 +6,7 @@
--disable_warnings
drop table if exists t0,t1,t2,t3,t4,t5;
+drop view if exists v0,v1,v2,v3;
--enable_warnings
SET @org_optimizer_switch=@@optimizer_switch;
@@ -2341,6 +2342,90 @@ WHERE t3.pk IN (2);
drop view v4;
drop table t1,t2,t3,t4;
+--echo #
+--echo # MDEV-28602 Wrong result with outer join, merged derived table and view
+--echo #
+
+create table t1 (
+ Election int(10) unsigned NOT NULL
+);
+
+insert into t1 (Election) values (1);
+
+create table t2 (
+ VoteID int(10),
+ ElectionID int(10),
+ UserID int(10)
+);
+
+insert into t2 (ElectionID, UserID) values (2, 30), (3, 30);
+create view v1 as select * from t1
+ left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T
+ on T.ElectionID = t1.Election
+limit 9;
+# limit X causes merge algorithm select as opposed to temp table
+select * from v1;
+drop table t1, t2;
+drop view v1;
+
+--echo #
+--echo # and another contrived example showing a bit of heirarchy
+--echo #
+create table t10 (a int);
+create table t20 (b int);
+insert into t10 values (1),(2);
+insert into t20 values (1),(3);
+create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3;
+create table t30 (c int);
+insert into t30 values (1),(3);
+create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6;
+select * from v20 limit 9;
+drop view v10, v20;
+drop table t10, t20, t30;
+
+--echo #
+--echo # More complex testcase
+--echo #
+create table t2 (b int);
+insert into t2 values (3),(7),(1);
+create table t3 (c int);
+insert into t3 values (3),(1);
+create table t1 (a int);
+insert into t1 values (1),(2),(7),(1);
+
+select * from
+(
+ select * from
+ (select 'Z' as z, t1.a from t1) dt1
+ left join
+ (select 'Y' as y, t2.b from t2) dt2
+ left join
+ (select 'X' as x, t3.c from t3) dt3
+ on dt2.b=dt3.c
+ on dt1.a=dt2.b
+ limit 9
+) dt;
+
+## Same as dt3 above
+create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3;
+
+## Same as dt2 above
+create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2;
+
+## Same as (...) in the "... dt1 left join (...)" above
+create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c;
+
+# Same as above select statement
+create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9;
+
+select * from v1;
+
+set statement join_cache_level=0 for
+select * from v1;
+
+drop view v0, v1, v2, v3;
+drop table t1, t2, t3;
+
--echo # end of 10.3 tests
SET optimizer_switch=@org_optimizer_switch;
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index 3cb846426fe..f483f5bb634 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -6,6 +6,7 @@ set @@join_cache_level=6;
set @optimizer_switch_for_join_outer_test=@@optimizer_switch;
set @join_cache_level_for_join_outer_test=@@join_cache_level;
drop table if exists t0,t1,t2,t3,t4,t5;
+drop view if exists v0,v1,v2,v3;
SET @org_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off');
set join_cache_level=@join_cache_level_for_join_outer_test;
@@ -2832,5 +2833,89 @@ WHERE t3.pk IN (2);
1
drop view v4;
drop table t1,t2,t3,t4;
+#
+# MDEV-28602 Wrong result with outer join, merged derived table and view
+#
+create table t1 (
+Election int(10) unsigned NOT NULL
+);
+insert into t1 (Election) values (1);
+create table t2 (
+VoteID int(10),
+ElectionID int(10),
+UserID int(10)
+);
+insert into t2 (ElectionID, UserID) values (2, 30), (3, 30);
+create view v1 as select * from t1
+left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T
+on T.ElectionID = t1.Election
+limit 9;
+select * from v1;
+Election Voted ElectionID
+1 NULL NULL
+drop table t1, t2;
+drop view v1;
+#
+# and another contrived example showing a bit of heirarchy
+#
+create table t10 (a int);
+create table t20 (b int);
+insert into t10 values (1),(2);
+insert into t20 values (1),(3);
+create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3;
+create table t30 (c int);
+insert into t30 values (1),(3);
+create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6;
+select * from v20 limit 9;
+c x u y b
+1 X U Y 1
+3 NULL NULL NULL NULL
+drop view v10, v20;
+drop table t10, t20, t30;
+#
+# More complex testcase
+#
+create table t2 (b int);
+insert into t2 values (3),(7),(1);
+create table t3 (c int);
+insert into t3 values (3),(1);
+create table t1 (a int);
+insert into t1 values (1),(2),(7),(1);
+select * from
+(
+select * from
+(select 'Z' as z, t1.a from t1) dt1
+left join
+(select 'Y' as y, t2.b from t2) dt2
+left join
+(select 'X' as x, t3.c from t3) dt3
+on dt2.b=dt3.c
+on dt1.a=dt2.b
+limit 9
+) dt;
+z a y b x c
+Z 1 Y 1 X 1
+Z 1 Y 1 X 1
+Z 7 Y 7 NULL NULL
+Z 2 NULL NULL NULL NULL
+create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3;
+create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2;
+create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c;
+create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9;
+select * from v1;
+z a y b x c
+Z 1 Y 1 X 1
+Z 1 Y 1 X 1
+Z 7 Y 7 NULL NULL
+Z 2 NULL NULL NULL NULL
+set statement join_cache_level=0 for
+select * from v1;
+z a y b x c
+Z 1 Y 1 X 1
+Z 2 NULL NULL NULL NULL
+Z 7 Y 7 NULL NULL
+Z 1 Y 1 X 1
+drop view v0, v1, v2, v3;
+drop table t1, t2, t3;
# end of 10.3 tests
SET optimizer_switch=@org_optimizer_switch;
diff --git a/mysql-test/suite/binlog/r/binlog_verbose_compressed_fields.result b/mysql-test/suite/binlog/r/binlog_verbose_compressed_fields.result
new file mode 100644
index 00000000000..6ee11754935
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_verbose_compressed_fields.result
@@ -0,0 +1,15 @@
+CREATE TABLE t1 (a TEXT, ac TEXT COMPRESSED, b TINYTEXT, bc TINYTEXT COMPRESSED, c MEDIUMTEXT, cc MEDIUMTEXT COMPRESSED, d LONGTEXT, dc LONGTEXT COMPRESSED, e VARCHAR(10), ec VARCHAR(10) COMPRESSED);
+# Isolate row event into its own binary log
+FLUSH BINARY LOGS;
+INSERT INTO t1 VALUES ('mya', 'myac', 'myb', 'mybc', 'myc', 'mycc', 'myd', 'mydc', 'mye', 'myec');
+FLUSH BINARY LOGS;
+# MYSQLBINLOG --base64-output=decode-rows -vv datadir/binlog_file --result-file=result_binlog
+include/assert_grep.inc [Ensure compressed TEXT fields are annotated correctly]
+include/assert_grep.inc [Ensure compressed TINYTEXT fields are annotated correctly]
+include/assert_grep.inc [Ensure compressed MEDIUMTEXT fields are annotated correctly]
+include/assert_grep.inc [Ensure compressed LONGTEXT fields are annotated correctly]
+include/assert_grep.inc [Ensure compressed VARSTRING fields are annotated correctly]
+include/assert_grep.inc [Ensure COMPRESSED only shows up for corresponding fields]
+include/assert_grep.inc [Ensure non-compressed TEXT fields are annotated correctly]
+include/assert_grep.inc [Ensure non-compressed VARSTRING fields are annotated correctly]
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_verbose_compressed_fields.test b/mysql-test/suite/binlog/t/binlog_verbose_compressed_fields.test
new file mode 100644
index 00000000000..8cbcdbef601
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_verbose_compressed_fields.test
@@ -0,0 +1,70 @@
+#
+# Purpose:
+# This test validates that mysqlbinlog is able to annotate compressed column
+# types with two levels of verbosity.
+#
+# Methodology:
+# Validate that the output from mysqlbinlog -vv after creating and inserting
+# into a table with compressed and uncompressed fields correctly annotates
+# which columns are compressed
+#
+# References:
+# MDEV-25277: mysqlbinlog --verbose cannot read row events with compressed
+# columns: Don't know how to handle column type: 140
+#
+--source include/have_binlog_format_row.inc
+
+CREATE TABLE t1 (a TEXT, ac TEXT COMPRESSED, b TINYTEXT, bc TINYTEXT COMPRESSED, c MEDIUMTEXT, cc MEDIUMTEXT COMPRESSED, d LONGTEXT, dc LONGTEXT COMPRESSED, e VARCHAR(10), ec VARCHAR(10) COMPRESSED);
+
+--echo # Isolate row event into its own binary log
+FLUSH BINARY LOGS;
+INSERT INTO t1 VALUES ('mya', 'myac', 'myb', 'mybc', 'myc', 'mycc', 'myd', 'mydc', 'mye', 'myec');
+FLUSH BINARY LOGS;
+
+--let $binlog_file= query_get_value(SHOW BINARY LOGS, Log_name, 2)
+--let $datadir= `SELECT @@datadir`
+--let $result_binlog= $MYSQLTEST_VARDIR/tmp/$binlog_file
+
+--echo # MYSQLBINLOG --base64-output=decode-rows -vv datadir/binlog_file --result-file=result_binlog
+--exec $MYSQL_BINLOG --base64-output=decode-rows -vv $datadir/$binlog_file --result-file=$result_binlog
+
+--let $assert_file= $result_binlog
+--let $assert_count= 1
+
+--let $assert_text= Ensure compressed TEXT fields are annotated correctly
+--let $assert_select=\WTEXT COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure compressed TINYTEXT fields are annotated correctly
+--let $assert_select=\WTINYTEXT COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure compressed MEDIUMTEXT fields are annotated correctly
+--let $assert_select=\WMEDIUMTEXT COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure compressed LONGTEXT fields are annotated correctly
+--let $assert_select=\WLONGTEXT COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure compressed VARSTRING fields are annotated correctly
+--let $assert_select=\WVARSTRING\(\d+\) COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure COMPRESSED only shows up for corresponding fields
+--let $assert_count= 5
+--let $assert_select= COMPRESSED
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure non-compressed TEXT fields are annotated correctly
+--let $assert_count= 8
+--let $assert_select=/*.*TEXT
+--source include/assert_grep.inc
+
+--let $assert_text= Ensure non-compressed VARSTRING fields are annotated correctly
+--let $assert_count= 2
+--let $assert_select=/*.*VARSTRING
+--source include/assert_grep.inc
+
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index ae53511d7e0..51d793f0cf8 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -495,3 +495,42 @@ set foreign_key_checks= on;
delete history from t1;
delete from t1;
drop table t1;
+#
+# MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT
+# constraint
+#
+create table t0 (pk integer primary key) with system versioning engine=innodb;
+create table t1 (pk integer primary key,
+foreign key(pk) references t0(pk)
+on delete restrict on update cascade) engine=innodb;
+create table t2 (pk integer);
+insert into t0 (pk) values (1);
+insert into t1 (pk) values (1);
+insert into t2 (pk) values (1);
+delete from t0;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE)
+replace t0 values (1);
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE)
+select * into outfile 'load_t0' from t0 ;
+load data infile 'load_t0' replace into table t0;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE)
+delete t0, t2 from t0 join t2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE)
+select pk from t0;
+pk
+1
+# Cleanup
+drop table t1, t0, t2;
+# create_select for a temporary table didn't set up pos_in_locked_tables.
+create table t (a int unique) engine=innodb
+replace select 1 as a, 2 as b union select 1 as a, 3 as c;
+select * from t;
+a b
+1 3
+drop table t;
+create temporary table t (a int unique) engine=innodb
+replace select 1 as a, 2 as b union select 1 as a, 3 as c;
+select * from t;
+a b
+1 3
+drop table t;
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 3548a9b301b..532086b791d 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -527,4 +527,50 @@ delete from t1;
# cleanup
drop table t1;
+--echo #
+--echo # MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT
+--echo # constraint
+--echo #
+create table t0 (pk integer primary key) with system versioning engine=innodb;
+create table t1 (pk integer primary key,
+ foreign key(pk) references t0(pk)
+ on delete restrict on update cascade) engine=innodb;
+create table t2 (pk integer);
+
+insert into t0 (pk) values (1);
+insert into t1 (pk) values (1);
+insert into t2 (pk) values (1);
+
+--error ER_ROW_IS_REFERENCED_2
+delete from t0;
+
+--error ER_ROW_IS_REFERENCED_2
+replace t0 values (1);
+
+select * into outfile 'load_t0' from t0 ;
+--error ER_ROW_IS_REFERENCED_2
+load data infile 'load_t0' replace into table t0;
+
+--error ER_ROW_IS_REFERENCED_2
+delete t0, t2 from t0 join t2;
+
+select pk from t0;
+
+--echo # Cleanup
+drop table t1, t0, t2;
+--let $datadir= `select @@datadir`
+--remove_file $datadir/test/load_t0
+
+
+--echo # create_select for a temporary table didn't set up pos_in_locked_tables.
+create table t (a int unique) engine=innodb
+ replace select 1 as a, 2 as b union select 1 as a, 3 as c;
+select * from t;
+drop table t;
+
+create temporary table t (a int unique) engine=innodb
+ replace select 1 as a, 2 as b union select 1 as a, 3 as c;
+select * from t;
+drop table t;
+
--source suite/versioning/common_finish.inc
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index aaf711b0fb9..83118a8fdc6 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -584,7 +584,7 @@ if ($MySQLaccess::CGI) { #CGI-version
# ----------------------
# brief and table-format
# exclude each-other
-# table-format is prefered
+# table-format is preferred
if (defined($Param{'table'})) { undef($Param{'brief'}); }
if (defined($Param{'preview'}) or
defined($Param{'copy'}) or
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 6a94cb0f706..4e177073872 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -47,18 +47,51 @@ trim_string()
trim_dir()
{
- local t=$(trim_string "$1")
- if [ "$t" != '/' ]; then
- if [ "${t%/}" != "$t" ]; then
- t=$(trim_string "${t%/}")
+ if [ -n "$BASH_VERSION" ]; then
+ local pattern="![:space:]${2:-}"
+ local x="${1#*[$pattern]}"
+ local z=${#1}
+ x=${#x}
+ if [ $x -ne $z ]; then
+ local y="${1%[$pattern/]*}"
+ y=${#y}
+ x=$(( z-x-1 ))
+ y=$(( y-x+1 ))
+ x="${1:$x:$y}"
+ [ -z "$x" ] && x='.'
+ printf '%s' "$x"
+ else
+ printf ''
fi
else
- t='.'
+ local pattern="[:space:]${2:-}"
+ local x=$(echo "$1" | sed -E "s/^[$pattern]+|[$pattern/]+\$//g")
+ if [ -n "$x" ]; then
+ echo "$x"
+ elif "${1#*/}" != "$1"; then
+ echo '.'
+ else
+ echo ''
+ fi
fi
+}
+
+trim_right()
+{
if [ -n "$BASH_VERSION" ]; then
- printf '%s' "$t"
+ local pattern="[![:space:]${2:-}]"
+ local z=${#1}
+ local y="${1%$pattern*}"
+ y=${#y}
+ if [ $y -ne $z ]; then
+ y=$(( y+1 ))
+ printf '%s' "${1:0:$y}"
+ else
+ printf ''
+ fi
else
- echo "$t"
+ local pattern="[[:space:]${2:-}]"
+ echo "$1" | sed -E "s/$pattern+\$//g"
fi
}
@@ -101,6 +134,7 @@ WSREP_SST_OPT_ADDR=""
WSREP_SST_OPT_ADDR_PORT=""
WSREP_SST_OPT_HOST=""
WSREP_SST_OPT_HOST_UNESCAPED=""
+ARIA_LOG_DIR=""
INNODB_DATA_HOME_DIR=$(trim_dir "${INNODB_DATA_HOME_DIR:-}")
INNODB_LOG_GROUP_HOME=$(trim_dir "${INNODB_LOG_GROUP_HOME:-}")
INNODB_UNDO_DIR=$(trim_dir "${INNODB_UNDO_DIR:-}")
@@ -111,7 +145,7 @@ INNOEXTRA=""
while [ $# -gt 0 ]; do
case "$1" in
'--address')
- WSREP_SST_OPT_ADDR="$2"
+ WSREP_SST_OPT_ADDR=$(trim_string "$2")
#
# Break address string into host:port/path parts
#
@@ -119,20 +153,22 @@ case "$1" in
\[*)
# IPv6
# Remove the starting and ending square brackets, if present:
- addr_no_bracket="${WSREP_SST_OPT_ADDR#\[}"
+ addr="${WSREP_SST_OPT_ADDR#\[}"
+ addr=$(trim_right "${addr%%\]*}")
# Some utilities and subsequent code require an address
# without square brackets:
- readonly WSREP_SST_OPT_HOST_UNESCAPED="${addr_no_bracket%%\]*}"
+ readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr"
# Square brackets are needed in most cases:
- readonly WSREP_SST_OPT_HOST="[$WSREP_SST_OPT_HOST_UNESCAPED]"
+ readonly WSREP_SST_OPT_HOST="[$addr]"
# Mark this address as IPv6:
readonly WSREP_SST_OPT_HOST_IPv6=1
# Let's remove the leading part that contains the host address:
remain="${WSREP_SST_OPT_ADDR#*\]}"
;;
*)
- readonly WSREP_SST_OPT_HOST="${WSREP_SST_OPT_ADDR%%[:/]*}"
- readonly WSREP_SST_OPT_HOST_UNESCAPED="$WSREP_SST_OPT_HOST"
+ addr=$(trim_right "${WSREP_SST_OPT_ADDR%%[:/]*}")
+ readonly WSREP_SST_OPT_HOST="$addr"
+ readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr"
readonly WSREP_SST_OPT_HOST_IPv6=0
# Let's remove the leading part that contains the host address:
remain="${WSREP_SST_OPT_ADDR#*[:/]}"
@@ -154,17 +190,18 @@ case "$1" in
else
readonly WSREP_SST_OPT_PATH=""
fi
+ WSREP_SST_OPT_ADDR_PORT=$(trim_right "$WSREP_SST_OPT_ADDR_PORT")
# Remove the module name part from the string, which ends with "/":
remain="${WSREP_SST_OPT_PATH#*/}"
# This operation removes the tail after the very first occurrence
# of the "/" character, inclusively:
- readonly WSREP_SST_OPT_MODULE="${WSREP_SST_OPT_PATH%%/*}"
+ readonly WSREP_SST_OPT_MODULE=$(trim_right "${WSREP_SST_OPT_PATH%%/*}")
# If there is one more "/" in the string, then everything before
# it will be the LSN, otherwise the LSN is empty:
if [ "$remain" != "$WSREP_SST_OPT_PATH" ]; then
# Extract the part that matches the LSN by removing all
# characters starting from the very first "/":
- readonly WSREP_SST_OPT_LSN="${remain%%/*}"
+ readonly WSREP_SST_OPT_LSN=$(trim_right "${remain%%/*}")
# Exctract everything after the first occurrence of
# the "/" character in the string:
source="$remain"
@@ -176,7 +213,7 @@ case "$1" in
# Let's extract the version number by removing the tail
# after the very first occurence of the "/" character
# (inclusively):
- readonly WSREP_SST_OPT_SST_VER="${remain%%/*}"
+ readonly WSREP_SST_OPT_SST_VER=$(trim_right "${remain%%/*}")
else
readonly WSREP_SST_OPT_SST_VER=""
fi
@@ -198,6 +235,11 @@ case "$1" in
readonly WSREP_SST_OPT_DATA=$(trim_dir "$2")
shift
;;
+ '--aria-log-dir-path')
+ # Let's remove the trailing slash:
+ readonly ARIA_LOG_DIR=$(trim_dir "$2")
+ shift
+ ;;
'--innodb-data-home-dir')
# Let's remove the trailing slash:
readonly INNODB_DATA_HOME_DIR=$(trim_dir "$2")
@@ -218,41 +260,46 @@ case "$1" in
shift
;;
'--defaults-file')
- readonly WSREP_SST_OPT_DEFAULT="$1=$2"
- readonly WSREP_SST_OPT_DEFAULTS="$1='$2'"
+ file=$(trim_string "$2")
+ readonly WSREP_SST_OPT_DEFAULT="$1=$file"
+ readonly WSREP_SST_OPT_DEFAULTS="$1='$file'"
shift
;;
'--defaults-extra-file')
- readonly WSREP_SST_OPT_EXTRA_DEFAULT="$1=$2"
- readonly WSREP_SST_OPT_EXTRA_DEFAULTS="$1='$2'"
+ file=$(trim_string "$2")
+ readonly WSREP_SST_OPT_EXTRA_DEFAULT="$1=$file"
+ readonly WSREP_SST_OPT_EXTRA_DEFAULTS="$1='$file'"
shift
;;
'--defaults-group-suffix')
- readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$2"
- readonly WSREP_SST_OPT_SUFFIX_VALUE="$2"
+ suffix=$(trim_string "$2")
+ readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$suffix"
+ readonly WSREP_SST_OPT_SUFFIX_VALUE="$suffix"
shift
;;
'--host')
- case "$2" in
+ addr=$(trim_string "$2")
+ case "$addr" in
\[*)
# IPv6
# Remove the starting and ending square brackets, if present:
- addr_no_bracket="${2#\[}"
+ addr="${addr#\[}"
+ addr=$(trim_right "${addr%%\]*}")
# Some utilities and subsequent code require an address
# without square brackets:
- readonly WSREP_SST_OPT_HOST_UNESCAPED="${addr_no_bracket%%\]*}"
+ readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr"
# Square brackets are needed in most cases:
- readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]"
+ readonly WSREP_SST_OPT_HOST="[$addr]"
# Mark this address as IPv6:
readonly WSREP_SST_OPT_HOST_IPv6=1
;;
*)
- readonly WSREP_SST_OPT_HOST="$2"
- readonly WSREP_SST_OPT_HOST_UNESCAPED="$2"
+ readonly WSREP_SST_OPT_HOST="$addr"
+ readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr"
readonly WSREP_SST_OPT_HOST_IPv6=0
;;
esac
- WSREP_SST_OPT_ADDR="$WSREP_SST_OPT_HOST"
+ WSREP_SST_OPT_ADDR="$addr"
shift
;;
'--local-port')
@@ -272,11 +319,11 @@ case "$1" in
shift
;;
'--role')
- readonly WSREP_SST_OPT_ROLE="$2"
+ readonly WSREP_SST_OPT_ROLE=$(trim_string "$2")
shift
;;
'--socket')
- readonly WSREP_SST_OPT_SOCKET="$2"
+ readonly WSREP_SST_OPT_SOCKET=$(trim_string "$2")
shift
;;
'--user')
@@ -284,23 +331,23 @@ case "$1" in
shift
;;
'--gtid')
- readonly WSREP_SST_OPT_GTID="$2"
+ readonly WSREP_SST_OPT_GTID=$(trim_string "$2")
shift
;;
'--binlog'|'--log-bin')
- readonly WSREP_SST_OPT_BINLOG="$2"
+ readonly WSREP_SST_OPT_BINLOG=$(trim_string "$2")
shift
;;
'--binlog-index'|'--log-bin-index')
- WSREP_SST_OPT_BINLOG_INDEX="$2"
+ WSREP_SST_OPT_BINLOG_INDEX=$(trim_string "$2")
shift
;;
'--log-basename')
- readonly WSREP_SST_OPT_LOG_BASENAME="$2"
+ readonly WSREP_SST_OPT_LOG_BASENAME=$(trim_string "$2")
shift
;;
'--gtid-domain-id')
- readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2"
+ readonly WSREP_SST_OPT_GTID_DOMAIN_ID=$(trim_string "$2")
shift
;;
'--mysqld-args')
@@ -458,6 +505,12 @@ case "$1" in
# from mysqld's argument list:
skip_mysqld_arg=0
case "$option" in
+ '--aria-log-dir-path')
+ if [ -z "$ARIA_LOG_DIR" ]; then
+ MYSQLD_OPT_ARIA_LOG_DIR=$(trim_dir "$value")
+ fi
+ skip_mysqld_arg=1
+ ;;
'--innodb-data-home-dir')
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
MYSQLD_OPT_INNODB_DATA_HOME_DIR=$(trim_dir "$value")
@@ -551,6 +604,10 @@ readonly WSREP_SST_OPT_PROGRESS
# The same argument can be present on the command line several
# times, in this case we must take its last value:
+if [ -n "${MYSQLD_OPT_ARIA_LOG_DIR:-}" -a \
+ -z "$ARIA_LOG_DIR" ]; then
+ readonly ARIA_LOG_DIR="$MYSQLD_OPT_ARIA_LOG_DIR"
+fi
if [ -n "${MYSQLD_OPT_INNODB_DATA_HOME_DIR:-}" -a \
-z "$INNODB_DATA_HOME_DIR" ]; then
readonly INNODB_DATA_HOME_DIR="$MYSQLD_OPT_INNODB_DATA_HOME_DIR"
@@ -608,6 +665,9 @@ if [ -n "$WSREP_SST_OPT_LOG_BASENAME" ]; then
WSREP_SST_OPT_MYSQLD="--log-basename='$WSREP_SST_OPT_LOG_BASENAME'"
fi
fi
+if [ -n "$ARIA_LOG_DIR" ]; then
+ INNOEXTRA="$INNOEXTRA --aria-log-dir-path='$ARIA_LOG_DIR'"
+fi
if [ -n "$INNODB_DATA_HOME_DIR" ]; then
INNOEXTRA="$INNOEXTRA --innodb-data-home-dir='$INNODB_DATA_HOME_DIR'"
fi
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 63ef8be8690..7e26af83701 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -55,6 +55,7 @@ speciald=1
ib_home_dir=""
ib_log_dir=""
ib_undo_dir=""
+ar_log_dir=""
sfmt=""
strmcmd=""
@@ -439,9 +440,10 @@ get_footprint()
-regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \
-type f -print0 | du --files0-from=- --block-size=1 -c -s | \
awk 'END { print $1 }')
-
local payload_undo=0
- if [ -n "$ib_undo_dir" -a -d "$ib_undo_dir" ]; then
+ if [ -n "$ib_undo_dir" -a "$ib_undo_dir" != '.' -a \
+ "$ib_undo_dir" != "$DATA_DIR" -a -d "$ib_undo_dir" ]
+ then
cd "$ib_undo_dir"
payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \
du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
@@ -451,7 +453,7 @@ get_footprint()
wsrep_log_info \
"SST footprint estimate: data: $payload_data, undo: $payload_undo"
- payload=$(( payload_data + payload_undo ))
+ payload=$(( payload_data+payload_undo ))
if [ "$compress" != 'none' ]; then
# QuickLZ has around 50% compression ratio
@@ -1220,13 +1222,16 @@ else # joiner
INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR")
fi
- if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' ]; then
+ if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \
+ "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ]
+ then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR"
cd "$INNODB_DATA_HOME_DIR"
ib_home_dir="$(pwd)"
cd "$OLD_PWD"
+ [ "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir=""
fi
# if no command line argument and INNODB_LOG_GROUP_HOME is not set,
@@ -1236,13 +1241,16 @@ else # joiner
INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME")
fi
- if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' ]; then
+ if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \
+ "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ]
+ then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME"
cd "$INNODB_LOG_GROUP_HOME"
ib_log_dir="$(pwd)"
cd "$OLD_PWD"
+ [ "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir=""
fi
# if no command line argument and INNODB_UNDO_DIR is not set,
@@ -1252,13 +1260,34 @@ else # joiner
INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR")
fi
- if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; then
+ if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \
+ "$INNODB_UNDO_DIR" != "$DATA_DIR" ]
+ then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR"
cd "$INNODB_UNDO_DIR"
ib_undo_dir="$(pwd)"
cd "$OLD_PWD"
+ [ "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir=""
+ fi
+
+ # if no command line argument then try to get it from the my.cnf:
+ if [ -z "$ARIA_LOG_DIR" ]; then
+ ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path')
+ ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR")
+ fi
+
+ if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \
+ "$ARIA_LOG_DIR" != "$DATA_DIR" ]
+ then
+ # handle both relative and absolute paths:
+ cd "$DATA"
+ [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR"
+ cd "$ARIA_LOG_DIR"
+ ar_log_dir="$(pwd)"
+ cd "$OLD_PWD"
+ [ "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir=""
fi
if [ -n "$backup_threads" ]; then
@@ -1400,12 +1429,14 @@ else # joiner
find -E ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
+ ${ar_log_dir:+"$ar_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rf {} >&2 \+
else
find ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
+ ${ar_log_dir:+"$ar_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rf {} >&2 \+
fi
@@ -1500,11 +1531,15 @@ else # joiner
binlogs=$(ls -d -1 "$binlog_base".[0-9]* 2>/dev/null || :)
fi
cd "$DATA_DIR"
- if [ -n "$binlog_dir" -a "$binlog_dir" != '.' ]; then
+ if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \
+ "$binlog_dir" != "$DATA_DIR" ]
+ then
[ ! -d "$binlog_dir" ] && mkdir -p "$binlog_dir"
fi
index_dir=$(dirname "$binlog_index");
- if [ -n "$index_dir" -a "$index_dir" != '.' ]; then
+ if [ -n "$index_dir" -a "$index_dir" != '.' -a \
+ "$index_dir" != "$DATA_DIR" ]
+ then
[ ! -d "$index_dir" ] && mkdir -p "$index_dir"
fi
if [ -n "$binlogs" ]; then
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index ddf41559c29..5279929c5b0 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -174,6 +174,7 @@ cd "$OLD_PWD"
BINLOG_TAR_FILE="$DATA_DIR/wsrep_sst_binlog.tar"
+ar_log_dir="$DATA_DIR"
ib_log_dir="$DATA_DIR"
ib_home_dir="$DATA_DIR"
ib_undo_dir="$DATA_DIR"
@@ -185,7 +186,9 @@ if [ -z "$INNODB_LOG_GROUP_HOME" ]; then
INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME")
fi
-if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' ]; then
+if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \
+ "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ]
+then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME"
@@ -201,7 +204,9 @@ if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR")
fi
-if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' ]; then
+if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \
+ "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ]
+then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR"
@@ -217,7 +222,9 @@ if [ -z "$INNODB_UNDO_DIR" ]; then
INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR")
fi
-if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; then
+if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \
+ "$INNODB_UNDO_DIR" != "$DATA_DIR" ]
+then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR"
@@ -226,6 +233,23 @@ if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; then
cd "$OLD_PWD"
fi
+# if no command line argument then try to get it from the my.cnf:
+if [ -z "$ARIA_LOG_DIR" ]; then
+ ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path')
+ ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR")
+fi
+
+if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \
+ "$ARIA_LOG_DIR" != "$DATA_DIR" ]
+then
+ # handle both relative and absolute paths:
+ cd "$DATA"
+ [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR"
+ cd "$ARIA_LOG_DIR"
+ ar_log_dir="$(pwd)"
+ cd "$OLD_PWD"
+fi
+
encgroups='--mysqld|sst'
check_server_ssl_config
@@ -504,7 +528,9 @@ EOF
if [ "$first" = '-' -o "$first" = '@' ]; then
bin_base="./$bin_base"
fi
- if [ -n "$bin_dir" -a "$bin_dir" != '.' ]; then
+ if [ -n "$bin_dir" -a "$bin_dir" != '.' -a \
+ "$bin_dir" != "$DATA_DIR" ]
+ then
tar $tar_options "$BINLOG_TAR_FILE" \
-C "$bin_dir" "$bin_base" >&2
else
@@ -541,7 +567,10 @@ FILTER="-f '- /lost+found'
-f '+ /wsrep_sst_binlog.tar'
-f '- $ib_home_dir/ib_lru_dump'
-f '- $ib_home_dir/ibdata*'
- -f '+ $ib_undo_dir/undo*'
+ -f '- $ib_undo_dir/undo*'
+ -f '- $ib_log_dir/ib_logfile[0-9]*'
+ -f '- $ar_log_dir/aria_log_control'
+ -f '- $ar_log_dir/aria_log.*'
-f '+ /*/'
-f '- /*'"
@@ -587,12 +616,12 @@ FILTER="-f '- /lost+found'
wsrep_log_info "Transfer of InnoDB data files done"
- # second, we transfer InnoDB and Aria log files
+ # second, we transfer InnoDB log files
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
- $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '+ /aria_log.*' \
- -f '+ /aria_log_control' -f '- **' "$ib_log_dir/" \
+ $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' \
+ -f '- **' "$ib_log_dir/" \
"rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$?
if [ $RC -ne 0 ]; then
@@ -600,26 +629,61 @@ FILTER="-f '- /lost+found'
exit 255 # unknown error
fi
- wsrep_log_info "Transfer of InnoDB and Aria log files done"
+ wsrep_log_info "Transfer of InnoDB log files done"
+
+ # third, we transfer InnoDB undo logs
+ rsync ${STUNNEL:+--rsh="$STUNNEL"} \
+ --owner --group --perms --links --specials \
+ --ignore-times --inplace --dirs --delete --quiet \
+ $WHOLE_FILE_OPT -f '+ /undo*' \
+ -f '- **' "$ib_undo_dir/" \
+ "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$?
+
+ if [ $RC -ne 0 ]; then
+ wsrep_log_error "rsync innodb_undo_dir returned code $RC:"
+ exit 255 # unknown error
+ fi
+
+ wsrep_log_info "Transfer of InnoDB undo logs done"
+
+ # fourth, we transfer Aria logs
+ rsync ${STUNNEL:+--rsh="$STUNNEL"} \
+ --owner --group --perms --links --specials \
+ --ignore-times --inplace --dirs --delete --quiet \
+ $WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \
+ -f '- **' "$ar_log_dir/" \
+ "rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$?
+
+ if [ $RC -ne 0 ]; then
+ wsrep_log_error "rsync aria_log_dir_path returned code $RC:"
+ exit 255 # unknown error
+ fi
+
+ wsrep_log_info "Transfer of Aria logs done"
# then, we parallelize the transfer of database directories,
# use '.' so that path concatenation works:
- cd "$DATA"
-
backup_threads=$(parse_cnf '--mysqld|sst' 'backup-threads')
if [ -z "$backup_threads" ]; then
get_proc
backup_threads=$nproc
fi
+ cd "$DATA"
+
find . -maxdepth 1 -mindepth 1 -type d -not -name 'lost+found' \
-not -name '.zfs' -print0 | xargs -I{} -0 -P $backup_threads \
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials --ignore-times \
--inplace --recursive --delete --quiet $WHOLE_FILE_OPT \
- --exclude '*/ib_logfile*' --exclude '*/aria_log.*' \
- --exclude '*/aria_log_control' "$WSREP_SST_OPT_DATA/{}/" \
+ -f '- $ib_home_dir/ib_lru_dump' \
+ -f '- $ib_home_dir/ibdata*' \
+ -f '- $ib_undo_dir/undo*' \
+ -f '- $ib_log_dir/ib_logfile[0-9]*' \
+ -f '- $ar_log_dir/aria_log_control' \
+ -f '- $ar_log_dir/aria_log.*' \
+ "$WSREP_SST_OPT_DATA/{}/" \
"rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$?
cd "$OLD_PWD"
@@ -707,6 +771,10 @@ $SILENT
path = $ib_log_dir
[$MODULE-data_dir]
path = $ib_home_dir
+[$MODULE-undo_dir]
+ path = $ib_undo_dir
+[$MODULE-aria_log]
+ path = $ar_log_dir
EOF
# If the IP is local, listen only on it:
@@ -872,7 +940,7 @@ EOF
binlog_cd=0
# Change the directory to binlog base (if possible):
if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \
- -d "$binlog_dir" ]
+ "$binlog_dir" != "$DATA_DIR" -a -d "$binlog_dir" ]
then
binlog_cd=1
cd "$binlog_dir"
@@ -891,11 +959,15 @@ EOF
tmpfile=$(TMPDIR="$tmpdir"; mktemp)
fi
index_dir=$(dirname "$binlog_index");
- if [ -n "$index_dir" -a "$index_dir" != '.' ]; then
+ if [ -n "$index_dir" -a "$index_dir" != '.' -a \
+ "$index_dir" != "$DATA_DIR" ]
+ then
[ ! -d "$index_dir" ] && mkdir -p "$index_dir"
fi
binlog_cd=0
- if [ -n "$binlog_dir" -a "$binlog_dir" != '.' ]; then
+ if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \
+ "$binlog_dir" != "$DATA_DIR" ]
+ then
[ ! -d "$binlog_dir" ] && mkdir -p "$binlog_dir"
binlog_cd=1
cd "$binlog_dir"
diff --git a/sql/item.h b/sql/item.h
index e8cc5031ca4..ac4a42107cb 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6002,6 +6002,14 @@ public:
Item_direct_ref::save_in_result_field(no_conversions);
}
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ if (check_null_ref())
+ return set_field_to_null_with_conversions(field, no_conversions);
+
+ return Item_direct_ref::save_in_field(field, no_conversions);
+ }
+
void cleanup()
{
null_ref_table= NULL;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 0cb8667c8b0..8b09a908cda 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2991,10 +2991,12 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
return meta & 0xFF;
+ case MYSQL_TYPE_BLOB_COMPRESSED:
case MYSQL_TYPE_BLOB:
switch (meta) {
case 1:
- strmake(typestr, "TINYBLOB/TINYTEXT", typestr_length);
+ my_snprintf(typestr, typestr_length, "TINYBLOB/TINYTEXT%s",
+ type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : "");
if (!ptr)
goto return_null;
@@ -3002,7 +3004,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
my_b_write_quoted(file, ptr + 1, length);
return length + 1;
case 2:
- strmake(typestr, "BLOB/TEXT", typestr_length);
+ my_snprintf(typestr, typestr_length, "BLOB/TEXT%s",
+ type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : "");
if (!ptr)
goto return_null;
@@ -3010,7 +3013,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
my_b_write_quoted(file, ptr + 2, length);
return length + 2;
case 3:
- strmake(typestr, "MEDIUMBLOB/MEDIUMTEXT", typestr_length);
+ my_snprintf(typestr, typestr_length, "MEDIUMBLOB/MEDIUMTEXT%s",
+ type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : "");
if (!ptr)
goto return_null;
@@ -3018,7 +3022,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
my_b_write_quoted(file, ptr + 3, length);
return length + 3;
case 4:
- strmake(typestr, "LONGBLOB/LONGTEXT", typestr_length);
+ my_snprintf(typestr, typestr_length, "LONGBLOB/LONGTEXT%s",
+ type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : "");
if (!ptr)
goto return_null;
@@ -3030,10 +3035,12 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
return 0;
}
+ case MYSQL_TYPE_VARCHAR_COMPRESSED:
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
length= meta;
- my_snprintf(typestr, typestr_length, "VARSTRING(%d)", length);
+ my_snprintf(typestr, typestr_length, "VARSTRING(%d)%s", length,
+ type == MYSQL_TYPE_VARCHAR_COMPRESSED ? " COMPRESSED" : "");
if (!ptr)
goto return_null;
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 11d9f80865a..42cede28f20 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -716,7 +716,7 @@ class QUICK_RANGE :public Sql_alloc {
}
/**
- Initalizes a key_range object for communication with storage engine.
+ Initializes a key_range object for communication with storage engine.
This function facilitates communication with the Storage Engine API by
translating the minimum endpoint of the interval represented by this
@@ -737,7 +737,7 @@ class QUICK_RANGE :public Sql_alloc {
}
/**
- Initalizes a key_range object for communication with storage engine.
+ Initializes a key_range object for communication with storage engine.
This function facilitates communication with the Storage Engine API by
translating the minimum endpoint of the interval represented by this
@@ -754,7 +754,7 @@ class QUICK_RANGE :public Sql_alloc {
}
/**
- Initalizes a key_range object for communication with storage engine.
+ Initializes a key_range object for communication with storage engine.
This function facilitates communication with the Storage Engine API by
translating the maximum endpoint of the interval represented by this
@@ -775,7 +775,7 @@ class QUICK_RANGE :public Sql_alloc {
}
/**
- Initalizes a key_range object for communication with storage engine.
+ Initializes a key_range object for communication with storage engine.
This function facilitates communication with the Storage Engine API by
translating the maximum endpoint of the interval represented by this
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index d59bc37b7a3..d89bcda2491 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -32,7 +32,7 @@ typedef struct st_changed_table_list CHANGED_TABLE_LIST;
Can't create new free memory block if unused memory in block less
then QUERY_CACHE_MIN_ALLOCATION_UNIT.
if QUERY_CACHE_MIN_ALLOCATION_UNIT == 0 then
- QUERY_CACHE_MIN_ALLOCATION_UNIT choosed automaticaly
+ QUERY_CACHE_MIN_ALLOCATION_UNIT choosed automatically
*/
#define QUERY_CACHE_MIN_ALLOCATION_UNIT 512
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 5696d3108d3..d56ccdff2a7 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -4441,6 +4441,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
*/
DBUG_ASSERT(0);
}
+ create_table->table->pos_in_table_list= create_table;
}
}
else
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 627b6191e51..4dd45b7ce43 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5550,7 +5550,7 @@ static bool update_wsrep_auto_increment_control (sys_var *self, THD *thd, enum_v
{
/*
The variables that control auto increment shall be calculated
- automaticaly based on the size of the cluster. This usually done
+ automatically based on the size of the cluster. This usually done
within the wsrep_view_handler_cb callback. However, if the user
manually sets the value of wsrep_auto_increment_control to 'ON',
then we should to re-calculate these variables again (because
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index c83deb72f02..6f781a1f291 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -8936,10 +8936,12 @@ ha_innobase::update_row(
const bool vers_ins_row = vers_set_fields
&& thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE;
+ TABLE_LIST *tl= table->pos_in_table_list;
+ uint8 op_map= tl->trg_event_map | tl->slave_fk_event_map;
/* This is not a delete */
m_prebuilt->upd_node->is_delete =
(vers_set_fields && !vers_ins_row) ||
- (thd_sql_command(m_user_thd) == SQLCOM_DELETE &&
+ (op_map & trg2bit(TRG_EVENT_DELETE) &&
table->versioned(VERS_TIMESTAMP))
? VERSIONED_DELETE
: NO_DELETE;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index a5ac7de0a92..e10d0c9f2b5 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2022, Oracle and/or its affiliates.
-Copyright (c) 2014, 2022, MariaDB Corporation.
+Copyright (c) 2014, 2023, 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
@@ -721,8 +721,6 @@ UNIV_INLINE
bool
lock_rec_has_to_wait(
/*=================*/
- bool for_locking,
- /*!< in is called locking or releasing */
const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly
@@ -878,7 +876,7 @@ lock_has_to_wait(
}
return lock_rec_has_to_wait(
- false, lock1->trx, lock1->type_mode, lock2,
+ lock1->trx, lock1->type_mode, lock2,
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM));
}
@@ -1165,7 +1163,7 @@ lock_rec_other_has_conflicting(
lock != NULL;
lock = lock_rec_get_next(heap_no, lock)) {
- if (lock_rec_has_to_wait(true, trx, mode, lock, is_supremum)) {
+ if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) {
#ifdef WITH_WSREP
if (trx->is_wsrep()) {
trx_mutex_enter(lock->trx);
diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc
index 8533dffcb27..ea39e684110 100644
--- a/storage/perfschema/pfs_timer.cc
+++ b/storage/perfschema/pfs_timer.cc
@@ -166,7 +166,7 @@ void init_timers(void)
/*
For STAGE and STATEMENT, a timer with a fixed frequency is better.
- The prefered timer is nanosecond, or lower resolutions.
+ The preferred timer is nanosecond, or lower resolutions.
*/
if (nanosec_to_pico != 0)
@@ -203,7 +203,7 @@ void init_timers(void)
/*
For IDLE, a timer with a fixed frequency is critical,
as the CPU clock may slow down a lot if the server is completely idle.
- The prefered timer is microsecond, or lower resolutions.
+ The preferred timer is microsecond, or lower resolutions.
*/
if (microsec_to_pico != 0)