) {
next if 1../The following groups are read/;
# formatting, skip line consisting entirely of dashes and blanks
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/mysql_upgrade.test mariadb-10.1-10.1.30/mysql-test/t/mysql_upgrade.test
--- mariadb-10.1-10.1.25/mysql-test/t/mysql_upgrade.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/mysql_upgrade.test 2017-12-21 15:48:47.000000000 +0000
@@ -1,6 +1,7 @@
-- source include/mysql_upgrade_preparation.inc
-- source include/have_working_dns.inc
-- source include/have_innodb.inc
+-- source include/have_partition.inc
set sql_mode="";
@@ -168,6 +169,31 @@
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
+#
+# MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars
+#
+use test;
+call mtr.add_suppression('Column last_update in table "mysql"."innodb_table_stats" is INT NOT NULL but should be');
+alter table mysql.innodb_table_stats modify last_update int not null;
+
+create table extralongname_extralongname_extralongname_extralongname_ext (
+ id int(10) unsigned not null,
+ created_date date not null,
+ created timestamp not null,
+ primary key (created,id,created_date)
+) engine=innodb stats_persistent=1 default charset=latin1
+ partition by range (year(created_date))
+ subpartition by hash (month(created_date))
+ subpartitions 2 (
+ partition p2007 values less than (2008),
+ partition p2008 values less than (2009)
+ );
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+select length(table_name) from mysql.innodb_table_stats;
+drop table extralongname_extralongname_extralongname_extralongname_ext;
+
+--echo End of 10.0 tests
+
set sql_mode=default;
#
@@ -192,4 +218,4 @@
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
SET GLOBAL enforce_storage_engine=NULL;
---echo End of tests
+--echo End of 10.1 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/old-mode.test mariadb-10.1-10.1.30/mysql-test/t/old-mode.test
--- mariadb-10.1-10.1.25/mysql-test/t/old-mode.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/old-mode.test 2017-12-21 15:48:48.000000000 +0000
@@ -83,3 +83,37 @@
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
+#
+# MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change
+#
+
+# Copy_field
+set time_zone='Europe/Moscow';
+set global mysql56_temporal_format=false;
+create table t1 (a timestamp);
+set timestamp=1288477526;
+insert t1 values (null);
+set timestamp=1288481126;
+insert t1 values (null);
+select a, unix_timestamp(a) from t1;
+set global mysql56_temporal_format=true;
+select a, unix_timestamp(a) from t1;
+alter table t1 modify a timestamp;
+select a, unix_timestamp(a) from t1;
+drop table t1;
+
+# field_conv_incompatible()
+set global mysql56_temporal_format=false;
+create table t1 (a timestamp);
+set timestamp=1288477526;
+insert t1 values (null);
+set timestamp=1288481126;
+insert t1 values (null);
+select a, unix_timestamp(a) from t1;
+set global mysql56_temporal_format=true;
+select a, unix_timestamp(a) from t1;
+create table t2 (a timestamp);
+insert t2 select a from t1;
+select a, unix_timestamp(a) from t2;
+drop table t1, t2;
+set time_zone=DEFAULT;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/openssl_1.test mariadb-10.1-10.1.30/mysql-test/t/openssl_1.test
--- mariadb-10.1-10.1.25/mysql-test/t/openssl_1.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/openssl_1.test 2017-12-21 15:48:48.000000000 +0000
@@ -221,8 +221,8 @@
#
# Common ciphers to openssl and yassl
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA
--disable_query_log
--disable_result_log
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/openssl_6975.test mariadb-10.1-10.1.30/mysql-test/t/openssl_6975.test
--- mariadb-10.1-10.1.25/mysql-test/t/openssl_6975.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/openssl_6975.test 2017-12-21 15:48:48.000000000 +0000
@@ -8,7 +8,8 @@
# this is OpenSSL test.
create user ssl_sslv3@localhost;
-grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
+# grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA";
+grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA";
create user ssl_tls12@localhost;
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
@@ -17,9 +18,9 @@
disable_abort_on_error;
echo TLS1.2 ciphers: user is ok with any cipher;
exec $mysql --ssl-cipher=AES128-SHA256;
---replace_result DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-GCM-SHA384
+--replace_result DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-GCM-SHA384
exec $mysql --ssl-cipher=TLSv1.2;
-echo TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA;
+echo TLS1.2 ciphers: user requires SSLv3 cipher AES128-SHA;
exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256;
exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2;
echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
@@ -27,13 +28,13 @@
exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2;
echo SSLv3 ciphers: user is ok with any cipher;
-exec $mysql --ssl-cipher=RC4-SHA;
+exec $mysql --ssl-cipher=AES256-SHA;
exec $mysql --ssl-cipher=SSLv3;
-echo SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA;
-exec $mysql --user ssl_sslv3 --ssl-cipher=RC4-SHA;
+echo SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA;
+exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA;
exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3;
echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
-exec $mysql --user ssl_tls12 --ssl-cipher=RC4-SHA;
+exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA;
exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3;
drop user ssl_sslv3@localhost;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/partition_datatype.test mariadb-10.1-10.1.30/mysql-test/t/partition_datatype.test
--- mariadb-10.1-10.1.25/mysql-test/t/partition_datatype.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/partition_datatype.test 2017-12-21 15:48:48.000000000 +0000
@@ -217,11 +217,13 @@
drop table t1;
-- error ER_PARTITION_FIELDS_TOO_LONG
create table t1 (a varchar(3070)) partition by key (a);
--- error ER_TOO_BIG_ROWSIZE
+-- error ER_PARTITION_FIELDS_TOO_LONG
+create table t1 (a varchar(65532) not null) partition by key (a);
+-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
create table t1 (a varchar(65533)) partition by key (a);
--- error ER_TOO_BIG_ROWSIZE
+-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
create table t1 (a varchar(65534) not null) partition by key (a);
--- error ER_TOO_BIG_ROWSIZE
+-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
create table t1 (a varchar(65535)) partition by key (a);
#
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/partition_symlink.test mariadb-10.1-10.1.30/mysql-test/t/partition_symlink.test
--- mariadb-10.1-10.1.25/mysql-test/t/partition_symlink.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/partition_symlink.test 2017-12-21 15:48:48.000000000 +0000
@@ -38,11 +38,10 @@
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t2;
INSERT INTO t1 VALUES (0), (1), (2);
---error ER_TABLES_DIFFERENT_METADATA
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
--error ER_TABLES_DIFFERENT_METADATA
ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t2;
---sorted_result
+SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1, t2;
# skipped because of bug#52354
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/ps.test mariadb-10.1-10.1.30/mysql-test/t/ps.test
--- mariadb-10.1-10.1.25/mysql-test/t/ps.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/ps.test 2017-12-21 15:48:48.000000000 +0000
@@ -3731,4 +3731,133 @@
drop table t1;
+--echo #
+--echo # MDEV-9208: Function->Function->View = Mysqld segfault
+--echo # (Server crashes in Dependency_marker::visit_field on 2nd
+--echo # execution with merged subquery)
+--echo #
+
+CREATE TABLE t1 (i1 INT);
+insert into t1 values(1),(2);
+
+CREATE TABLE t2 (i2 INT);
+insert into t2 values(1),(2);
+
+prepare stmt from "
+ select 1 from (
+ select
+ if (i1<0, 0, 0) as f1,
+ (select f1) as f2
+ from t1, t2
+ ) sq
+";
+
+execute stmt;
+execute stmt;
+
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-9619: Assertion `null_ref_table' failed in virtual
+--echo # table_map Item_direct_view_ref::used_tables() const on 2nd
+--echo # execution of PS
+--echo #
+
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES ('a'),('b');
+
+CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('c'),('d');
+
+PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )";
+EXECUTE stmt;
+EXECUTE stmt;
+insert into t1 values ('c');
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+drop view v1;
+drop table t1,t2;
+
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES ('a'),('b');
+
+CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('c'),('d');
+
+PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )";
+EXECUTE stmt;
+EXECUTE stmt;
+insert into t1 values ('c');
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+drop view v1;
+drop table t1,t2;
+
+
+
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+
+INSERT INTO t2 VALUES (1),(4);
+
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+
+create table t1 (a int, b int, c int);
+create table t2 (x int, y int, z int);
+create table t3 as select * from t1;
+insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600);
+insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600);
+insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600);
+
+
+set @optimizer_switch_save=@@optimizer_switch;
+set @join_cache_level_save=@@join_cache_level;
+set optimizer_switch='materialization=off';
+set join_cache_level=0;
+select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z);
+prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)";
+EXECUTE stmt;
+EXECUTE stmt;
+
+create view v1 as select * from t1;
+create view v2 as select * from t2;
+create view v3 as select * from t3;
+select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z);
+prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)";
+EXECUTE stmt;
+EXECUTE stmt;
+set optimizer_switch=@optimizer_switch_save;
+set join_cache_level=@join_cache_level_save;
+
+deallocate prepare stmt;
+drop view v1,v2,v3;
+drop table t1,t2,t3;
+
--echo # End of 5.5 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/range_vs_index_merge.test mariadb-10.1-10.1.30/mysql-test/t/range_vs_index_merge.test
--- mariadb-10.1-10.1.25/mysql-test/t/range_vs_index_merge.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/range_vs_index_merge.test 2017-12-21 15:48:48.000000000 +0000
@@ -1241,6 +1241,59 @@
DROP TABLE t1;
+--echo #
+--echo # mdev-11574: do not build index merge of two indexes when
+--echo # one index is an infix of the other index
+--echo #
+
+set names utf8;
+
+CREATE DATABASE world;
+
+use world;
+
+--source include/world_schema.inc
+
+--disable_query_log
+--disable_result_log
+--disable_warnings
+--source include/world.inc
+--enable_warnings
+--enable_result_log
+--enable_query_log
+
+DROP INDEX Country ON City;
+CREATE INDEX CountryName ON City(Country,Name);
+CREATE INDEX Name ON City(Name);
+
+--disable_query_log
+--disable_result_log
+--disable_warnings
+ANALYZE TABLE City;
+--enable_warnings
+--enable_result_log
+--enable_query_log
+
+let $q=
+select * from City
+where
+ Country='FIN' AND Name IN ('Lahti','Imatra') OR
+ Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
+ Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
+ Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
+ Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
+ Country='PRT' AND Name IN ('Braga', 'Porto') OR
+ Country='FRA' AND Name IN ('Paris', 'Marcel') OR
+ Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
+ Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
+ Country='ITA' AND Name IN ('Napoli', 'Venezia');
+
+eval $q;
+eval explain $q;
+
+
+DROP DATABASE world;
+
#the following command must be the last one in the file
set session optimizer_switch='index_merge_sort_intersection=default';
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/read_only.test mariadb-10.1-10.1.30/mysql-test/t/read_only.test
--- mariadb-10.1-10.1.25/mysql-test/t/read_only.test 2017-07-01 18:20:18.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/read_only.test 2017-12-21 15:48:48.000000000 +0000
@@ -84,6 +84,9 @@
insert into t4 select * from t3;
+--error ER_OPTION_PREVENTS_STATEMENT
+create table t3 (a int);
+
# a non-temp table updated:
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
@@ -116,6 +119,11 @@
insert into t1 values(1);
#
+# MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option
+#
+drop temporary table if exists t1;
+
+#
# Bug#11733 COMMITs should not happen if read-only is set
#
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/show_function_with_pad_char_to_full_length.test mariadb-10.1-10.1.30/mysql-test/t/show_function_with_pad_char_to_full_length.test
--- mariadb-10.1-10.1.25/mysql-test/t/show_function_with_pad_char_to_full_length.test 1970-01-01 00:00:00.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/show_function_with_pad_char_to_full_length.test 2017-12-21 15:48:48.000000000 +0000
@@ -0,0 +1,23 @@
+#
+# Test that show function status succeeds with
+# sql_mode = 'PAD_CHAR_TO_FULL_LENGTH (MDEV-13149)
+
+# show function status
+
+create function f() returns int return 1;
+--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
+show function status;
+set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
+--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
+show function status;
+drop function f;
+select @@sql_mode;
+
+# select ROUTINE_NAME from information_schema.ROUTINES
+
+create function f() returns int return 1;
+select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
+set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
+select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
+drop function f;
+select @@sql_mode;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/sp.test mariadb-10.1-10.1.30/mysql-test/t/sp.test
--- mariadb-10.1-10.1.25/mysql-test/t/sp.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/sp.test 2017-12-21 15:48:48.000000000 +0000
@@ -9556,5 +9556,53 @@
drop user 'foo'@'%';
drop procedure sp1;
+--echo #
+--echo # MDEV-10972: Insert from select / view / union --
+--echo # repeatable crash in 10.1, 10.2 Linux/Mac/Windows
+--echo #
+
+create table t (id int auto_increment primary key);
+insert into t values (9494),(9495),(9496),(9497),(9498),(9499),(9500),(9501),(9502),(9503);
+
+create VIEW v AS
+select id from t
+union
+select id from t
+;
+
+drop procedure if exists p;
+create procedure p()
+insert into tmp_t select t.id from (
+ select id from v
+ union
+ select id from v
+) sq
+inner join t on (sq.id = t.id);
+
+--error ER_NO_SUCH_TABLE
+CALL p();
+create table tmp_t (id int null);
+CALL p();
+
+drop procedure p;
+drop view v;
+drop table t, tmp_t;
+
+
+--echo #
+--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+--echo #
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 );
+
+--error ER_NON_INSERTABLE_TABLE
+REPLACE INTO v1 VALUES (f1());
+SET @aux = f1();
+
+# Cleanup
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
--echo #End of 10.1 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/ssl.test mariadb-10.1-10.1.30/mysql-test/t/ssl.test
--- mariadb-10.1-10.1.25/mysql-test/t/ssl.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/ssl.test 2017-12-21 15:48:48.000000000 +0000
@@ -33,8 +33,8 @@
disconnect ssl_con;
create user mysqltest_1@localhost;
-grant usage on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
---exec $MYSQL -umysqltest_1 --ssl-cipher=EDH-RSA-DES-CBC3-SHA -e "show status like 'ssl_cipher'" 2>&1
+grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
+--exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1
drop user mysqltest_1@localhost;
# Wait till all disconnects are completed
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/stat_tables_repl.test mariadb-10.1-10.1.30/mysql-test/t/stat_tables_repl.test
--- mariadb-10.1-10.1.25/mysql-test/t/stat_tables_repl.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/stat_tables_repl.test 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
--source include/have_stat_tables.inc
---source include/master-slave.inc
--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
--echo #
--echo # Bug mdev-485: unexpected failure with replication of DROP/ALTER table
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/subselect_exists2in.test mariadb-10.1-10.1.30/mysql-test/t/subselect_exists2in.test
--- mariadb-10.1-10.1.25/mysql-test/t/subselect_exists2in.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/subselect_exists2in.test 2017-12-21 15:48:48.000000000 +0000
@@ -786,6 +786,46 @@
DROP TABLE t1;
+--echo #
+--echo # MDEV-14164: Unknown column error when adding aggregate to function
+--echo # in oracle style procedure FOR loop
+--echo #
+
+CREATE TABLE t1(id INT, val INT);
+DELIMITER //;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE cur1 CURSOR FOR SELECT * FROM (
+ SELECT DISTINCT id FROM t1) a
+ WHERE NOT EXISTS (SELECT * FROM ( SELECT id FROM t1) b
+ WHERE a.id=b.id);
+ OPEN cur1;
+ CLOSE cur1;
+ OPEN cur1;
+ CLOSE cur1;
+END;
+//
+DELIMITER ;//
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+CREATE TABLE t1(id INT, val INT);
+DELIMITER //;
+CREATE PROCEDURE p1()
+BEGIN
+ SELECT * FROM (SELECT DISTINCT id FROM t1) a
+ WHERE NOT a.id IN (SELECT b.id FROM t1 b);
+ SELECT * FROM (SELECT DISTINCT id FROM t1) a
+ WHERE NOT EXISTS (SELECT * FROM t1 b WHERE a.id=b.id);
+END;
+//
+DELIMITER ;//
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
--echo # End of 10.0 tests
#restore defaults
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/subselect_mat_cost_bugs.test mariadb-10.1-10.1.30/mysql-test/t/subselect_mat_cost_bugs.test
--- mariadb-10.1-10.1.25/mysql-test/t/subselect_mat_cost_bugs.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/subselect_mat_cost_bugs.test 2017-12-21 15:48:48.000000000 +0000
@@ -522,4 +522,23 @@
drop table t1;
+--echo #
+--echo # MDEV-13135: subquery with ON expression subject to
+--echo # semi-join optimizations
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a AS v_a FROM t1;
+INSERT INTO t1 VALUES (1),(3);
+
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (3),(4);
+
+SELECT * FROM t1 WHERE a NOT IN (
+ SELECT b FROM t2 INNER JOIN v1 ON (b IN ( SELECT a FROM t1 ))
+ WHERE v_a = b
+);
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/subselect_nulls.test mariadb-10.1-10.1.30/mysql-test/t/subselect_nulls.test
--- mariadb-10.1-10.1.25/mysql-test/t/subselect_nulls.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/subselect_nulls.test 2017-12-21 15:48:48.000000000 +0000
@@ -97,3 +97,9 @@
drop table x1;
drop table x2;
+
+#
+# MDEV-7339 Server crashes in Item_func_trig_cond::val_int
+#
+select (select 1, 2) in (select 3, 4);
+select (select NULL, NULL) in (select 3, 4);
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/subselect.test mariadb-10.1-10.1.30/mysql-test/t/subselect.test
--- mariadb-10.1-10.1.25/mysql-test/t/subselect.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/subselect.test 2017-12-21 15:48:48.000000000 +0000
@@ -3600,7 +3600,7 @@
drop table t2, t1;
drop view v1;
---echo End of 5.0 tests.
+--echo # End of 5.0 tests.
#
# Test [NOT] IN truth table (both as top-level and general predicate).
@@ -4685,7 +4685,7 @@
drop table t1,t2;
---echo End of 5.1 tests
+--echo # End of 5.1 tests
--echo #
--echo # Bug #11765713 58705:
@@ -5156,7 +5156,7 @@
DROP TABLE t1,t2;
---echo End of 5.2 tests
+--echo # End of 5.2 tests
--echo #
--echo # BUG#779885: Crash in eliminate_item_equal with materialization=on in
@@ -6004,11 +6004,17 @@
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+--error ER_WRONG_GROUP_FIELD
+SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
+--error ER_WRONG_GROUP_FIELD
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
delete from t1;
+--error ER_WRONG_GROUP_FIELD
+SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
+--error ER_WRONG_GROUP_FIELD
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
drop view v2;
@@ -6024,6 +6030,49 @@
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
DROP TABLE t1;
+--echo #
+--echo # MDEV-10146: Wrong result (or questionable result and behavior)
+--echo # with aggregate function in uncorrelated SELECT subquery
+--echo #
+CREATE TABLE t1 (f1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (f2 int);
+
+INSERT INTO t2 VALUES (3);
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
+
+INSERT INTO t2 VALUES (4);
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
+--error ER_SUBQUERY_NO_1_ROW
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+
+drop view v1;
+drop table t1,t2;
+
+#
+# MDEV-7828 Assertion `key_read == 0' failed in TABLE::enable_keyread with SELECT SQ and WHERE SQ
+#
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+--echo #
+--echo # Disable this query till MDEV-13399 is resolved
+--echo #
+--echo # INSERT t2 VALUES (9);
+--echo # --error ER_SUBQUERY_NO_1_ROW
+--echo # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+--echo #
+drop table t1, t2;
+
+--echo # End of 10.0 tests
--echo #
--echo # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
@@ -6051,4 +6100,4 @@
DROP TABLE t1, t2;
SET NAMES default;
---echo End of 10.1 tests
+--echo # End of 10.1 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/symlink.test mariadb-10.1-10.1.30/mysql-test/t/symlink.test
--- mariadb-10.1-10.1.25/mysql-test/t/symlink.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/symlink.test 2017-12-21 15:48:48.000000000 +0000
@@ -316,3 +316,28 @@
DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;
+use test;
+
+#
+# End of 5.5 tests
+#
+
+#
+# End of 10.0 tests
+#
+
+#
+# MDEV-13636 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for 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)) engine=MyISAM data directory='$MYSQL_TMP_DIR' index directory = '$MYSQL_TMP_DIR';
+insert t1 values (1,2,3), (2,3,4), (3,4,5), (4,5,6), (5,6,7), (6,7,8), (7,8,9);
+alter online table t1 delay_key_write=1;
+replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
+show create table t1;
+drop table t1;
+
+#
+# End of 10.1 tests
+#
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/tc_heuristic_recover.test mariadb-10.1-10.1.30/mysql-test/t/tc_heuristic_recover.test
--- mariadb-10.1-10.1.25/mysql-test/t/tc_heuristic_recover.test 1970-01-01 00:00:00.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/tc_heuristic_recover.test 2017-12-21 15:48:48.000000000 +0000
@@ -0,0 +1,106 @@
+# The test verifies a few server/engine recovery option combinations.
+# Specifically, MDEV-13437,13438 are concerned with no crashes
+# due to InnoDB being read-only during --tc-heuristic-recover=ROLLBACK|COMMIT.
+#
+# Initially the test commits a transaction and in the following proceeds
+# throughout some phases.
+# Within them the server is shut down and attempted to restart, to succeed
+# that in the end.
+# All this proves no crashes and effective rollback of the transaction.
+#
+--source include/have_innodb.inc
+# The test logics really requires --log-bin.
+--source include/have_binlog_format_mixed.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+call mtr.add_suppression("Can't init tc log");
+call mtr.add_suppression("Found 1 prepared transactions!");
+call mtr.add_suppression("Aborting");
+
+# Now take a shapshot of the last time server options.
+#
+# The "restart" expect-file facility can't be engaged because the server
+# having conflicting options may not succeed to boot up.
+# Also notice $MYSQLD_CMD is too "static" being unaware of the actual options
+# of the last (before shutdown or kill) server run.
+# That's why $MYSQLD_LAST_CMD that allows for the server new start
+# with more options appended to a stub set which is settled at this very point.
+--let $mysqld_stub_cmd= $MYSQLD_LAST_CMD
+--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let SEARCH_FILE= $error_log
+set debug_sync='RESET';
+
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+FLUSH TABLES; # we need the table post crash-restart, see MDEV-8841.
+
+# Run transaction in a separate "prey" connection
+--connect (con1,localhost,root,,)
+# The signal won't arrive though
+set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
+--send INSERT INTO t1 VALUES (1);
+
+--connection default
+
+--let $table= information_schema.processlist
+--let $where= where state = 'debug sync point: ha_commit_trans_after_prepare'
+--let $wait_condition= SELECT count(*) = 1 FROM $table $where
+--source include/wait_condition.inc
+
+--echo # Prove that no COMMIT or ROLLBACK occurred yet.
+SELECT * FROM t1;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+
+# TODO: MDEV-12700 Allow innodb_read_only startup without prior slow shutdown.
+--source include/kill_mysqld.inc
+--let $restart_parameters= --innodb-force-recovery=4
+--source include/fail_start_mysqld.inc
+
+--let SEARCH_PATTERN= was in the XA prepared state
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Found 1 prepared transactions!
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
+--source include/search_pattern_in_file++.inc
+
+--let $restart_parameters= --innodb-force-recovery=4 --tc-heuristic-recover=COMMIT
+--source include/fail_start_mysqld.inc
+--let SEARCH_PATTERN= was in the XA prepared state
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Found 1 prepared transactions!
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
+--source include/search_pattern_in_file++.inc
+
+--let $restart_parameters= --tc-heuristic-recover=ROLLBACK
+--source include/fail_start_mysqld.inc
+
+--let SEARCH_PATTERN= was in the XA prepared state
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Found 1 prepared transactions!
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
+--source include/search_pattern_in_file++.inc
+
+--let $restart_parameters=
+--source include/start_mysqld.inc
+
+--let SEARCH_PATTERN= was in the XA prepared state
+--source include/search_pattern_in_file++.inc
+--let SEARCH_PATTERN= Found 1 prepared transactions!
+--source include/search_pattern_in_file++.inc
+
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT * FROM t1;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+#
+# Cleanup
+#
+DROP TABLE t1;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/trigger.test mariadb-10.1-10.1.30/mysql-test/t/trigger.test
--- mariadb-10.1-10.1.25/mysql-test/t/trigger.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/trigger.test 2017-12-21 15:48:48.000000000 +0000
@@ -2634,3 +2634,27 @@
DROP TRIGGER t1_bi;
DROP TABLE t1;
+--echo #
+--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+--echo #
+
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+
+create trigger trg after insert on t2 for each row
+ INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1;
+
+drop table t1;
+
+--error ER_NO_SUCH_TABLE
+insert into t2 value (2);
+CREATE TABLE t1 (i INT);
+insert into t2 value (2);
+
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;
+
+
+--echo End of 10.1 tests.
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/type_bit.test mariadb-10.1-10.1.30/mysql-test/t/type_bit.test
--- mariadb-10.1-10.1.25/mysql-test/t/type_bit.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/type_bit.test 2017-12-21 15:48:48.000000000 +0000
@@ -439,3 +439,22 @@
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
+--echo #
+
+CREATE TABLE t1 (val bit(1));
+INSERT INTO t1 VALUES (0);
+CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+--enable_metadata
+SELECT COALESCE(val, 1) FROM t1;
+--disable_metadata
+DROP TABLE t1;
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/type_date.test mariadb-10.1-10.1.30/mysql-test/t/type_date.test
--- mariadb-10.1-10.1.25/mysql-test/t/type_date.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/type_date.test 2017-12-21 15:48:48.000000000 +0000
@@ -576,6 +576,15 @@
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison
+--echo #
+
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1985-05-13'),('1989-12-24');
+SELECT d, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP HAVING CASE d WHEN '2017-05-25' THEN 0 ELSE 1 END;
+DROP TABLE t1;
+
--echo #
--echo # End of 10.1 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/type_varchar.test mariadb-10.1-10.1.30/mysql-test/t/type_varchar.test
--- mariadb-10.1-10.1.25/mysql-test/t/type_varchar.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/type_varchar.test 2017-12-21 15:48:48.000000000 +0000
@@ -219,7 +219,51 @@
DROP TABLE t1;
--echo #
---echo # Start of 10.0 tests
+--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
+--echo #
+
+CREATE TABLE t1 (c1 VARBINARY(65532));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARBINARY(65533));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARBINARY(65534));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARBINARY(65535));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARBINARY(65536));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARCHAR(65532));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARCHAR(65533));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARCHAR(65534));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARCHAR(65535));
+DESCRIBE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 VARCHAR(65536));
+DESCRIBE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.5 tests
--echo #
--echo #
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/union.test mariadb-10.1-10.1.30/mysql-test/t/union.test
--- mariadb-10.1-10.1.25/mysql-test/t/union.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/union.test 2017-12-21 15:48:48.000000000 +0000
@@ -1405,6 +1405,20 @@
--echo End of 5.0 tests
+#
+# Bug #24595639: INCORRECT BEHAVIOR IN QUERY WITH UNION AND GROUP BY
+#
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (c varchar(30), d varchar(30));
+insert into t1 values ('1','1'),('2','2'),('4','4');
+create table t3 (e int, f int);
+insert into t3 values (1,1),(2,2),(31,31),(32,32);
+select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
+select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
+drop table t1,t2,t3;
+
+--echo End of 5.5 tests
--echo #
--echo # WL#1763 Avoid creating temporary table in UNION ALL
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/user_var.test mariadb-10.1-10.1.30/mysql-test/t/user_var.test
--- mariadb-10.1-10.1.25/mysql-test/t/user_var.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/user_var.test 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,5 @@
# Initialise
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
+source include/have_sequence.inc;
--error 1054
set @a := foo;
@@ -501,3 +499,9 @@
--enable_column_names
--enable_query_log
+#
+# MDEV-13897 SELECT @a := MAX(col) FROM t requires full index scan
+#
+explain select @a:=max(seq) from seq_1_to_1000000;
+
+# End of 10.1 tests
diff -Nru mariadb-10.1-10.1.25/mysql-test/t/view.test mariadb-10.1-10.1.30/mysql-test/t/view.test
--- mariadb-10.1-10.1.25/mysql-test/t/view.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/view.test 2017-12-21 15:48:48.000000000 +0000
@@ -1,3 +1,4 @@
+--source include/have_partition.inc
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
@@ -5577,6 +5578,31 @@
drop view v1;
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-11240: Server crashes in check_view_single_update or
+--echo # Assertion `derived->table' failed in mysql_derived_merge_for_insert
+--echo #
+
+CREATE TABLE t3 (a INT);
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
+CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
+--error ER_VIEW_NO_INSERT_FIELD_LIST
+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 -Nru mariadb-10.1-10.1.25/mysql-test/t/xml.test mariadb-10.1-10.1.30/mysql-test/t/xml.test
--- mariadb-10.1-10.1.25/mysql-test/t/xml.test 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/t/xml.test 2017-12-21 15:48:48.000000000 +0000
@@ -674,9 +674,7 @@
--echo # Bug#58175 xml functions read initialized bytes when conversions happen
--echo #
SET NAMES latin1;
---enable_prepare_warnings
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
---disable_prepare_warnings
--echo #
--echo # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
@@ -715,7 +713,7 @@
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('b',128),'><',REPEAT('c',512),'>c512',REPEAT('c',512),'>'));
SELECT ExtractValue (a, CONCAT('//',REPEAT('c',512))) AS c512 FROM t1;
diff -Nru mariadb-10.1-10.1.25/mysql-test/unstable-tests mariadb-10.1-10.1.30/mysql-test/unstable-tests
--- mariadb-10.1-10.1.25/mysql-test/unstable-tests 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysql-test/unstable-tests 2017-12-21 15:48:48.000000000 +0000
@@ -23,77 +23,98 @@
#
##############################################################################
-main.alter_table_online : Modified in 10.1.24
+main.alter_table : Modified in 10.1.29
main.alter_table_trans : MDEV-12084 - timeout
-main.analyze_format_json : MDEV-11866 - Wrong result
-main.analyze_stmt_orderby : MDEV-11866 - Wrong result
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
-main.bootstrap : Modified in 10.1.25
+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.create_delayed : MDEV-10605 - failed with timeout
-main.ctype_ucs : Modified in 10.1.25
+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.derived_view : Modified in 10.1.24
-main.drop-no_root : MDEV-12633 - Valgrind warnings
-main.errors : MDEV-13179 - Wrong error 1290; modified in 10.1.25
+main.ctype_utf32 : 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
main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist
main.events_restart : MDEV-12236 - Server shutdown problem
-main.func_concat : Modified in 10.1.25
-main.func_crypt : Modified in 10.1.25
-main.func_regexp_pcre : Modified in 10.1.25
-main.gis : Modified in 10.1.25
+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.join_outer : Modified in 10.1.25
+main.join_outer : Modified in 10.1.30
main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist
-main.loadxml : Modified in 10.1.24
main.mdev-504 : MDEV-10607 - sporadic "can't connect"
+main.mdev13607 : Added in 10.1.29
main.mdev375 : MDEV-10607 - sporadic "can't connect"
-main.mdl_sync : Modified in 10.1.25
main.merge : MDEV-10607 - sporadic "can't connect"
-main.myisam_debug : Modified in 10.1.24
-main.mysql : Modified in 10.1.25
-main.mysqlcheck : MDEV-12633 - Valgrind warnings
+main.myisam : Modified in 10.1.29
+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; modified in 10.1.25
-main.mysql_client_test : MDEV-12633 - Valgrind warnings
-main.mysql_client_test_comp : MDEV-12633 - Valgrind warnings
-main.mysql_client_test_nonblock : MDEV-12633 - Valgrind warnings
-main.mysqld--help : Modified in 10.1.25
-main.order_by : MOdified in 10.1.25
+main.mysqltest : MDEV-9269 - fails on Alpha
main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan
-main.partition_alter : Modified in 10.1.25
+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.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
+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
+main.plugin_load_option : Include files modified in 10.1.29
+main.plugin_maturity : Include files modified in 10.1.29
+main.plugin_not_embedded : Include files modified in 10.1.29
+main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.29
main.query_cache : MDEV-12895 - Wrong result
+main.range_vs_index_merge : Modified in 10.1.29
main.range_vs_index_merge_innodb : MDEV-12637 - Timeout
-main.repair_symlink-5543 : MDEV-12215 - Wrong error codes
+main.read_only : Modified in 10.1.29
main.set_statement : MDEV-13183 - Wrong result
-main.show_check : MDEV-12633 - Valgrind warnings
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.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.25
-main.subselect_sj : Modified in 10.1.24
-main.subselect_sj_mat : Modified in 10.1.25
-main.subselect_sj2_mat : Modified in 10.1.25
-main.symlink-aria-11902 : MDEV-12215 - Unexpected errors
-main.symlink-myisam-11902 : MDEV-12215 - Unexpected errors
+main.subselect_mat_cost_bugs : Modified in 10.1.29
+main.table_options-5867 : Include files modified in 10.1.29
+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.view : Modified in 10.1.25
+main.type_varchar : Modified in 10.1.29
+main.user_var : 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
-binlog.mysqladmin : Added in 10.1.24
#----------------------------------------------------------------
@@ -101,30 +122,39 @@
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.jdbc_new : Modified in 10.1.24
+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.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.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
#----------------------------------------------------------------
-csv.read_only : Added in 10.1.24
-
-#----------------------------------------------------------------
-
-encryption.create_or_replace : MDEV-9359 - Assertion failure
+encryption.create_or_replace : MDEV-9359 - Assertion failure, MDEV-13516 - Assertion failure
+encryption.debug_key_management : MDEV-13841 - Timeout on wait condition
+encryption.encrypt_and_grep : MDEV-13765 - Wrong result
+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-checksum-algorithm : MDEV-13167 - Assertion failure; added in 10.1.25
-encryption.innodb-compressed-blob : Modified in 10.1.25
+encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
encryption.innodb-discard-import-change : MDEV-12632 - Valgrind warnings
+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
encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure
encryption.innodb_first_page : MDEV-10689 - crashes
-encryption.innodb-first-page-read : MDEV-13181 - Signal 8; added in 10.1.25
-encryption.innodb-key-rotation-disable : Modified in 10.1.24
+encryption.innodb-first-page-read : MDEV-14356 - Timeout on wait condition
encryption.innodb_lotoftables : MDEV-11531 - InnoDB error
encryption.innodb-missing-key : MDEV-9359 - assertion failure
encryption.innodb-page_encryption : MDEV-10641 - mutex problem
@@ -140,7 +170,6 @@
#----------------------------------------------------------------
-federated.assisted_discovery : Modified in 10.1.24
federated.federated_bug_585688 : MDEV-12907 - Valgrind
federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips
federated.federated_partition : MDEV-10417 - Fails on Mips
@@ -157,69 +186,79 @@
#----------------------------------------------------------------
-galera.galera_autoinc_sst_xtrabackup : Config modified in 10.1.24
-galera.galera_defaults : Modified in 10.1.25
-galera.galera_gcs_fc_limit : Modified in 10.1.24
-galera.MW-369 : Added in 10.1.25
+galera.* : The suite was enabled in 10.1.27 and is still unstable
+galera_3nodes.* : The suite has not been stabilized yet
-galera_3nodes.* : config files modified in 10.1.24
+galera.galera_applier_ftwrl_table_alter : MDEV-13738 - MySQL server has gone away
+galera.galera_gcs_fc_limit : MDEV-13877 - Timeout
+galera.galera_suspend_slave : MDEV-13873 - Wrong error code
+galera.galera_toi_truncate : MDEV-13743 - query 'reap' succeeded
+galera.galera_unicode_identifiers : MDEV-13871 - Unknown database
+galera.galera_var_node_address : MDEV-13880 - Failed to start mysqld
+galera.galera_wan : MDEV-13879 - Stray state UUID msg warnings
+galera.galera_wsrep_log_conficts : MDEV-13874 - check-testcase failed
+galera.partition : MDEV-13881 - Wrong result
+galera.query_cache : MDEV-13883 - Wrong result
+galera.MW-328A : MDEV-13876 - Wrong result
#----------------------------------------------------------------
-innodb.101_compatibility : Modified in 10.1.25
innodb.binlog_consistent : MDEV-10618 - Server fails to start
-innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server; modified in 10.1.25
-innodb.drop_table_background : Added in 10.1.24
-innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.1.25
-innodb.innodb-alter-discard : Modified in 10.1.25
-innodb.innodb-alter-nullable : Modified in 10.1.25
-innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.1.25
-innodb.innodb-alter-tempfile : Modified in 10.1.25
+innodb.doublewrite : MDEV-12905, MDEV-14205 - Lost connection to MySQL server
+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-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, also modified in 10.1.24
+innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes
innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan
-innodb.innodb_bug53290 : MDEV-12634 - Valgrind warnings
-innodb.innodb-page_compression_bzip2 : Modified in 10.1.24
-innodb.innodb-page_compression_default : Modified in 10.1.24
-innodb.innodb-page_compression_lz4 : Modified in 10.1.24
-innodb.innodb-page_compression_lzma : Modified in 10.1.24
-innodb.innodb-page_compression_lzo : Modified in 10.1.24
-innodb.innodb-page_compression_snappy : Modified in 10.1.24
-innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem; modified in 10.1.24
-innodb.innodb_prefix_index_restart_server : MDEV-12899 - Server crash on shutdown
+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-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.log_data_file_size : MDEV-12893 - Database page corruption; modified in 10.1.25
-innodb.log_file_size : Modified in 10.1.25
-innodb.row_format_redundant : Added in 10.1.25
-innodb.table_flags : Added in 10.1.25
+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.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_fts.concurrent_insert : Added in 10.1.29
+innodb_fts.fulltext : Modified in 10.1.29
innodb_fts.fulltext_misc : MDEV-12636 - Valgrind warnings
-innodb_zip.innodb_bug36169 : Modified in 10.1.25
-innodb_zip.innodb_bug36172 : Modified in 10.1.25
-innodb_zip.innodb_bug52745 : Modified in 10.1.25
-innodb_zip.innodb_bug53591 : Modified in 10.1.25
-innodb_zip.innodb_bug56680 : Modified in 10.1.25
-innodb_zip.innodb-create-options : Modified in 10.1.25
-innodb_zip.innodb-zip : Modified in 10.1.25
+innodb_zip.innodb_prefix_index_liftedlimit : Modified in 10.1.29
+innodb_zip.wl5522_debug_zip : Added in 10.1.29
#----------------------------------------------------------------
-mariabackup.* : suite.pm modified in 10.1.24
-
-mariabackup.full_backup : Modified in 10.1.25
-mariabackup.incremental_backup : Uses include file modified in 10.1.25
-mariabackup.incremental_encrypted : Modified in 10.1.25
-mariabackup.xb_aws_key_management : Uses include file modified in 10.1.25
-mariabackup.xb_compressed_encrypted : Modified in 10.1.25
-mariabackup.xb_file_key_management : Modified in 10.1.25
-mariabackup.xb_fulltext_encrypted : Uses include file modified in 10.1.25
-mariabackup.xb_partition : Uses include file modified in 10.1.25
-mariabackup.xbstream : Uses include file modified in 10.1.25
+maria.maria : MDEV-14430 - Wrong result; modified in 10.1.29
#----------------------------------------------------------------
+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
+
+#----------------------------------------------------------------
+
+mroonga.* : Many tests and include files added and modified in 10.1.29
+mroonga/storage.* : Many tests and include files added and modified in 10.1.29
+
mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha
mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha
mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha
@@ -228,12 +267,17 @@
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
#----------------------------------------------------------------
multi_source.gtid : MDEV-10417 - Fails on Mips
multi_source.info_logs : MDEV-10042 - Wrong result, MDEV-12629 - Valgrind warnings
-multi_source.mdev-9544 : Added in 10.1.25
multi_source.multisource : MDEV-10417 - Fails on Mips
multi_source.reset_slave : MDEV-10690 - wrong result
multi_source.simple : MDEV-4633 - Wrong slave status output
@@ -241,32 +285,37 @@
#----------------------------------------------------------------
+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_auto_increment_maria : MDEV-14430 - Wrong result
parts.partition_innodb_status_file : MDEV-12901 - Valgrind
-parts.quoting : Modified in 10.1.25
#----------------------------------------------------------------
-perfschema.bad_option_2 : Modified in 10.1.25
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
perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders
perfschema.stage_mdl_table : MDEV-12638 - Wrong result
-perfschema.start_server_1_digest : Added in 10.1.24
perfschema.threads_mysql : MDEV-10677 - sporadic wrong result
#----------------------------------------------------------------
+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
-plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc
+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
#----------------------------------------------------------------
-roles.current_role_view-12666 : Added in 10.1.25
-roles.show_create_database-10463 : Added in 10.1.25
+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
#----------------------------------------------------------------
@@ -277,38 +326,60 @@
rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master
rpl.rpl_checksum_cache : MDEV-12173 - Unexpected error
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
+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
rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog
-rpl.rpl_mdev-11092 : MDEV-13065 - Wrong value in include; added in 10.1.24
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_row_log_innodb : MDEV-10688 - Wrong result
+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 : 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_row_utf32 : One-time server startup timeout on ppc64le in 10.1.25
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, MDEV-10892 - Assertion failure
+rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status
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_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_temporary_error2 : MDEV-10634 - Wrong number of retries
+rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
#----------------------------------------------------------------
@@ -344,23 +415,21 @@
#----------------------------------------------------------------
sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.delay_key_write_func : Modified in 10.1.24
+sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.1.29
+sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.1.29
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
-sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists
+sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.1.29
+sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.1.29
+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.innodb_sched_priority_cleaner_basic : Modified in 10.1.25
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
-sys_vars.sysvars_wsrep : Modified in 10.1.24
#----------------------------------------------------------------
-tokudb.bug-1657908 : Added in 10.1.24
tokudb.change_column_all_1000_10 : MDEV-12640 - Crash
tokudb.change_column_bin : MDEV-12640 - Crash
tokudb.change_column_char : MDEV-12822 - Lost connection to MySQL server
@@ -368,26 +437,22 @@
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
+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
tokudb.hotindex-update-1 : MDEV-12640 - Crash
tokudb.rows-32m-rand-insert : MDEV-12640 - Crash
tokudb.rows-32m-seq-insert : MDEV-12640 - Crash
-tokudb_backup.backup_master_info : Added in 10.1.24
-tokudb_backup.backup_master_state : Added in 10.1.24
-tokudb_backup.empty_slave_info_file : Added in 10.1.24
-tokudb_backup.innodb_use_native_aio_enabled : Added in 10.1.24
-tokudb_backup.rpl_safe_slave : Added in 10.1.24
-tokudb_backup.rpl_tokudb_commit_sync : Added in 10.1.24
-
tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output
tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output
-tokudb_bugs.db233 : Modified in 10.1.24
-tokudb_bugs.leak172 : Modified in 10.1.24
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
@@ -397,11 +462,13 @@
vcol.not_supported : MDEV-10639 - Testcase timeout
vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
+vcol.vcol_misc : Modified in 10.1.29
#----------------------------------------------------------------
wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node
+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.variables : Include file modified in 10.1.25
wsrep_info.plugin : MDEV-12909 - Wrong result
diff -Nru mariadb-10.1-10.1.25/mysys/ma_dyncol.c mariadb-10.1-10.1.30/mysys/ma_dyncol.c
--- mariadb-10.1-10.1.25/mysys/ma_dyncol.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/ma_dyncol.c 2017-12-21 15:48:48.000000000 +0000
@@ -4183,8 +4183,7 @@
}
else
{
- if ((rc= mariadb_dyncol_val_str(json, &val,
- &my_charset_utf8_general_ci, '"')) < 0)
+ if ((rc= mariadb_dyncol_val_str(json, &val, DYNCOL_UTF, '"')) < 0)
goto err;
}
}
diff -Nru mariadb-10.1-10.1.25/mysys/my_default.c mariadb-10.1-10.1.30/mysys/my_default.c
--- mariadb-10.1-10.1.25/mysys/my_default.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_default.c 2017-12-21 15:48:48.000000000 +0000
@@ -487,8 +487,7 @@
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 @@
err:
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
- exit(1);
- return 0; /* Keep compiler happy */
+ return 2;
}
diff -Nru mariadb-10.1-10.1.25/mysys/my_fopen.c mariadb-10.1-10.1.30/mysys/my_fopen.c
--- mariadb-10.1-10.1.25/mysys/my_fopen.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_fopen.c 2017-12-21 15:48:48.000000000 +0000
@@ -142,7 +142,7 @@
/*
A hack around a race condition in the implementation of freopen.
- The race condition steams from the fact that the current fd of
+ The race condition stems from the fact that the current fd of
the stream is closed before its number is used to duplicate the
new file descriptor. This defeats the desired atomicity of the
close and duplicate of dup2().
diff -Nru mariadb-10.1-10.1.25/mysys/my_init.c mariadb-10.1-10.1.30/mysys/my_init.c
--- mariadb-10.1-10.1.25/mysys/my_init.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_init.c 2017-12-21 15:48:48.000000000 +0000
@@ -200,7 +200,6 @@
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
_CrtCheckMemory();
- _CrtDumpMemoryLeaks();
#endif
}
diff -Nru mariadb-10.1-10.1.25/mysys/my_malloc.c mariadb-10.1-10.1.30/mysys/my_malloc.c
--- mariadb-10.1-10.1.25/mysys/my_malloc.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_malloc.c 2017-12-21 15:48:48.000000000 +0000
@@ -109,7 +109,7 @@
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
ME_NOREFRESH + ME_FATALERROR),size);
if (my_flags & MY_FAE)
- exit(1);
+ abort();
}
else
{
diff -Nru mariadb-10.1-10.1.25/mysys/my_new.cc mariadb-10.1-10.1.30/mysys/my_new.cc
--- mariadb-10.1-10.1.25/mysys/my_new.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_new.cc 2017-12-21 15:48:48.000000000 +0000
@@ -47,6 +47,11 @@
return (void *) my_malloc (sz ? sz : 1, MYF(0));
}
+void operator delete (void *ptr, std::size_t)
+{
+ my_free(ptr);
+}
+
void operator delete (void *ptr)
{
my_free(ptr);
@@ -56,6 +61,11 @@
{
my_free(ptr);
}
+
+void operator delete[] (void *ptr, std::size_t) throw ()
+{
+ my_free(ptr);
+}
void operator delete(void* ptr, const std::nothrow_t&) throw()
{
diff -Nru mariadb-10.1-10.1.25/mysys/my_winerr.c mariadb-10.1-10.1.30/mysys/my_winerr.c
--- mariadb-10.1-10.1.25/mysys/my_winerr.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/my_winerr.c 2017-12-21 15:48:48.000000000 +0000
@@ -75,7 +75,9 @@
{ ERROR_ALREADY_EXISTS, EEXIST }, /* 183 */
{ ERROR_FILENAME_EXCED_RANGE, ENOENT }, /* 206 */
{ ERROR_NESTING_NOT_ALLOWED, EAGAIN }, /* 215 */
- { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */
+ { ERROR_FILE_SYSTEM_LIMITATION, EFBIG }, /* 665 */
+ { ERROR_NO_SYSTEM_RESOURCES, ENOMEM }, /* 1450 */
+ { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */
};
/* size of the table */
diff -Nru mariadb-10.1-10.1.25/mysys/stacktrace.c mariadb-10.1-10.1.30/mysys/stacktrace.c
--- mariadb-10.1-10.1.25/mysys/stacktrace.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/stacktrace.c 2017-12-21 15:48:48.000000000 +0000
@@ -765,7 +765,7 @@
size_t my_write_stderr(const void *buf, size_t count)
{
- return (size_t) write(STDERR_FILENO, buf, count);
+ return (size_t) write(fileno(stderr), buf, count);
}
diff -Nru mariadb-10.1-10.1.25/mysys/thr_alarm.c mariadb-10.1-10.1.30/mysys/thr_alarm.c
--- mariadb-10.1-10.1.25/mysys/thr_alarm.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/thr_alarm.c 2017-12-21 15:48:48.000000000 +0000
@@ -273,7 +273,7 @@
/*
Come here when some alarm in queue is due.
Mark all alarms with are finnished in list.
- Shedule alarms to be sent again after 1-10 sec (many alarms at once)
+ Schedule alarms to be sent again after 1-10 sec (many alarms at once)
If alarm_aborted is set then all alarms are given and resent
every second.
*/
@@ -425,7 +425,7 @@
if (alarm_aborted != 1) /* If memory not freed */
{
mysql_mutex_lock(&LOCK_alarm);
- DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements));
+ DBUG_PRINT("info",("Rescheduling %d waiting alarms",alarm_queue.elements));
alarm_aborted= -1; /* mark aborted */
if (alarm_queue.elements || (alarm_thread_running && free_structures))
{
diff -Nru mariadb-10.1-10.1.25/mysys/typelib.c mariadb-10.1-10.1.30/mysys/typelib.c
--- mariadb-10.1-10.1.25/mysys/typelib.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/mysys/typelib.c 2017-12-21 15:48:48.000000000 +0000
@@ -45,18 +45,6 @@
}
-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 -Nru mariadb-10.1-10.1.25/pcre/ChangeLog mariadb-10.1-10.1.30/pcre/ChangeLog
--- mariadb-10.1-10.1.25/pcre/ChangeLog 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/ChangeLog 2017-12-21 15:48:48.000000000 +0000
@@ -4,6 +4,53 @@
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.
+Version 8.41 05-July-2017
+-------------------------
+
+1. Fixed typo in CMakeLists.txt (wrong number of arguments for
+PCRE_STATIC_RUNTIME (affects MSVC only).
+
+2. Issue 1 for 8.40 below was not correctly fixed. If pcregrep in multiline
+mode with --only-matching matched several lines, it restarted scanning at the
+next line instead of moving on to the end of the matched string, which can be
+several lines after the start.
+
+3. Fix a missing else in the JIT compiler reported by 'idaifish'.
+
+4. A (?# style comment is now ignored between a basic quantifier and a
+following '+' or '?' (example: /X+(?#comment)?Y/.
+
+5. Avoid use of a potentially overflowing buffer in pcregrep (patch by Petr
+Pisar).
+
+6. Fuzzers have reported issues in pcretest. These are NOT serious (it is,
+after all, just a test program). However, to stop the reports, some easy ones
+are fixed:
+
+ (a) Check for values < 256 when calling isprint() in pcretest.
+ (b) Give an error for too big a number after \O.
+
+7. In the 32-bit library in non-UTF mode, an attempt to find a Unicode
+property for a character with a code point greater than 0x10ffff (the Unicode
+maximum) caused a crash.
+
+8. The alternative matching function, pcre_dfa_exec() misbehaved if it
+encountered a character class with a possessive repeat, for example [a-f]{3}+.
+
+9. When pcretest called pcre_copy_substring() in 32-bit mode, it set the buffer
+length incorrectly, which could result in buffer overflow.
+
+10. Remove redundant line of code (accidentally left in ages ago).
+
+11. Applied C++ patch from Irfan Adilovic to guard 'using std::' directives
+with namespace pcrecpp (Bugzilla #2084).
+
+12. Remove a duplication typo in pcre_tables.c.
+
+13. Fix returned offsets from regexec() when REG_STARTEND is used with a
+starting offset greater than zero.
+
+
Version 8.40 11-January-2017
----------------------------
diff -Nru mariadb-10.1-10.1.25/pcre/CMakeLists.txt mariadb-10.1-10.1.30/pcre/CMakeLists.txt
--- mariadb-10.1-10.1.25/pcre/CMakeLists.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/CMakeLists.txt 2017-12-21 15:48:48.000000000 +0000
@@ -128,9 +128,9 @@
SET(PCRE_NEWLINE "LF" CACHE STRING
"What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
-# MARIADB: Changed the default from OFF to ON as pcre_test.bat on Windows
-# MARIADB: fails complaining about too small stack size on Windows.
-SET(PCRE_NO_RECURSE ON CACHE BOOL
+# Windows has much smaller stack (pcre recursion limit of 112, vs
+# 250-500 on Linuxes)
+SET(PCRE_NO_RECURSE "${WIN32}" CACHE BOOL
"If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
diff -Nru mariadb-10.1-10.1.25/pcre/configure.ac mariadb-10.1-10.1.30/pcre/configure.ac
--- mariadb-10.1-10.1.25/pcre/configure.ac 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/configure.ac 2017-12-21 15:48:48.000000000 +0000
@@ -9,18 +9,18 @@
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
-m4_define(pcre_minor, [40])
+m4_define(pcre_minor, [41])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2017-01-11])
+m4_define(pcre_date, [2017-07-05])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre_version, [3:8:2])
-m4_define(libpcre16_version, [2:8:2])
-m4_define(libpcre32_version, [0:8:0])
-m4_define(libpcreposix_version, [0:4:0])
+m4_define(libpcre_version, [3:9:2])
+m4_define(libpcre16_version, [2:9:2])
+m4_define(libpcre32_version, [0:9:0])
+m4_define(libpcreposix_version, [0:5:0])
m4_define(libpcrecpp_version, [0:1:0])
AC_PREREQ(2.57)
diff -Nru mariadb-10.1-10.1.25/pcre/doc/html/pcrejit.html mariadb-10.1-10.1.30/pcre/doc/html/pcrejit.html
--- mariadb-10.1-10.1.25/pcre/doc/html/pcrejit.html 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/html/pcrejit.html 2017-12-21 15:48:48.000000000 +0000
@@ -79,9 +79,12 @@
If your program may sometimes be linked with versions of PCRE that are older
-than 8.20, but you want to use JIT when it is available, you can test
-the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such
-as PCRE_CONFIG_JIT, for compile-time control of your code.
+than 8.20, but you want to use JIT when it is available, you can test the
+values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such as
+PCRE_CONFIG_JIT, for compile-time control of your code. Also beware that the
+pcre_jit_exec() function was not available at all before 8.32,
+and may not be available at all if PCRE isn't compiled with
+--enable-jit. See the "JIT FAST PATH API" section below for details.
SIMPLE USE OF JIT
@@ -119,6 +122,20 @@
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
+If using pcre_jit_exec() and supporting a pre-8.32 version of
+PCRE, you can insert:
+
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+
+but as described in the "JIT FAST PATH API" section below this assumes
+version 8.32 and later are compiled with --enable-jit, which may
+break.
+
+
The JIT compiler generates different optimized code for each of the three
modes (normal, soft partial, hard partial). When pcre_exec() is called,
the appropriate code is run if it is available. Otherwise, the pattern is
@@ -428,6 +445,36 @@
Bypassing the sanity checks and the pcre_exec() wrapping can give
speedups of more than 10%.
+
+Note that the pcre_jit_exec() function is not available in versions of
+PCRE before 8.32 (released in November 2012). If you need to support versions
+that old you must either use the slower pcre_exec(), or switch between
+the two codepaths by checking the values of PCRE_MAJOR and PCRE_MINOR.
+
+
+Due to an unfortunate implementation oversight, even in versions 8.32
+and later there will be no pcre_jit_exec() stub function defined
+when PCRE is compiled with --disable-jit, which is the default, and
+there's no way to detect whether PCRE was compiled with --enable-jit
+via a macro.
+
+
+If you need to support versions older than 8.32, or versions that may
+not build with --enable-jit, you must either use the slower
+pcre_exec(), or switch between the two codepaths by checking the
+values of PCRE_MAJOR and PCRE_MINOR.
+
+
+Switching between the two by checking the version assumes that all the
+versions being targeted are built with --enable-jit. To also support
+builds that may use --disable-jit either pcre_exec() must be
+used, or a compile-time check for JIT via pcre_config() (which
+assumes the runtime environment will be the same), or as the Git
+project decided to do, simply assume that pcre_jit_exec() is
+present in 8.32 or later unless a compile-time flag is provided, see
+the "grep: un-break building with PCRE >= 8.32 without --enable-jit"
+commit in git.git for an example of that.
+
SEE ALSO
pcreapi(3)
@@ -443,9 +490,9 @@
REVISION
-Last updated: 17 March 2013
+Last updated: 05 July 2017
-Copyright © 1997-2013 University of Cambridge.
+Copyright © 1997-2017 University of Cambridge.
Return to the PCRE index page.
diff -Nru mariadb-10.1-10.1.25/pcre/doc/html/pcretest.html mariadb-10.1-10.1.30/pcre/doc/html/pcretest.html
--- mariadb-10.1-10.1.25/pcre/doc/html/pcretest.html 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/html/pcretest.html 2017-12-21 15:48:48.000000000 +0000
@@ -74,6 +74,11 @@
maximum portability, therefore, it is safest to use only ASCII characters in
pcretest input files.
+
+The input is processed using using C's string functions, so must not
+contain binary zeroes, even though in Unix-like environments, fgets()
+treats any bytes other than newline as data characters.
+
PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
From release 8.30, two separate PCRE libraries can be built. The original one
@@ -1149,9 +1154,9 @@
REVISION
-Last updated: 09 February 2014
+Last updated: 23 February 2017
-Copyright © 1997-2014 University of Cambridge.
+Copyright © 1997-2017 University of Cambridge.
Return to the PCRE index page.
diff -Nru mariadb-10.1-10.1.25/pcre/doc/pcrejit.3 mariadb-10.1-10.1.30/pcre/doc/pcrejit.3
--- mariadb-10.1-10.1.25/pcre/doc/pcrejit.3 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/pcrejit.3 2017-12-21 15:48:48.000000000 +0000
@@ -1,4 +1,4 @@
-.TH PCREJIT 3 "17 March 2013" "PCRE 8.33"
+.TH PCREJIT 3 "05 July 2017" "PCRE 8.41"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE JUST-IN-TIME COMPILER SUPPORT"
@@ -54,9 +54,12 @@
API that is JIT-specific.
.P
If your program may sometimes be linked with versions of PCRE that are older
-than 8.20, but you want to use JIT when it is available, you can test
-the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such
-as PCRE_CONFIG_JIT, for compile-time control of your code.
+than 8.20, but you want to use JIT when it is available, you can test the
+values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such as
+PCRE_CONFIG_JIT, for compile-time control of your code. Also beware that the
+\fBpcre_jit_exec()\fP function was not available at all before 8.32,
+and may not be available at all if PCRE isn't compiled with
+--enable-jit. See the "JIT FAST PATH API" section below for details.
.
.
.SH "SIMPLE USE OF JIT"
@@ -96,6 +99,19 @@
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
.sp
+If using \fBpcre_jit_exec()\fP and supporting a pre-8.32 version of
+PCRE, you can insert:
+.sp
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+.sp
+but as described in the "JIT FAST PATH API" section below this assumes
+version 8.32 and later are compiled with --enable-jit, which may
+break.
+.sp
The JIT compiler generates different optimized code for each of the three
modes (normal, soft partial, hard partial). When \fBpcre_exec()\fP is called,
the appropriate code is run if it is available. Otherwise, the pattern is
@@ -404,6 +420,32 @@
.P
Bypassing the sanity checks and the \fBpcre_exec()\fP wrapping can give
speedups of more than 10%.
+.P
+Note that the \fBpcre_jit_exec()\fP function is not available in versions of
+PCRE before 8.32 (released in November 2012). If you need to support versions
+that old you must either use the slower \fBpcre_exec()\fP, or switch between
+the two codepaths by checking the values of PCRE_MAJOR and PCRE_MINOR.
+.P
+Due to an unfortunate implementation oversight, even in versions 8.32
+and later there will be no \fBpcre_jit_exec()\fP stub function defined
+when PCRE is compiled with --disable-jit, which is the default, and
+there's no way to detect whether PCRE was compiled with --enable-jit
+via a macro.
+.P
+If you need to support versions older than 8.32, or versions that may
+not build with --enable-jit, you must either use the slower
+\fBpcre_exec()\fP, or switch between the two codepaths by checking the
+values of PCRE_MAJOR and PCRE_MINOR.
+.P
+Switching between the two by checking the version assumes that all the
+versions being targeted are built with --enable-jit. To also support
+builds that may use --disable-jit either \fBpcre_exec()\fP must be
+used, or a compile-time check for JIT via \fBpcre_config()\fP (which
+assumes the runtime environment will be the same), or as the Git
+project decided to do, simply assume that \fBpcre_jit_exec()\fP is
+present in 8.32 or later unless a compile-time flag is provided, see
+the "grep: un-break building with PCRE >= 8.32 without --enable-jit"
+commit in git.git for an example of that.
.
.
.SH "SEE ALSO"
@@ -426,6 +468,6 @@
.rs
.sp
.nf
-Last updated: 17 March 2013
-Copyright (c) 1997-2013 University of Cambridge.
+Last updated: 05 July 2017
+Copyright (c) 1997-2017 University of Cambridge.
.fi
diff -Nru mariadb-10.1-10.1.25/pcre/doc/pcretest.1 mariadb-10.1-10.1.30/pcre/doc/pcretest.1
--- mariadb-10.1-10.1.25/pcre/doc/pcretest.1 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/pcretest.1 2017-12-21 15:48:48.000000000 +0000
@@ -1,4 +1,4 @@
-.TH PCRETEST 1 "09 February 2014" "PCRE 8.35"
+.TH PCRETEST 1 "23 February 2017" "PCRE 8.41"
.SH NAME
pcretest - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@@ -50,6 +50,10 @@
(hex 1A) causes an immediate end of file, and no further data is read. For
maximum portability, therefore, it is safest to use only ASCII characters in
\fBpcretest\fP input files.
+.P
+The input is processed using using C's string functions, so must not
+contain binary zeroes, even though in Unix-like environments, \fBfgets()\fP
+treats any bytes other than newline as data characters.
.
.
.SH "PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES"
@@ -1151,6 +1155,6 @@
.rs
.sp
.nf
-Last updated: 09 February 2014
-Copyright (c) 1997-2014 University of Cambridge.
+Last updated: 23 February 2017
+Copyright (c) 1997-2017 University of Cambridge.
.fi
diff -Nru mariadb-10.1-10.1.25/pcre/doc/pcretest.txt mariadb-10.1-10.1.30/pcre/doc/pcretest.txt
--- mariadb-10.1-10.1.25/pcre/doc/pcretest.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/pcretest.txt 2017-12-21 15:48:48.000000000 +0000
@@ -39,6 +39,10 @@
For maximum portability, therefore, it is safest to use only ASCII
characters in pcretest input files.
+ The input is processed using using C's string functions, so must not
+ contain binary zeroes, even though in Unix-like environments, fgets()
+ treats any bytes other than newline as data characters.
+
PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
@@ -1083,5 +1087,5 @@
REVISION
- Last updated: 09 February 2014
- Copyright (c) 1997-2014 University of Cambridge.
+ Last updated: 23 February 2017
+ Copyright (c) 1997-2017 University of Cambridge.
diff -Nru mariadb-10.1-10.1.25/pcre/doc/pcre.txt mariadb-10.1-10.1.30/pcre/doc/pcre.txt
--- mariadb-10.1-10.1.25/pcre/doc/pcre.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/doc/pcre.txt 2017-12-21 15:48:48.000000000 +0000
@@ -8365,7 +8365,11 @@
If your program may sometimes be linked with versions of PCRE that are
older than 8.20, but you want to use JIT when it is available, you can
test the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT
- macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
+ macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
+ Also beware that the pcre_jit_exec() function was not available at all
+ before 8.32, and may not be available at all if PCRE isn't compiled
+ with --enable-jit. See the "JIT FAST PATH API" section below for
+ details.
SIMPLE USE OF JIT
@@ -8407,6 +8411,18 @@
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
+ If using pcre_jit_exec() and supporting a pre-8.32 version of PCRE, you
+ can insert:
+
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+
+ but as described in the "JIT FAST PATH API" section below this assumes
+ version 8.32 and later are compiled with --enable-jit, which may break.
+
The JIT compiler generates different optimized code for each of the
three modes (normal, soft partial, hard partial). When pcre_exec() is
called, the appropriate code is run if it is available. Otherwise, the
@@ -8696,6 +8712,33 @@
Bypassing the sanity checks and the pcre_exec() wrapping can give
speedups of more than 10%.
+ Note that the pcre_jit_exec() function is not available in versions of
+ PCRE before 8.32 (released in November 2012). If you need to support
+ versions that old you must either use the slower pcre_exec(), or switch
+ between the two codepaths by checking the values of PCRE_MAJOR and
+ PCRE_MINOR.
+
+ Due to an unfortunate implementation oversight, even in versions 8.32
+ and later there will be no pcre_jit_exec() stub function defined when
+ PCRE is compiled with --disable-jit, which is the default, and there's
+ no way to detect whether PCRE was compiled with --enable-jit via a
+ macro.
+
+ If you need to support versions older than 8.32, or versions that may
+ not build with --enable-jit, you must either use the slower
+ pcre_exec(), or switch between the two codepaths by checking the values
+ of PCRE_MAJOR and PCRE_MINOR.
+
+ Switching between the two by checking the version assumes that all the
+ versions being targeted are built with --enable-jit. To also support
+ builds that may use --disable-jit either pcre_exec() must be used, or a
+ compile-time check for JIT via pcre_config() (which assumes the runtime
+ environment will be the same), or as the Git project decided to do,
+ simply assume that pcre_jit_exec() is present in 8.32 or later unless a
+ compile-time flag is provided, see the "grep: un-break building with
+ PCRE >= 8.32 without --enable-jit" commit in git.git for an example of
+ that.
+
SEE ALSO
@@ -8711,8 +8754,8 @@
REVISION
- Last updated: 17 March 2013
- Copyright (c) 1997-2013 University of Cambridge.
+ Last updated: 05 July 2017
+ Copyright (c) 1997-2017 University of Cambridge.
------------------------------------------------------------------------------
diff -Nru mariadb-10.1-10.1.25/pcre/NEWS mariadb-10.1-10.1.30/pcre/NEWS
--- mariadb-10.1-10.1.25/pcre/NEWS 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/NEWS 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,12 @@
News about PCRE releases
------------------------
+Release 8.41 13-June-2017
+-------------------------
+
+This is a bug-fix release.
+
+
Release 8.40 11-January-2017
----------------------------
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_compile.c mariadb-10.1-10.1.30/pcre/pcre_compile.c
--- mariadb-10.1-10.1.25/pcre/pcre_compile.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_compile.c 2017-12-21 15:48:48.000000000 +0000
@@ -1249,6 +1249,7 @@
if ((c = *ptr) >= CHAR_8) break;
+ /* fall through */
/* Fall through with a digit less than 8 */
/* \0 always starts an octal number, but we may drop through to here with a
@@ -5097,6 +5098,8 @@
either not match or match, depending on whether the class is or is
not negated. */
+ /* fall through */
+
default:
if (local_negate &&
(xclass || tempptr[2] != CHAR_RIGHT_SQUARE_BRACKET))
@@ -5739,6 +5742,21 @@
ptr = p - 1; /* Character before the next significant one. */
}
+ /* We also need to skip over (?# comments, which are not dependent on
+ extended mode. */
+
+ if (ptr[1] == CHAR_LEFT_PARENTHESIS && ptr[2] == CHAR_QUESTION_MARK &&
+ ptr[3] == CHAR_NUMBER_SIGN)
+ {
+ ptr += 4;
+ while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+ if (*ptr == CHAR_NULL)
+ {
+ *errorcodeptr = ERR18;
+ goto FAILED;
+ }
+ }
+
/* If the next character is '+', we have a possessive quantifier. This
implies greediness, whatever the setting of the PCRE_UNGREEDY option.
If the next character is '?' this is a minimizing repeat, by default,
@@ -7150,7 +7168,7 @@
goto FAILED;
}
/* Fall through to handle (?P< as (?< is handled */
-
+ /* fall through */
/* ------------------------------------------------------------ */
DEFINE_NAME: /* Come here from (?< handling */
@@ -8210,7 +8228,6 @@
if (mclength == 1 || req_caseopt == 0)
{
- firstchar = mcbuffer[0] | req_caseopt;
firstchar = mcbuffer[0];
firstcharflags = req_caseopt;
diff -Nru mariadb-10.1-10.1.25/pcre/pcrecpp_unittest.cc mariadb-10.1-10.1.30/pcre/pcrecpp_unittest.cc
--- mariadb-10.1-10.1.25/pcre/pcrecpp_unittest.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcrecpp_unittest.cc 2017-12-21 15:48:48.000000000 +0000
@@ -43,6 +43,7 @@
#include
#include "pcrecpp.h"
+using std::string;
using pcrecpp::StringPiece;
using pcrecpp::RE;
using pcrecpp::RE_Options;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_dfa_exec.c mariadb-10.1-10.1.30/pcre/pcre_dfa_exec.c
--- mariadb-10.1-10.1.25/pcre/pcre_dfa_exec.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_dfa_exec.c 2017-12-21 15:48:48.000000000 +0000
@@ -7,7 +7,7 @@
below for why this module is different).
Written by Philip Hazel
- Copyright (c) 1997-2014 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -2625,7 +2625,7 @@
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
- if (*ecode == OP_CRPOSRANGE)
+ if (*ecode == OP_CRPOSRANGE && count >= (int)GET2(ecode, 1))
{
active_count--; /* Remove non-match possibility */
next_active_state--;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_exec.c mariadb-10.1-10.1.30/pcre/pcre_exec.c
--- mariadb-10.1-10.1.25/pcre/pcre_exec.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_exec.c 2017-12-21 15:48:48.000000000 +0000
@@ -509,6 +509,12 @@
(e.g. stopped by repeated call or recursion limit)
*/
+#ifdef __GNUC__
+static int
+match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
+ PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
+ unsigned int rdepth) __attribute__((noinline,noclone));
+#endif
static int
match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
@@ -669,7 +675,7 @@
return match((PCRE_PUCHAR)&rdepth, NULL, NULL, 0, NULL, NULL, 1);
else
{
- int len = (char *)&rdepth - (char *)eptr;
+ int len = (int)((char *)&rdepth - (char *)eptr);
return (len > 0)? -len : len;
}
}
@@ -1053,6 +1059,8 @@
group. At this point, the return is converted into MATCH_NOMATCH so that
previous backup points can be taken. */
+ /* fall through */
+
case OP_ONCE:
case OP_BRA:
case OP_SBRA:
diff -Nru mariadb-10.1-10.1.25/pcre/pcregrep.c mariadb-10.1-10.1.30/pcre/pcregrep.c
--- mariadb-10.1-10.1.25/pcre/pcregrep.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcregrep.c 2017-12-21 15:48:48.000000000 +0000
@@ -1804,11 +1804,6 @@
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
- /* If the current match ended past the end of the line (only possible
- in multiline mode), we are done with this line. */
-
- if ((unsigned int)offsets[1] > linelength) goto END_ONE_MATCH;
-
startoffset = offsets[1]; /* Restart after the match */
if (startoffset <= oldstartoffset)
{
@@ -1818,6 +1813,22 @@
if (utf8)
while ((matchptr[startoffset] & 0xc0) == 0x80) startoffset++;
}
+
+ /* If the current match ended past the end of the line (only possible
+ in multiline mode), we must move on to the line in which it did end
+ before searching for more matches. */
+
+ while (startoffset > (int)linelength)
+ {
+ matchptr = ptr += linelength + endlinelength;
+ filepos += (int)(linelength + endlinelength);
+ linenumber++;
+ startoffset -= (int)(linelength + endlinelength);
+ t = end_of_line(ptr, endptr, &endlinelength);
+ linelength = t - ptr - endlinelength;
+ length = (size_t)(endptr - ptr);
+ }
+
goto ONLY_MATCHING_RESTART;
}
}
@@ -3179,9 +3190,11 @@
cp->hint = pcre_study(cp->compiled, study_options, &error);
if (error != NULL)
{
- char s[16];
- if (patterns->next == NULL) s[0] = 0; else sprintf(s, " number %d", j);
- fprintf(stderr, "pcregrep: Error while studying regex%s: %s\n", s, error);
+ if (patterns->next == NULL)
+ fprintf(stderr, "pcregrep: Error while studying regex: %s\n", error);
+ else
+ fprintf(stderr, "pcregrep: Error while studying regex number %d: %s\n",
+ j, error);
goto EXIT2;
}
#ifdef SUPPORT_PCREGREP_JIT
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_internal.h mariadb-10.1-10.1.30/pcre/pcre_internal.h
--- mariadb-10.1-10.1.25/pcre/pcre_internal.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_internal.h 2017-12-21 15:48:48.000000000 +0000
@@ -2772,6 +2772,9 @@
extern const pcre_uint16 PRIV(ucd_stage2)[];
extern const pcre_uint32 PRIV(ucp_gentype)[];
extern const pcre_uint32 PRIV(ucp_gbtable)[];
+#ifdef COMPILE_PCRE32
+extern const ucd_record PRIV(dummy_ucd_record)[];
+#endif
#ifdef SUPPORT_JIT
extern const int PRIV(ucp_typerange)[];
#endif
@@ -2780,10 +2783,16 @@
/* UCD access macros */
#define UCD_BLOCK_SIZE 128
-#define GET_UCD(ch) (PRIV(ucd_records) + \
+#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
+#ifdef COMPILE_PCRE32
+#define GET_UCD(ch) ((ch > 0x10ffff)? PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
+#else
+#define GET_UCD(ch) REAL_GET_UCD(ch)
+#endif
+
#define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype
#define UCD_SCRIPT(ch) GET_UCD(ch)->script
#define UCD_CATEGORY(ch) PRIV(ucp_gentype)[UCD_CHARTYPE(ch)]
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_jit_compile.c mariadb-10.1-10.1.30/pcre/pcre_jit_compile.c
--- mariadb-10.1-10.1.25/pcre/pcre_jit_compile.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_jit_compile.c 2017-12-21 15:48:48.000000000 +0000
@@ -487,7 +487,7 @@
#undef CMP
/* Used for accessing the elements of the stack. */
-#define STACK(i) ((-(i) - 1) * (int)sizeof(sljit_sw))
+#define STACK(i) ((i) * (int)sizeof(sljit_sw))
#define TMP1 SLJIT_R0
#define TMP2 SLJIT_R2
@@ -552,13 +552,15 @@
sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w))
#define CMPTO(type, src1, src1w, src2, src2w, label) \
sljit_set_label(sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w)), (label))
-#define OP_FLAGS(op, dst, dstw, src, srcw, type) \
- sljit_emit_op_flags(compiler, (op), (dst), (dstw), (src), (srcw), (type))
+#define OP_FLAGS(op, dst, dstw, type) \
+ sljit_emit_op_flags(compiler, (op), (dst), (dstw), (type))
#define GET_LOCAL_BASE(dst, dstw, offset) \
sljit_get_local_base(compiler, (dst), (dstw), (offset))
#define READ_CHAR_MAX 0x7fffffff
+#define INVALID_UTF_CHAR 888
+
static pcre_uchar *bracketend(pcre_uchar *cc)
{
SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
@@ -784,7 +786,7 @@
default:
/* All opcodes are supported now! */
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
}
@@ -1660,9 +1662,9 @@
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
cc += 1;
@@ -1676,9 +1678,9 @@
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
cc += 1 + 2 + cc[1];
@@ -1689,27 +1691,27 @@
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
if (common->mark_ptr != 0 && !setmark_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
if (common->capture_last_ptr != 0 && !capture_last_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
cc += 1 + LINK_SIZE;
@@ -1723,20 +1725,20 @@
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
@@ -1887,18 +1889,17 @@
BOOL tmp2empty = TRUE;
pcre_uchar *alternative;
enum {
- start,
loop,
end
} status;
-status = save ? start : loop;
-stackptr = STACK(stackptr - 2);
+status = loop;
+stackptr = STACK(stackptr);
stacktop = STACK(stacktop - 1);
if (!save)
{
- stackptr += (needs_control_head ? 2 : 1) * sizeof(sljit_sw);
+ stacktop -= (needs_control_head ? 2 : 1) * sizeof(sljit_sw);
if (stackptr < stacktop)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), stackptr);
@@ -1914,196 +1915,186 @@
/* The tmp1next must be TRUE in either way. */
}
+SLJIT_ASSERT(common->recursive_head_ptr != 0);
+
do
{
count = 0;
- switch(status)
+ if (cc >= ccend)
{
- case start:
- SLJIT_ASSERT(save && common->recursive_head_ptr != 0);
+ if (!save)
+ break;
+
count = 1;
srcw[0] = common->recursive_head_ptr;
if (needs_control_head)
{
SLJIT_ASSERT(common->control_head_ptr != 0);
count = 2;
- srcw[1] = common->control_head_ptr;
+ srcw[0] = common->control_head_ptr;
+ srcw[1] = common->recursive_head_ptr;
+ }
+ status = end;
+ }
+ else switch(*cc)
+ {
+ case OP_KET:
+ if (PRIVATE_DATA(cc) != 0)
+ {
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
+ cc += PRIVATE_DATA(cc + 1);
}
- status = loop;
+ cc += 1 + LINK_SIZE;
break;
- case loop:
- if (cc >= ccend)
+ case OP_ASSERT:
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK:
+ case OP_ASSERTBACK_NOT:
+ case OP_ONCE:
+ case OP_ONCE_NC:
+ case OP_BRAPOS:
+ case OP_SBRA:
+ case OP_SBRAPOS:
+ case OP_SCOND:
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(srcw[0] != 0);
+ cc += 1 + LINK_SIZE;
+ break;
+
+ case OP_CBRA:
+ case OP_SCBRA:
+ if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
{
- status = end;
- break;
+ count = 1;
+ srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
}
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
- switch(*cc)
- {
- case OP_KET:
- if (PRIVATE_DATA(cc) != 0)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
- cc += PRIVATE_DATA(cc + 1);
- }
- cc += 1 + LINK_SIZE;
- break;
+ case OP_CBRAPOS:
+ case OP_SCBRAPOS:
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
+ SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- case OP_ONCE_NC:
- case OP_BRAPOS:
- case OP_SBRA:
- case OP_SBRAPOS:
- case OP_SCOND:
+ case OP_COND:
+ /* Might be a hidden SCOND. */
+ alternative = cc + GET(cc, 1);
+ if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
+ {
count = 1;
srcw[0] = PRIVATE_DATA(cc);
SLJIT_ASSERT(srcw[0] != 0);
- cc += 1 + LINK_SIZE;
- break;
-
- case OP_CBRA:
- case OP_SCBRA:
- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
- {
- count = 1;
- srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- }
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
+ }
+ cc += 1 + LINK_SIZE;
+ break;
- case OP_CBRAPOS:
- case OP_SCBRAPOS:
- count = 2;
+ CASE_ITERATOR_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ count = 1;
srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
-
- case OP_COND:
- /* Might be a hidden SCOND. */
- alternative = cc + GET(cc, 1);
- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(srcw[0] != 0);
- }
- cc += 1 + LINK_SIZE;
- break;
-
- CASE_ITERATOR_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 2;
+ }
+ cc += 2;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2;
+ CASE_ITERATOR_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2 + IMM2_SIZE;
+ CASE_ITERATOR_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2 + IMM2_SIZE;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 1;
+ break;
+
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1;
+ break;
+
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1 + IMM2_SIZE;
+ break;
+
+ case OP_CLASS:
+ case OP_NCLASS:
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
+#else
+ size = 1 + 32 / (int)sizeof(pcre_uchar);
+#endif
+ if (PRIVATE_DATA(cc))
+ switch(get_class_iterator_size(cc + size))
{
+ case 1:
count = 1;
srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 1;
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
+ case 2:
count = 2;
srcw[0] = PRIVATE_DATA(cc);
srcw[1] = srcw[0] + sizeof(sljit_sw);
- }
- cc += 1;
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
+ default:
+ SLJIT_UNREACHABLE();
+ break;
}
- cc += 1 + IMM2_SIZE;
- break;
-
- case OP_CLASS:
- case OP_NCLASS:
-#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
- case OP_XCLASS:
- size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
-#else
- size = 1 + 32 / (int)sizeof(pcre_uchar);
-#endif
- if (PRIVATE_DATA(cc))
- switch(get_class_iterator_size(cc + size))
- {
- case 1:
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- break;
-
- case 2:
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
- break;
-
- default:
- SLJIT_ASSERT_STOP();
- break;
- }
- cc += size;
- break;
-
- default:
- cc = next_opcode(common, cc);
- SLJIT_ASSERT(cc != NULL);
- break;
- }
+ cc += size;
break;
- case end:
- SLJIT_ASSERT_STOP();
+ default:
+ cc = next_opcode(common, cc);
+ SLJIT_ASSERT(cc != NULL);
break;
}
@@ -2312,7 +2303,7 @@
{
DEFINE_COMPILER;
-OP2(SLJIT_SUB | SLJIT_SET_E, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
+OP2(SLJIT_SUB | SLJIT_SET_Z, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO));
}
@@ -2322,7 +2313,7 @@
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
#ifdef DESTROY_REGISTERS
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 12345);
OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
@@ -2330,7 +2321,7 @@
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, TMP1, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);
#endif
-add_stub(common, CMP(SLJIT_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
+add_stub(common, CMP(SLJIT_LESS, STACK_TOP, 0, STACK_LIMIT, 0));
}
static SLJIT_INLINE void free_stack(compiler_common *common, int size)
@@ -2338,7 +2329,7 @@
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
}
static sljit_uw * allocate_read_only_data(compiler_common *common, sljit_uw size)
@@ -2396,7 +2387,7 @@
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
loop = LABEL();
OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw), SLJIT_R0, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
}
@@ -2434,7 +2425,7 @@
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
loop = LABEL();
OP1(SLJIT_MOVU, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
@@ -2452,22 +2443,22 @@
{
while (current != NULL)
{
- switch (current[-2])
+ switch (current[1])
{
case type_then_trap:
break;
case type_mark:
- if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)current[-3]) == 0)
- return current[-4];
+ if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)current[2]) == 0)
+ return current[3];
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
- SLJIT_ASSERT(current > (sljit_sw*)current[-1]);
- current = (sljit_sw*)current[-1];
+ SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]);
+ current = (sljit_sw*)current[0];
}
return -1;
}
@@ -2501,7 +2492,7 @@
OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
OP1(SLJIT_MOVU_S32, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
JUMPHERE(early_quit);
@@ -3106,8 +3097,8 @@
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
/* Skip low surrogate if necessary. */
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
return;
@@ -3126,6 +3117,7 @@
if (nltype == NLTYPE_ANY)
{
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_NOT_ZERO : SLJIT_ZERO));
}
else if (nltype == NLTYPE_ANYCRLF)
@@ -3167,7 +3159,7 @@
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -3181,7 +3173,7 @@
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
jump = JUMP(SLJIT_NOT_ZERO);
/* Three byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
@@ -3215,15 +3207,15 @@
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_NOT_ZERO);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_NOT_ZERO);
/* This code runs only in 8 bit mode. No need to shift the value. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
@@ -3246,7 +3238,7 @@
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
@@ -3287,10 +3279,30 @@
/* Search the UCD record for the character comes in TMP1.
Returns chartype in TMP1 and UCD offset in TMP2. */
DEFINE_COMPILER;
+#ifdef COMPILE_PCRE32
+struct sljit_jump *jump;
+#endif
+
+#if defined SLJIT_DEBUG && SLJIT_DEBUG
+/* dummy_ucd_record */
+const ucd_record *record = GET_UCD(INVALID_UTF_CHAR);
+SLJIT_ASSERT(record->script == ucp_Common && record->chartype == ucp_Cn && record->gbprop == ucp_gbOther);
+SLJIT_ASSERT(record->caseset == 0 && record->other_case == 0);
+#endif
SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
+
+#ifdef COMPILE_PCRE32
+if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0x10ffff + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -3365,8 +3377,8 @@
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3403,8 +3415,8 @@
{
singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(singlechar);
@@ -3853,7 +3865,7 @@
}
}
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
static sljit_s32 character_to_int32(pcre_uchar chr)
{
@@ -4019,6 +4031,7 @@
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
nomatch = JUMP(SLJIT_ZERO);
@@ -4119,6 +4132,7 @@
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
JUMPTO(SLJIT_ZERO, start);
@@ -4155,18 +4169,8 @@
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
OP2(SLJIT_ADD, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, SLJIT_IMM, IN_UCHARS(offset + 1));
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
- if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_END, 0, TMP3, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER, STR_END, TMP3, 0);
- }
-#endif
- {
- quit = CMP(SLJIT_LESS_EQUAL, STR_END, 0, TMP3, 0);
- OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
- JUMPHERE(quit);
- }
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP3, 0);
+ sljit_emit_cmov(compiler, SLJIT_GREATER, STR_END, TMP3, 0);
}
#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
@@ -4174,11 +4178,11 @@
utf_start = LABEL();
#endif
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
/* SSE2 accelerated first character search. */
-if (sljit_x86_is_sse2_available())
+if (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
{
fast_forward_first_char2_sse2(common, char1, char2);
@@ -4213,16 +4217,16 @@
if (offset > 0)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
}
- else if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- }
else
{
- quit = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, STR_PTR, 0, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- JUMPHERE(quit);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ if (has_match_end)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ sljit_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, TMP1, 0);
+ }
+ else
+ sljit_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, STR_END, 0);
}
if (has_match_end)
@@ -4249,10 +4253,10 @@
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char1);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char2);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char1);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char2);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
found = JUMP(SLJIT_NOT_ZERO);
}
}
@@ -4571,8 +4575,8 @@
firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4616,8 +4620,8 @@
JUMPHERE(foundcr);
notfoundnl = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4670,7 +4674,7 @@
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
found = JUMP(SLJIT_NOT_ZERO);
}
@@ -4692,8 +4696,8 @@
{
CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
}
@@ -4780,31 +4784,31 @@
struct sljit_label *mainloop;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP1(SLJIT_MOV, TMP1, 0, STACK_TOP, 0);
-GET_LOCAL_BASE(TMP3, 0, 0);
+OP1(SLJIT_MOV, TMP3, 0, STACK_TOP, 0);
+GET_LOCAL_BASE(TMP1, 0, 0);
/* Drop frames until we reach STACK_TOP. */
mainloop = LABEL();
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
-jump = JUMP(SLJIT_SIG_LESS_EQUAL);
-
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), -sizeof(sljit_sw));
+jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0);
+
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -3 * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
JUMPTO(SLJIT_JUMP, mainloop);
JUMPHERE(jump);
-jump = JUMP(SLJIT_SIG_LESS);
-/* End of dropping frames. */
+jump = CMP(SLJIT_NOT_ZERO /* SIG_LESS */, TMP2, 0, SLJIT_IMM, 0);
+/* End of reverting values. */
+OP1(SLJIT_MOV, STACK_TOP, 0, TMP3, 0);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
JUMPTO(SLJIT_JUMP, mainloop);
}
@@ -4837,11 +4841,11 @@
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
}
@@ -4881,11 +4885,11 @@
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
}
else
@@ -4913,7 +4917,7 @@
}
set_jumps(skipread_list, LABEL());
-OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+OP2(SLJIT_XOR | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
}
@@ -5064,7 +5068,7 @@
return TRUE;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return FALSE;
}
}
@@ -5077,22 +5081,22 @@
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5103,34 +5107,34 @@
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
-OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
+OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x2000);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5143,22 +5147,22 @@
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5183,7 +5187,7 @@
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
@@ -5227,7 +5231,7 @@
JUMPHERE(jump);
#endif
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
@@ -5394,7 +5398,7 @@
#endif
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
context->ucharptr = 0;
@@ -5568,7 +5572,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -5592,7 +5596,7 @@
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
}
@@ -5625,7 +5629,7 @@
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
#ifdef COMPILE_PCRE8
@@ -5644,6 +5648,15 @@
if (needschar && !charsaved)
OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
+#ifdef COMPILE_PCRE32
+ if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0x10ffff + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -5735,14 +5748,14 @@
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5761,14 +5774,14 @@
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5793,12 +5806,12 @@
break;
case PT_LAMP:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5820,33 +5833,33 @@
case PT_SPACE:
case PT_PXSPACE:
SET_CHAR_OFFSET(9);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_TYPE_OFFSET(ucp_Zl);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_WORD:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
/* Fall through. */
case PT_ALNUM:
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Nd);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5868,8 +5881,8 @@
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
other_cases += 2;
}
else if (is_powerof2(other_cases[2] ^ other_cases[1]))
@@ -5881,63 +5894,63 @@
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
- OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
+ OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
other_cases += 3;
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
}
while (*other_cases != NOTACHAR)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
}
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_UCNC:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_CHAR_OFFSET(0xa0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_GREATER_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_PXGRAPH:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5946,21 +5959,21 @@
case PT_PXPRINT:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_NOT_EQUAL);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5968,21 +5981,21 @@
case PT_PXPUNCT:
SET_TYPE_OFFSET(ucp_Sc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Pc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -6028,6 +6041,7 @@
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6043,10 +6057,10 @@
else
{
jump[1] = CMP(SLJIT_EQUAL, TMP2, 0, STR_END, 0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_NOT_EQUAL);
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL));
check_partial(common, TRUE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
@@ -6068,9 +6082,9 @@
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
jump[2] = JUMP(SLJIT_GREATER);
- add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL) /* LESS */);
/* Equal. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
jump[3] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
@@ -6089,6 +6103,7 @@
read_char_range(common, common->nlmin, common->nlmax, TRUE);
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
}
@@ -6204,7 +6219,7 @@
label = LABEL();
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
skip_char_back(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -6217,7 +6232,7 @@
check_start_used_ptr(common);
return cc + LINK_SIZE;
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
return cc;
}
@@ -6250,7 +6265,7 @@
#endif
read_char8_type(common, type == OP_NOT_DIGIT);
/* Flip the starting bit in the negative case. */
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
add_jump(compiler, backtracks, JUMP(type == OP_DIGIT ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6264,7 +6279,7 @@
else
#endif
read_char8_type(common, type == OP_NOT_WHITESPACE);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
add_jump(compiler, backtracks, JUMP(type == OP_WHITESPACE ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6278,7 +6293,7 @@
else
#endif
read_char8_type(common, type == OP_NOT_WORDCHAR);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
add_jump(compiler, backtracks, JUMP(type == OP_WORDCHAR ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6320,8 +6335,8 @@
#elif defined COMPILE_PCRE16
jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
#endif
@@ -6383,6 +6398,7 @@
detect_partial_match(common, backtracks);
read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6392,6 +6408,7 @@
detect_partial_match(common, backtracks);
read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6418,7 +6435,7 @@
OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
JUMPTO(SLJIT_NOT_ZERO, label);
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
@@ -6587,7 +6604,7 @@
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
@@ -6604,7 +6621,7 @@
return cc + GET(cc, 0) - 1;
#endif
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
return cc;
}
@@ -6790,9 +6807,9 @@
#endif /* SUPPORT_UTF && SUPPORT_UCP */
{
if (ref)
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
else
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
if (withchecks)
jump = JUMP(SLJIT_ZERO);
@@ -6883,7 +6900,7 @@
cc += 1 + IMM2_SIZE + 1 + 2 * IMM2_SIZE;
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -6897,7 +6914,7 @@
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
/* Temporary release of STR_PTR. */
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
/* Handles both invalid and empty cases. Since the minimum repeat,
is zero the invalid case is basically the same as an empty case. */
if (ref)
@@ -6910,7 +6927,7 @@
zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
/* Restore if not zero length. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
}
else
{
@@ -7157,7 +7174,7 @@
(((int)sizeof(PUBL(callout_block)) + 7) & ~7)
#define CALLOUT_ARG_OFFSET(arg) \
- (-CALLOUT_ARG_SIZE + SLJIT_OFFSETOF(PUBL(callout_block), arg))
+ SLJIT_OFFSETOF(PUBL(callout_block), arg)
static SLJIT_INLINE pcre_uchar *compile_callout_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
{
@@ -7187,7 +7204,8 @@
/* Needed to save important temporary registers. */
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
-OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);
+/* SLJIT_R0 = arguments */
+OP1(SLJIT_MOV, SLJIT_R1, 0, STACK_TOP, 0);
GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
@@ -7195,12 +7213,12 @@
free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
/* Check return value. */
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
if (common->forced_quit_label == NULL)
- add_jump(compiler, &common->forced_quit, JUMP(SLJIT_SIG_LESS));
+ add_jump(compiler, &common->forced_quit, JUMP(SLJIT_NOT_EQUAL) /* SIG_LESS */);
else
- JUMPTO(SLJIT_SIG_LESS, common->forced_quit_label);
+ JUMPTO(SLJIT_NOT_EQUAL /* SIG_LESS */, common->forced_quit_label);
return cc + 2 + 2 * LINK_SIZE;
}
@@ -7321,7 +7339,7 @@
allocate_stack(common, framesize + extrasize);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
@@ -7392,22 +7410,22 @@
free_stack(common, extrasize);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 2));
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
}
}
@@ -7418,25 +7436,25 @@
if (conditional)
{
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? STACK(-2) : STACK(-1));
}
else if (bra == OP_BRAZERO)
{
if (framesize < 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
else
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - extrasize));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0);
}
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
else if (framesize >= 0)
{
/* For OP_BRA and OP_BRAMINZERO. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
}
}
add_jump(compiler, found, JUMP(SLJIT_JUMP));
@@ -7480,12 +7498,12 @@
set_jumps(common->positive_assert_quit, LABEL());
SLJIT_ASSERT(framesize != no_stack);
if (framesize < 0)
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
}
JUMPHERE(jump);
}
@@ -7534,18 +7552,18 @@
{
/* We know that STR_PTR was stored on the top of the stack. */
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
/* Keep the STR_PTR on the top of the stack. */
if (bra == OP_BRAZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
if (extrasize == 2)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
}
else if (bra == OP_BRAMINZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
}
@@ -7554,13 +7572,13 @@
if (bra == OP_BRA)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize + 1));
}
else
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
if (extrasize == 2)
{
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
@@ -7588,7 +7606,7 @@
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
}
set_jumps(backtrack->common.topbacktracks, LABEL());
}
@@ -7675,23 +7693,23 @@
}
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? STACK(-2) : STACK(-1));
/* TMP2 which is set here used by OP_KETRMAX below. */
if (ket == OP_KETRMAX)
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
else if (ket == OP_KETRMIN)
{
/* Move the STR_PTR to the private_data_ptr. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
}
else
{
stacksize = (ket != OP_KET || has_alternatives) ? 2 : 1;
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
if (ket == OP_KETRMAX)
{
@@ -7927,7 +7945,7 @@
{
/* Except when the whole stack frame must be saved. */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));
+ braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-BACKTRACK_AS(bracket_backtrack)->u.framesize - 2));
}
JUMPHERE(skip);
}
@@ -8000,7 +8018,7 @@
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), STR_PTR, 0);
if (BACKTRACK_AS(bracket_backtrack)->u.framesize == no_frame)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize + 1), TMP2, 0);
}
else if (ket == OP_KETRMAX || has_alternatives)
@@ -8018,7 +8036,7 @@
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stacksize = needs_control_head ? 1 : 0;
if (ket != OP_KET || has_alternatives)
@@ -8090,13 +8108,13 @@
slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
slot += common->name_entry_size;
i--;
while (i-- > 0)
{
OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
- OP2(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, STR_PTR, 0);
+ OP2(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, TMP2, 0, STR_PTR, 0);
slot += common->name_entry_size;
}
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
@@ -8111,7 +8129,7 @@
if (*matchingpath == OP_FAIL)
stacksize = 0;
- if (*matchingpath == OP_RREF)
+ else if (*matchingpath == OP_RREF)
{
stacksize = GET2(matchingpath, 1);
if (common->currententry == NULL)
@@ -8244,7 +8262,7 @@
{
if (has_alternatives)
BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
/* Drop STR_PTR for greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -8274,7 +8292,7 @@
if (repeat_type == OP_EXACT)
{
count_match(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
}
else if (repeat_type == OP_UPTO)
@@ -8374,7 +8392,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -8452,7 +8470,7 @@
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stack = 0;
if (!zero)
@@ -8524,7 +8542,7 @@
{
if (offset != 0)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0);
@@ -8535,10 +8553,10 @@
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
if (opcode == OP_SBRAPOS)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw), STR_PTR, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), STACK(-framesize - 2), STR_PTR, 0);
}
/* Even if the match is empty, we need to reset the control head. */
@@ -8584,7 +8602,7 @@
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
}
}
@@ -8601,7 +8619,7 @@
if (framesize < 0)
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
else /* TMP2 is set to [private_data_ptr] above. */
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_sw), SLJIT_IMM, 0));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), STACK(-stacksize), SLJIT_IMM, 0));
}
/* None of them matched. */
@@ -8824,7 +8842,7 @@
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -8832,7 +8850,7 @@
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
}
@@ -8862,7 +8880,7 @@
if (opcode == OP_UPTO)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
jump = JUMP(SLJIT_ZERO);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0);
}
@@ -8924,7 +8942,7 @@
label = LABEL();
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO));
}
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
@@ -8944,7 +8962,7 @@
OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
}
@@ -8971,7 +8989,7 @@
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9000,7 +9018,7 @@
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9026,7 +9044,7 @@
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
@@ -9113,7 +9131,7 @@
label = LABEL();
compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
set_jumps(no_match, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1);
@@ -9124,7 +9142,7 @@
label = LABEL();
detect_partial_match(common, &no_match);
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
set_jumps(no_char1_match, LABEL());
@@ -9142,7 +9160,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9264,7 +9282,7 @@
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
allocate_stack(common, size);
if (size > 3)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
else
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 1), SLJIT_IMM, BACKTRACK_AS(then_trap_backtrack)->start);
@@ -9569,7 +9587,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return;
}
if (cc == NULL)
@@ -9677,7 +9695,7 @@
case OP_MINUPTO:
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
add_jump(compiler, &jumplist, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
@@ -9723,7 +9741,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9831,7 +9849,7 @@
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(assert_backtrack)->framesize - 1));
set_jumps(current->topbacktracks, LABEL());
}
@@ -9841,7 +9859,7 @@
if (bra == OP_BRAZERO)
{
/* We know there is enough place on the stack. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
JUMPTO(SLJIT_JUMP, CURRENT_AS(assert_backtrack)->matchingpath);
JUMPHERE(brajump);
@@ -9954,7 +9972,7 @@
else
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 2), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
}
/* Drop STR_PTR for non-greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -10060,7 +10078,7 @@
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-assert->framesize - 1));
}
cond = JUMP(SLJIT_JUMP);
set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL());
@@ -10201,7 +10219,7 @@
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-assert->framesize - 1));
}
JUMPHERE(cond);
}
@@ -10256,7 +10274,7 @@
JUMPHERE(once);
/* Restore previous private_data_ptr */
if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 1));
else if (ket == OP_KETRMIN)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
@@ -10346,7 +10364,7 @@
free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
JUMPHERE(jump);
}
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_sw));
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracketpos_backtrack)->framesize - 1));
}
static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -10392,10 +10410,10 @@
jump = JUMP(SLJIT_JUMP);
loop = LABEL();
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), -(int)sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
JUMPHERE(jump);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(2 * sizeof(sljit_sw)), TMP1, 0, loop);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(3 * sizeof(sljit_sw)), TMP2, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0, loop);
add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP));
return;
}
@@ -10645,7 +10663,7 @@
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
current = current->prev;
@@ -10684,7 +10702,7 @@
count_match(common);
allocate_stack(common, private_data_size + framesize + alternativesize);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0);
-copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
+copy_private_data(common, ccbegin, ccend, TRUE, framesize + alternativesize, private_data_size + framesize + alternativesize, needs_control_head);
if (needs_control_head)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0);
@@ -10737,9 +10755,9 @@
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
if (needs_frame)
{
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
+ add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
}
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
common->quit = NULL;
@@ -10750,32 +10768,32 @@
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
if (needs_frame)
{
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
+ add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
}
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);
JUMPHERE(jump);
if (common->quit != NULL)
set_jumps(common->quit, LABEL());
-copy_private_data(common, ccbegin, ccend, FALSE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
+copy_private_data(common, ccbegin, ccend, FALSE, framesize + alternativesize, private_data_size + framesize + alternativesize, needs_control_head);
free_stack(common, private_data_size + framesize + alternativesize);
if (needs_control_head)
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-3));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP1, 0);
OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0);
}
else
{
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP2, 0);
}
-sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);
+sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
#undef COMPILE_BACKTRACKINGPATH
@@ -11237,7 +11255,7 @@
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_TOP, 0);
-OP2(SLJIT_ADD, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
+OP2(SLJIT_SUB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
jump = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
@@ -11391,10 +11409,10 @@
sljit_u8 local_space[MACHINE_STACK_SIZE];
struct sljit_stack local_stack;
-local_stack.top = (sljit_sw)&local_space;
-local_stack.base = local_stack.top;
-local_stack.limit = local_stack.base + MACHINE_STACK_SIZE;
-local_stack.max_limit = local_stack.limit;
+local_stack.max_limit = local_space;
+local_stack.limit = local_space;
+local_stack.base = local_space + MACHINE_STACK_SIZE;
+local_stack.top = local_space + MACHINE_STACK_SIZE;
arguments->stack = &local_stack;
convert_executable_func.executable_func = executable_func;
return convert_executable_func.call_executable_func(arguments);
diff -Nru mariadb-10.1-10.1.25/pcre/pcreposix.c mariadb-10.1-10.1.30/pcre/pcreposix.c
--- mariadb-10.1-10.1.25/pcre/pcreposix.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcreposix.c 2017-12-21 15:48:48.000000000 +0000
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2016 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -389,8 +389,8 @@
{
for (i = 0; i < (size_t)rc; i++)
{
- pmatch[i].rm_so = ovector[i*2];
- pmatch[i].rm_eo = ovector[i*2+1];
+ pmatch[i].rm_so = ovector[i*2] + so;
+ pmatch[i].rm_eo = ovector[i*2+1] + so;
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_scanner_unittest.cc mariadb-10.1-10.1.30/pcre/pcre_scanner_unittest.cc
--- mariadb-10.1-10.1.25/pcre/pcre_scanner_unittest.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_scanner_unittest.cc 2017-12-21 15:48:48.000000000 +0000
@@ -57,6 +57,7 @@
} while (0)
using std::vector;
+using std::string;
using pcrecpp::StringPiece;
using pcrecpp::Scanner;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_stringpiece.h.in mariadb-10.1-10.1.30/pcre/pcre_stringpiece.h.in
--- mariadb-10.1-10.1.25/pcre/pcre_stringpiece.h.in 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_stringpiece.h.in 2017-12-21 15:48:48.000000000 +0000
@@ -52,12 +52,12 @@
#include
+namespace pcrecpp {
+
using std::memcmp;
using std::strlen;
using std::string;
-namespace pcrecpp {
-
class PCRECPP_EXP_DEFN StringPiece {
private:
const char* ptr_;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_stringpiece_unittest.cc mariadb-10.1-10.1.30/pcre/pcre_stringpiece_unittest.cc
--- mariadb-10.1-10.1.25/pcre/pcre_stringpiece_unittest.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_stringpiece_unittest.cc 2017-12-21 15:48:48.000000000 +0000
@@ -24,6 +24,7 @@
} \
} while (0)
+using std::string;
using pcrecpp::StringPiece;
static void CheckSTLComparator() {
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_tables.c mariadb-10.1-10.1.30/pcre/pcre_tables.c
--- mariadb-10.1-10.1.25/pcre/pcre_tables.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_tables.c 2017-12-21 15:48:48.000000000 +0000
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2012 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -161,7 +161,7 @@
(1<= 32 && (c) < 127)
#endif
-#define PRINTOK(c) (locale_set? isprint(c) : PRINTABLE(c))
+#define PRINTOK(c) (locale_set? (((c) < 256) && isprint(c)) : PRINTABLE(c))
/* Posix support is disabled in 16 or 32 bit only mode. */
#if !defined SUPPORT_PCRE8 && !defined NOPOSIX
@@ -426,11 +426,11 @@
#define PCRE_COPY_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \
namesptr, cbuffer, size) \
rc = pcre32_copy_named_substring((pcre32 *)re, (PCRE_SPTR32)bptr, offsets, \
- count, (PCRE_SPTR32)namesptr, (PCRE_UCHAR32 *)cbuffer, size/2)
+ count, (PCRE_SPTR32)namesptr, (PCRE_UCHAR32 *)cbuffer, size/4)
#define PCRE_COPY_SUBSTRING32(rc, bptr, offsets, count, i, cbuffer, size) \
rc = pcre32_copy_substring((PCRE_SPTR32)bptr, offsets, count, i, \
- (PCRE_UCHAR32 *)cbuffer, size/2)
+ (PCRE_UCHAR32 *)cbuffer, size/4)
#define PCRE_DFA_EXEC32(count, re, extra, bptr, len, start_offset, options, \
offsets, size_offsets, workspace, size_workspace) \
@@ -4834,7 +4834,16 @@
continue;
case 'O':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
+ while(isdigit(*p))
+ {
+ if (n > (INT_MAX-10)/10) /* Hack to stop fuzzers */
+ {
+ printf("** \\O argument is too big\n");
+ yield = 1;
+ goto EXIT;
+ }
+ n = n * 10 + *p++ - '0';
+ }
if (n > size_offsets_max)
{
size_offsets_max = n;
diff -Nru mariadb-10.1-10.1.25/pcre/pcre_ucd.c mariadb-10.1-10.1.30/pcre/pcre_ucd.c
--- mariadb-10.1-10.1.25/pcre/pcre_ucd.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/pcre_ucd.c 2017-12-21 15:48:48.000000000 +0000
@@ -38,6 +38,20 @@
const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0};
#else
+/* If the 32-bit library is run in non-32-bit mode, character values
+greater than 0x10ffff may be encountered. For these we set up a
+special record. */
+
+#ifdef COMPILE_PCRE32
+const ucd_record PRIV(dummy_ucd_record)[] = {{
+ ucp_Common, /* script */
+ ucp_Cn, /* type unassigned */
+ ucp_gbOther, /* grapheme break property */
+ 0, /* case set */
+ 0, /* other case */
+ }};
+#endif
+
/* When recompiling tables with a new Unicode version, please check the
types in this structure definition from pcre_internal.h (the actual
field names will be different):
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testinput1 mariadb-10.1-10.1.30/pcre/testdata/testinput1
--- mariadb-10.1-10.1.25/pcre/testdata/testinput1 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testinput1 2017-12-21 15:48:48.000000000 +0000
@@ -5739,4 +5739,7 @@
/(?=.*X)X$/
\ X
+/X+(?#comment)?/
+ >XXX<
+
/-- End of testinput1 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testinput12 mariadb-10.1-10.1.30/pcre/testdata/testinput12
--- mariadb-10.1-10.1.25/pcre/testdata/testinput12 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testinput12 2017-12-21 15:48:48.000000000 +0000
@@ -104,4 +104,6 @@
/(.|.)*?bx/
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
+/((?(?!))x)(?'name')(?1)/S++
+
/-- End of testinput12 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testinput15 mariadb-10.1-10.1.30/pcre/testdata/testinput15
--- mariadb-10.1-10.1.25/pcre/testdata/testinput15 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testinput15 2017-12-21 15:48:48.000000000 +0000
@@ -363,4 +363,7 @@
/abc/89
+//8+L
+ \xf1\xad\xae\xae
+
/-- End of testinput15 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testinput8 mariadb-10.1-10.1.30/pcre/testdata/testinput8
--- mariadb-10.1-10.1.25/pcre/testdata/testinput8 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testinput8 2017-12-21 15:48:48.000000000 +0000
@@ -4845,4 +4845,7 @@
aaa\D
a\D
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+
/-- End of testinput8 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testoutput1 mariadb-10.1-10.1.30/pcre/testdata/testoutput1
--- mariadb-10.1-10.1.25/pcre/testdata/testoutput1 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testoutput1 2017-12-21 15:48:48.000000000 +0000
@@ -9442,4 +9442,8 @@
\ X
0: X
+/X+(?#comment)?/
+ >XXX<
+ 0: X
+
/-- End of testinput1 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testoutput12 mariadb-10.1-10.1.30/pcre/testdata/testoutput12
--- mariadb-10.1-10.1.25/pcre/testdata/testoutput12 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testoutput12 2017-12-21 15:48:48.000000000 +0000
@@ -201,4 +201,6 @@
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
Error -8 (match limit exceeded)
+/((?(?!))x)(?'name')(?1)/S++
+
/-- End of testinput12 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testoutput15 mariadb-10.1-10.1.30/pcre/testdata/testoutput15
--- mariadb-10.1-10.1.25/pcre/testdata/testoutput15 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testoutput15 2017-12-21 15:48:48.000000000 +0000
@@ -1136,4 +1136,9 @@
/abc/89
Failed: setting UTF is disabled by the application at offset 0
+//8+L
+ \xf1\xad\xae\xae
+ 0:
+ 0+ \x{6dbae}
+
/-- End of testinput15 --/
diff -Nru mariadb-10.1-10.1.25/pcre/testdata/testoutput8 mariadb-10.1-10.1.30/pcre/testdata/testoutput8
--- mariadb-10.1-10.1.25/pcre/testdata/testoutput8 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/pcre/testdata/testoutput8 2017-12-21 15:48:48.000000000 +0000
@@ -7801,4 +7801,8 @@
** Show all captures ignored after DFA matching
0: a
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+ 0: 02-123-123
+
/-- End of testinput8 --/
diff -Nru mariadb-10.1-10.1.25/plugin/aws_key_management/aws_key_management_plugin.cc mariadb-10.1-10.1.30/plugin/aws_key_management/aws_key_management_plugin.cc
--- mariadb-10.1-10.1.25/plugin/aws_key_management/aws_key_management_plugin.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/aws_key_management/aws_key_management_plugin.cc 2017-12-21 15:48:48.000000000 +0000
@@ -82,9 +82,20 @@
static int rotate_key;
static int request_timeout;
+#ifndef DBUG_OFF
+#define WITH_AWS_MOCK 1
+#else
+#define WITH_AWS_MOCK 0
+#endif
+
+#if WITH_AWS_MOCK
+static char mock;
+#endif
+
+
/* AWS functionality*/
-static int aws_decrypt_key(const char *path, KEY_INFO *info);
-static int aws_generate_datakey(uint key_id, uint version);
+static int read_and_decrypt_key(const char *path, KEY_INFO *info);
+static int generate_and_save_datakey(uint key_id, uint version);
static int extract_id_and_version(const char *name, uint *id, uint *ver);
static unsigned int get_latest_key_version(unsigned int key_id);
@@ -95,6 +106,35 @@
static Aws::KMS::KMSClient *client;
+#if WITH_AWS_MOCK
+/*
+ Mock routines to test plugin without actual AWS KMS interaction
+ we only need to mock 2 functions - generating encrypted key, and decrypt
+
+ This mock functions do no-op encryption, i.e encrypt and decrypt of
+ a buffer return the buffer itself.
+*/
+
+/*
+ Generate random "encrypted" key. We do not encrypt anything in mock mode.
+*/
+static int mock_generate_encrypted_key(Aws::Utils::ByteBuffer *result)
+{
+ size_t len = key_spec == 0?16 : 32;
+ *result = Aws::Utils::ByteBuffer(len);
+ my_random_bytes(result->GetUnderlyingData(), (int)len);
+ return 0;
+}
+
+
+static int mock_decrypt(Aws::Utils::ByteBuffer input, Aws::Utils::ByteBuffer* output, Aws::String *errmsg)
+{
+ /* We do not encrypt or decrypt in mock mode.*/
+ *output = input;
+ return 0;
+}
+#endif
+
/* Redirect AWS trace to error log */
class MySQLLogSystem : public Aws::Utils::Logging::FormattedLogSystem
{
@@ -163,13 +203,7 @@
Aws::SDKOptions sdkOptions;
-/*
- Plugin initialization.
-
- Create KMS client and scan datadir to find out which keys and versions
- are present.
-*/
-static int plugin_init(void *p)
+static int aws_init()
{
#ifdef HAVE_YASSL
@@ -198,7 +232,29 @@
my_printf_error(ER_UNKNOWN_ERROR, "Can not initialize KMS client", ME_ERROR_LOG | ME_WARNING);
return -1;
}
-
+ return 0;
+}
+
+static int init()
+{
+#if WITH_AWS_MOCK
+ if(mock)
+ return 0;
+#endif
+ return aws_init();
+}
+
+/*
+ Plugin initialization.
+
+ Create KMS client and scan datadir to find out which keys and versions
+ are present.
+*/
+static int plugin_init(void *p)
+{
+ if (init())
+ return -1;
+
vector files= traverse_current_directory();
for (size_t i=0; i < files.size(); i++)
{
@@ -214,14 +270,29 @@
}
-static int plugin_deinit(void *p)
+static void aws_shutdown()
{
- latest_version_cache.clear();
- key_info_cache.clear();
delete client;
ShutdownAWSLogging();
-
Aws::ShutdownAPI(sdkOptions);
+}
+
+
+static void shutdown()
+{
+#if WITH_AWS_MOCK
+ if(mock)
+ return;
+#endif
+ aws_shutdown();
+}
+
+
+static int plugin_deinit(void *p)
+{
+ latest_version_cache.clear();
+ key_info_cache.clear();
+ shutdown();
return 0;
}
@@ -251,7 +322,7 @@
char path[256];
format_keyfile_name(path, sizeof(path), info->key_id, info->key_version);
- ret= aws_decrypt_key(path, info);
+ ret= read_and_decrypt_key(path, info);
if (ret)
info->load_failed= true;
@@ -317,14 +388,7 @@
else // (ver == 0)
{
/* Generate a new key, version 1 */
- if (!master_key_id[0])
- {
- my_printf_error(ER_UNKNOWN_ERROR,
- "Can't generate encryption key %u, because 'aws_key_management_master_key_id' parameter is not set",
- MYF(0), key_id);
- return(ENCRYPTION_KEY_VERSION_INVALID);
- }
- if (aws_generate_datakey(key_id, 1) != 0)
+ if (generate_and_save_datakey(key_id, 1) != 0)
return(ENCRYPTION_KEY_VERSION_INVALID);
info.key_id= key_id;
info.key_version= 1;
@@ -336,11 +400,35 @@
return(info.key_version);
}
+/* Decrypt Byte buffer with AWS. */
+static int aws_decrypt(Aws::Utils::ByteBuffer input, Aws::Utils::ByteBuffer* output, Aws::String *errmsg)
+{
+ DecryptRequest request;
+ request.SetCiphertextBlob(input);
+ DecryptOutcome outcome = client->Decrypt(request);
+ if (!outcome.IsSuccess())
+ {
+ *errmsg = outcome.GetError().GetMessage();
+ return -1;
+ }
+ *output= outcome.GetResult().GetPlaintext();
+ return 0;
+}
+
+
+static int decrypt(Aws::Utils::ByteBuffer input, Aws::Utils::ByteBuffer* output, Aws::String *errmsg)
+{
+#if WITH_AWS_MOCK
+ if(mock)
+ return mock_decrypt(input,output, errmsg);
+#endif
+ return aws_decrypt(input, output, errmsg);
+}
/*
Decrypt a file with KMS
*/
-static int aws_decrypt_key(const char *path, KEY_INFO *info)
+static int read_and_decrypt_key(const char *path, KEY_INFO *info)
{
/* Read file content into memory */
@@ -361,20 +449,21 @@
ifs.read(&contents[0], pos);
/* Decrypt data the with AWS */
- DecryptRequest request;
- Aws::Utils::ByteBuffer byteBuffer((unsigned char *)contents.data(), pos);
- request.SetCiphertextBlob(byteBuffer);
- DecryptOutcome outcome = client->Decrypt(request);
- if (!outcome.IsSuccess())
+
+ Aws::Utils::ByteBuffer input((unsigned char *)contents.data(), pos);
+ Aws::Utils::ByteBuffer plaintext;
+ Aws::String errmsg;
+
+ if (decrypt(input, &plaintext, &errmsg))
{
- my_printf_error(ER_UNKNOWN_ERROR, "AWS KMS plugin: Decrypt failed for %s : %s", ME_ERROR_LOG, path,
- outcome.GetError().GetMessage().c_str());
- return(-1);
+ my_printf_error(ER_UNKNOWN_ERROR, "AWS KMS plugin: Decrypt failed for %s : %s", ME_ERROR_LOG, path,
+ errmsg.c_str());
+ return -1;
}
- Aws::Utils::ByteBuffer plaintext = outcome.GetResult().GetPlaintext();
+
size_t len = plaintext.GetLength();
- if (len > (int)sizeof(info->data))
+ if (len > sizeof(info->data))
{
my_printf_error(ER_UNKNOWN_ERROR, "AWS KMS plugin: encoding key too large for %s", ME_ERROR_LOG, path);
return(ENCRYPTION_KEY_BUFFER_TOO_SMALL);
@@ -385,9 +474,15 @@
}
-/* Generate a new datakey and store it a file */
-static int aws_generate_datakey(uint keyid, uint version)
+int aws_generate_encrypted_key(Aws::Utils::ByteBuffer *result)
{
+ if (!master_key_id[0])
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "Can't generate encryption key, because 'aws_key_management_master_key_id' parameter is not set",
+ MYF(0));
+ return(-1);
+ }
GenerateDataKeyWithoutPlaintextRequest request;
request.SetKeyId(master_key_id);
request.SetKeySpec(DataKeySpecMapper::GetDataKeySpecForName(key_spec_names[key_spec]));
@@ -401,11 +496,30 @@
outcome.GetError().GetMessage().c_str());
return(-1);
}
+ *result = outcome.GetResult().GetCiphertextBlob();
+ return 0;
+}
+
+
+static int generate_encrypted_key(Aws::Utils::ByteBuffer *output)
+{
+#if WITH_AWS_MOCK
+ if(mock)
+ return mock_generate_encrypted_key(output);
+#endif
+ return aws_generate_encrypted_key(output);
+}
+
+/* Generate a new datakey and store it a file */
+static int generate_and_save_datakey(uint keyid, uint version)
+{
+ Aws::Utils::ByteBuffer byteBuffer;
+
+ if (generate_encrypted_key(&byteBuffer))
+ return -1;
string out;
char filename[20];
- Aws::Utils::ByteBuffer byteBuffer = outcome.GetResult().GetCiphertextBlob();
-
format_keyfile_name(filename, sizeof(filename), keyid, version);
int fd= open(filename, O_WRONLY |O_CREAT|O_BINARY, IF_WIN(_S_IREAD, S_IRUSR| S_IRGRP| S_IROTH));
if (fd < 0)
@@ -438,7 +552,7 @@
my_printf_error(ER_UNKNOWN_ERROR, "key %u does not exist", MYF(ME_JUST_WARNING), key_id);
return -1;
}
- else if (aws_generate_datakey(key_id, ver + 1))
+ else if (generate_and_save_datakey(key_id, ver + 1))
{
my_printf_error(ER_UNKNOWN_ERROR, "Could not generate datakey for key id= %u, ver= %u",
MYF(ME_JUST_WARNING), key_id, ver);
@@ -594,6 +708,13 @@
"AWS region. For example us-east-1, or eu-central-1. If no value provided, SDK default is used.",
NULL, NULL, "");
+#if WITH_AWS_MOCK
+static MYSQL_SYSVAR_BOOL(mock, mock,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Mock AWS KMS calls (for testing).",
+ NULL, NULL, 0);
+#endif
+
static struct st_mysql_sys_var* settings[]= {
MYSQL_SYSVAR(master_key_id),
MYSQL_SYSVAR(key_spec),
@@ -601,6 +722,9 @@
MYSQL_SYSVAR(log_level),
MYSQL_SYSVAR(request_timeout),
MYSQL_SYSVAR(region),
+#if WITH_AWS_MOCK
+ MYSQL_SYSVAR(mock),
+#endif
NULL
};
diff -Nru mariadb-10.1-10.1.25/plugin/aws_key_management/CMakeLists.txt mariadb-10.1-10.1.30/plugin/aws_key_management/CMakeLists.txt
--- mariadb-10.1-10.1.25/plugin/aws_key_management/CMakeLists.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/aws_key_management/CMakeLists.txt 2017-12-21 15:48:48.000000000 +0000
@@ -20,6 +20,7 @@
ENDIF()
RETURN()
ENDMACRO()
+SET(CMAKE_CXX_STANDARD 11)
MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc DISABLED
COMPONENT aws-key-management)
diff -Nru mariadb-10.1-10.1.25/plugin/handler_socket/CMakeLists.txt mariadb-10.1-10.1.30/plugin/handler_socket/CMakeLists.txt
--- mariadb-10.1-10.1.25/plugin/handler_socket/CMakeLists.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/handler_socket/CMakeLists.txt 2017-12-21 15:48:48.000000000 +0000
@@ -8,6 +8,12 @@
#Remove -fno-implicit-templates from compiler flags(handlersocket would not work with it)
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag(" -Wdeprecated-declarations" HAVE_CXX_WDEPRECATED_DECLARATIONS)
+IF (HAVE_CXX_WDEPRECATED_DECLARATIONS)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
+ENDIF()
+
INCLUDE_DIRECTORIES(libhsclient)
# Handlersocket client library. We do not distribute it,
diff -Nru mariadb-10.1-10.1.25/plugin/metadata_lock_info/metadata_lock_info.cc mariadb-10.1-10.1.30/plugin/metadata_lock_info/metadata_lock_info.cc
--- mariadb-10.1-10.1.25/plugin/metadata_lock_info/metadata_lock_info.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/metadata_lock_info/metadata_lock_info.cc 2017-12-21 15:48:48.000000000 +0000
@@ -44,12 +44,6 @@
{ C_STRING_WITH_LEN("MDL_EXCLUSIVE") },
};
-static const LEX_STRING metadata_lock_info_duration[] = {
- { C_STRING_WITH_LEN("MDL_STATEMENT") },
- { C_STRING_WITH_LEN("MDL_TRANSACTION") },
- { C_STRING_WITH_LEN("MDL_EXPLICIT") },
-};
-
static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] =
{
{"THREAD_ID", 20, MYSQL_TYPE_LONGLONG, 0,
@@ -128,8 +122,6 @@
== MDL_key::NAMESPACE_END);
compile_time_assert(sizeof(metadata_lock_info_lock_mode)/sizeof(LEX_STRING)
== MDL_TYPE_END);
- compile_time_assert(sizeof(metadata_lock_info_duration)/sizeof(LEX_STRING)
- == MDL_DURATION_END);
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
DBUG_ENTER("i_s_metadata_lock_info_init");
diff -Nru mariadb-10.1-10.1.25/plugin/semisync/semisync_master.cc mariadb-10.1-10.1.30/plugin/semisync/semisync_master.cc
--- mariadb-10.1-10.1.25/plugin/semisync/semisync_master.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/semisync/semisync_master.cc 2017-12-21 15:48:48.000000000 +0000
@@ -555,7 +555,7 @@
if (need_copy_send_pos)
{
- strcpy(reply_file_name_, log_file_name);
+ strmake_buf(reply_file_name_, log_file_name);
reply_file_pos_ = log_file_pos;
reply_file_name_inited_ = true;
@@ -663,7 +663,7 @@
if (cmp <= 0)
{
/* This thd has a lower position, let's update the minimum info. */
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strmake_buf(wait_file_name_, trx_wait_binlog_name);
wait_file_pos_ = trx_wait_binlog_pos;
rpl_semi_sync_master_wait_pos_backtraverse++;
@@ -674,7 +674,7 @@
}
else
{
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strmake_buf(wait_file_name_, trx_wait_binlog_name);
wait_file_pos_ = trx_wait_binlog_pos;
wait_file_name_inited_ = true;
diff -Nru mariadb-10.1-10.1.25/plugin/server_audit/server_audit.c mariadb-10.1-10.1.30/plugin/server_audit/server_audit.c
--- mariadb-10.1-10.1.25/plugin/server_audit/server_audit.c 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/server_audit/server_audit.c 2017-12-21 15:48:48.000000000 +0000
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.1"
+#define PLUGIN_STR_VERSION "1.4.3"
#define _my_thread_var loc_thread_var
@@ -1089,6 +1089,7 @@
const struct mysql_event_connection *event)
{
cn->query_id= 0;
+ cn->query_length= 0;
cn->log_always= 0;
cn->thread_id= event->thread_id;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
@@ -1120,6 +1121,21 @@
} while(0)
+#define ESC_MAP_SIZE 0x60
+static const char esc_map[ESC_MAP_SIZE]=
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, '\'', 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0
+};
+
+static char escaped_char(char c)
+{
+ return ((unsigned char ) c) >= ESC_MAP_SIZE ? 0 : esc_map[(unsigned char) c];
+}
static void setup_connection_initdb(struct connection_info *cn,
@@ -1130,6 +1146,7 @@
cn->thread_id= event->general_thread_id;
cn->query_id= 0;
+ cn->query_length= 0;
cn->log_always= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
event->general_query, event->general_query_length);
@@ -1145,7 +1162,7 @@
}
else
{
- get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
+ get_str_n(cn->user, &cn->user_length, sizeof(cn->user),
uh_buffer, user_len);
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
uh_buffer+user_len+1, host_len);
@@ -1162,6 +1179,7 @@
cn->thread_id= event->thread_id;
cn->query_id= query_counter++;
cn->log_always= 0;
+ cn->query_length= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
event->database, event->database_length);
get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
@@ -1183,6 +1201,7 @@
cn->thread_id= event->general_thread_id;
cn->query_id= query_counter++;
cn->log_always= 0;
+ cn->query_length= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db), "", 0);
if (get_user_host(event->general_user, event->general_user_length,
@@ -1196,7 +1215,7 @@
}
else
{
- get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
+ get_str_n(cn->user, &cn->user_length, sizeof(cn->user),
uh_buffer, user_len);
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
uh_buffer+user_len+1, host_len);
@@ -1323,21 +1342,16 @@
const char *res_end= result + result_len - 2;
while (len)
{
+ char esc_c;
+
if (result >= res_end)
break;
- if (*str == '\'')
- {
- if (result+1 >= res_end)
- break;
- *(result++)= '\\';
- *(result++)= '\'';
- }
- else if (*str == '\\')
+ if ((esc_c= escaped_char(*str)))
{
if (result+1 >= res_end)
break;
*(result++)= '\\';
- *(result++)= '\\';
+ *(result++)= esc_c;
}
else if (is_space(*str))
*(result++)= ' ';
@@ -1426,19 +1440,12 @@
no_password:
if (result >= res_end)
break;
- if (*str == '\'')
+ if ((b_char= escaped_char(*str)))
{
if (result+1 >= res_end)
break;
*(result++)= '\\';
- *(result++)= '\'';
- }
- else if (*str == '\\')
- {
- if (result+1 >= res_end)
- break;
- *(result++)= '\\';
- *(result++)= '\\';
+ *(result++)= b_char;
}
else if (is_space(*str))
*(result++)= ' ';
@@ -1956,7 +1963,7 @@
/* That one is important as this function can be called with */
/* &lock_operations locked when the server logs an error reported */
/* by this plugin. */
- if (internal_stop_logging)
+ if (!thd || internal_stop_logging)
return;
flogger_mutex_lock(&lock_operations);
@@ -2007,6 +2014,7 @@
event_query_command(event))
{
log_statement(cn, event, "QUERY");
+ cn->query_length= 0; /* So the log_current_query() won't log this again. */
}
}
else if (event_class == MYSQL_AUDIT_TABLE_CLASS && FILTER(EVENT_TABLE) && cn)
@@ -2522,7 +2530,8 @@
if (!thd)
return;
cn= get_loc_info(thd);
- if (!ci_needs_setup(cn) && FILTER(EVENT_QUERY) && do_log_user(cn->user))
+ if (!ci_needs_setup(cn) && cn->query_length &&
+ FILTER(EVENT_QUERY) && do_log_user(cn->user))
{
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
cn->query, cn->query_length, 0, "QUERY");
diff -Nru mariadb-10.1-10.1.25/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf mariadb-10.1-10.1.30/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
--- mariadb-10.1-10.1.25/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf 2017-12-21 15:48:48.000000000 +0000
@@ -8,8 +8,6 @@
innodb-locks-unsafe-for-binlog=1
wsrep-cluster-address=gcomm://
wsrep_provider=@ENV.WSREP_PROVIDER
-# enforce read-committed characteristics across the cluster
-wsrep_causal_reads=ON
[mysqld.1]
#galera_port=@OPT.port
diff -Nru mariadb-10.1-10.1.25/scripts/CMakeLists.txt mariadb-10.1-10.1.30/scripts/CMakeLists.txt
--- mariadb-10.1-10.1.25/scripts/CMakeLists.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/CMakeLists.txt 2017-12-21 15:48:48.000000000 +0000
@@ -1,4 +1,5 @@
-# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+# Copyright (c) 2011, 2017, 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
@@ -116,6 +117,13 @@
ENDFOREACH()
ENDIF()
+
+IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ SET (PERL_PATH "/usr/local/bin/perl")
+ELSE()
+ SET (PERL_PATH "/usr/bin/perl")
+ENDIF()
+
IF(UNIX)
# FIND_PROC and CHECK_PID are used by mysqld_safe
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -213,6 +221,11 @@
SET(localstatedir ${MYSQL_DATADIR})
ENDIF()
+SET(resolveip_locations "$basedir/${INSTALL_BINDIR} $basedir/bin")
+SET(mysqld_locations "$basedir/${INSTALL_SBINDIR} $basedir/libexec $basedir/sbin $basedir/bin")
+SET(errmsg_locations "$basedir/${INSTALL_MYSQLSHAREDIR}/english $basedir/share/english $basedir/share/mysql/english")
+SET(pkgdata_locations "$basedir/${INSTALL_MYSQLSHAREDIR} $basedir/share $basedir/share/mysql")
+
IF(UNIX)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
@@ -291,12 +304,16 @@
IF(WITH_WSREP)
SET(WSREP_SCRIPTS
wsrep_sst_mysqldump
- wsrep_sst_common
wsrep_sst_rsync
wsrep_sst_xtrabackup
wsrep_sst_xtrabackup-v2
wsrep_sst_mariabackup
)
+ # The following script is sourced from other SST scripts, so it should
+ # not be made executable.
+ SET(WSREP_SOURCE
+ wsrep_sst_common
+ )
ENDIF()
IF (NOT WITHOUT_SERVER)
SET(SERVER_SCRIPTS
@@ -336,6 +353,9 @@
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
+ # TODO: The following EXECUTE could be redundant as INSTALL_SCRIPT
+ # macro does an INSTALL(PROGRAMS ..) that automatically sets +x on
+ # the executable.
EXECUTE_PROCESS(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${file})
IF(NOT ${file}_COMPONENT)
SET(${file}_COMPONENT Server)
@@ -346,6 +366,20 @@
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
+
+ FOREACH(file ${WSREP_SOURCE})
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server)
+ ENDIF()
+ INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT ${${file}_COMPONENT}
+ )
+ ENDFOREACH()
+
ENDIF()
# Install libgcc as mylibgcc.a
@@ -363,4 +397,3 @@
COMPONENT Development)
ENDIF()
ENDIF()
-
diff -Nru mariadb-10.1-10.1.25/scripts/dheadgen.pl mariadb-10.1-10.1.30/scripts/dheadgen.pl
--- mariadb-10.1-10.1.25/scripts/dheadgen.pl 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/dheadgen.pl 2017-12-21 15:48:48.000000000 +0000
@@ -1,10 +1,4 @@
-#!/usr/bin/perl -w
-
-#
-# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
-
+# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff -Nru mariadb-10.1-10.1.25/scripts/galera_recovery.sh mariadb-10.1-10.1.30/scripts/galera_recovery.sh
--- mariadb-10.1-10.1.25/scripts/galera_recovery.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/galera_recovery.sh 2017-12-21 15:48:48.000000000 +0000
@@ -69,7 +69,7 @@
wsrep_recover_position() {
# Redirect server's error log to the log file.
eval /usr/sbin/mysqld $cmdline_args --user=$user --wsrep_recover \
- --log-error="$log_file"
+ --disable-log-error 2> "$log_file"
ret=$?
if [ $ret -ne 0 ]; then
# Something went wrong, let us also print the error log so that it
diff -Nru mariadb-10.1-10.1.25/scripts/mysqlaccess.sh mariadb-10.1-10.1.30/scripts/mysqlaccess.sh
--- mariadb-10.1-10.1.25/scripts/mysqlaccess.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysqlaccess.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -477,16 +477,23 @@
# *****************************
# Read configuration-file
MySQLaccess::Debug::Print(1, "Reading configuration file...");
- if (-f "./$script_conf") {
- require "./$script_conf";
+ if (-f "@sysconfdir@/$script_conf") {
+ print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n";
+ require "@sysconfdir@/$script_conf";
}
elsif (-f "@prefix@/$script_conf") {
+ print "Configuration file '$script_conf' is found in '@prefix@/'\n";
require "@prefix@/$script_conf";
}
- elsif (-f "@sysconfdir@/$script_conf") {
- require "@sysconfdir@/$script_conf";
+ elsif (-f "./$script_conf") {
+ print "\nERROR! Configuration file '$script_conf' is found in the current ";
+ print "directory.\nThe permissible locations for this file are either ";
+ print "@sysconfdir@/ or @prefix@/\n";
+ print "Please move it to one of these locations and retry.\n\n";
+ exit 0;
}
+
# ****************************
# Read in all parameters
if ($MySQLaccess::CMD) { #command-line version
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_config.pl.in mariadb-10.1-10.1.30/scripts/mysql_config.pl.in
--- mariadb-10.1-10.1.25/scripts/mysql_config.pl.in 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_config.pl.in 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_convert_table_format.sh mariadb-10.1-10.1.30/scripts/mysql_convert_table_format.sh
--- mariadb-10.1-10.1.25/scripts/mysql_convert_table_format.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_convert_table_format.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000-2002, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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
diff -Nru mariadb-10.1-10.1.25/scripts/mysqld_multi.sh mariadb-10.1-10.1.30/scripts/mysqld_multi.sh
--- mariadb-10.1-10.1.25/scripts/mysqld_multi.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysqld_multi.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,23 +1,7 @@
-#!/usr/bin/perl
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
-# Copyright (c) 2000-2011 Monty Program Ab, Jani Tolonen
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA
+#!@PERL_PATH@
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+# Copyright (c) 2010, 2017, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff -Nru mariadb-10.1-10.1.25/scripts/mysqld_safe.sh mariadb-10.1-10.1.30/scripts/mysqld_safe.sh
--- mariadb-10.1-10.1.25/scripts/mysqld_safe.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysqld_safe.sh 2017-12-21 15:48:48.000000000 +0000
@@ -246,7 +246,7 @@
local euid=$(id -u)
local ret=0
- local wr_logfile=$(mktemp $DATADIR/wsrep_recovery.XXXXXX)
+ local wr_logfile=$(mktemp /tmp/wsrep_recovery.XXXXXX)
# safety checks
if [ -z $wr_logfile ]; then
@@ -264,11 +264,11 @@
local wr_pidfile="$DATADIR/"`@HOSTNAME@`"-recover.pid"
- local wr_options="--log_error='$wr_logfile' --pid-file='$wr_pidfile'"
+ local wr_options="--disable-log-error --pid-file='$wr_pidfile'"
log_notice "WSREP: Running position recovery with $wr_options"
- eval_log_error "$mysqld_cmd --wsrep_recover $wr_options"
+ eval "$mysqld_cmd --wsrep_recover $wr_options 2> $wr_logfile"
local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then
@@ -989,8 +989,8 @@
then
:
else
- exec 1>&-
- exec 2>&-
+ exec 1>/dev/null
+ exec 2>/dev/null
fi
# maximum number of wsrep restarts
diff -Nru mariadb-10.1-10.1.25/scripts/mysqldumpslow.sh mariadb-10.1-10.1.30/scripts/mysqldumpslow.sh
--- mariadb-10.1-10.1.25/scripts/mysqldumpslow.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysqldumpslow.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000-2002, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_find_rows.sh mariadb-10.1-10.1.30/scripts/mysql_find_rows.sh
--- mariadb-10.1-10.1.25/scripts/mysql_find_rows.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_find_rows.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_fix_extensions.sh mariadb-10.1-10.1.30/scripts/mysql_fix_extensions.sh
--- mariadb-10.1-10.1.25/scripts/mysql_fix_extensions.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_fix_extensions.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2001 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff -Nru mariadb-10.1-10.1.25/scripts/mysqlhotcopy.sh mariadb-10.1-10.1.30/scripts/mysqlhotcopy.sh
--- mariadb-10.1-10.1.25/scripts/mysqlhotcopy.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysqlhotcopy.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_install_db.pl.in mariadb-10.1-10.1.30/scripts/mysql_install_db.pl.in
--- mariadb-10.1-10.1.25/scripts/mysql_install_db.pl.in 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_install_db.pl.in 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates.
#
# 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
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_install_db.sh mariadb-10.1-10.1.30/scripts/mysql_install_db.sh
--- mariadb-10.1-10.1.25/scripts/mysql_install_db.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_install_db.sh 2017-12-21 15:48:48.000000000 +0000
@@ -187,7 +187,7 @@
# Try to find a specific file within --basedir which can either be a binary
# release or installed source directory and return the path.
-find_in_basedir()
+find_in_dirs()
{
case "$1" in
--dir)
@@ -199,13 +199,13 @@
for dir in "$@"
do
- if test -f "$basedir/$dir/$file"
+ if test -f "$dir/$file"
then
if test -n "$return_dir"
then
- echo "$basedir/$dir"
+ echo "$dir"
else
- echo "$basedir/$dir/$file"
+ echo "$dir/$file"
fi
break
fi
@@ -269,7 +269,7 @@
print_defaults="$builddir/extra/my_print_defaults"
elif test -n "$basedir"
then
- print_defaults=`find_in_basedir my_print_defaults bin extra`
+ print_defaults=`find_in_dirs my_print_defaults $basedir/bin $basedir/extra`
if test -z "$print_defaults"
then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
@@ -295,44 +295,46 @@
then
basedir="$builddir"
bindir="$basedir/client"
- extra_bindir="$basedir/extra"
+ resolveip="$basedir/extra/resolveip"
mysqld="$basedir/sql/mysqld"
langdir="$basedir/sql/share/english"
srcpkgdatadir="$srcdir/scripts"
buildpkgdatadir="$builddir/scripts"
- scriptdir="$srcdir/scripts"
elif test -n "$basedir"
then
- bindir="$basedir/bin"
- extra_bindir="$bindir"
- mysqld=`find_in_basedir mysqld libexec sbin bin`
+ bindir="$basedir/bin" # only used in the help text
+ resolveip=`find_in_dirs resolveip @resolveip_locations@`
+ if test -z "$resolveip"
+ then
+ cannot_find_file resolveip @resolveip_locations@
+ exit 1
+ fi
+ mysqld=`find_in_dirs mysqld @mysqld_locations@`
if test -z "$mysqld"
then
- cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin
+ cannot_find_file mysqld @mysqld_locations@
exit 1
fi
- langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english`
+ langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@`
if test -z "$langdir"
then
- cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english
+ cannot_find_file errmsg.sys @errmsg_locations@
exit 1
fi
- srcpkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ srcpkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@`
buildpkgdatadir=$srcpkgdatadir
if test -z "$srcpkgdatadir"
then
- cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql
+ cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1
fi
- scriptdir="$basedir/scripts"
else
basedir="@prefix@"
bindir="@bindir@"
- extra_bindir="$bindir"
+ resolveip="$bindir/resolveip"
mysqld="@libexecdir@/mysqld"
srcpkgdatadir="@pkgdatadir@"
buildpkgdatadir="@pkgdatadir@"
- scriptdir="@scriptdir@"
fi
# Set up paths to SQL scripts required for bootstrap
@@ -376,14 +378,14 @@
# Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then
- resolved=`"$extra_bindir/resolveip" $hostname 2>&1`
+ resolved=`"$resolveip" $hostname 2>&1`
if test $? -ne 0
then
- resolved=`"$extra_bindir/resolveip" localhost 2>&1`
+ resolved=`"$resolveip" localhost 2>&1`
if test $? -ne 0
then
echo "Neither host '$hostname' nor 'localhost' could be looked up with"
- echo "'$extra_bindir/resolveip'"
+ echo "'$resolveip'"
echo "Please configure the 'hostname' command to return a correct"
echo "hostname."
echo "If you want to solve this at a later stage, restart this script"
@@ -391,7 +393,7 @@
link_to_help
exit 1
fi
- echo "WARNING: The host '$hostname' could not be looked up with resolveip."
+ echo "WARNING: The host '$hostname' could not be looked up with $resolveip."
echo "This probably means that your libc libraries are not 100 % compatible"
echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work"
echo "normally with the exception that host name resolving will not work."
@@ -479,7 +481,7 @@
echo "The problem could be conflicting information in an external"
echo "my.cnf files. You can ignore these by doing:"
echo
- echo " shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf"
+ echo " shell> $0 --defaults-file=~/.my.cnf"
echo
echo "You can also try to start the mysqld daemon with:"
echo
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_secure_installation.pl.in mariadb-10.1-10.1.30/scripts/mysql_secure_installation.pl.in
--- mariadb-10.1-10.1.25/scripts/mysql_secure_installation.pl.in 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_secure_installation.pl.in 2017-12-21 15:48:48.000000000 +0000
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates.
#
# 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
@@ -388,6 +388,3 @@
HERE
-
-
-
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_setpermission.sh mariadb-10.1-10.1.30/scripts/mysql_setpermission.sh
--- mariadb-10.1-10.1.25/scripts/mysql_setpermission.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_setpermission.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,8 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
## Emacs, this is -*- perl -*- mode? :-)
-# Copyright (c) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_system_tables_fix.sql mariadb-10.1-10.1.30/scripts/mysql_system_tables_fix.sql
--- mariadb-10.1-10.1.25/scripts/mysql_system_tables_fix.sql 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_system_tables_fix.sql 2017-12-21 15:48:48.000000000 +0000
@@ -672,6 +672,15 @@
# Convering the host name to lower case for existing users
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
+# fix bad data when upgrading from unfixed InnoDB (MDEV-13360)
+set @str="delete from innodb_index_stats where length(table_name) > 64";
+set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
+prepare stmt from @str;
+execute stmt;
+set @str=replace(@str, "innodb_index_stats", "innodb_table_stats");
+prepare stmt from @str;
+execute stmt;
+
# update timestamp fields in the innodb stat tables
set @str="alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp";
set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
diff -Nru mariadb-10.1-10.1.25/scripts/mysql_zap.sh mariadb-10.1-10.1.30/scripts/mysql_zap.sh
--- mariadb-10.1-10.1.25/scripts/mysql_zap.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/mysql_zap.sh 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000-2002, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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
diff -Nru mariadb-10.1-10.1.25/scripts/wsrep_sst_common.sh mariadb-10.1-10.1.30/scripts/wsrep_sst_common.sh
--- mariadb-10.1-10.1.25/scripts/wsrep_sst_common.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/wsrep_sst_common.sh 2017-12-21 15:48:48.000000000 +0000
@@ -32,6 +32,22 @@
case "$1" in
'--address')
readonly WSREP_SST_OPT_ADDR="$2"
+ #
+ # Break address string into host:port/path parts
+ #
+ if echo $WSREP_SST_OPT_ADDR | grep -qe '^\[.*\]'
+ then
+ # IPv6 notation
+ readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR/\]*/\]}
+ readonly WSREP_SST_OPT_HOST_UNESCAPED=$(echo $WSREP_SST_OPT_HOST | \
+ cut -d '[' -f 2 | cut -d ']' -f 1)
+ else
+ # "traditional" notation
+ readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*}
+ fi
+ readonly WSREP_SST_OPT_PORT=$(echo $WSREP_SST_OPT_ADDR | \
+ cut -d ']' -f 2 | cut -s -d ':' -f 2 | cut -d '/' -f 1)
+ readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/}
shift
;;
'--bypass')
@@ -181,6 +197,11 @@
wsrep_log "[ERROR] $*"
}
+wsrep_log_warning()
+{
+ wsrep_log "[WARNING] $*"
+}
+
wsrep_log_info()
{
wsrep_log "[INFO] $*"
@@ -214,3 +235,39 @@
return $ret
}
+
+#
+# user can specify xtrabackup specific settings that will be used during sst
+# process like encryption, etc.....
+# parse such configuration option. (group for xb settings is [sst] in my.cnf
+#
+# 1st param: group : name of the config file section, e.g. mysqld
+# 2nd param: var : name of the variable in the section, e.g. server-id
+# 3rd param: - : default value for the param
+parse_cnf()
+{
+ local group=$1
+ local var=$2
+ local reval=""
+
+ # print the default settings for given group using my_print_default.
+ # normalize the variable names specified in cnf file (user can use _ or - for example log-bin or log_bin)
+ # then grep for needed variable
+ # finally get the variable value (if variables has been specified multiple time use the last value only)
+
+ # look in group+suffix
+ if [ -n $WSREP_SST_OPT_CONF_SUFFIX ]; then
+ reval=$($MY_PRINT_DEFAULTS "${group}${WSREP_SST_OPT_CONF_SUFFIX}" | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
+ fi
+
+ # look in group
+ if [ -z $reval ]; then
+ reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
+ fi
+
+ # use default if we haven't found a value
+ if [ -z $reval ]; then
+ [ -n $3 ] && reval=$3
+ fi
+ echo $reval
+}
diff -Nru mariadb-10.1-10.1.25/scripts/wsrep_sst_mysqldump.sh mariadb-10.1-10.1.30/scripts/wsrep_sst_mysqldump.sh
--- mariadb-10.1-10.1.25/scripts/wsrep_sst_mysqldump.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/wsrep_sst_mysqldump.sh 2017-12-21 15:48:48.000000000 +0000
@@ -30,6 +30,7 @@
{
[ "$1" = "127.0.0.1" ] && return 0
[ "$1" = "localhost" ] && return 0
+ [ "$1" = "[::1]" ] && return 0
[ "$1" = "$(hostname -s)" ] && return 0
[ "$1" = "$(hostname -f)" ] && return 0
[ "$1" = "$(hostname -d)" ] && return 0
@@ -116,8 +117,9 @@
$MYSQL_CLIENT $AUTH -S$WSREP_SST_OPT_SOCKET --disable-reconnect --connect_timeout=10 |\
tail -1 | awk -F ' ' '{ print $2 }')
-MYSQL="$MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\
-"--disable-reconnect --connect_timeout=10"
+MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\
+"$AUTH -h${WSREP_SST_OPT_HOST_UNESCAPED:-$WSREP_SST_OPT_HOST} "\
+"-P$WSREP_SST_OPT_PORT --disable-reconnect --connect_timeout=10"
# Check if binary logging is enabled on the joiner node.
# Note: SELECT cannot be used at this point.
diff -Nru mariadb-10.1-10.1.25/scripts/wsrep_sst_rsync.sh mariadb-10.1-10.1.30/scripts/wsrep_sst_rsync.sh
--- mariadb-10.1-10.1.25/scripts/wsrep_sst_rsync.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/wsrep_sst_rsync.sh 2017-12-21 15:48:48.000000000 +0000
@@ -67,6 +67,11 @@
exit 2 # ENOENT
fi
+ if ! which lsof > /dev/null; then
+ wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
+ exit 2 # ENOENT
+ fi
+
local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \
grep "(LISTEN)")
local is_rsync=$(echo $port_info | \
@@ -97,9 +102,19 @@
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
if [ -z "$WSREP_LOG_DIR" ]; then
- WSREP_LOG_DIR=$($MY_PRINT_DEFAULTS --mysqld \
- | grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \
- | cut -b 29- )
+ WSREP_LOG_DIR=$(parse_cnf mariadb-10.0 innodb_log_group_home_dir "")
+fi
+if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf mysqld innodb_log_group_home_dir "")
+fi
+if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf server innodb_log_group_home_dir "")
+fi
+if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf mariadb innodb_log_group_home_dir "")
+fi
+if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf mysqld-10.0 innodb_log_group_home_dir "")
fi
if [ -n "$WSREP_LOG_DIR" ]; then
@@ -222,8 +237,8 @@
[ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
[ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu)
- find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \
- xargs -I{} -0 -P $count \
+ find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" \
+ -print0 | xargs -I{} -0 -P $count \
rsync --owner --group --perms --links --specials \
--ignore-times --inplace --recursive --delete --quiet \
$WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \
@@ -284,9 +299,9 @@
RSYNC_CONF="$WSREP_SST_OPT_DATA/$MODULE.conf"
if [ -n "${MYSQL_TMP_DIR:-}" ] ; then
- SILENT="log file = $MYSQL_TMP_DIR/rsynd.log"
+ SILENT="log file = $MYSQL_TMP_DIR/rsyncd.log"
else
- SILENT=""
+ SILENT=""
fi
cat << EOF > "$RSYNC_CONF"
@@ -304,6 +319,7 @@
# rm -rf "$DATA"/ib_logfile* # we don't want old logs around
# listen at all interfaces (for firewalled setups)
+ readonly RSYNC_PORT=${WSREP_SST_OPT_PORT:-4444}
rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" &
RSYNC_REAL_PID=$!
@@ -312,7 +328,7 @@
sleep 0.2
done
- echo "ready $ADDR/$MODULE"
+ echo "ready $WSREP_SST_OPT_HOST:$RSYNC_PORT/$MODULE"
# wait for SST to complete by monitoring magic file
while [ ! -r "$MAGIC_FILE" ] && check_pid "$RSYNC_PID" && \
diff -Nru mariadb-10.1-10.1.25/scripts/wsrep_sst_xtrabackup-v2.sh mariadb-10.1-10.1.30/scripts/wsrep_sst_xtrabackup-v2.sh
--- mariadb-10.1-10.1.25/scripts/wsrep_sst_xtrabackup-v2.sh 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/scripts/wsrep_sst_xtrabackup-v2.sh 2017-12-21 15:48:48.000000000 +0000
@@ -35,8 +35,8 @@
SST_PORT=""
REMOTEIP=""
REMOTEHOST=""
+tca=""
tcert=""
-tpem=""
tkey=""
sockopt=""
progress=""
@@ -48,7 +48,6 @@
# Initially
stagemsg="${WSREP_SST_OPT_ROLE}"
cpat=""
-speciald=1
ib_home_dir=""
ib_log_dir=""
ib_undo_dir=""
@@ -72,6 +71,11 @@
scomp=""
sdecomp=""
+ssl_dhparams=""
+
+ssl_cert=""
+ssl_ca=""
+ssl_key=""
# Required for backup locks
# For backup locks it is 1 sent by joiner
@@ -151,6 +155,10 @@
if [[ -z $ekey ]];then
ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile"
else
+ wsrep_log_warning "Using the 'encrypt-key' option causes the encryption key"
+ wsrep_log_warning "to be set via the command-line and is considered insecure."
+ wsrep_log_warning "It is recommended to use the 'encrypt-key-file' option instead."
+
ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey"
fi
@@ -161,6 +169,86 @@
stagemsg+="-XB-Encrypted"
}
+#
+# If the ssl_dhparams variable is already set, uses that as a source
+# of dh parameters for OpenSSL. Otherwise, looks for dhparams.pem in the
+# datadir, and creates it there if it can't find the file.
+# No input parameters
+#
+check_for_dhparams()
+{
+ if [[ -z "$ssl_dhparams" ]]; then
+ if ! [[ -r "$DATA/dhparams.pem" ]]; then
+ wsrep_check_programs openssl
+ wsrep_log_info "Could not find dhparams file, creating $DATA/dhparams.pem"
+
+ if ! openssl dhparam -out "$DATA/dhparams.pem" 2048 >/dev/null 2>&1
+ then
+ wsrep_log_error "******** FATAL ERROR ********************************* "
+ wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. "
+ wsrep_log_error "****************************************************** "
+ exit 22
+ fi
+ fi
+ ssl_dhparams="$DATA/dhparams.pem"
+ fi
+}
+
+#
+# verifies that the certificate matches the private key
+# doing this will save us having to wait for a timeout that would
+# otherwise occur.
+#
+# 1st param: path to the cert
+# 2nd param: path to the private key
+#
+verify_cert_matches_key()
+{
+ local cert_path=$1
+ local key_path=$2
+
+ wsrep_check_programs openssl diff
+
+ # generate the public key from the cert and the key
+ # they should match (otherwise we can't create an SSL connection)
+ if ! diff <(openssl x509 -in "$cert_path" -pubkey -noout) <(openssl rsa -in "$key_path" -pubout 2>/dev/null) >/dev/null 2>&1
+ then
+ wsrep_log_error "******** FATAL ERROR ************************* "
+ wsrep_log_error "* The certifcate and private key do not match. "
+ wsrep_log_error "* Please check your certificate and key files. "
+ wsrep_log_error "********************************************** "
+ exit 22
+ fi
+}
+
+# Checks to see if the file exists
+# If the file does not exist (or cannot be read), issues an error
+# and exits
+#
+# 1st param: file name to be checked (for read access)
+# 2nd param: 1st error message (header)
+# 3rd param: 2nd error message (footer, optional)
+#
+verify_file_exists()
+{
+ local file_path=$1
+ local error_message1=$2
+ local error_message2=$3
+
+ if ! [[ -r "$file_path" ]]; then
+ wsrep_log_error "******** FATAL ERROR ************************* "
+ wsrep_log_error "* $error_message1 "
+ wsrep_log_error "* Could not find/access : $file_path "
+
+ if ! [[ -z "$error_message2" ]]; then
+ wsrep_log_error "* $error_message2 "
+ fi
+
+ wsrep_log_error "********************************************** "
+ exit 22
+ fi
+}
+
get_transfer()
{
if [[ -z $SST_PORT ]];then
@@ -174,15 +262,25 @@
wsrep_log_error "nc(netcat) not found in path: $PATH"
exit 2
fi
+
+ if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then
+ wsrep_log_error "******** FATAL ERROR *********************** "
+ wsrep_log_error "* Using SSL encryption (encrypt= 2, 3, or 4) "
+ wsrep_log_error "* is not supported when using nc(netcat). "
+ wsrep_log_error "******************************************** "
+ exit 22
+ fi
+
wsrep_log_info "Using netcat as streamer"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- if nc -h 2>&1 | grep -q ncat;then
- tcmd="nc -l ${TSST_PORT}"
+ if nc -h 2>&1 | grep -q ncat; then
+ tcmd="nc $sockopt -l ${TSST_PORT}"
else
- tcmd="nc -dl ${TSST_PORT}"
+ tcmd="nc $sockopt -dl ${TSST_PORT}"
fi
else
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
+ # netcat doesn't understand [] around IPv6 address
+ tcmd="nc ${REMOTEIP//[\[\]]/} ${TSST_PORT}"
fi
else
tfmt='socat'
@@ -192,74 +290,111 @@
exit 2
fi
- if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q "WITH_OPENSSL 1";then
- wsrep_log_error "Encryption requested, but socat is not OpenSSL enabled (encrypt=$encrypt)"
- exit 2
- fi
+ donor_extra=""
+ joiner_extra=""
+ if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then
+ if ! socat -V | grep -q WITH_OPENSSL; then
+ wsrep_log_error "******** FATAL ERROR ****************** "
+ wsrep_log_error "* socat is not openssl enabled. "
+ wsrep_log_error "* Unable to encrypt SST communications. "
+ wsrep_log_error "*************************************** "
+ exit 2
+ fi
- if [[ $encrypt -eq 2 ]];then
- wsrep_log_info "Using openssl based encryption with socat: with crt and pem"
- if [[ -z $tpem || -z $tcert ]];then
- wsrep_log_error "Both PEM and CRT files required"
- exit 22
+ # Determine the socat version
+ SOCAT_VERSION=`socat -V 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1`
+ if [[ -z "$SOCAT_VERSION" ]]; then
+ wsrep_log_error "******** FATAL ERROR **************** "
+ wsrep_log_error "* Cannot determine the socat version. "
+ wsrep_log_error "************************************* "
+ exit 2
fi
+
+ # socat versions < 1.7.3 will have 512-bit dhparams (too small)
+ # so create 2048-bit dhparams and send that as a parameter
+ # socat version >= 1.7.3, checks to see if the peername matches the hostname
+ # set commonname="" to disable the peername checks
+ #
+ if ! check_for_version "$SOCAT_VERSION" "1.7.3"; then
+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
+ # dhparams check (will create ssl_dhparams if needed)
+ check_for_dhparams
+ joiner_extra=",dhparam=$ssl_dhparams"
+ fi
+ fi
+ if check_for_version "$SOCAT_VERSION" "1.7.3"; then
+ donor_extra=',commonname=""'
+ fi
+ fi
+
+ if [[ $encrypt -eq 2 ]]; then
+ wsrep_log_warning "**** WARNING **** encrypt=2 is deprecated and will be removed in a future release"
+ wsrep_log_info "Using openssl based encryption with socat: with crt and ca"
+
+ verify_file_exists "$tcert" "Both certificate and CA files are required." \
+ "Please check the 'tcert' option. "
+ verify_file_exists "$tca" "Both certificate and CA files are required." \
+ "Please check the 'tca' option. "
+
stagemsg+="-OpenSSL-Encrypted-2"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- wsrep_log_info "Decrypting with cert=${tpem}, cafile=${tcert}"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tpem},cafile=${tcert}${sockopt} stdio"
+ wsrep_log_info "Decrypting with CERT: $tcert, CA: $tca"
+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},cafile=${tca}${joiner_extra}${sockopt} stdio"
else
- wsrep_log_info "Encrypting with cert=${tpem}, cafile=${tcert}"
- tcmd="socat -u stdio openssl-connect:${REMOTEHOST}:${TSST_PORT},cert=${tpem},cafile=${tcert}${sockopt}"
+ wsrep_log_info "Encrypting with CERT: $tcert, CA: $tca"
+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}"
fi
elif [[ $encrypt -eq 3 ]];then
+ wsrep_log_warning "**** WARNING **** encrypt=3 is deprecated and will be removed in a future release"
wsrep_log_info "Using openssl based encryption with socat: with key and crt"
- if [[ -z $tpem || -z $tkey ]];then
- wsrep_log_error "Both certificate and key files required"
- exit 22
- fi
+
+ verify_file_exists "$tcert" "Both certificate and key files are required." \
+ "Please check the 'tcert' option. "
+ verify_file_exists "$tkey" "Both certificate and key files are required." \
+ "Please check the 'tkey' option. "
+
stagemsg+="-OpenSSL-Encrypted-3"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- if [[ -z $tcert ]];then
- wsrep_log_info "Decrypting with cert=${tpem}, key=${tkey}, verify=0"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tpem},key=${tkey},verify=0${sockopt} stdio"
- else
- wsrep_log_info "Decrypting with cert=${tpem}, key=${tkey}, cafile=${tcert}"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tpem},key=${tkey},cafile=${tcert}${sockopt} stdio"
- fi
+ wsrep_log_info "Decrypting with CERT: $tcert, KEY: $tkey"
+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio"
else
- if [[ -z $tcert ]];then
- wsrep_log_info "Encrypting with cert=${tpem}, key=${tkey}, verify=0"
- tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tpem},key=${tkey},verify=0${sockopt}"
- else
- wsrep_log_info "Encrypting with cert=${tpem}, key=${tkey}, cafile=${tcert}"
- tcmd="socat -u stdio openssl-connect:${REMOTEHOST}:${TSST_PORT},cert=${tpem},key=${tkey},cafile=${tcert}${sockopt}"
- fi
+ wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey"
+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}"
fi
+ elif [[ $encrypt -eq 4 ]]; then
+ wsrep_log_info "Using openssl based encryption with socat: with key, crt, and ca"
- else
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
+ verify_file_exists "$ssl_ca" "CA, certificate, and key files are required." \
+ "Please check the 'ssl-ca' option. "
+ verify_file_exists "$ssl_cert" "CA, certificate, and key files are required." \
+ "Please check the 'ssl-cert' option. "
+ verify_file_exists "$ssl_key" "CA, certificate, and key files are required." \
+ "Please check the 'ssl-key' option. "
+
+ # Check to see that the key matches the cert
+ verify_cert_matches_key $ssl_cert $ssl_key
+
+ stagemsg+="-OpenSSL-Encrypted-4"
+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
+ wsrep_log_info "Decrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${joiner_extra}${sockopt} stdio"
+ else
+ wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}"
+ fi
+
+ else
+ if [[ $encrypt -eq 1 ]]; then
+ wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release"
+ fi
+
+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
else
tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}"
fi
fi
fi
-
-}
-
-parse_cnf()
-{
- local group=$1
- local var=$2
- # print the default settings for given group using my_print_default.
- # normalize the variable names specified in cnf file (user can use _ or - for example log-bin or log_bin)
- # then grep for needed variable
- # finally get the variable value (if variables has been specified multiple time use the last value only)
- reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
- if [[ -z $reval ]];then
- [[ -n $3 ]] && reval=$3
- fi
- echo $reval
}
get_footprint()
@@ -309,15 +444,15 @@
{
sfmt=$(parse_cnf sst streamfmt "xbstream")
tfmt=$(parse_cnf sst transferfmt "socat")
- tcert=$(parse_cnf sst tca "")
- tpem=$(parse_cnf sst tcert "")
+ tca=$(parse_cnf sst tca "")
+ tcert=$(parse_cnf sst tcert "")
tkey=$(parse_cnf sst tkey "")
encrypt=$(parse_cnf sst encrypt 0)
sockopt=$(parse_cnf sst sockopt "")
progress=$(parse_cnf sst progress "")
rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0)
- cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
+ cpat=$(parse_cnf sst cpat '.*\.pem$\|.*init\.ok$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "")
ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
@@ -331,9 +466,23 @@
ekey=$(parse_cnf sst encrypt-key "")
ekeyfile=$(parse_cnf sst encrypt-key-file "")
fi
+
+ # Pull the parameters needed for encrypt=4
+ ssl_ca=$(parse_cnf sst ssl-ca "")
+ if [[ -z "$ssl_ca" ]]; then
+ ssl_ca=$(parse_cnf mysqld ssl-ca "")
+ fi
+ ssl_cert=$(parse_cnf sst ssl-cert "")
+ if [[ -z "$ssl_cert" ]]; then
+ ssl_cert=$(parse_cnf mysqld ssl-cert "")
+ fi
+ ssl_key=$(parse_cnf sst ssl-key "")
+ if [[ -z "$ssl_key" ]]; then
+ ssl_key=$(parse_cnf mysqld ssl-key "")
+ fi
+
rlimit=$(parse_cnf sst rlimit "")
uextra=$(parse_cnf sst use-extra 0)
- speciald=$(parse_cnf sst sst-special-dirs 1)
iopts=$(parse_cnf sst inno-backup-opts "")
iapts=$(parse_cnf sst inno-apply-opts "")
impts=$(parse_cnf sst inno-move-opts "")
@@ -342,13 +491,8 @@
ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}")
ssystag+="-"
- if [[ $speciald -eq 0 ]];then
- wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1"
- speciald=1
- fi
-
if [[ $ssyslog -ne -1 ]];then
- if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
+ if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
ssyslog=1
fi
fi
@@ -494,32 +638,30 @@
setup_ports()
{
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }')
- REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }')
- REMOTEHOST=$(getent hosts $REMOTEIP | awk '{ print $2 }')
- if [[ -z $REMOTEHOST ]];then
- REMOTEHOST=$REMOTEIP
- fi
- lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }')
- sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }')
+ SST_PORT=$WSREP_SST_OPT_PORT
+ REMOTEIP=$WSREP_SST_OPT_HOST
+ lsn=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $2 }')
+ sst_ver=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $3 }')
else
- SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
+ SST_PORT=$WSREP_SST_OPT_PORT
fi
}
-# waits ~10 seconds for nc to open the port and then reports ready
+# waits ~1 minute for nc/socat to open the port and then reports ready
# (regardless of timeout)
wait_for_listen()
{
- local PORT=$1
- local ADDR=$2
+ local HOST=$1
+ local PORT=$2
local MODULE=$3
- for i in {1..50}
+
+ for i in {1..300}
do
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
sleep 0.2
done
- echo "ready ${ADDR}/${MODULE}//$sst_ver"
+
+ echo "ready ${HOST}:${PORT}/${MODULE}//$sst_ver"
}
check_extra()
@@ -527,7 +669,7 @@
local use_socket=1
if [[ $uextra -eq 1 ]];then
if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
- local eport=$($MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
+ local eport=$($MY_PRINT_DEFAULTS mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
if [[ -n $eport ]];then
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
@@ -622,11 +764,64 @@
}
+# Returns the version string in a standardized format
+# Input "1.2.3" => echoes "010203"
+# Wrongly formatted values => echoes "000000"
+normalize_version()
+{
+ local major=0
+ local minor=0
+ local patch=0
+
+ # Only parses purely numeric version numbers, 1.2.3
+ # Everything after the first three values are ignored
+ if [[ $1 =~ ^([0-9]+)\.([0-9]+)\.?([0-9]*)([\.0-9])*$ ]]; then
+ major=${BASH_REMATCH[1]}
+ minor=${BASH_REMATCH[2]}
+ patch=${BASH_REMATCH[3]}
+ fi
+
+ printf %02d%02d%02d $major $minor $patch
+}
+
+# Compares two version strings
+# The first parameter is the version to be checked
+# The second parameter is the minimum version required
+# Returns 1 (failure) if $1 >= $2, 0 (success) otherwise
+check_for_version()
+{
+ local local_version_str="$( normalize_version $1 )"
+ local required_version_str="$( normalize_version $2 )"
+
+ if [[ "$local_version_str" < "$required_version_str" ]]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
wsrep_log_error "innobackupex not in path: $PATH"
exit 2
fi
+# check the version, we require XB-2.4 to ensure that we can pass the
+# datadir via the command-line option
+XB_REQUIRED_VERSION="2.3.5"
+
+XB_VERSION=`$INNOBACKUPEX_BIN --version 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1`
+if [[ -z $XB_VERSION ]]; then
+ wsrep_log_error "FATAL: Cannot determine the $INNOBACKUPEX_BIN version. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST"
+ exit 2
+fi
+
+if ! check_for_version $XB_VERSION $XB_REQUIRED_VERSION; then
+ wsrep_log_error "FATAL: The $INNOBACKUPEX_BIN version is $XB_VERSION. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST"
+ exit 2
+fi
+
+
rm -f "${MAGIC_FILE}"
if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
@@ -670,14 +865,14 @@
}
INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
- INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
- INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
+ INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
+ INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi
else
INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
- INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
- INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
+ INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
+ INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
fi
get_stream
@@ -718,15 +913,6 @@
fi
get_keys
- if [[ $encrypt -eq 1 ]];then
- if [[ -n $ekey ]];then
- INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey "
- else
- INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile "
- fi
- fi
-
-
check_extra
wsrep_log_info "Streaming GTID file before SST"
@@ -739,17 +925,17 @@
if [[ $encrypt -eq 1 ]];then
if [[ -n $scomp ]];then
- tcmd=" $ecmd | $scomp | $tcmd "
+ tcmd=" \$ecmd | $scomp | $tcmd "
else
- tcmd=" $ecmd | $tcmd "
+ tcmd=" \$ecmd | $tcmd "
fi
elif [[ -n $scomp ]];then
tcmd=" $scomp | $tcmd "
fi
-
send_donor $DATA "${stagemsg}-gtid"
+ # Restore the transport commmand to its original state
tcmd="$ttcmd"
if [[ -n $progress ]];then
get_footprint
@@ -764,10 +950,16 @@
wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}"
- if [[ -n $scomp ]];then
+ # Add compression to the head of the stream (if specified)
+ if [[ -n $scomp ]]; then
tcmd="$scomp | $tcmd"
fi
+ # Add encryption to the head of the stream (if specified)
+ if [[ $encrypt -eq 1 ]]; then
+ tcmd=" \$ecmd | $tcmd "
+ fi
+
set +e
timeit "${stagemsg}-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
set -e
@@ -797,9 +989,9 @@
get_keys
if [[ $encrypt -eq 1 ]];then
if [[ -n $scomp ]];then
- tcmd=" $ecmd | $scomp | $tcmd "
+ tcmd=" \$ecmd | $scomp | $tcmd "
else
- tcmd=" $ecmd | $tcmd "
+ tcmd=" \$ecmd | $tcmd "
fi
elif [[ -n $scomp ]];then
tcmd=" $scomp | $tcmd "
@@ -824,7 +1016,6 @@
stagemsg="Joiner-Recv"
-
sencrypted=1
nthreads=1
@@ -835,14 +1026,7 @@
# May need xtrabackup_checkpoints later on
rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile
- ADDR=${WSREP_SST_OPT_ADDR}
- if [ -z "${SST_PORT}" ]
- then
- SST_PORT=4444
- ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}"
- fi
-
- wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} &
+ wait_for_listen ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444} ${MODULE} &
trap sig_joiner_cleanup HUP PIPE INT TERM
trap cleanup_joiner EXIT
@@ -855,9 +1039,9 @@
get_keys
if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then
if [[ -n $sdecomp ]];then
- strmcmd=" $sdecomp | $ecmd | $strmcmd"
+ strmcmd=" $sdecomp | \$ecmd | $strmcmd"
else
- strmcmd=" $ecmd | $strmcmd"
+ strmcmd=" \$ecmd | $strmcmd"
fi
elif [[ -n $sdecomp ]];then
strmcmd=" $sdecomp | $strmcmd"
@@ -888,7 +1072,7 @@
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
diff -Nru mariadb-10.1-10.1.25/sql/CMakeLists.txt mariadb-10.1-10.1.30/sql/CMakeLists.txt
--- mariadb-10.1-10.1.25/sql/CMakeLists.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/CMakeLists.txt 2017-12-21 15:48:48.000000000 +0000
@@ -48,24 +48,13 @@
SET(GEN_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
-${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-)
-SET(GEN_DIGEST_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
+${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
)
SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES}
- ${GEN_DIGEST_SOURCES}
PROPERTIES GENERATED 1)
-# Gen_lex_token
-# Make sure sql_yacc.h is generated before compiling gen_lex_token
-
-IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
- SET(DEPENDS_gen_lex_token DEPENDS gen_lex_token)
- SET(DEPENDS_gen_lex_hash DEPENDS gen_lex_hash)
-ENDIF()
-
IF(NOT CMAKE_CROSSCOMPILING)
ADD_EXECUTABLE(gen_lex_token gen_lex_token.cc
@@ -75,7 +64,7 @@
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
COMMAND gen_lex_token > lex_token.h
- ${DEPENDS_gen_lex_token}
+ DEPENDS gen_lex_token
)
ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER)
@@ -148,7 +137,6 @@
table_cache.cc encryption.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
${GEN_SOURCES}
- ${GEN_DIGEST_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
@@ -169,7 +157,6 @@
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
ADD_DEPENDENCIES(sql GenServerSource)
-ADD_DEPENDENCIES(sql GenDigestServerSource)
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC}
@@ -208,7 +195,7 @@
SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.def)
SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.exp)
SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.lib)
- SET(MYSQLD_CORELIBS sql mysys mysys_ssl dbug strings)
+ SET(MYSQLD_CORELIBS sql mysys dbug strings)
FOREACH (CORELIB ${MYSQLD_CORELIBS})
GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION)
FILE(TO_NATIVE_PATH ${LOC} LOC)
@@ -219,25 +206,45 @@
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(_PLATFORM x64)
ENDIF()
+ # Create a cmake script to generate import and export libs
+ # from a .def file
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT "
+ IF ((mysqld_lib.def IS_NEWER_THAN mysqld_lib.lib) OR
+ (mysqld_lib.def IS_NEWER_THAN mysqld_lib.exp))
+ FILE(REMOVE mysqld_lib.lib mysqld_lib.exp)
+ SET(ENV{VS_UNICODE_OUTPUT})
+ EXECUTE_PROCESS (
+ COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${MYSQLD_DEF}\" /MACHINE:${_PLATFORM}
+ RESULT_VARIABLE ret)
+ IF(NOT ret EQUAL 0)
+ MESSAGE(FATAL_ERROR \"process failed ret=\${ret}\")
+ ENDIF()
+ ENDIF()
+ ")
+
+ CONFIGURE_FILE(
+ ${PROJECT_SOURCE_DIR}/cmake/configurable_file_content.in
+ make_mysqld_lib.cmake)
+
+ IF(CMAKE_VERSION VERSION_GREATER "3.2.0")
+ SET(MYSQLD_LIB_BYPRODUCTS BYPRODUCTS ${MYSQLD_DEF} ${MYSQLD_LIB} ${MYSQLD_EXP})
+ ENDIF()
ADD_CUSTOM_COMMAND(
- OUTPUT ${MYSQLD_DEF}
- COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js
- ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.stamp
+ ${MYSQLD_LIB_BYPRODUCTS}
+ COMMENT "Generating mysqld_lib.def, mysqld_lib.lib, mysqld_lib.exp"
+ COMMAND cscript //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js
+ ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp
COMMAND ${CMAKE_COMMAND} -E copy_if_different mysqld_lib.def.tmp mysqld_lib.def
COMMAND ${CMAKE_COMMAND} -E remove mysqld_lib.def.tmp
+ COMMAND ${CMAKE_COMMAND} -P make_mysqld_lib.cmake
+ COMMAND ${CMAKE_COMMAND} -E touch mysqld_lib.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${MYSQLD_CORELIBS}
)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${MYSQLD_LIB}
- COMMAND lib
- ARGS /NAME:mysqld.exe "/DEF:${MYSQLD_DEF}" "/MACHINE:${_PLATFORM}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${MYSQLD_DEF}
- )
- ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${MYSQLD_LIB})
+ ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.stamp)
ADD_LIBRARY(mysqld_import_lib UNKNOWN IMPORTED GLOBAL)
SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB})
ENDIF()
@@ -253,7 +260,9 @@
ENDIF()
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
- SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
+ IF(NOT MSVC)
+ SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
+ ENDIF()
GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS)
IF(NOT mysqld_link_flags)
SET(mysqld_link_flags)
@@ -267,7 +276,6 @@
ENDIF()
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
-SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
TARGET_LINK_LIBRARIES(mysqld sql)
# Provide plugins with minimal set of libraries
@@ -293,10 +301,6 @@
SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS
"${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
ENDIF()
-INSTALL_DEBUG_TARGET(mysqld
- DESTINATION ${INSTALL_SBINDIR}
- PDB_DESTINATION ${INSTALL_SBINDIR}/debug
- RENAME mysqld-debug)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
@@ -330,7 +334,7 @@
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
COMMAND gen_lex_hash > lex_hash.h
- ${DEPENDS_gen_lex_hash}
+ DEPENDS gen_lex_hash
)
MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc COMPONENT Server)
@@ -342,27 +346,13 @@
DEPENDS ${GEN_SOURCES}
)
-ADD_CUSTOM_TARGET(
- GenDigestServerSource
- DEPENDS ${GEN_DIGEST_SOURCES}
-)
-
#Need this only for embedded
SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE)
IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
- ADD_LIBRARY(udf_example MODULE udf_example.c)
+ ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "")
- # udf_example depends on strings
- IF(WIN32)
- IF(MSVC)
- SET_TARGET_PROPERTIES(udf_example PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/udf_example.def")
- ENDIF()
- TARGET_LINK_LIBRARIES(udf_example strings)
- ELSE()
- # udf_example is using safemutex exported by mysqld
- TARGET_LINK_LIBRARIES(udf_example mysqld)
- ENDIF()
+ TARGET_LINK_LIBRARIES(udf_example strings)
ENDIF()
FOREACH(tool glibtoolize libtoolize aclocal autoconf autoheader automake gtar
diff -Nru mariadb-10.1-10.1.25/sql/datadict.cc mariadb-10.1-10.1.30/sql/datadict.cc
--- mariadb-10.1-10.1.25/sql/datadict.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/datadict.cc 2017-12-21 15:48:48.000000000 +0000
@@ -45,6 +45,8 @@
engine_name is a LEX_STRING, where engine_name->str must point to
a buffer of at least NAME_CHAR_LEN+1 bytes.
+ If engine_name is 0, then the function will only test if the file is a
+ view or not
@retval FRMTYPE_ERROR error
@retval FRMTYPE_TABLE table
@@ -72,12 +74,23 @@
goto err;
}
+ /*
+ We return FRMTYPE_TABLE if we can read the .frm file. This allows us
+ to drop a bad .frm file with DROP TABLE
+ */
type= FRMTYPE_TABLE;
- if (!is_binary_frm_header(header) || !engine_name)
+ /* engine_name is 0 if we only want to know if table is view or not */
+ if (!engine_name)
goto err;
+ /* Initialize engine name in case we are not able to find it out */
engine_name->length= 0;
+ engine_name->str[0]= 0;
+
+ if (!is_binary_frm_header(header))
+ goto err;
+
dbt= header[3];
/* cannot use ha_resolve_by_legacy_type without a THD */
diff -Nru mariadb-10.1-10.1.25/sql/debug_sync.cc mariadb-10.1-10.1.30/sql/debug_sync.cc
--- mariadb-10.1-10.1.25/sql/debug_sync.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/debug_sync.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1502,7 +1502,7 @@
{
if (!--action->hit_limit)
{
- thd->killed= KILL_QUERY;
+ thd->set_killed(KILL_QUERY);
my_error(ER_DEBUG_SYNC_HIT_LIMIT, MYF(0));
}
DBUG_PRINT("debug_sync_exec", ("hit_limit: %lu at: '%s'",
diff -Nru mariadb-10.1-10.1.25/sql/encryption.cc mariadb-10.1-10.1.30/sql/encryption.cc
--- mariadb-10.1-10.1.25/sql/encryption.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/encryption.cc 2017-12-21 15:48:48.000000000 +0000
@@ -98,19 +98,27 @@
int finalize_encryption_plugin(st_plugin_int *plugin)
{
- encryption_handler.encryption_key_get_func=
- (uint (*)(uint, uint, uchar*, uint*))no_key;
- encryption_handler.encryption_key_get_latest_version_func= no_key;
- encryption_handler.encryption_ctx_size_func= zero_size;
+ bool used= plugin_ref_to_int(encryption_manager) == plugin;
+
+ if (used)
+ {
+ encryption_handler.encryption_key_get_func=
+ (uint (*)(uint, uint, uchar*, uint*))no_key;
+ encryption_handler.encryption_key_get_latest_version_func= no_key;
+ encryption_handler.encryption_ctx_size_func= zero_size;
+ }
if (plugin && plugin->plugin->deinit && plugin->plugin->deinit(NULL))
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
- if (encryption_manager)
+
+ if (used)
+ {
plugin_unlock(NULL, encryption_manager);
- encryption_manager= 0;
+ encryption_manager= 0;
+ }
return 0;
}
diff -Nru mariadb-10.1-10.1.25/sql/event_data_objects.cc mariadb-10.1-10.1.30/sql/event_data_objects.cc
--- mariadb-10.1-10.1.25/sql/event_data_objects.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/event_data_objects.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1472,19 +1472,33 @@
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;
}
diff -Nru mariadb-10.1-10.1.25/sql/events.cc mariadb-10.1-10.1.30/sql/events.cc
--- mariadb-10.1-10.1.25/sql/events.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/events.cc 2017-12-21 15:48:48.000000000 +0000
@@ -188,8 +188,8 @@
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_HOUR_SECOND:
{
ulonglong tmp_expr= expr;
@@ -205,8 +205,8 @@
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_DAY_SECOND:
{
ulonglong tmp_expr= expr;
@@ -228,8 +228,8 @@
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_DAY_MICROSECOND:
case INTERVAL_HOUR_MICROSECOND:
case INTERVAL_MINUTE_MICROSECOND:
@@ -243,7 +243,8 @@
break;
case INTERVAL_WEEK:
expr/= 7;
- /* fall through */
+ close_quote= FALSE;
+ break;
default:
close_quote= FALSE;
break;
@@ -334,6 +335,7 @@
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if (lock_object_name(thd, MDL_key::EVENT,
parse_data->dbname.str, parse_data->name.str))
@@ -416,6 +418,10 @@
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
+#ifdef WITH_WSREP
+ error:
+ DBUG_RETURN(TRUE);
+#endif /* WITH_WSREP */
}
@@ -456,6 +462,9 @@
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
+
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+
if (lock_object_name(thd, MDL_key::EVENT,
parse_data->dbname.str, parse_data->name.str))
DBUG_RETURN(TRUE);
@@ -540,6 +549,10 @@
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
+#ifdef WITH_WSREP
+error:
+ DBUG_RETURN(TRUE);
+#endif /* WITH_WSREP */
}
@@ -580,6 +593,8 @@
if (check_access(thd, EVENT_ACL, dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+
/*
Turn off row binlogging of this statement and use statement-based so
that all supporting tables are updated for DROP EVENT command.
@@ -601,6 +616,10 @@
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
+#ifdef WITH_WSREP
+error:
+ DBUG_RETURN(TRUE);
+#endif
}
diff -Nru mariadb-10.1-10.1.25/sql/field.cc mariadb-10.1-10.1.30/sql/field.cc
--- mariadb-10.1-10.1.25/sql/field.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/field.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2013, Monty Program Ab.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2017, MariaDB
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
@@ -4729,7 +4729,7 @@
return j;
}
-longlong Field_double::val_int(void)
+longlong Field_double::val_int_from_real(bool want_unsigned_result)
{
ASSERT_COLUMN_MARKED_FOR_READ;
double j;
@@ -4737,8 +4737,15 @@
bool error;
float8get(j,ptr);
- res= double_to_longlong(j, 0, &error);
- if (error)
+ res= double_to_longlong(j, want_unsigned_result, &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)
{
THD *thd= get_thd();
ErrConvDouble err(j);
@@ -5064,6 +5071,23 @@
}
+int Field_timestamp::store_timestamp(Field_timestamp *from)
+{
+ ulong sec_part;
+ my_time_t ts= from->get_timestamp(&sec_part);
+ store_TIME(ts, sec_part);
+ if (!ts && !sec_part && get_thd()->variables.sql_mode & MODE_NO_ZERO_DATE)
+ {
+ ErrConvString s(
+ STRING_WITH_LEN("0000-00-00 00:00:00.000000") - (decimals() ? 6 - decimals() : 7),
+ system_charset_info);
+ set_datetime_warning(WARN_DATA_TRUNCATED, &s, MYSQL_TIMESTAMP_DATETIME, 1);
+ return 1;
+ }
+ return 0;
+}
+
+
double Field_timestamp::val_real(void)
{
return (double) Field_timestamp::val_int();
@@ -8885,13 +8909,13 @@
ulonglong tmp=(ulonglong) Field_enum::val_int();
uint bitnr=0;
+ /*
+ Some callers expect *val_buffer to contain the result,
+ so we assign to it, rather than doing 'return &empty_set_string.
+ */
+ *val_buffer= empty_set_string;
if (tmp == 0)
{
- /*
- Some callers expect *val_buffer to contain the result,
- so we assign to it, rather than doing 'return &empty_set_string.
- */
- *val_buffer= empty_set_string;
return val_buffer;
}
diff -Nru mariadb-10.1-10.1.25/sql/field_conv.cc mariadb-10.1-10.1.30/sql/field_conv.cc
--- mariadb-10.1-10.1.25/sql/field_conv.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/field_conv.cc 2017-12-21 15:48:48.000000000 +0000
@@ -219,6 +219,13 @@
}
+static int copy_timestamp_fields(Field *from, Field *to)
+{
+ DBUG_ASSERT(from->type() == MYSQL_TYPE_TIMESTAMP);
+ DBUG_ASSERT(to->type() == MYSQL_TYPE_TIMESTAMP);
+ return ((Field_timestamp*)to)->store_timestamp((Field_timestamp*)from);
+}
+
static void do_skip(Copy_field *copy __attribute__((unused)))
{
}
@@ -417,6 +424,12 @@
}
+static void do_field_timestamp(Copy_field *copy)
+{
+ copy_timestamp_fields(copy->from_field, copy->to_field);
+}
+
+
static void do_field_temporal(Copy_field *copy)
{
MYSQL_TIME ltime;
@@ -724,7 +737,9 @@
((to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)) &&
mysql_type_to_time_type(to->type()) != MYSQL_TIMESTAMP_TIME))
- return do_field_temporal;
+ return (from->type() == MYSQL_TYPE_TIMESTAMP &&
+ to->type() == MYSQL_TYPE_TIMESTAMP)
+ ? do_field_timestamp : do_field_temporal;
/* Do binary copy */
}
// Check if identical fields
@@ -924,6 +939,10 @@
my_decimal buff;
return to->store_decimal(from->val_decimal(&buff));
}
+ if (from->type() == MYSQL_TYPE_TIMESTAMP && to->type() == MYSQL_TYPE_TIMESTAMP)
+ {
+ return copy_timestamp_fields(from, to);
+ }
if (from->cmp_type() == TIME_RESULT)
{
MYSQL_TIME ltime;
diff -Nru mariadb-10.1-10.1.25/sql/field.h mariadb-10.1-10.1.30/sql/field.h
--- mariadb-10.1-10.1.25/sql/field.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/field.h 2017-12-21 15:48:48.000000000 +0000
@@ -745,6 +745,10 @@
{ return store(ls->str, ls->length, cs); }
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
+ virtual ulonglong val_uint(void)
+ {
+ return (ulonglong) val_int();
+ }
virtual bool val_bool(void)= 0;
virtual my_decimal *val_decimal(my_decimal *);
inline String *val_str(String *str) { return val_str(str, str); }
@@ -1999,6 +2003,7 @@
class Field_double :public Field_real {
+ longlong val_int_from_real(bool want_unsigned_result);
public:
Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2025,7 +2030,8 @@
int store(longlong nr, bool unsigned_val);
int reset(void) { bzero(ptr,sizeof(double)); return 0; }
double val_real(void);
- longlong val_int(void);
+ longlong val_int(void) { return val_int_from_real(false); }
+ ulonglong val_uint(void) { return (ulonglong) val_int_from_real(true); }
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
int cmp(const uchar *,const uchar *);
@@ -2186,6 +2192,7 @@
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
+ int store_timestamp(Field_timestamp *from);
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
diff -Nru mariadb-10.1-10.1.25/sql/filesort.cc mariadb-10.1-10.1.30/sql/filesort.cc
--- mariadb-10.1-10.1.25/sql/filesort.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/filesort.cc 2017-12-21 15:48:48.000000000 +0000
@@ -998,7 +998,8 @@
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)
{
diff -Nru mariadb-10.1-10.1.25/sql/filesort_utils.cc mariadb-10.1-10.1.30/sql/filesort_utils.cc
--- mariadb-10.1-10.1.25/sql/filesort_utils.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/filesort_utils.cc 2017-12-21 15:48:48.000000000 +0000
@@ -96,7 +96,7 @@
if (m_idx_array.is_null())
{
- sort_buff_sz= num_records * (record_length + sizeof(uchar*));
+ sort_buff_sz= ((size_t)num_records) * (record_length + sizeof(uchar*));
set_if_bigger(sort_buff_sz, record_length * MERGEBUFF2);
uchar **sort_keys=
(uchar**) my_malloc(sort_buff_sz, MYF(MY_THREAD_SPECIFIC));
diff -Nru mariadb-10.1-10.1.25/sql/handler.cc mariadb-10.1-10.1.30/sql/handler.cc
--- mariadb-10.1-10.1.25/sql/handler.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/handler.cc 2017-12-21 15:48:48.000000000 +0000
@@ -73,6 +73,14 @@
ulong total_ha= 0;
/* number of storage engines (from handlertons[]) that support 2pc */
ulong total_ha_2pc= 0;
+#ifndef DBUG_OFF
+/*
+ Number of non-mandatory 2pc handlertons whose initialization failed
+ to estimate total_ha_2pc value under supposition of the failures
+ have not occcured.
+*/
+ulong failed_ha_2pc= 0;
+#endif
/* size of savepoint storage area (see ha_init) */
ulong savepoint_alloc_size= 0;
@@ -397,7 +405,7 @@
}
static volatile int32 need_full_discover_for_existence= 0;
-static volatile int32 engines_with_discover_table_names= 0;
+static volatile int32 engines_with_discover_file_names= 0;
static volatile int32 engines_with_discover= 0;
static int full_discover_for_existence(handlerton *, const char *, const char *)
@@ -422,8 +430,8 @@
if (hton->discover_table_existence == full_discover_for_existence)
my_atomic_add32(&need_full_discover_for_existence, val);
- if (hton->discover_table_names)
- my_atomic_add32(&engines_with_discover_table_names, val);
+ if (hton->discover_table_names && hton->tablefile_extensions[0])
+ my_atomic_add32(&engines_with_discover_file_names, val);
if (hton->discover_table)
my_atomic_add32(&engines_with_discover, val);
@@ -649,6 +657,10 @@
(void) plugin->plugin->deinit(NULL);
err:
+#ifndef DBUG_OFF
+ if (hton->prepare && hton->state == SHOW_OPTION_YES)
+ failed_ha_2pc++;
+#endif
my_free(hton);
err_no_hton_memory:
plugin->data= NULL;
@@ -1660,6 +1672,11 @@
{ // cannot happen
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
error=1;
+#ifdef WITH_WSREP
+ WSREP_WARN("handlerton rollback failed, thd %lu %lld conf %d SQL %s",
+ thd->thread_id, thd->query_id, thd->wsrep_conflict_state,
+ thd->query());
+#endif /* WITH_WSREP */
}
status_var_increment(thd->status_var.ha_rollback_count);
ha_info_next= ha_info->next();
@@ -1854,7 +1871,7 @@
{
#ifndef DBUG_OFF
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- sql_print_information("ignore xid %s", xid_to_str(buf, info->list+i));
+ DBUG_PRINT("info", ("ignore xid %s", xid_to_str(buf, info->list+i)));
#endif
xid_cache_insert(info->list+i, XA_PREPARED);
info->found_foreign_xids++;
@@ -1871,19 +1888,31 @@
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
{
#ifndef DBUG_OFF
- char buf[XIDDATASIZE*4+6]; // see xid_to_str
- sql_print_information("commit xid %s", xid_to_str(buf, info->list+i));
+ int rc=
+#endif
+ hton->commit_by_xid(hton, info->list+i);
+#ifndef DBUG_OFF
+ if (rc == 0)
+ {
+ char buf[XIDDATASIZE*4+6]; // see xid_to_str
+ DBUG_PRINT("info", ("commit xid %s", xid_to_str(buf, info->list+i)));
+ }
#endif
- hton->commit_by_xid(hton, info->list+i);
}
else
{
#ifndef DBUG_OFF
- char buf[XIDDATASIZE*4+6]; // see xid_to_str
- sql_print_information("rollback xid %s",
- xid_to_str(buf, info->list+i));
+ int rc=
+#endif
+ hton->rollback_by_xid(hton, info->list+i);
+#ifndef DBUG_OFF
+ if (rc == 0)
+ {
+ char buf[XIDDATASIZE*4+6]; // see xid_to_str
+ DBUG_PRINT("info", ("rollback xid %s",
+ xid_to_str(buf, info->list+i)));
+ }
#endif
- hton->rollback_by_xid(hton, info->list+i);
}
}
if (got < info->len)
@@ -1905,7 +1934,8 @@
/* commit_list and tc_heuristic_recover cannot be set both */
DBUG_ASSERT(info.commit_list==0 || tc_heuristic_recover==0);
/* if either is set, total_ha_2pc must be set too */
- DBUG_ASSERT(info.dry_run || total_ha_2pc>(ulong)opt_bin_log);
+ DBUG_ASSERT(info.dry_run ||
+ (failed_ha_2pc + total_ha_2pc) > (ulong)opt_bin_log);
if (total_ha_2pc <= (ulong)opt_bin_log)
DBUG_RETURN(0);
@@ -5033,10 +5063,15 @@
{
char engine_buf[NAME_CHAR_LEN + 1];
LEX_STRING engine= { engine_buf, 0 };
+ frm_type_enum type;
- if (dd_frm_type(thd, path, &engine) != FRMTYPE_VIEW)
+ if ((type= dd_frm_type(thd, path, &engine)) == FRMTYPE_ERROR)
+ DBUG_RETURN(0);
+
+ if (type != FRMTYPE_VIEW)
{
- plugin_ref p= plugin_lock_by_name(thd, &engine, MYSQL_STORAGE_ENGINE_PLUGIN);
+ plugin_ref p= plugin_lock_by_name(thd, &engine,
+ MYSQL_STORAGE_ENGINE_PLUGIN);
*hton= p ? plugin_hton(p) : NULL;
if (*hton)
// verify that the table really exists
@@ -5159,6 +5194,7 @@
{
LEX_STRING **src= tables->front();
LEX_STRING **dst= src;
+ sort();
while (++dst <= tables->back())
{
LEX_STRING *s= *src, *d= *dst;
@@ -5226,10 +5262,12 @@
int error;
DBUG_ENTER("ha_discover_table_names");
- if (engines_with_discover_table_names == 0 && !reusable)
+ if (engines_with_discover_file_names == 0 && !reusable)
{
- error= ext_table_discovery_simple(dirp, result);
- result->sort();
+ st_discover_names_args args= {db, NULL, result, 0};
+ error= ext_table_discovery_simple(dirp, result) ||
+ plugin_foreach(thd, discover_names,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &args);
}
else
{
@@ -5242,8 +5280,6 @@
error= extension_based_table_discovery(dirp, reg_ext, result) ||
plugin_foreach(thd, discover_names,
MYSQL_STORAGE_ENGINE_PLUGIN, &args);
- result->sort();
-
if (args.possible_duplicates > 0)
result->remove_duplicates();
}
diff -Nru mariadb-10.1-10.1.25/sql/handler.h mariadb-10.1-10.1.30/sql/handler.h
--- mariadb-10.1-10.1.25/sql/handler.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/handler.h 2017-12-21 15:48:48.000000000 +0000
@@ -1470,16 +1470,30 @@
static unsigned int const CREATED_TEMP_TABLE= 0x02;
static unsigned int const DROPPED_TEMP_TABLE= 0x04;
static unsigned int const DID_WAIT= 0x08;
+ static unsigned int const DID_DDL= 0x10;
void mark_created_temp_table()
{
DBUG_PRINT("debug", ("mark_created_temp_table"));
m_unsafe_rollback_flags|= CREATED_TEMP_TABLE;
}
+ void mark_dropped_temp_table()
+ {
+ DBUG_PRINT("debug", ("mark_dropped_temp_table"));
+ m_unsafe_rollback_flags|= DROPPED_TEMP_TABLE;
+ }
+ bool has_created_dropped_temp_table() const {
+ return
+ (m_unsafe_rollback_flags & (CREATED_TEMP_TABLE|DROPPED_TEMP_TABLE)) != 0;
+ }
void mark_trans_did_wait() { m_unsafe_rollback_flags|= DID_WAIT; }
bool trans_did_wait() const {
return (m_unsafe_rollback_flags & DID_WAIT) != 0;
}
+ void mark_trans_did_ddl() { m_unsafe_rollback_flags|= DID_DDL; }
+ bool trans_did_ddl() const {
+ return (m_unsafe_rollback_flags & DID_DDL) != 0;
+ }
};
@@ -1750,6 +1764,13 @@
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
return false;
}
+ ulong table_options_with_row_type()
+ {
+ if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
+ return table_options | HA_OPTION_PACK_RECORD;
+ else
+ return table_options;
+ }
};
diff -Nru mariadb-10.1-10.1.25/sql/ha_partition.cc mariadb-10.1-10.1.30/sql/ha_partition.cc
--- mariadb-10.1-10.1.25/sql/ha_partition.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/ha_partition.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2005, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab & SkySQL Ab
+ Copyright (c) 2005, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, MariaDB
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
@@ -674,7 +674,7 @@
HA_CREATE_INFO *create_info)
{
int error;
- char name_buff[FN_REFLEN], name_lc_buff[FN_REFLEN];
+ char name_buff[FN_REFLEN + 1], name_lc_buff[FN_REFLEN];
char *name_buffer_ptr;
const char *path;
uint i;
@@ -716,8 +716,9 @@
for (j= 0; j < m_part_info->num_subparts; j++)
{
part_elem= sub_it++;
- create_partition_name(name_buff, path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
+ if ((error= create_partition_name(name_buff, sizeof(name_buff), path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto create_error;
if ((error= set_up_table_before_create(table_arg, name_buff,
create_info, part_elem)) ||
((error= (*file)->ha_create(name_buff, table_arg, create_info))))
@@ -729,8 +730,9 @@
}
else
{
- create_partition_name(name_buff, path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
+ if ((error= create_partition_name(name_buff, sizeof(name_buff), path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto create_error;
if ((error= set_up_table_before_create(table_arg, name_buff,
create_info, part_elem)) ||
((error= (*file)->ha_create(name_buff, table_arg, create_info))))
@@ -746,9 +748,9 @@
name_buffer_ptr= m_name_buffer_ptr;
for (abort_file= file, file= m_file; file < abort_file; file++)
{
- create_partition_name(name_buff, path, name_buffer_ptr, NORMAL_PART_NAME,
- FALSE);
- (void) (*file)->ha_delete_table((const char*) name_buff);
+ if (!create_partition_name(name_buff, sizeof(name_buff), path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE))
+ (void) (*file)->ha_delete_table((const char*) name_buff);
name_buffer_ptr= strend(name_buffer_ptr) + 1;
}
handler::delete_table(name);
@@ -775,7 +777,7 @@
int ha_partition::drop_partitions(const char *path)
{
List_iterator part_it(m_part_info->partitions);
- char part_name_buff[FN_REFLEN];
+ char part_name_buff[FN_REFLEN + 1];
uint num_parts= m_part_info->partitions.elements;
uint num_subparts= m_part_info->num_subparts;
uint i= 0;
@@ -808,9 +810,11 @@
{
partition_element *sub_elem= sub_it++;
part= i * num_subparts + j;
- create_subpartition_name(part_name_buff, path,
- part_elem->partition_name,
- sub_elem->partition_name, name_variant);
+ if ((ret_error= create_subpartition_name(part_name_buff,
+ sizeof(part_name_buff), path,
+ part_elem->partition_name,
+ sub_elem->partition_name, name_variant)))
+ error= ret_error;
file= m_file[part];
DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff));
if ((ret_error= file->ha_delete_table(part_name_buff)))
@@ -821,15 +825,19 @@
}
else
{
- create_partition_name(part_name_buff, path,
- part_elem->partition_name, name_variant,
- TRUE);
- file= m_file[i];
- DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
- if ((ret_error= file->ha_delete_table(part_name_buff)))
+ if ((ret_error= create_partition_name(part_name_buff,
+ sizeof(part_name_buff), path,
+ part_elem->partition_name, name_variant, TRUE)))
error= ret_error;
- if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
- error= 1;
+ else
+ {
+ file= m_file[i];
+ DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
+ if ((ret_error= file->ha_delete_table(part_name_buff)))
+ error= ret_error;
+ if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
+ error= 1;
+ }
}
if (part_elem->part_state == PART_IS_CHANGED)
part_elem->part_state= PART_NORMAL;
@@ -865,8 +873,8 @@
{
List_iterator part_it(m_part_info->partitions);
List_iterator temp_it(m_part_info->temp_partitions);
- char part_name_buff[FN_REFLEN];
- char norm_name_buff[FN_REFLEN];
+ char part_name_buff[FN_REFLEN + 1];
+ char norm_name_buff[FN_REFLEN + 1];
uint num_parts= m_part_info->partitions.elements;
uint part_count= 0;
uint num_subparts= m_part_info->num_subparts;
@@ -908,10 +916,11 @@
{
sub_elem= sub_it++;
file= m_reorged_file[part_count++];
- create_subpartition_name(norm_name_buff, path,
- part_elem->partition_name,
- sub_elem->partition_name,
- NORMAL_PART_NAME);
+ if ((ret_error= create_subpartition_name(norm_name_buff,
+ sizeof(norm_name_buff), path,
+ part_elem->partition_name,
+ sub_elem->partition_name, NORMAL_PART_NAME)))
+ error= ret_error;
DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff));
if ((ret_error= file->ha_delete_table(norm_name_buff)))
error= ret_error;
@@ -924,16 +933,20 @@
else
{
file= m_reorged_file[part_count++];
- create_partition_name(norm_name_buff, path,
- part_elem->partition_name, NORMAL_PART_NAME,
- TRUE);
- DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
- if ((ret_error= file->ha_delete_table(norm_name_buff)))
+ if ((ret_error= create_partition_name(norm_name_buff,
+ sizeof(norm_name_buff), path,
+ part_elem->partition_name, NORMAL_PART_NAME, TRUE)))
error= ret_error;
- else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
- error= 1;
else
- part_elem->log_entry= NULL; /* Indicate success */
+ {
+ DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
+ if ((ret_error= file->ha_delete_table(norm_name_buff)))
+ error= ret_error;
+ else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
+ error= 1;
+ else
+ part_elem->log_entry= NULL; /* Indicate success */
+ }
}
} while (++i < temp_partitions);
(void) sync_ddl_log();
@@ -976,10 +989,11 @@
{
sub_elem= sub_it++;
part= i * num_subparts + j;
- create_subpartition_name(norm_name_buff, path,
- part_elem->partition_name,
- sub_elem->partition_name,
- NORMAL_PART_NAME);
+ if ((ret_error= create_subpartition_name(norm_name_buff,
+ sizeof(norm_name_buff), path,
+ part_elem->partition_name,
+ sub_elem->partition_name, NORMAL_PART_NAME)))
+ error= ret_error;
if (part_elem->part_state == PART_IS_CHANGED)
{
file= m_reorged_file[part_count++];
@@ -991,10 +1005,11 @@
(void) sync_ddl_log();
}
file= m_new_file[part];
- create_subpartition_name(part_name_buff, path,
- part_elem->partition_name,
- sub_elem->partition_name,
- TEMP_PART_NAME);
+ if ((ret_error= create_subpartition_name(part_name_buff,
+ sizeof(part_name_buff), path,
+ part_elem->partition_name,
+ sub_elem->partition_name, TEMP_PART_NAME)))
+ error= ret_error;
DBUG_PRINT("info", ("Rename subpartition from %s to %s",
part_name_buff, norm_name_buff));
if ((ret_error= file->ha_rename_table(part_name_buff,
@@ -1008,32 +1023,36 @@
}
else
{
- create_partition_name(norm_name_buff, path,
- part_elem->partition_name, NORMAL_PART_NAME,
- TRUE);
- if (part_elem->part_state == PART_IS_CHANGED)
+ if ((ret_error= create_partition_name(norm_name_buff,
+ sizeof(norm_name_buff), path,
+ part_elem->partition_name, NORMAL_PART_NAME, TRUE)) ||
+ (ret_error= create_partition_name(part_name_buff,
+ sizeof(part_name_buff), path,
+ part_elem->partition_name, TEMP_PART_NAME, TRUE)))
+ error= ret_error;
+ else
{
- file= m_reorged_file[part_count++];
- DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
- if ((ret_error= file->ha_delete_table(norm_name_buff)))
+ if (part_elem->part_state == PART_IS_CHANGED)
+ {
+ file= m_reorged_file[part_count++];
+ DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
+ if ((ret_error= file->ha_delete_table(norm_name_buff)))
+ error= ret_error;
+ else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
+ error= 1;
+ (void) sync_ddl_log();
+ }
+ file= m_new_file[i];
+ DBUG_PRINT("info", ("Rename partition from %s to %s",
+ part_name_buff, norm_name_buff));
+ if ((ret_error= file->ha_rename_table(part_name_buff,
+ norm_name_buff)))
error= ret_error;
else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
error= 1;
- (void) sync_ddl_log();
+ else
+ part_elem->log_entry= NULL;
}
- file= m_new_file[i];
- create_partition_name(part_name_buff, path,
- part_elem->partition_name, TEMP_PART_NAME,
- TRUE);
- DBUG_PRINT("info", ("Rename partition from %s to %s",
- part_name_buff, norm_name_buff));
- if ((ret_error= file->ha_rename_table(part_name_buff,
- norm_name_buff)))
- error= ret_error;
- else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
- error= 1;
- else
- part_elem->log_entry= NULL;
}
}
} while (++i < num_parts);
@@ -1649,7 +1668,7 @@
{
List_iterator part_it(m_part_info->partitions);
List_iterator t_it(m_part_info->temp_partitions);
- char part_name_buff[FN_REFLEN];
+ char part_name_buff[FN_REFLEN + 1];
uint num_parts= m_part_info->partitions.elements;
uint num_subparts= m_part_info->num_subparts;
uint i= 0;
@@ -1878,10 +1897,14 @@
do
{
partition_element *sub_elem= sub_it++;
- create_subpartition_name(part_name_buff, path,
- part_elem->partition_name,
- sub_elem->partition_name,
- name_variant);
+ if ((error= create_subpartition_name(part_name_buff,
+ sizeof(part_name_buff), path,
+ part_elem->partition_name, sub_elem->partition_name,
+ name_variant)))
+ {
+ cleanup_new_partition(part_count);
+ DBUG_RETURN(error);
+ }
part= i * num_subparts + j;
DBUG_PRINT("info", ("Add subpartition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info,
@@ -1899,9 +1922,14 @@
}
else
{
- create_partition_name(part_name_buff, path,
- part_elem->partition_name, name_variant,
- TRUE);
+ if ((error= create_partition_name(part_name_buff,
+ sizeof(part_name_buff), path, part_elem->partition_name,
+ name_variant, TRUE)))
+ {
+ cleanup_new_partition(part_count);
+ DBUG_RETURN(error);
+ }
+
DBUG_PRINT("info", ("Add partition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info,
new_file_array[i],
@@ -2272,8 +2300,8 @@
{
int save_error= 0;
int error;
- char from_buff[FN_REFLEN], to_buff[FN_REFLEN], from_lc_buff[FN_REFLEN],
- to_lc_buff[FN_REFLEN];
+ char from_buff[FN_REFLEN + 1], to_buff[FN_REFLEN + 1],
+ from_lc_buff[FN_REFLEN], to_lc_buff[FN_REFLEN];
char *name_buffer_ptr;
const char *from_path;
const char *to_path= NULL;
@@ -2309,13 +2337,15 @@
i= 0;
do
{
- create_partition_name(from_buff, from_path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
+ if ((error= create_partition_name(from_buff, sizeof(from_buff), from_path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto rename_error;
if (to != NULL)
{ // Rename branch
- create_partition_name(to_buff, to_path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
+ if ((error= create_partition_name(to_buff, sizeof(to_buff), to_path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto rename_error;
error= (*file)->ha_rename_table(from_buff, to_buff);
if (error)
goto rename_error;
@@ -2344,12 +2374,14 @@
for (abort_file= file, file= m_file; file < abort_file; file++)
{
/* Revert the rename, back from 'to' to the original 'from' */
- create_partition_name(from_buff, from_path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
- create_partition_name(to_buff, to_path, name_buffer_ptr,
- NORMAL_PART_NAME, FALSE);
- /* Ignore error here */
- (void) (*file)->ha_rename_table(to_buff, from_buff);
+ if (!create_partition_name(from_buff, sizeof(from_buff), from_path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE) &&
+ !create_partition_name(to_buff, sizeof(to_buff), to_path,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE))
+ {
+ /* Ignore error here */
+ (void) (*file)->ha_rename_table(to_buff, from_buff);
+ }
name_buffer_ptr= strend(name_buffer_ptr) + 1;
}
DBUG_RETURN(error);
@@ -3416,7 +3448,7 @@
char *name_buffer_ptr;
int error= HA_ERR_INITIALIZATION;
handler **file;
- char name_buff[FN_REFLEN];
+ char name_buff[FN_REFLEN + 1];
ulonglong check_table_flags;
DBUG_ENTER("ha_partition::open");
@@ -3470,8 +3502,9 @@
file= m_is_clone_of->m_file;
for (i= 0; i < m_tot_parts; i++)
{
- create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME,
- FALSE);
+ if ((error= create_partition_name(name_buff, sizeof(name_buff), name,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto err_handler;
/* ::clone() will also set ha_share from the original. */
if (!(m_file[i]= file[i]->clone(name_buff, m_clone_mem_root)))
{
@@ -3487,8 +3520,9 @@
file= m_file;
do
{
- create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME,
- FALSE);
+ if ((error= create_partition_name(name_buff, sizeof(name_buff), name,
+ name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
+ goto err_handler;
table->s->connect_string = m_connect_string[(uint)(file-m_file)];
if ((error= (*file)->ha_open(table, name_buff, mode,
test_if_locked | HA_OPEN_NO_PSI_CALL)))
@@ -7863,7 +7897,7 @@
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_GEOMETRY:
- /* fall through. */
+ /* fall through */
default:
DBUG_ASSERT(0); // New type?
/* Fall through for default hashing (5.5). */
diff -Nru mariadb-10.1-10.1.25/sql/ha_partition.h mariadb-10.1-10.1.30/sql/ha_partition.h
--- mariadb-10.1-10.1.25/sql/ha_partition.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/ha_partition.h 2017-12-21 15:48:48.000000000 +0000
@@ -356,6 +356,10 @@
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes);
+ void update_part_create_info(HA_CREATE_INFO *create_info, uint part_id)
+ {
+ m_file[part_id]->update_create_info(create_info);
+ }
private:
int copy_partitions(ulonglong * const copied, ulonglong * const deleted);
void cleanup_new_partition(uint part_count);
diff -Nru mariadb-10.1-10.1.25/sql/item.cc mariadb-10.1-10.1.30/sql/item.cc
--- mariadb-10.1-10.1.25/sql/item.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB
+ Copyright (c) 2010, 2017, 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
@@ -770,6 +770,7 @@
cached_table(0), depended_from(0), can_be_depended(TRUE)
{
name = (char*) field_name_arg;
+ name_length= name ? strlen(name) : 0;
}
@@ -783,6 +784,7 @@
cached_table(NULL), depended_from(NULL), can_be_depended(TRUE)
{
name = (char*) field_name_arg;
+ name_length= name ? strlen(name) : 0;
}
@@ -1740,7 +1742,10 @@
{
set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
}
- collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
+ if (value_item->collation.derivation == DERIVATION_NUMERIC)
+ collation.set_numeric();
+ else
+ collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
max_length= value_item->max_length;
decimals= value_item->decimals;
fixed= 1;
@@ -2128,6 +2133,9 @@
Item **args, uint nargs,
uint flags, int item_sep)
{
+ THD *thd= current_thd;
+ if (thd->lex->is_ps_or_view_context_analysis())
+ return false;
Item **arg, *safe_args[2]= {NULL, NULL};
/*
@@ -2143,7 +2151,6 @@
safe_args[1]= args[item_sep];
}
- THD *thd= current_thd;
bool res= FALSE;
uint i;
@@ -2674,7 +2681,8 @@
return (get_depended_from() ? OUTER_REF_TABLE_BIT : field->table->map);
}
-void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
{
if (new_parent == get_depended_from())
depended_from= NULL;
@@ -2718,6 +2726,19 @@
if (!need_change)
return;
+ if (!merge)
+ {
+ /*
+ It is transformation without merge.
+ This field was "outer" for the inner SELECT where it was taken and
+ moved up.
+ "Outer" fields uses normal SELECT_LEX context of upper SELECTs for
+ name resolution, so we can switch everything to it safely.
+ */
+ this->context= &new_parent->context;
+ return;
+ }
+
Name_resolution_context *ctx= new Name_resolution_context();
if (context->select_lex == new_parent)
{
@@ -4454,7 +4475,7 @@
int cur_match_degree= 0;
/* SELECT list element with explicit alias */
- if ((*(cur_group->item))->name &&
+ if ((*(cur_group->item))->name && !table_name &&
!(*(cur_group->item))->is_autogenerated_name &&
!my_strcasecmp(system_charset_info,
(*(cur_group->item))->name, field_name))
@@ -4602,7 +4623,8 @@
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
@@ -4875,6 +4897,12 @@
((ref_type == REF_ITEM || ref_type == FIELD_ITEM) ?
(Item_ident*) (*reference) :
0));
+ if (thd->lex->in_sum_func &&
+ thd->lex->in_sum_func->nest_level >= select->nest_level)
+ {
+ set_if_bigger(thd->lex->in_sum_func->max_arg_level,
+ select->nest_level);
+ }
/*
A reference to a view field had been found and we
substituted it instead of this Item (find_field_in_tables
@@ -5620,7 +5648,7 @@
srccs == &my_charset_bin ?
dstcs->csname : srccs->csname,
err.ptr());
- return m_thd->is_strict_mode();
+ return false;
}
if (const char *pos= cannot_convert_error_pos())
{
@@ -5633,7 +5661,7 @@
ER_CANNOT_CONVERT_CHARACTER,
ER_THD(m_thd, ER_CANNOT_CONVERT_CHARACTER),
srccs->csname, buf, dstcs->csname);
- return m_thd->is_strict_mode();
+ return false;
}
return false;
}
@@ -5824,7 +5852,7 @@
Field_string(max_length, maybe_null, name, collation.collation);
break;
}
- /* Fall through */
+ /* fall through */
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING:
@@ -6629,6 +6657,7 @@
*/
if (const_item() &&
!(basic_const_item() || item->basic_const_item() ||
+ item->type() == Item::NULL_ITEM || /* Item_name_const hack */
item->type() == Item::FIELD_ITEM ||
item->type() == SUBSELECT_ITEM ||
item->type() == CACHE_ITEM ||
@@ -6810,7 +6839,11 @@
// Find which select the field is in. This is achieved by walking up
// the select tree and looking for the table of interest.
st_select_lex *sel;
- for (sel= current_select; sel; sel= sel->outer_select())
+ for (sel= current_select;
+ sel ;
+ sel= (sel->context.outer_context ?
+ sel->context.outer_context->select_lex:
+ NULL))
{
List_iterator li(sel->leaf_tables);
TABLE_LIST *tbl;
@@ -7983,7 +8016,6 @@
bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
{
- DBUG_ASSERT(1);
/* view fild reference must be defined */
DBUG_ASSERT(*ref);
/* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
@@ -8044,18 +8076,19 @@
void Item_outer_ref::fix_after_pullout(st_select_lex *new_parent,
- Item **ref_arg)
+ Item **ref_arg, bool merge)
{
if (get_depended_from() == new_parent)
{
*ref_arg= outer_ref;
- (*ref_arg)->fix_after_pullout(new_parent, ref_arg);
+ (*ref_arg)->fix_after_pullout(new_parent, ref_arg, merge);
}
}
-void Item_ref::fix_after_pullout(st_select_lex *new_parent, Item **refptr)
+void Item_ref::fix_after_pullout(st_select_lex *new_parent, Item **refptr,
+ bool merge)
{
- (*ref)->fix_after_pullout(new_parent, ref);
+ (*ref)->fix_after_pullout(new_parent, ref, merge);
if (get_depended_from() == new_parent)
depended_from= NULL;
}
@@ -9836,7 +9869,7 @@
table_map Item_direct_view_ref::used_tables() const
{
- DBUG_ASSERT(null_ref_table);
+ DBUG_ASSERT(fixed);
if (get_depended_from())
return OUTER_REF_TABLE_BIT;
diff -Nru mariadb-10.1-10.1.25/sql/item_cmpfunc.cc mariadb-10.1-10.1.30/sql/item_cmpfunc.cc
--- mariadb-10.1-10.1.25/sql/item_cmpfunc.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_cmpfunc.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1229,10 +1229,11 @@
}
-void Item_in_optimizer::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_in_optimizer::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref, bool merge)
{
/* This will re-calculate attributes of our Item_in_subselect: */
- Item_bool_func::fix_after_pullout(new_parent, ref);
+ Item_bool_func::fix_after_pullout(new_parent, ref, merge);
/* Then, re-calculate not_null_tables_cache: */
eval_not_null_tables(NULL);
@@ -1848,6 +1849,19 @@
}
+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();
@@ -2060,10 +2074,11 @@
}
-void Item_func_between::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_func_between::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref, bool merge)
{
/* This will re-calculate attributes of the arguments */
- Item_func_opt_neg::fix_after_pullout(new_parent, ref);
+ Item_func_opt_neg::fix_after_pullout(new_parent, ref, merge);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables(NULL);
}
@@ -2406,10 +2421,11 @@
}
-void Item_func_if::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_func_if::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref, bool merge)
{
/* This will re-calculate attributes of the arguments */
- Item_func::fix_after_pullout(new_parent, ref);
+ Item_func::fix_after_pullout(new_parent, ref, merge);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables(NULL);
}
@@ -4138,10 +4154,11 @@
}
-void Item_func_in::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_func_in::fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
{
/* This will re-calculate attributes of the arguments */
- Item_func_opt_neg::fix_after_pullout(new_parent, ref);
+ Item_func_opt_neg::fix_after_pullout(new_parent, ref, merge);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables(NULL);
}
@@ -4663,7 +4680,8 @@
}
-void Item_cond::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_cond::fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
{
List_iterator- li(list);
Item *item;
@@ -4676,7 +4694,7 @@
while ((item=li++))
{
table_map tmp_table_map;
- item->fix_after_pullout(new_parent, li.ref());
+ item->fix_after_pullout(new_parent, li.ref(), merge);
item= *li.ref();
used_tables_and_const_cache_join(item);
@@ -5317,7 +5335,7 @@
DBUG_ASSERT(thd == current_thd);
stack_used= available_stack_size(thd->thread_stack, &stack_used);
m_pcre_extra.match_limit_recursion=
- (my_thread_stack_size - stack_used)/my_pcre_frame_size;
+ (my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size;
}
@@ -5412,7 +5430,7 @@
switch (rc)
{
case PCRE_ERROR_NULL:
- errmsg= "pcre_exec: null arguement passed";
+ errmsg= "pcre_exec: null argument passed";
break;
case PCRE_ERROR_BADOPTION:
errmsg= "pcre_exec: bad option";
@@ -5581,6 +5599,12 @@
}
+bool Item_func_regex::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_bool_func::fix_fields(thd, ref);
+}
+
void
Item_func_regex::fix_length_and_dec()
{
@@ -5607,6 +5631,13 @@
}
+bool Item_func_regexp_instr::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_int_func::fix_fields(thd, ref);
+}
+
+
void
Item_func_regexp_instr::fix_length_and_dec()
{
@@ -6872,7 +6903,7 @@
null_value= 1;
return 1;
}
- if (my_charset_same(nm->charset(), &my_charset_utf8_general_ci))
+ if (my_charset_same(nm->charset(), DYNCOL_UTF))
{
buf.str= (char *) nm->ptr();
buf.length= nm->length();
@@ -6882,11 +6913,11 @@
uint strlen;
uint dummy_errors;
buf.str= (char *)sql_alloc((strlen= nm->length() *
- my_charset_utf8_general_ci.mbmaxlen + 1));
+ DYNCOL_UTF->mbmaxlen + 1));
if (buf.str)
{
buf.length=
- copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci,
+ copy_and_convert(buf.str, strlen, DYNCOL_UTF,
nm->ptr(), nm->length(), nm->charset(),
&dummy_errors);
}
diff -Nru mariadb-10.1-10.1.25/sql/item_cmpfunc.h mariadb-10.1-10.1.30/sql/item_cmpfunc.h
--- mariadb-10.1-10.1.25/sql/item_cmpfunc.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_cmpfunc.h 2017-12-21 15:48:48.000000000 +0000
@@ -342,7 +342,7 @@
virtual void get_cache_parameters(List
- ¶meters);
bool is_top_level_item();
bool eval_not_null_tables(uchar *opt_arg);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool invisible_mode();
void reset_cache() { cache= NULL; }
};
@@ -824,7 +824,7 @@
void fix_length_and_dec();
virtual void print(String *str, enum_query_type query_type);
bool eval_not_null_tables(uchar *opt_arg);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(uchar *arg);
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
@@ -878,6 +878,7 @@
{
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"; }
@@ -980,7 +981,7 @@
}
const char *func_name() const { return "if"; }
bool eval_not_null_tables(uchar *opt_arg);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
private:
void cache_type_info(Item *source);
};
@@ -1595,7 +1596,7 @@
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
bool eval_not_null_tables(uchar *opt_arg);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(uchar *arg);
};
@@ -1991,6 +1992,7 @@
DBUG_VOID_RETURN;
}
longlong val_int();
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp"; }
@@ -2018,6 +2020,7 @@
DBUG_VOID_RETURN;
}
longlong val_int();
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_instr"; }
};
@@ -2061,7 +2064,7 @@
list.append(nlist);
}
bool fix_fields(THD *, Item **ref);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
enum Type type() const { return COND_ITEM; }
List
- * argument_list() { return &list; }
diff -Nru mariadb-10.1-10.1.25/sql/item_func.cc mariadb-10.1-10.1.30/sql/item_func.cc
--- mariadb-10.1-10.1.25/sql/item_func.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_func.cc 2017-12-21 15:48:48.000000000 +0000
@@ -270,7 +270,8 @@
}
-void Item_func::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_func::fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
{
Item **arg,**arg_end;
@@ -281,7 +282,7 @@
{
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
{
- (*arg)->fix_after_pullout(new_parent, arg);
+ (*arg)->fix_after_pullout(new_parent, arg, merge);
Item *item= *arg;
used_tables_and_const_cache_join(item);
@@ -3959,7 +3960,7 @@
{
DBUG_ASSERT(fixed == 1);
longlong result= 0;
- String *gtid_pos = args[0]->val_str(&value);
+ String *gtid_pos __attribute__((unused)) = args[0]->val_str(&value);
if (args[0]->null_value)
{
diff -Nru mariadb-10.1-10.1.25/sql/item_func.h mariadb-10.1-10.1.30/sql/item_func.h
--- mariadb-10.1-10.1.25/sql/item_func.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_func.h 2017-12-21 15:48:48.000000000 +0000
@@ -126,7 +126,7 @@
Item_func_or_sum::cleanup();
used_tables_and_const_cache_init();
}
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
void quick_fix_field();
table_map not_null_tables() const;
void update_used_tables()
@@ -1773,12 +1773,6 @@
create_tmp_field(false, table, MY_INT32_NUM_DECIMAL_DIGITS) :
tmp_table_field_from_field_type(table, false, true);
}
- table_map used_tables() const
- {
- return used_tables_cache | RAND_TABLE_BIT;
- }
- bool const_item() const { return 0; }
- bool is_expensive() { return 1; }
virtual void print(String *str, enum_query_type query_type);
void print_as_stmt(String *str, enum_query_type query_type);
const char *func_name() const { return "set_user_var"; }
diff -Nru mariadb-10.1-10.1.25/sql/item_geofunc.cc mariadb-10.1-10.1.30/sql/item_geofunc.cc
--- mariadb-10.1-10.1.25/sql/item_geofunc.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_geofunc.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1194,6 +1194,8 @@
}
else
func->repeat_expression(shape_a);
+ if (func->reserve_op_buffer(1))
+ return 1;
func->add_operation(op_matrix(nc%3), 1);
if (do_store_shapes)
{
@@ -1364,11 +1366,13 @@
Gcalc_function::op_intersection, 2);
func.add_operation(Gcalc_function::op_internals, 1);
shape_a= func.get_next_expression_pos();
- if ((null_value= g1.store_shapes(&trn)))
+ if ((null_value= g1.store_shapes(&trn)) ||
+ func.reserve_op_buffer(1))
break;
func.add_operation(Gcalc_function::op_internals, 1);
shape_b= func.get_next_expression_pos();
- if ((null_value= g2.store_shapes(&trn)))
+ if ((null_value= g2.store_shapes(&trn)) ||
+ func.reserve_op_buffer(1))
break;
func.add_operation(Gcalc_function::v_find_t |
Gcalc_function::op_intersection, 2);
@@ -1603,6 +1607,8 @@
{
if (buffer_op == Gcalc_function::op_difference)
{
+ if (m_fn->reserve_op_buffer(1))
+ return 1;
m_fn->add_operation(Gcalc_function::op_false, 0);
return 0;
}
diff -Nru mariadb-10.1-10.1.25/sql/item.h mariadb-10.1-10.1.30/sql/item.h
--- mariadb-10.1-10.1.25/sql/item.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item.h 2017-12-21 15:48:48.000000000 +0000
@@ -1,8 +1,8 @@
#ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED
-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2016, MariaDB
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, MariaDB
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
@@ -548,8 +548,7 @@
class Item_splocal;
/**
- String_copier that honors the current sql_mode (strict vs non strict)
- and can send warnings.
+ String_copier that sends Item specific warnings.
*/
class String_copier_for_item: public String_copier
{
@@ -730,7 +729,9 @@
Fix after some tables has been pulled out. Basically re-calculate all
attributes that are dependent on the tables.
*/
- virtual void fix_after_pullout(st_select_lex *new_parent, Item **ref) {};
+ virtual void fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
+ {};
/*
This method should be used in case where we are sure that we do not need
@@ -2385,7 +2386,7 @@
bool send(Protocol *protocol, String *str_arg);
void reset_field(Field *f);
bool fix_fields(THD *, Item **);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
void make_field(Send_field *tmp_field);
int save_in_field(Field *field,bool no_conversions);
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
@@ -2582,6 +2583,17 @@
Field *result_field;
Item_null_result(THD *thd): Item_null(thd), result_field(0) {}
bool is_result_field() { return result_field != 0; }
+#if MARIADB_VERSION_ID < 100300
+ enum_field_types field_type() const
+ {
+ return result_field->type();
+ }
+#else
+ const Type_handler *type_handler() const
+ {
+ return result_field->type_handler();
+ }
+#endif
void save_in_result_field(bool no_conversions)
{
save_in_field(result_field, no_conversions);
@@ -3895,7 +3907,7 @@
bool send(Protocol *prot, String *tmp);
void make_field(Send_field *field);
bool fix_fields(THD *, Item **);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
int save_in_field(Field *field, bool no_conversions);
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
fast_field_copier setup_fast_field_copier(Field *field)
@@ -4132,6 +4144,8 @@
bool fix_fields(THD *thd, Item **it);
void cleanup();
+ Item *get_orig_item() const { return orig_item; }
+
/* Methods of getting value which should be cached in the cache */
void save_val(Field *to);
double val_real();
@@ -4163,9 +4177,9 @@
Item *it= ((Item *) item)->real_item();
return orig_item->eq(it, binary_cmp);
}
- void fix_after_pullout(st_select_lex *new_parent, Item **refptr)
+ void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge)
{
- orig_item->fix_after_pullout(new_parent, &orig_item);
+ orig_item->fix_after_pullout(new_parent, &orig_item, merge);
}
int save_in_field(Field *to, bool no_conversions);
enum Item_result result_type () const { return orig_item->result_type(); }
@@ -4423,7 +4437,7 @@
outer_ref->save_org_in_field(result_field, NULL);
}
bool fix_fields(THD *, Item **);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
table_map used_tables() const
{
return (*ref)->const_item() ? 0 : OUTER_REF_TABLE_BIT;
diff -Nru mariadb-10.1-10.1.25/sql/item_inetfunc.cc mariadb-10.1-10.1.30/sql/item_inetfunc.cc
--- mariadb-10.1-10.1.25/sql/item_inetfunc.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_inetfunc.cc 2017-12-21 15:48:48.000000000 +0000
@@ -181,7 +181,8 @@
return NULL;
}
- String *arg_str= args[0]->val_str(buffer);
+ StringBuffer tmp;
+ String *arg_str= args[0]->val_str(&tmp);
if (!arg_str) // Out-of memory happened. The error has been reported.
{ // Or: the underlying field is NULL
null_value= true;
@@ -679,7 +680,7 @@
@retval true The string has been converted sucessfully.
*/
-bool Item_func_inet6_aton::calc_value(String *arg, String *buffer)
+bool Item_func_inet6_aton::calc_value(const String *arg, String *buffer)
{
// ipv4-string -> varbinary(4)
// ipv6-string -> varbinary(16)
@@ -719,7 +720,7 @@
@retval true The string has been converted sucessfully.
*/
-bool Item_func_inet6_ntoa::calc_value(String *arg, String *buffer)
+bool Item_func_inet6_ntoa::calc_value(const String *arg, String *buffer)
{
if (arg->charset() != &my_charset_bin)
return false;
diff -Nru mariadb-10.1-10.1.25/sql/item_inetfunc.h mariadb-10.1-10.1.30/sql/item_inetfunc.h
--- mariadb-10.1-10.1.25/sql/item_inetfunc.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_inetfunc.h 2017-12-21 15:48:48.000000000 +0000
@@ -98,7 +98,7 @@
virtual String *val_str_ascii(String *buffer);
protected:
- virtual bool calc_value(String *arg, String *buffer) = 0;
+ virtual bool calc_value(const String *arg, String *buffer) = 0;
};
@@ -125,7 +125,7 @@
}
protected:
- virtual bool calc_value(String *arg, String *buffer);
+ virtual bool calc_value(const String *arg, String *buffer);
};
@@ -157,7 +157,7 @@
}
protected:
- virtual bool calc_value(String *arg, String *buffer);
+ virtual bool calc_value(const String *arg, String *buffer);
};
diff -Nru mariadb-10.1-10.1.25/sql/item_row.cc mariadb-10.1-10.1.30/sql/item_row.cc
--- mariadb-10.1-10.1.25/sql/item_row.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_row.cc 2017-12-21 15:48:48.000000000 +0000
@@ -24,7 +24,6 @@
#include "sql_class.h" // THD, set_var.h: THD
#include "set_var.h"
-
void Item_row::illegal_method_call(const char *method)
{
DBUG_ENTER("Item_row::illegal_method_call");
@@ -110,13 +109,14 @@
}
-void Item_row::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_row::fix_after_pullout(st_select_lex *new_parent, Item **ref,
+ bool merge)
{
used_tables_and_const_cache_init();
not_null_tables_cache= 0;
for (uint i= 0; i < arg_count; i++)
{
- args[i]->fix_after_pullout(new_parent, &args[i]);
+ args[i]->fix_after_pullout(new_parent, &args[i], merge);
used_tables_and_const_cache_join(args[i]);
not_null_tables_cache|= args[i]->not_null_tables();
}
diff -Nru mariadb-10.1-10.1.25/sql/item_row.h mariadb-10.1-10.1.30/sql/item_row.h
--- mariadb-10.1-10.1.25/sql/item_row.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_row.h 2017-12-21 15:48:48.000000000 +0000
@@ -47,13 +47,10 @@
Item_row(THD *thd, List
- &list):
Item(thd), Item_args(thd, list), not_null_tables_cache(0), with_null(0)
{ }
- Item_row(THD *thd, Item_row *item):
- Item(thd),
- Item_args(item),
- Used_tables_and_const_cache(item),
- not_null_tables_cache(0),
- with_null(0)
- {}
+ Item_row(THD *thd, Item_row *row):
+ Item(thd), Item_args(thd, static_cast(row)), Used_tables_and_const_cache(),
+ not_null_tables_cache(0), with_null(0)
+ { }
enum Type type() const { return ROW_ITEM; };
void illegal_method_call(const char *);
@@ -83,7 +80,7 @@
return 0;
};
bool fix_fields(THD *thd, Item **ref);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
void cleanup();
void split_sum_func(THD *thd, Item **ref_pointer_array, List
- &fields,
uint flags);
diff -Nru mariadb-10.1-10.1.25/sql/item_strfunc.cc mariadb-10.1-10.1.30/sql/item_strfunc.cc
--- mariadb-10.1-10.1.25/sql/item_strfunc.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_strfunc.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1281,6 +1281,13 @@
/*********************************************************************/
+bool Item_func_regexp_replace::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_str_func::fix_fields(thd, ref);
+}
+
+
void Item_func_regexp_replace::fix_length_and_dec()
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3))
@@ -1416,6 +1423,13 @@
}
+bool Item_func_regexp_substr::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_str_func::fix_fields(thd, ref);
+}
+
+
void Item_func_regexp_substr::fix_length_and_dec()
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
@@ -2835,6 +2849,20 @@
}
+void Item_func_char::print(String *str, enum_query_type query_type)
+{
+ str->append(Item_func_char::func_name());
+ str->append('(');
+ print_args(str, 0, query_type);
+ if (collation.collation != &my_charset_bin)
+ {
+ str->append(C_STRING_WITH_LEN(" using "));
+ str->append(collation.collation->csname);
+ }
+ str->append(')');
+}
+
+
String *Item_func_char::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -4400,7 +4428,7 @@
if (res)
{
// guaranty UTF-8 string for names
- if (my_charset_same(res->charset(), &my_charset_utf8_general_ci))
+ if (my_charset_same(res->charset(), DYNCOL_UTF))
{
keys_str[i].length= res->length();
keys_str[i].str= sql_strmake(res->ptr(), res->length());
@@ -4411,11 +4439,11 @@
uint dummy_errors;
char *str=
(char *)sql_alloc((strlen= res->length() *
- my_charset_utf8_general_ci.mbmaxlen + 1));
+ DYNCOL_UTF->mbmaxlen + 1));
if (str)
{
keys_str[i].length=
- copy_and_convert(str, strlen, &my_charset_utf8_general_ci,
+ copy_and_convert(str, strlen, DYNCOL_UTF,
res->ptr(), res->length(), res->charset(),
&dummy_errors);
keys_str[i].str= str;
@@ -4634,9 +4662,10 @@
char *ptr;
size_t length, alloc_length;
dynstr_reassociate(&json, &ptr, &length, &alloc_length);
- str->reset(ptr, length, alloc_length, &my_charset_utf8_general_ci);
+ str->reset(ptr, length, alloc_length, DYNCOL_UTF);
null_value= FALSE;
}
+ str->set_charset(DYNCOL_UTF);
return str;
null:
@@ -4734,7 +4763,7 @@
return 1;
}
- if (my_charset_same(nm->charset(), &my_charset_utf8_general_ci))
+ if (my_charset_same(nm->charset(), DYNCOL_UTF))
{
buf.str= (char *) nm->ptr();
buf.length= nm->length();
@@ -4744,11 +4773,11 @@
uint strlen;
uint dummy_errors;
buf.str= (char *)sql_alloc((strlen= nm->length() *
- my_charset_utf8_general_ci.mbmaxlen + 1));
+ DYNCOL_UTF->mbmaxlen + 1));
if (buf.str)
{
buf.length=
- copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci,
+ copy_and_convert(buf.str, strlen, DYNCOL_UTF,
nm->ptr(), nm->length(), nm->charset(),
&dummy_errors);
}
@@ -5187,7 +5216,6 @@
goto null;
str->length(0);
- str->set_charset(&my_charset_utf8_general_ci);
for (i= 0; i < count; i++)
{
append_identifier(current_thd, str, names[i].str, names[i].length);
@@ -5197,6 +5225,7 @@
null_value= FALSE;
if (names)
my_free(names);
+ str->set_charset(DYNCOL_UTF);
return str;
null:
diff -Nru mariadb-10.1-10.1.25/sql/item_strfunc.h mariadb-10.1-10.1.30/sql/item_strfunc.h
--- mariadb-10.1-10.1.25/sql/item_strfunc.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_strfunc.h 2017-12-21 15:48:48.000000000 +0000
@@ -305,6 +305,7 @@
DBUG_VOID_RETURN;
}
String *val_str(String *str);
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_replace"; }
};
@@ -325,6 +326,7 @@
DBUG_VOID_RETURN;
}
String *val_str(String *str);
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_substr"; }
};
@@ -782,6 +784,7 @@
max_length= arg_count * 4;
}
const char *func_name() const { return "char"; }
+ void print(String *str, enum_query_type query_type);
};
@@ -1281,14 +1284,14 @@
class Item_func_dyncol_json: public Item_str_func
{
public:
- Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str) {}
+ Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str)
+ {collation.set(DYNCOL_UTF);}
const char *func_name() const{ return "column_json"; }
String *val_str(String *);
void fix_length_and_dec()
{
max_length= MAX_BLOB_WIDTH;
maybe_null= 1;
- collation.set(&my_charset_bin);
decimals= 0;
}
};
@@ -1321,7 +1324,8 @@
class Item_func_dyncol_list: public Item_str_func
{
public:
- Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) {};
+ Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str)
+ {collation.set(DYNCOL_UTF);}
void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; };
const char *func_name() const{ return "column_list"; }
String *val_str(String *);
diff -Nru mariadb-10.1-10.1.25/sql/item_subselect.cc mariadb-10.1-10.1.30/sql/item_subselect.cc
--- mariadb-10.1-10.1.25/sql/item_subselect.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_subselect.cc 2017-12-21 15:48:48.000000000 +0000
@@ -330,7 +330,8 @@
while ((upper= it++))
{
- if (upper->item->walk(&Item::enumerate_field_refs_processor, FALSE, arg))
+ if (upper->item &&
+ upper->item->walk(&Item::enumerate_field_refs_processor, FALSE, arg))
return TRUE;
}
return FALSE;
@@ -446,7 +447,8 @@
OUTER_REF_TABLE_BIT.
*/
-void Item_subselect::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_subselect::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref, bool merge)
{
recalc_used_tables(new_parent, TRUE);
parent_select= new_parent;
@@ -1152,7 +1154,8 @@
/*
as far as we moved content to upper level we have to fix dependences & Co
*/
- substitution->fix_after_pullout(select_lex->outer_select(), &substitution);
+ substitution->fix_after_pullout(select_lex->outer_select(),
+ &substitution, TRUE);
}
DBUG_RETURN(false);
}
@@ -1438,6 +1441,10 @@
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
DBUG_PRINT("info", ("in_strategy: %u", (uint)in_strategy));
left_expr_orig= left_expr= left_exp;
+ /* prepare to possible disassembling the item in convert_subq_to_sj() */
+ if (left_exp->type() == Item::ROW_ITEM)
+ left_expr_orig= new (thd->mem_root)
+ Item_row(thd, static_cast(left_exp));
func= &eq_creator;
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= UINT_MAX;
@@ -1461,6 +1468,10 @@
{
DBUG_ENTER("Item_allany_subselect::Item_allany_subselect");
left_expr_orig= left_expr= left_exp;
+ /* prepare to possible disassembling the item in convert_subq_to_sj() */
+ if (left_exp->type() == Item::ROW_ITEM)
+ left_expr_orig= new (thd->mem_root)
+ Item_row(thd, static_cast(left_exp));
func= func_creator(all_arg);
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= 1;
@@ -2925,7 +2936,7 @@
goto out;
}
}
- outer_exp->fix_after_pullout(unit->outer_select(), &outer_exp);
+ outer_exp->fix_after_pullout(unit->outer_select(), &outer_exp, FALSE);
outer_exp->update_used_tables();
outer.push_back(outer_exp, thd->mem_root);
}
@@ -3306,10 +3317,11 @@
}
-void Item_in_subselect::fix_after_pullout(st_select_lex *new_parent, Item **ref)
+void Item_in_subselect::fix_after_pullout(st_select_lex *new_parent,
+ Item **ref, bool merge)
{
- left_expr->fix_after_pullout(new_parent, &left_expr);
- Item_subselect::fix_after_pullout(new_parent, ref);
+ left_expr->fix_after_pullout(new_parent, &left_expr, merge);
+ Item_subselect::fix_after_pullout(new_parent, ref, merge);
used_tables_cache |= left_expr->used_tables();
}
@@ -3413,7 +3425,8 @@
{
DBUG_ASSERT(thd);
uint cols_num= left_expr->cols();
- if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
+ if (!abort_on_null && !pushed_cond_guards &&
+ (left_expr->maybe_null || cols_num > 1))
{
if (!(pushed_cond_guards= (bool*)thd->alloc(sizeof(bool) * cols_num)))
return TRUE;
diff -Nru mariadb-10.1-10.1.25/sql/item_subselect.h mariadb-10.1-10.1.30/sql/item_subselect.h
--- mariadb-10.1-10.1.25/sql/item_subselect.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_subselect.h 2017-12-21 15:48:48.000000000 +0000
@@ -169,7 +169,7 @@
}
bool fix_fields(THD *thd, Item **ref);
bool mark_as_dependent(THD *thd, st_select_lex *select, Item *item);
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
void recalc_used_tables(st_select_lex *new_parent, bool after_pullout);
virtual bool exec();
/*
@@ -607,7 +607,7 @@
virtual void print(String *str, enum_query_type query_type);
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
- void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool const_item() const
{
return Item_subselect::const_item() && left_expr->const_item();
diff -Nru mariadb-10.1-10.1.25/sql/item_sum.cc mariadb-10.1-10.1.30/sql/item_sum.cc
--- mariadb-10.1-10.1.25/sql/item_sum.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_sum.cc 2017-12-21 15:48:48.000000000 +0000
@@ -3594,7 +3594,7 @@
}
}
str->append(STRING_WITH_LEN(" separator \'"));
- str->append(*separator);
+ str->append_for_single_quote(separator->ptr(), separator->length());
str->append(STRING_WITH_LEN("\')"));
}
diff -Nru mariadb-10.1-10.1.25/sql/item_timefunc.cc mariadb-10.1-10.1.30/sql/item_timefunc.cc
--- mariadb-10.1-10.1.25/sql/item_timefunc.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_timefunc.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1793,9 +1793,18 @@
ltime->hour= TIME_MAX_HOUR+1;
check_time_range(ltime, decimals, &unused);
- make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- err->ptr(), err->length(),
- MYSQL_TIMESTAMP_TIME, NullS);
+ if (!err)
+ {
+ ErrConvInteger err2(sec, unsigned_flag);
+ make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ &err2, MYSQL_TIMESTAMP_TIME, NullS);
+ }
+ else
+ {
+ ErrConvString err2(err);
+ make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ &err2, MYSQL_TIMESTAMP_TIME, NullS);
+ }
return 0;
}
@@ -2396,7 +2405,7 @@
if (copier.copy_with_warn(cast_cs, &tmp_value, strcs,
str->ptr(), str->length(), cast_length))
{
- null_value= 1; // In strict mode: malformed data or could not convert
+ null_value= 1; // EOM
return 0;
}
check_truncation_with_warn(str, copier.source_end_pos() - str->ptr());
@@ -3100,7 +3109,7 @@
const char *val= format;
const char *end= format + length;
- for (; val != end && val != end; val++)
+ for (; val != end; val++)
{
if (*val == '%' && val+1 != end)
{
diff -Nru mariadb-10.1-10.1.25/sql/item_timefunc.h mariadb-10.1-10.1.30/sql/item_timefunc.h
--- mariadb-10.1-10.1.25/sql/item_timefunc.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/item_timefunc.h 2017-12-21 15:48:48.000000000 +0000
@@ -502,8 +502,16 @@
{ return val_decimal_from_date(decimal_value); }
Field *create_field_for_create_select(TABLE *table)
{ return tmp_table_field_from_field_type(table, false, false); }
+#if MARIADB_VERSION_ID > 100300
+#error This code should be removed in 10.3, to use the derived save_in_field()
+#else
int save_in_field(Field *field, bool no_conversions)
- { return save_date_in_field(field); }
+ {
+ return field_type() == MYSQL_TYPE_TIME ?
+ save_time_in_field(field) :
+ save_date_in_field(field);
+ }
+#endif
void fix_length_and_dec();
};
diff -Nru mariadb-10.1-10.1.25/sql/lex.h mariadb-10.1-10.1.30/sql/lex.h
--- mariadb-10.1-10.1.25/sql/lex.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/lex.h 2017-12-21 15:48:48.000000000 +0000
@@ -179,6 +179,7 @@
{ "DELAYED", SYM(DELAYED_SYM)},
{ "DELAY_KEY_WRITE", SYM(DELAY_KEY_WRITE_SYM)},
{ "DELETE", SYM(DELETE_SYM)},
+ { "DELETE_DOMAIN_ID", SYM(DELETE_DOMAIN_ID_SYM)},
{ "DESC", SYM(DESC)},
{ "DESCRIBE", SYM(DESCRIBE)},
{ "DES_KEY_FILE", SYM(DES_KEY_FILE)},
diff -Nru mariadb-10.1-10.1.25/sql/log.cc mariadb-10.1-10.1.30/sql/log.cc
--- mariadb-10.1-10.1.25/sql/log.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/log.cc 2017-12-21 15:48:48.000000000 +0000
@@ -6622,6 +6622,120 @@
purge();
}
+
+/**
+ Searches for the first (oldest) binlog file name in in the binlog index.
+
+ @param[in,out] buf_arg pointer to a buffer to hold found
+ the first binary log file name
+ @return NULL on success, otherwise error message
+*/
+static const char* get_first_binlog(char* buf_arg)
+{
+ IO_CACHE *index_file;
+ size_t length;
+ char fname[FN_REFLEN];
+ const char* errmsg= NULL;
+
+ DBUG_ENTER("get_first_binlog");
+
+ DBUG_ASSERT(mysql_bin_log.is_open());
+
+ mysql_bin_log.lock_index();
+
+ index_file=mysql_bin_log.get_index_file();
+ if (reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0))
+ {
+ errmsg= "failed to create a cache on binlog index";
+ goto end;
+ }
+ /* The file ends with EOF or empty line */
+ if ((length=my_b_gets(index_file, fname, sizeof(fname))) <= 1)
+ {
+ errmsg= "empty binlog index";
+ goto end;
+ }
+ else
+ {
+ fname[length-1]= 0; // Remove end \n
+ }
+ if (normalize_binlog_name(buf_arg, fname, false))
+ {
+ errmsg= "cound not normalize the first file name in the binlog index";
+ goto end;
+ }
+end:
+ mysql_bin_log.unlock_index();
+
+ DBUG_RETURN(errmsg);
+}
+
+/**
+ Check weather the gtid binlog state can safely remove gtid
+ domains passed as the argument. A safety condition is satisfied when
+ there are no events from the being deleted domains in the currently existing
+ binlog files. Upon successful check the supplied domains are removed
+ from @@gtid_binlog_state. The caller is supposed to rotate binlog so that
+ the active latest file won't have the deleted domains in its Gtid_list header.
+
+ @param domain_drop_lex gtid domain id sequence from lex.
+ Passed as a pointer to dynamic array must be not empty
+ unless pointer value NULL.
+ @retval zero on success
+ @retval > 0 ineffective call none from the *non* empty
+ gtid domain sequence is deleted
+ @retval < 0 on error
+*/
+static int do_delete_gtid_domain(DYNAMIC_ARRAY *domain_drop_lex)
+{
+ int rc= 0;
+ Gtid_list_log_event *glev= NULL;
+ char buf[FN_REFLEN];
+ File file;
+ IO_CACHE cache;
+ const char* errmsg= NULL;
+ char errbuf[MYSQL_ERRMSG_SIZE]= {0};
+
+ if (!domain_drop_lex)
+ return 0; // still "effective" having empty domain sequence to delete
+
+ DBUG_ASSERT(domain_drop_lex->elements > 0);
+ mysql_mutex_assert_owner(mysql_bin_log.get_log_lock());
+
+ if ((errmsg= get_first_binlog(buf)) != NULL)
+ goto end;
+ bzero((char*) &cache, sizeof(cache));
+ if ((file= open_binlog(&cache, buf, &errmsg)) == (File) -1)
+ goto end;
+ errmsg= get_gtid_list_event(&cache, &glev);
+ end_io_cache(&cache);
+ mysql_file_close(file, MYF(MY_WME));
+
+ DBUG_EXECUTE_IF("inject_binlog_delete_domain_init_error",
+ errmsg= "injected error";);
+ if (errmsg)
+ goto end;
+ errmsg= rpl_global_gtid_binlog_state.drop_domain(domain_drop_lex,
+ glev, errbuf);
+
+end:
+ if (errmsg)
+ {
+ if (strlen(errmsg) > 0)
+ {
+ my_error(ER_BINLOG_CANT_DELETE_GTID_DOMAIN, MYF(0), errmsg);
+ rc= -1;
+ }
+ else
+ {
+ rc= 1;
+ }
+ }
+ delete glev;
+
+ return rc;
+}
+
/**
The method is a shortcut of @c rotate() and @c purge().
LOCK_log is acquired prior to rotate and is released after it.
@@ -6631,9 +6745,10 @@
@retval
nonzero - error in rotating routine.
*/
-int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate)
+int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate,
+ DYNAMIC_ARRAY *domain_drop_lex)
{
- int error= 0;
+ int err_gtid=0, error= 0;
ulong prev_binlog_id;
DBUG_ENTER("MYSQL_BIN_LOG::rotate_and_purge");
bool check_purge= false;
@@ -6641,7 +6756,14 @@
//todo: fix the macro def and restore safe_mutex_assert_not_owner(&LOCK_log);
mysql_mutex_lock(&LOCK_log);
prev_binlog_id= current_binlog_id;
- if ((error= rotate(force_rotate, &check_purge)))
+
+ if ((err_gtid= do_delete_gtid_domain(domain_drop_lex)))
+ {
+ // inffective attempt to delete merely skips rotate and purge
+ if (err_gtid < 0)
+ error= 1; // otherwise error is propagated the user
+ }
+ else if ((error= rotate(force_rotate, &check_purge)))
check_purge= false;
/*
NOTE: Run purge_logs wo/ holding LOCK_log because it does not need
@@ -7043,8 +7165,15 @@
mode. Also, do not write the cached updates to binlog if binary logging is
disabled (log-bin/sql_log_bin).
*/
- if (wsrep_emulate_bin_log || !(thd->variables.option_bits & OPTION_BIN_LOG))
+ if (wsrep_emulate_bin_log)
+ {
DBUG_RETURN(0);
+ }
+ else if (!(thd->variables.option_bits & OPTION_BIN_LOG))
+ {
+ cache_mngr->need_unlog= false;
+ DBUG_RETURN(0);
+ }
entry.thd= thd;
entry.cache_mngr= cache_mngr;
@@ -9322,8 +9451,10 @@
if (using_heuristic_recover())
{
+ mysql_mutex_lock(&LOCK_log);
/* generate a new binlog to mask a corrupted one */
open(opt_name, LOG_BIN, 0, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
+ mysql_mutex_unlock(&LOCK_log);
cleanup();
return 1;
}
@@ -9365,11 +9496,19 @@
if (err)
DBUG_RETURN(0);
+
+ bool need_unlog= cache_mngr->need_unlog;
+ /*
+ The transaction won't need the flag anymore.
+ Todo/fixme: consider to move the statement into cache_mngr->reset()
+ relocated to the current or later point.
+ */
+ cache_mngr->need_unlog= false;
/*
If using explicit user XA, we will not have XID. We must still return a
non-zero cookie (as zero cookie signals error).
*/
- if (!xid || !cache_mngr->need_unlog)
+ if (!xid || !need_unlog)
DBUG_RETURN(BINLOG_COOKIE_DUMMY(cache_mngr->delayed_error));
else
DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id,
@@ -9442,6 +9581,9 @@
if (b->binlog_id == binlog_id)
{
--b->xid_count;
+
+ DBUG_ASSERT(b->xid_count >= 0); // catch unmatched (++) decrement
+
break;
}
first= false;
@@ -9643,6 +9785,8 @@
{
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);
@@ -9769,8 +9913,8 @@
sizeof(xev->xid));
if (!x || my_hash_insert(&xids, x))
goto err2;
- break;
}
+ break;
}
case BINLOG_CHECKPOINT_EVENT:
if (first_round && do_xa)
@@ -10215,6 +10359,73 @@
}
}
+
+/*
+ Find the Gtid_list_log_event at the start of a binlog.
+
+ NULL for ok, non-NULL error message for error.
+
+ If ok, then the event is returned in *out_gtid_list. This can be NULL if we
+ get back to binlogs written by old server version without GTID support. If
+ so, it means we have reached the point to start from, as no GTID events can
+ exist in earlier binlogs.
+*/
+const char *
+get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list)
+{
+ Format_description_log_event init_fdle(BINLOG_VERSION);
+ Format_description_log_event *fdle;
+ Log_event *ev;
+ const char *errormsg = NULL;
+
+ *out_gtid_list= NULL;
+
+ if (!(ev= Log_event::read_log_event(cache, 0, &init_fdle,
+ opt_master_verify_checksum)) ||
+ ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
+ {
+ if (ev)
+ delete ev;
+ return "Could not read format description log event while looking for "
+ "GTID position in binlog";
+ }
+
+ fdle= static_cast(ev);
+
+ for (;;)
+ {
+ Log_event_type typ;
+
+ ev= Log_event::read_log_event(cache, 0, fdle, opt_master_verify_checksum);
+ if (!ev)
+ {
+ errormsg= "Could not read GTID list event while looking for GTID "
+ "position in binlog";
+ break;
+ }
+ typ= ev->get_type_code();
+ if (typ == GTID_LIST_EVENT)
+ break; /* Done, found it */
+ if (typ == START_ENCRYPTION_EVENT)
+ {
+ if (fdle->start_decryption((Start_encryption_log_event*) ev))
+ errormsg= "Could not set up decryption for binlog.";
+ }
+ delete ev;
+ if (typ == ROTATE_EVENT || typ == STOP_EVENT ||
+ typ == FORMAT_DESCRIPTION_EVENT || typ == START_ENCRYPTION_EVENT)
+ continue; /* Continue looking */
+
+ /* We did not find any Gtid_list_log_event, must be old binlog. */
+ ev= NULL;
+ break;
+ }
+
+ delete fdle;
+ *out_gtid_list= static_cast(ev);
+ return errormsg;
+}
+
struct st_mysql_storage_engine binlog_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
diff -Nru mariadb-10.1-10.1.25/sql/log_event.cc mariadb-10.1-10.1.30/sql/log_event.cc
--- mariadb-10.1-10.1.25/sql/log_event.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/log_event.cc 2017-12-21 15:48:48.000000000 +0000
@@ -371,12 +371,6 @@
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-static void clear_all_errors(THD *thd, Relay_log_info *rli)
-{
- thd->is_slave_error = 0;
- thd->clear_error();
-}
-
inline int idempotent_error_code(int err_code)
{
int ret= 0;
@@ -2475,8 +2469,8 @@
case 2:
{
strmake(typestr, "ENUM(2 bytes)", typestr_length);
- if (!ptr)
- goto return_null;
+ if (!ptr)
+ goto return_null;
int32 i32= uint2korr(ptr);
my_b_printf(file, "%d", i32);
@@ -4255,7 +4249,7 @@
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
- clear_all_errors(thd, const_cast(rli));
+ thd->clear_error(1);
current_stmt_is_commit= is_commit();
DBUG_ASSERT(!current_stmt_is_commit || !rgi->tables_to_lock);
@@ -4475,7 +4469,7 @@
to check/fix it.
*/
if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
- clear_all_errors(thd, const_cast(rli)); /* Can ignore query */
+ thd->clear_error(1);
else
{
rli->report(ERROR_LEVEL, expected_error, rgi->gtid_info(),
@@ -4556,7 +4550,7 @@
ignored_error_code(actual_error))
{
DBUG_PRINT("info",("error ignored"));
- clear_all_errors(thd, const_cast(rli));
+ thd->clear_error(1);
if (actual_error == ER_QUERY_INTERRUPTED ||
actual_error == ER_CONNECTION_KILLED)
thd->reset_killed();
@@ -6025,8 +6019,7 @@
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query() == 0);
- thd->is_slave_error= 0;
- clear_all_errors(thd, const_cast(rli));
+ thd->clear_error(1);
/* see Query_log_event::do_apply_event() and BUG#13360 */
DBUG_ASSERT(!rgi->m_table_map.count());
@@ -6036,7 +6029,7 @@
*/
lex_start(thd);
thd->lex->local_file= local_fname;
- thd->reset_for_next_command();
+ thd->reset_for_next_command(0); // Errors are cleared above
/*
We test replicate_*_db rules. Note that we have already prepared
@@ -6635,8 +6628,10 @@
if (thd_arg->transaction.stmt.trans_did_wait() ||
thd_arg->transaction.all.trans_did_wait())
flags2|= FL_WAITED;
- if (sql_command_flags[thd->lex->sql_command] &
- (CF_DISALLOW_IN_RO_TRANS | CF_AUTO_COMMIT_TRANS))
+ if (thd_arg->transaction.stmt.trans_did_ddl() ||
+ thd_arg->transaction.stmt.has_created_dropped_temp_table() ||
+ thd_arg->transaction.all.trans_did_ddl() ||
+ thd_arg->transaction.all.has_created_dropped_temp_table())
flags2|= FL_DDL;
else if (is_transactional)
flags2|= FL_TRANSACTIONAL;
@@ -7862,21 +7857,6 @@
we keep the flags set to UNDEF_F.
*/
uint bytes_read= ((val + val_len) - buf_start);
-#ifndef DBUG_OFF
- bool old_pre_checksum_fd= description_event->is_version_before_checksum(
- &description_event->server_version_split);
-#endif
- DBUG_ASSERT((bytes_read == data_written -
- (old_pre_checksum_fd ||
- (description_event->checksum_alg ==
- BINLOG_CHECKSUM_ALG_OFF)) ?
- 0 : BINLOG_CHECKSUM_LEN)
- ||
- (bytes_read == data_written -1 -
- (old_pre_checksum_fd ||
- (description_event->checksum_alg ==
- BINLOG_CHECKSUM_ALG_OFF)) ?
- 0 : BINLOG_CHECKSUM_LEN));
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@@ -10089,7 +10069,7 @@
slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
get_type_str(),
RPL_LOG_NAME, (ulong) log_pos);
- clear_all_errors(thd, const_cast(rli));
+ thd->clear_error(1);
error= 0;
if (idempotent_error == 0)
break;
@@ -10141,7 +10121,7 @@
slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
get_type_str(),
RPL_LOG_NAME, (ulong) log_pos);
- clear_all_errors(thd, const_cast(rli));
+ thd->clear_error(1);
error= 0;
}
} // if (table)
diff -Nru mariadb-10.1-10.1.25/sql/log.h mariadb-10.1-10.1.30/sql/log.h
--- mariadb-10.1-10.1.25/sql/log.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/log.h 2017-12-21 15:48:48.000000000 +0000
@@ -755,7 +755,7 @@
int update_log_index(LOG_INFO* linfo, bool need_update_threads);
int rotate(bool force_rotate, bool* check_purge);
void checkpoint_and_purge(ulong binlog_id);
- int rotate_and_purge(bool force_rotate);
+ int rotate_and_purge(bool force_rotate, DYNAMIC_ARRAY* drop_gtid_domain= NULL);
/**
Flush binlog cache and synchronize to disk.
@@ -1165,4 +1165,9 @@
return &tc_log_mmap;
}
+
+class Gtid_list_log_event;
+const char *
+get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list);
+
#endif /* LOG_H */
diff -Nru mariadb-10.1-10.1.25/sql/multi_range_read.cc mariadb-10.1-10.1.30/sql/multi_range_read.cc
--- mariadb-10.1-10.1.25/sql/multi_range_read.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/multi_range_read.cc 2017-12-21 15:48:48.000000000 +0000
@@ -1224,28 +1224,18 @@
ptrdiff_t bytes_for_keys= (full_buf_end - full_buf) - bytes_for_rowids;
- if (bytes_for_keys < key_buff_elem_size + 1)
- {
- ptrdiff_t add= key_buff_elem_size + 1 - bytes_for_keys;
- bytes_for_keys= key_buff_elem_size + 1;
- bytes_for_rowids -= add;
- }
-
- if (bytes_for_rowids < (ptrdiff_t)rowid_buf_elem_size + 1)
- {
- ptrdiff_t add= (ptrdiff_t)(rowid_buf_elem_size + 1 - bytes_for_rowids);
- bytes_for_rowids= (ptrdiff_t)rowid_buf_elem_size + 1;
- bytes_for_keys -= add;
- }
+ if (bytes_for_keys < key_buff_elem_size + 1 ||
+ bytes_for_rowids < (ptrdiff_t)rowid_buf_elem_size + 1)
+ return TRUE; /* Failed to provide minimum space for one of the buffers */
rowid_buffer_end= full_buf + bytes_for_rowids;
rowid_buffer.set_buffer_space(full_buf, rowid_buffer_end);
key_buffer= &backward_key_buf;
key_buffer->set_buffer_space(rowid_buffer_end, full_buf_end);
- if (!key_buffer->have_space_for(key_buff_elem_size) ||
- !rowid_buffer.have_space_for((size_t)rowid_buf_elem_size))
- return TRUE; /* Failed to provide minimum space for one of the buffers */
+ /* The above code guarantees that the buffers are big enough */
+ DBUG_ASSERT(key_buffer->have_space_for(key_buff_elem_size) &&
+ rowid_buffer.have_space_for((size_t)rowid_buf_elem_size));
return FALSE;
}
diff -Nru mariadb-10.1-10.1.25/sql/mysqld.cc mariadb-10.1-10.1.30/sql/mysqld.cc
--- mariadb-10.1-10.1.25/sql/mysqld.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/mysqld.cc 2017-12-21 15:48:48.000000000 +0000
@@ -878,7 +878,7 @@
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started,
key_LOCK_status, key_LOCK_show_status,
- key_LOCK_system_variables_hash, key_LOCK_thd_data,
+ key_LOCK_system_variables_hash, key_LOCK_thd_data, key_LOCK_thd_kill,
key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
key_master_info_sleep_lock, key_master_info_start_stop_lock,
@@ -949,6 +949,7 @@
{ &key_LOCK_wait_commit, "wait_for_commit::LOCK_wait_commit", 0},
{ &key_LOCK_gtid_waiting, "gtid_waiting::LOCK_gtid_waiting", 0},
{ &key_LOCK_thd_data, "THD::LOCK_thd_data", 0},
+ { &key_LOCK_thd_kill, "THD::LOCK_thd_kill", 0},
{ &key_LOCK_user_conn, "LOCK_user_conn", PSI_FLAG_GLOBAL},
{ &key_LOCK_uuid_short_generator, "LOCK_uuid_short_generator", PSI_FLAG_GLOBAL},
{ &key_LOG_LOCK_log, "LOG::LOCK_log", 0},
@@ -1650,7 +1651,7 @@
if (WSREP(tmp) && (tmp->wsrep_exec_mode==REPL_RECV || tmp->wsrep_applier))
continue;
#endif
- tmp->killed= KILL_SERVER_HARD;
+ tmp->set_killed(KILL_SERVER_HARD);
MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
mysql_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->mysys_var)
@@ -1738,7 +1739,7 @@
if (WSREP(tmp) && tmp->wsrep_exec_mode==REPL_RECV)
{
sql_print_information("closing wsrep system thread");
- tmp->killed= KILL_CONNECTION;
+ tmp->set_killed(KILL_CONNECTION);
MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
if (tmp->mysys_var)
{
@@ -3541,8 +3542,6 @@
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)
{
@@ -3550,17 +3549,6 @@
}
-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)
@@ -3586,7 +3574,6 @@
#endif
-#ifndef EMBEDDED_LIBRARY
/**
This function is used to check for stack overrun for pathological
cases of regular expressions and 'like' expressions.
@@ -3615,18 +3602,10 @@
return 0;
return check_enough_stack_size_slow();
}
-#endif
-
-/*
- 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
@@ -3637,12 +3616,13 @@
static void init_pcre()
{
pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
- pcre_free= pcre_stack_free= my_str_free_mysqld;
-#ifndef EMBEDDED_LIBRARY
+ 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) + 16;
-#endif
+ my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0);
+ // pcre can underestimate its stack usage. Use a safe value, as in the manual
+ set_if_bigger(my_pcre_frame_size, 500);
+ my_pcre_frame_size += 16; // Again, safety margin, see the manual
}
@@ -3943,11 +3923,16 @@
thd->status_var.local_memory_used > (int64)thd->variables.max_mem_used &&
!thd->killed && !thd->get_stmt_da()->is_set())
{
- char buf[1024];
- thd->killed= KILL_QUERY;
+ /* Ensure we don't get called here again */
+ char buf[50], *buf2;
+ thd->set_killed(KILL_QUERY);
my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu",
thd->variables.max_mem_used);
- my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), buf);
+ if ((buf2= (char*) thd->alloc(256)))
+ {
+ my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf);
+ thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, buf2);
+ }
}
DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0);
}
@@ -5743,9 +5728,6 @@
#ifdef __WIN__
if (!opt_console)
{
- if (reopen_fstreams(log_error_file, stdout, stderr))
- unireg_abort(1);
- setbuf(stderr, NULL);
FreeConsole(); // Remove window
}
@@ -6318,7 +6300,7 @@
DBUG_PRINT("error",
("Can't create thread to handle request (error %d)",
error));
- thd->killed= KILL_CONNECTION; // Safety
+ thd->set_killed(KILL_CONNECTION); // Safety
mysql_mutex_unlock(&LOCK_thread_count);
mysql_mutex_lock(&LOCK_connection_count);
@@ -9222,8 +9204,29 @@
}
#ifdef WITH_WSREP
case OPT_WSREP_CAUSAL_READS:
- wsrep_causal_reads_update(&global_system_variables);
+ {
+ if (global_system_variables.wsrep_causal_reads)
+ {
+ WSREP_WARN("option --wsrep-causal-reads is deprecated");
+ if (!(global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ))
+ {
+ WSREP_WARN("--wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=%u. "
+ "WSREP_SYNC_WAIT_BEFORE_READ is on",
+ global_system_variables.wsrep_sync_wait);
+ global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
+ }
+ }
+ else
+ {
+ if (global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ) {
+ WSREP_WARN("--wsrep-sync-wait=%u takes precedence over --wsrep-causal-reads=OFF. "
+ "WSREP_SYNC_WAIT_BEFORE_READ is on",
+ global_system_variables.wsrep_sync_wait);
+ global_system_variables.wsrep_causal_reads = 1;
+ }
+ }
break;
+ }
case OPT_WSREP_SYNC_WAIT:
global_system_variables.wsrep_causal_reads=
MY_TEST(global_system_variables.wsrep_sync_wait &
diff -Nru mariadb-10.1-10.1.25/sql/mysqld.h mariadb-10.1-10.1.30/sql/mysqld.h
--- mariadb-10.1-10.1.25/sql/mysqld.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/mysqld.h 2017-12-21 15:48:49.000000000 +0000
@@ -290,7 +290,7 @@
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started,
key_LOCK_status, key_LOCK_show_status,
- key_LOCK_thd_data,
+ key_LOCK_thd_data, key_LOCK_thd_kill,
key_LOCK_user_conn, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
key_master_info_sleep_lock, key_master_info_start_stop_lock,
diff -Nru mariadb-10.1-10.1.25/sql/net_serv.cc mariadb-10.1-10.1.30/sql/net_serv.cc
--- mariadb-10.1-10.1.25/sql/net_serv.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/net_serv.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2012, 2016, MariaDB
+ Copyright (c) 2012, 2017, 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
diff -Nru mariadb-10.1-10.1.25/sql/opt_range.cc mariadb-10.1-10.1.30/sql/opt_range.cc
--- mariadb-10.1-10.1.25/sql/opt_range.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/opt_range.cc 2017-12-21 15:48:49.000000000 +0000
@@ -7306,8 +7306,10 @@
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
+ Field::geometry_type sav_geom_type;
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
{
+ sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
/* We have to be able to store all sorts of spatial features here */
((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
}
@@ -7338,6 +7340,13 @@
}
}
}
+
+#ifdef HAVE_SPATIAL
+ if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ {
+ ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
+ }
+#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
}
@@ -8329,6 +8338,34 @@
}
/*
+ Check whether the key parts inf_init..inf_end-1 of one index can compose
+ an infix for the key parts key_init..key_end-1 of another index
+*/
+
+static
+bool is_key_infix(KEY_PART *key_init, KEY_PART *key_end,
+ KEY_PART *inf_init, KEY_PART *inf_end)
+{
+ KEY_PART *key_part, *inf_part;
+ for (key_part= key_init; key_part < key_end; key_part++)
+ {
+ if (key_part->field->eq(inf_init->field))
+ break;
+ }
+ if (key_part == key_end)
+ return false;
+ for (key_part++, inf_part= inf_init + 1;
+ key_part < key_end && inf_part < inf_end;
+ key_part++, inf_part++)
+ {
+ if (!key_part->field->eq(inf_part->field))
+ return false;
+ }
+ return inf_part == inf_end;
+}
+
+
+/*
Check whether range parts of two trees must be ored for some indexes
SYNOPSIS
@@ -8384,14 +8421,9 @@
KEY_PART *key2_init= param->key[idx2]+tree2->keys[idx2]->part;
KEY_PART *key2_end= param->key[idx2]+tree2->keys[idx2]->max_part_no;
- KEY_PART *part1, *part2;
- for (part1= key1_init, part2= key2_init;
- part1 < key1_end && part2 < key2_end;
- part1++, part2++)
- {
- if (!part1->field->eq(part2->field))
- DBUG_RETURN(FALSE);
- }
+ if (!is_key_infix(key1_init, key1_end, key2_init, key2_end) &&
+ !is_key_infix(key2_init, key2_end, key1_init, key1_end))
+ DBUG_RETURN(FALSE);
}
}
diff -Nru mariadb-10.1-10.1.25/sql/opt_subselect.cc mariadb-10.1-10.1.30/sql/opt_subselect.cc
--- mariadb-10.1-10.1.25/sql/opt_subselect.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/opt_subselect.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1612,6 +1612,7 @@
sj-nest.
*/
st_select_lex *subq_lex= subq_pred->unit->first_select();
+ DBUG_ASSERT(subq_lex->next_select() == NULL);
nested_join->join_list.empty();
List_iterator_fast li(subq_lex->top_join_list);
TABLE_LIST *tl;
@@ -1664,7 +1665,7 @@
{
tl->jtbm_table_no= table_no;
Item *dummy= tl->jtbm_subselect;
- tl->jtbm_subselect->fix_after_pullout(parent_lex, &dummy);
+ tl->jtbm_subselect->fix_after_pullout(parent_lex, &dummy, true);
DBUG_ASSERT(dummy == tl->jtbm_subselect);
}
SELECT_LEX *old_sl= tl->select_lex;
@@ -1715,7 +1716,8 @@
if (subq_pred->left_expr->cols() == 1)
{
- nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr,
+ /* add left = select_list_element */
+ nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr,
thd->mem_root);
/*
Create Item_func_eq. Note that
@@ -1729,26 +1731,62 @@
Item_func_eq *item_eq=
new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr_orig,
subq_lex->ref_pointer_array[0]);
+ if (!item_eq)
+ DBUG_RETURN(TRUE);
if (subq_pred->left_expr_orig != subq_pred->left_expr)
thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr);
item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
}
- else
+ else if (subq_pred->left_expr->type() == Item::ROW_ITEM)
{
+ /*
+ disassemple left expression and add
+ left1 = select_list_element1 and left2 = select_list_element2 ...
+ */
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{
- nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->
- element_index(i),
+ nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->addr(i),
thd->mem_root);
- Item_func_eq *item_eq=
+ Item_func_eq *item_eq=
new (thd->mem_root)
- Item_func_eq(thd, subq_pred->left_expr->element_index(i),
+ Item_func_eq(thd, subq_pred->left_expr_orig->element_index(i),
subq_lex->ref_pointer_array[i]);
+ if (!item_eq)
+ DBUG_RETURN(TRUE);
+ DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed);
+ if (subq_pred->left_expr_orig->element_index(i) !=
+ subq_pred->left_expr->element_index(i))
+ thd->change_item_tree(item_eq->arguments(),
+ subq_pred->left_expr->element_index(i));
item_eq->in_equality_no= i;
sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
}
}
+ else
+ {
+ /*
+ add row operation
+ left = (select_list_element1, select_list_element2, ...)
+ */
+ Item_row *row= new (thd->mem_root) Item_row(thd, subq_lex->pre_fix);
+ /* fix fields on subquery was call so they should be the same */
+ DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols());
+ if (!row)
+ DBUG_RETURN(TRUE);
+ nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
+ Item_func_eq *item_eq=
+ new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr_orig, row);
+ if (!item_eq)
+ DBUG_RETURN(TRUE);
+ for (uint i= 0; i < row->cols(); i++)
+ {
+ if (row->element_index(i) != subq_lex->ref_pointer_array[i])
+ thd->change_item_tree(row->addr(i), subq_lex->ref_pointer_array[i]);
+ }
+ item_eq->in_equality_no= 0;
+ sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
+ }
/*
Fix the created equality and AND
@@ -1768,7 +1806,8 @@
Walk through sj nest's WHERE and ON expressions and call
item->fix_table_changes() for all items.
*/
- sj_nest->sj_on_expr->fix_after_pullout(parent_lex, &sj_nest->sj_on_expr);
+ sj_nest->sj_on_expr->fix_after_pullout(parent_lex, &sj_nest->sj_on_expr,
+ TRUE);
fix_list_after_tbl_changes(parent_lex, &sj_nest->nested_join->join_list);
@@ -1927,7 +1966,7 @@
DBUG_ASSERT(parent_join->table_count < MAX_TABLES);
Item *conds= hash_sj_engine->semi_join_conds;
- conds->fix_after_pullout(parent_lex, &conds);
+ conds->fix_after_pullout(parent_lex, &conds, TRUE);
DBUG_EXECUTE("where", print_where(conds,"SJ-EXPR", QT_ORDINARY););
@@ -1979,7 +2018,7 @@
while ((table= it++))
{
if (table->on_expr)
- table->on_expr->fix_after_pullout(new_parent, &table->on_expr);
+ table->on_expr->fix_after_pullout(new_parent, &table->on_expr, TRUE);
if (table->nested_join)
fix_list_after_tbl_changes(new_parent, &table->nested_join->join_list);
}
@@ -3302,8 +3341,8 @@
ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest,
table_map remaining_tables)
{
- List_iterator
- li(sj_nest->nested_join->sj_outer_expr_list);
- Item *item;
+ List_iterator li(sj_nest->nested_join->sj_outer_expr_list);
+ Item **item;
uint i= 0;
ulonglong res= 0;
while ((item= li++))
@@ -3314,7 +3353,7 @@
class and see if there is an element that is bound?
(this is an optional feature)
*/
- if (!(item->used_tables() & remaining_tables))
+ if (!(item[0]->used_tables() & remaining_tables))
{
res |= 1ULL << i;
}
diff -Nru mariadb-10.1-10.1.25/sql/partition_info.cc mariadb-10.1-10.1.30/sql/partition_info.cc
--- mariadb-10.1-10.1.25/sql/partition_info.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/partition_info.cc 2017-12-21 15:48:49.000000000 +0000
@@ -39,9 +39,6 @@
{
MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("partition_info::get_clone");
-
- if (!this)
- DBUG_RETURN(NULL);
List_iterator part_it(partitions);
partition_element *part;
partition_info *clone= new (mem_root) partition_info();
@@ -889,6 +886,7 @@
*/
partition_element *partition_info::get_part_elem(const char *partition_name,
char *file_name,
+ size_t file_name_size,
uint32 *part_id)
{
List_iterator part_it(partitions);
@@ -910,10 +908,10 @@
sub_part_elem->partition_name, partition_name))
{
if (file_name)
- create_subpartition_name(file_name, "",
- part_elem->partition_name,
- partition_name,
- NORMAL_PART_NAME);
+ if (create_subpartition_name(file_name, file_name_size, "",
+ part_elem->partition_name,
+ partition_name, NORMAL_PART_NAME))
+ DBUG_RETURN(NULL);
*part_id= j + (i * num_subparts);
DBUG_RETURN(sub_part_elem);
}
@@ -928,8 +926,9 @@
part_elem->partition_name, partition_name))
{
if (file_name)
- create_partition_name(file_name, "", partition_name,
- NORMAL_PART_NAME, TRUE);
+ if (create_partition_name(file_name, file_name_size, "",
+ partition_name, NORMAL_PART_NAME, TRUE))
+ DBUG_RETURN(NULL);
*part_id= i;
DBUG_RETURN(part_elem);
}
@@ -2744,6 +2743,24 @@
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;
+}
+
+
/**
Fix partition data from parser.
@@ -2833,6 +2850,8 @@
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 -Nru mariadb-10.1-10.1.25/sql/partition_info.h mariadb-10.1-10.1.30/sql/partition_info.h
--- mariadb-10.1-10.1.25/sql/partition_info.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/partition_info.h 2017-12-21 15:48:49.000000000 +0000
@@ -340,9 +340,8 @@
bool init_column_part(THD *thd);
bool add_column_list_value(THD *thd, Item *item);
void set_show_version_string(String *packet);
- partition_element *get_part_elem(const char *partition_name,
- char *file_name,
- uint32 *part_id);
+ partition_element *get_part_elem(const char *partition_name, char *file_name,
+ size_t file_name_size, uint32 *part_id);
void report_part_expr_error(bool use_subpart_expr);
bool set_used_partition(List
- &fields,
List
- &values,
@@ -369,6 +368,7 @@
bool *prune_needs_default_values,
MY_BITMAP *used_partitions);
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 -Nru mariadb-10.1-10.1.25/sql/records.cc mariadb-10.1-10.1.30/sql/records.cc
--- mariadb-10.1-10.1.25/sql/records.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/records.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, 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
diff -Nru mariadb-10.1-10.1.25/sql/rpl_gtid.cc mariadb-10.1-10.1.30/sql/rpl_gtid.cc
--- mariadb-10.1-10.1.25/sql/rpl_gtid.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_gtid.cc 2017-12-21 15:48:49.000000000 +0000
@@ -26,7 +26,7 @@
#include "key.h"
#include "rpl_gtid.h"
#include "rpl_rli.h"
-
+#include "log_event.h"
const LEX_STRING rpl_gtid_slave_state_table_name=
{ C_STRING_WITH_LEN("gtid_slave_pos") };
@@ -1728,6 +1728,155 @@
return res;
}
+/**
+ Remove domains supplied by the first argument from binlog state.
+ Removal is done for any domain whose last gtids (from all its servers) match
+ ones in Gtid list event of the 2nd argument.
+
+ @param ids gtid domain id sequence, may contain dups
+ @param glev pointer to Gtid list event describing
+ the match condition
+ @param errbuf [out] pointer to possible error message array
+
+ @retval NULL as success when at least one domain is removed
+ @retval "" empty string to indicate ineffective call
+ when no domains removed
+ @retval NOT EMPTY string otherwise an error message
+*/
+const char*
+rpl_binlog_state::drop_domain(DYNAMIC_ARRAY *ids,
+ Gtid_list_log_event *glev,
+ char* errbuf)
+{
+ DYNAMIC_ARRAY domain_unique; // sequece (unsorted) of unique element*:s
+ rpl_binlog_state::element* domain_unique_buffer[16];
+ ulong k, l;
+ const char* errmsg= NULL;
+
+ DBUG_ENTER("rpl_binlog_state::drop_domain");
+
+ my_init_dynamic_array2(&domain_unique,
+ sizeof(element*), domain_unique_buffer,
+ sizeof(domain_unique_buffer) / sizeof(element*), 4, 0);
+
+ mysql_mutex_lock(&LOCK_binlog_state);
+
+ /*
+ Gtid list is supposed to come from a binlog's Gtid_list event and
+ therefore should be a subset of the current binlog state. That is
+ for every domain in the list the binlog state contains a gtid with
+ sequence number not less than that of the list.
+ Exceptions of this inclusion rule are:
+ A. the list may still refer to gtids from already deleted domains.
+ Files containing them must have been purged whereas the file
+ with the list is not yet.
+ B. out of order groups were injected
+ C. manually build list of binlog files violating the inclusion
+ constraint.
+ While A is a normal case (not necessarily distinguishable from C though),
+ B and C may require the user's attention so any (incl the A's suspected)
+ inconsistency is diagnosed and *warned*.
+ */
+ for (l= 0, errbuf[0]= 0; l < glev->count; l++, errbuf[0]= 0)
+ {
+ rpl_gtid* rb_state_gtid= find_nolock(glev->list[l].domain_id,
+ glev->list[l].server_id);
+ if (!rb_state_gtid)
+ sprintf(errbuf,
+ "missing gtids from the '%u-%u' domain-server pair which is "
+ "referred to in the gtid list describing an earlier state. Ignore "
+ "if the domain ('%u') was already explicitly deleted",
+ glev->list[l].domain_id, glev->list[l].server_id,
+ glev->list[l].domain_id);
+ else if (rb_state_gtid->seq_no < glev->list[l].seq_no)
+ sprintf(errbuf,
+ "having a gtid '%u-%u-%llu' which is less than "
+ "the '%u-%u-%llu' of the gtid list describing an earlier state. "
+ "The state may have been affected by manually injecting "
+ "a lower sequence number gtid or via replication",
+ rb_state_gtid->domain_id, rb_state_gtid->server_id,
+ rb_state_gtid->seq_no, glev->list[l].domain_id,
+ glev->list[l].server_id, glev->list[l].seq_no);
+ if (strlen(errbuf)) // use strlen() as cheap flag
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BINLOG_CANT_DELETE_GTID_DOMAIN,
+ "The current gtid binlog state is incompatible with "
+ "a former one %s.", errbuf);
+ }
+
+ /*
+ For each domain_id from ids
+ when no such domain in binlog state
+ warn && continue
+ For each domain.server's last gtid
+ when not locate the last gtid in glev.list
+ error out binlog state can't change
+ otherwise continue
+ */
+ for (ulong i= 0; i < ids->elements; i++)
+ {
+ rpl_binlog_state::element *elem= NULL;
+ ulong *ptr_domain_id;
+ bool not_match;
+
+ ptr_domain_id= (ulong*) dynamic_array_ptr(ids, i);
+ elem= (rpl_binlog_state::element *)
+ my_hash_search(&hash, (const uchar *) ptr_domain_id, 0);
+ if (!elem)
+ {
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BINLOG_CANT_DELETE_GTID_DOMAIN,
+ "The gtid domain being deleted ('%lu') is not in "
+ "the current binlog state", *ptr_domain_id);
+ continue;
+ }
+
+ for (not_match= true, k= 0; k < elem->hash.records; k++)
+ {
+ rpl_gtid *d_gtid= (rpl_gtid *)my_hash_element(&elem->hash, k);
+ for (ulong l= 0; l < glev->count && not_match; l++)
+ not_match= !(*d_gtid == glev->list[l]);
+ }
+
+ if (not_match)
+ {
+ sprintf(errbuf, "binlog files may contain gtids from the domain ('%lu') "
+ "being deleted. Make sure to first purge those files",
+ *ptr_domain_id);
+ errmsg= errbuf;
+ goto end;
+ }
+ // compose a sequence of unique pointers to domain object
+ for (k= 0; k < domain_unique.elements; k++)
+ {
+ if ((rpl_binlog_state::element*) dynamic_array_ptr(&domain_unique, k)
+ == elem)
+ break; // domain_id's elem has been already in
+ }
+ if (k == domain_unique.elements) // proven not to have duplicates
+ insert_dynamic(&domain_unique, (uchar*) &elem);
+ }
+
+ // Domain removal from binlog state
+ for (k= 0; k < domain_unique.elements; k++)
+ {
+ rpl_binlog_state::element *elem= *(rpl_binlog_state::element**)
+ dynamic_array_ptr(&domain_unique, k);
+ my_hash_free(&elem->hash);
+ my_hash_delete(&hash, (uchar*) elem);
+ }
+
+ DBUG_ASSERT(strlen(errbuf) == 0);
+
+ if (domain_unique.elements == 0)
+ errmsg= "";
+
+end:
+ mysql_mutex_unlock(&LOCK_binlog_state);
+ delete_dynamic(&domain_unique);
+
+ DBUG_RETURN(errmsg);
+}
slave_connection_state::slave_connection_state()
{
diff -Nru mariadb-10.1-10.1.25/sql/rpl_gtid.h mariadb-10.1-10.1.30/sql/rpl_gtid.h
--- mariadb-10.1-10.1.25/sql/rpl_gtid.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_gtid.h 2017-12-21 15:48:49.000000000 +0000
@@ -34,6 +34,13 @@
uint64 seq_no;
};
+inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs)
+{
+ return
+ lhs.domain_id == rhs.domain_id &&
+ lhs.server_id == rhs.server_id &&
+ lhs.seq_no == rhs.seq_no;
+};
enum enum_gtid_skip_type {
GTID_SKIP_NOT, GTID_SKIP_STANDALONE, GTID_SKIP_TRANSACTION
@@ -93,6 +100,7 @@
class Relay_log_info;
struct rpl_group_info;
+class Gtid_list_log_event;
/*
Replication slave state.
@@ -256,6 +264,7 @@
rpl_gtid *find_nolock(uint32 domain_id, uint32 server_id);
rpl_gtid *find(uint32 domain_id, uint32 server_id);
rpl_gtid *find_most_recent(uint32 domain_id);
+ const char* drop_domain(DYNAMIC_ARRAY *ids, Gtid_list_log_event *glev, char*);
};
diff -Nru mariadb-10.1-10.1.25/sql/rpl_handler.cc mariadb-10.1-10.1.30/sql/rpl_handler.cc
--- mariadb-10.1-10.1.25/sql/rpl_handler.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_handler.cc 2017-12-21 15:48:49.000000000 +0000
@@ -267,7 +267,7 @@
thd->semisync_info= log_info;
}
- strcpy(log_info->log_file, log_file+dirname_length(log_file));
+ strmake_buf(log_info->log_file, log_file+dirname_length(log_file));
log_info->log_pos = log_pos;
FOREACH_OBSERVER(ret, after_flush, false,
diff -Nru mariadb-10.1-10.1.25/sql/rpl_mi.cc mariadb-10.1-10.1.30/sql/rpl_mi.cc
--- mariadb-10.1-10.1.25/sql/rpl_mi.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_mi.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1,5 +1,5 @@
-/* Copyright (c) 2006, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011, Monty Program Ab
+/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2017, 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
@@ -844,7 +844,6 @@
if (!mi->inited)
DBUG_VOID_RETURN;
- end_relay_log_info(&mi->rli);
if (mi->fd >= 0)
{
end_io_cache(&mi->file);
@@ -883,6 +882,7 @@
/* We use 2 here instead of 1 just to make it easier when debugging */
mi->killed= 2;
end_master_info(mi);
+ end_relay_log_info(&mi->rli);
mi->unlock_slave_threads();
delete mi;
diff -Nru mariadb-10.1-10.1.25/sql/rpl_parallel.cc mariadb-10.1-10.1.30/sql/rpl_parallel.cc
--- mariadb-10.1-10.1.25/sql/rpl_parallel.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_parallel.cc 2017-12-21 15:48:49.000000000 +0000
@@ -714,9 +714,7 @@
DBUG_EXECUTE_IF("inject_mdev8031", {
/* Simulate that we get deadlock killed at this exact point. */
rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED;
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->killed= KILL_CONNECTION;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ thd->set_killed(KILL_CONNECTION);
});
rgi->cleanup_context(thd, 1);
wait_for_pending_deadlock_kill(thd, rgi);
@@ -862,9 +860,7 @@
/* Simulate that we get deadlock killed during open_binlog(). */
thd->reset_for_next_command();
rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED;
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->killed= KILL_CONNECTION;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ thd->set_killed(KILL_CONNECTION);
thd->send_kill_message();
fd= (File)-1;
err= 1;
diff -Nru mariadb-10.1-10.1.25/sql/rpl_rli.cc mariadb-10.1-10.1.30/sql/rpl_rli.cc
--- mariadb-10.1-10.1.25/sql/rpl_rli.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_rli.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1,5 +1,5 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab
+/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2017, 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
@@ -54,8 +54,8 @@
sync_counter(0), is_relay_log_recovery(is_slave_recovery),
save_temporary_tables(0), mi(0),
inuse_relaylog_list(0), last_inuse_relaylog(0),
- cur_log_old_open_count(0), group_relay_log_pos(0),
- event_relay_log_pos(0),
+ cur_log_old_open_count(0), error_on_rli_init_info(false),
+ group_relay_log_pos(0), event_relay_log_pos(0),
#if HAVE_valgrind
is_fake(FALSE),
#endif
@@ -119,16 +119,21 @@
const char* info_fname)
{
char fname[FN_REFLEN+128];
- int info_fd;
+ int info_fd= -1;
const char* msg = 0;
int error = 0;
+ mysql_mutex_t *log_lock;
DBUG_ENTER("init_relay_log_info");
DBUG_ASSERT(!rli->no_storage); // Don't init if there is no storage
if (rli->inited) // Set if this function called
DBUG_RETURN(0);
+
+ log_lock= rli->relay_log.get_log_lock();
fn_format(fname, info_fname, mysql_data_home, "", 4+32);
mysql_mutex_lock(&rli->data_lock);
+ if (rli->error_on_rli_init_info)
+ goto err;
info_fd = rli->info_fd;
rli->cur_log_fd = -1;
rli->slave_skip_counter=0;
@@ -208,7 +213,6 @@
Master_info* mi= rli->mi;
char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN];
char *buf_relaylog_index_name= opt_relaylog_index_name;
- mysql_mutex_t *log_lock;
create_logfile_name_with_suffix(buf_relay_logname,
sizeof(buf_relay_logname),
@@ -228,7 +232,6 @@
note, that if open() fails, we'll still have index file open
but a destructor will take care of that
*/
- log_lock= rli->relay_log.get_log_lock();
mysql_mutex_lock(log_lock);
if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
@@ -254,8 +257,8 @@
if ((info_fd= mysql_file_open(key_file_relay_log_info,
fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
{
- sql_print_error("Failed to create a new relay log info file (\
-file '%s', errno %d)", fname, my_errno);
+ sql_print_error("Failed to create a new relay log info file ("
+ "file '%s', errno %d)", fname, my_errno);
msg= current_thd->get_stmt_da()->message();
goto err;
}
@@ -306,7 +309,9 @@
if (info_fd >= 0)
mysql_file_close(info_fd, MYF(0));
rli->info_fd= -1;
+ mysql_mutex_lock(log_lock);
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ mysql_mutex_unlock(log_lock);
mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
@@ -428,17 +433,24 @@
goto err;
}
rli->inited= 1;
+ rli->error_on_rli_init_info= false;
mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(0);
err:
- sql_print_error("%s", msg);
+ rli->error_on_rli_init_info= true;
+ if (msg)
+ sql_print_error("%s", msg);
end_io_cache(&rli->info_file);
if (info_fd >= 0)
mysql_file_close(info_fd, MYF(0));
rli->info_fd= -1;
+
+ mysql_mutex_lock(log_lock);
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ mysql_mutex_unlock(log_lock);
mysql_mutex_unlock(&rli->data_lock);
+
DBUG_RETURN(1);
}
@@ -1101,6 +1113,8 @@
const char** errmsg)
{
int error=0;
+ const char *ln;
+ char name_buf[FN_REFLEN];
DBUG_ENTER("purge_relay_logs");
/*
@@ -1127,12 +1141,37 @@
if (!rli->inited)
{
DBUG_PRINT("info", ("rli->inited == 0"));
- DBUG_RETURN(0);
- }
-
- DBUG_ASSERT(rli->slave_running == 0);
- DBUG_ASSERT(rli->mi->slave_running == 0);
+ if (rli->error_on_rli_init_info)
+ {
+ ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
+ 1, name_buf);
+ if (rli->relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log index file:%s.", rli->relay_log.get_index_fname());
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_lock(rli->relay_log.get_log_lock());
+ if (rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
+ (rli->max_relay_log_size ? rli->max_relay_log_size :
+ max_binlog_size), 1, TRUE))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log file:%s.", rli->relay_log.get_log_fname());
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ }
+ else
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ DBUG_ASSERT(rli->slave_running == 0);
+ DBUG_ASSERT(rli->mi->slave_running == 0);
+ }
mysql_mutex_lock(&rli->data_lock);
/*
@@ -1179,6 +1218,12 @@
rli->group_relay_log_name[0]= rli->event_relay_log_name[0]= 0;
}
+ if (!rli->inited && rli->error_on_rli_init_info)
+ {
+ mysql_mutex_lock(rli->relay_log.get_log_lock());
+ rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ }
err:
DBUG_PRINT("info",("log_space_total: %llu",rli->log_space_total));
mysql_mutex_unlock(&rli->data_lock);
diff -Nru mariadb-10.1-10.1.25/sql/rpl_rli.h mariadb-10.1-10.1.30/sql/rpl_rli.h
--- mariadb-10.1-10.1.25/sql/rpl_rli.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/rpl_rli.h 2017-12-21 15:48:49.000000000 +0000
@@ -1,4 +1,5 @@
-/* Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, 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
@@ -176,7 +177,14 @@
a different log under our feet
*/
uint32 cur_log_old_open_count;
-
+
+ /*
+ If on init_info() call error_on_rli_init_info is true that means
+ that previous call to init_info() terminated with an error, RESET
+ SLAVE must be executed and the problem fixed manually.
+ */
+ bool error_on_rli_init_info;
+
/*
Let's call a group (of events) :
- a transaction
diff -Nru mariadb-10.1-10.1.25/sql/share/errmsg-utf8.txt mariadb-10.1-10.1.30/sql/share/errmsg-utf8.txt
--- mariadb-10.1-10.1.25/sql/share/errmsg-utf8.txt 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/share/errmsg-utf8.txt 2017-12-21 15:48:49.000000000 +0000
@@ -1732,32 +1732,32 @@
spa "Puede ser solamente un campo automatico y este debe ser definido como una clave"
swe "Det får finnas endast ett AUTO_INCREMENT-fält och detta måste vara en nyckel"
ukr "Невірне визначення таблиці; Може бути лише один автоматичний стовбець, що повинен бути визначений як ключ"
-ER_UNUSED_9
- eng "You should never see it"
+ER_BINLOG_CANT_DELETE_GTID_DOMAIN
+ eng "Could not delete gtid domain. Reason: %s."
ER_NORMAL_SHUTDOWN
- cze "%s: normá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"
- jpn "%s: 通常シャットダウン\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"
+ jpn "%s: 通常シャットダウン"
+ 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řijat signal %d, končím\n"
dan "%s: Fangede signal %d. Afslutter!!\n"
@@ -7118,7 +7118,7 @@
eng "%s does not support subqueries or stored functions."
ER_SET_STATEMENT_NOT_SUPPORTED 42000
eng "The system variable %.200s cannot be set in SET STATEMENT."
-ER_UNUSED_17
+ER_UNUSED_9
eng "You should never see it"
ER_USER_CREATE_EXISTS
eng "Can't create user '%-.64s'@'%-.64s'; it already exists"
diff -Nru mariadb-10.1-10.1.25/sql/slave.cc mariadb-10.1-10.1.30/sql/slave.cc
--- mariadb-10.1-10.1.25/sql/slave.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/slave.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, 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
@@ -483,6 +483,7 @@
{
delete active_mi;
active_mi= 0;
+ sql_print_error("Failed to allocate memory for the Master Info structure");
goto err;
}
@@ -545,7 +546,6 @@
DBUG_RETURN(error);
err:
- sql_print_error("Failed to allocate memory for the Master Info structure");
error= 1;
goto end;
}
@@ -2466,6 +2466,7 @@
}
if (rli->ign_gtids.count())
{
+ DBUG_ASSERT(!rli->is_in_group()); // Ensure no active transaction
glev= new Gtid_list_log_event(&rli->ign_gtids,
Gtid_list_log_event::FLAG_IGN_GTIDS);
rli->ign_gtids.reset();
@@ -3187,7 +3188,6 @@
thd->variables.sql_log_slow= opt_log_slow_slave_statements;
thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
set_slave_thread_options(thd);
- thd->client_capabilities = CLIENT_LOCAL_FILES;
mysql_mutex_lock(&LOCK_thread_count);
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
mysql_mutex_unlock(&LOCK_thread_count);
@@ -3610,7 +3610,9 @@
apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd,
rpl_group_info *rgi)
{
+#ifndef DBUG_OFF
Relay_log_info* rli= rgi->rli;
+#endif
mysql_mutex_assert_not_owner(&rli->data_lock);
int reason= apply_event_and_update_pos_setup(ev, thd, rgi);
/*
@@ -5582,7 +5584,9 @@
bool gtid_skip_enqueue= false;
bool got_gtid_event= false;
rpl_gtid event_gtid;
-
+#ifndef DBUG_OFF
+ static uint dbug_rows_event_count= 0;
+#endif
/*
FD_q must have been prepared for the first R_a event
inside get_master_version_and_clock()
@@ -5649,6 +5653,26 @@
(uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
+#ifdef ENABLED_DEBUG_SYNC
+ /*
+ A (+d,dbug.rows_events_to_delay_relay_logging)-test is supposed to
+ create a few Write_log_events and after receiving the 1st of them
+ the IO thread signals to launch the SQL thread, and sets itself to
+ wait for a release signal.
+ */
+ DBUG_EXECUTE_IF("dbug.rows_events_to_delay_relay_logging",
+ if ((buf[EVENT_TYPE_OFFSET] == WRITE_ROWS_EVENT_V1 ||
+ buf[EVENT_TYPE_OFFSET] == WRITE_ROWS_EVENT) &&
+ ++dbug_rows_event_count == 2)
+ {
+ const char act[]=
+ "now SIGNAL start_sql_thread "
+ "WAIT_FOR go_on_relay_logging";
+ DBUG_ASSERT(debug_sync_service);
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
+#endif
mysql_mutex_lock(&mi->data_lock);
switch ((uchar)buf[EVENT_TYPE_OFFSET]) {
@@ -6314,6 +6338,7 @@
mysql_mutex_t *log_lock;
DBUG_ENTER("end_relay_log_info");
+ rli->error_on_rli_init_info= false;
if (!rli->inited)
DBUG_VOID_RETURN;
if (rli->info_fd >= 0)
@@ -6897,9 +6922,12 @@
DBUG_RETURN(ev);
}
- if (rli->ign_gtids.count())
+ if (rli->ign_gtids.count() && !rli->is_in_group())
{
- /* We generate and return a Gtid_list, to update gtid_slave_pos. */
+ /*
+ We generate and return a Gtid_list, to update gtid_slave_pos,
+ unless being in the middle of a group.
+ */
DBUG_PRINT("info",("seeing ignored end gtids"));
ev= new Gtid_list_log_event(&rli->ign_gtids,
Gtid_list_log_event::FLAG_IGN_GTIDS);
diff -Nru mariadb-10.1-10.1.25/sql/spatial.cc mariadb-10.1-10.1.30/sql/spatial.cc
--- mariadb-10.1-10.1.25/sql/spatial.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/spatial.cc 2017-12-21 15:48:49.000000000 +0000
@@ -1149,8 +1149,8 @@
uint32 n_points, org_n_points;
double prev_x, prev_y;
double cur_area= 0;
- double cur_cx= 0;
- double cur_cy= 0;
+ double cur_cx= 0, cur_cy= 0;
+ double sum_cx= 0, sum_cy= 0;
if (no_data(data, 4))
return 1;
@@ -1164,17 +1164,32 @@
while (--n_points) // One point is already read
{
double tmp_x, tmp_y;
+ double loc_area;
get_point(&tmp_x, &tmp_y, data);
data+= POINT_DATA_SIZE;
- cur_area+= (prev_x + tmp_x) * (prev_y - tmp_y);
+ loc_area= prev_x * tmp_y - tmp_x * prev_y;
+ cur_area+= loc_area;
cur_cx+= tmp_x;
cur_cy+= tmp_y;
+ sum_cx+= (prev_x + tmp_x) * loc_area;
+ sum_cy+= (prev_y + tmp_y) * loc_area;
+
prev_x= tmp_x;
prev_y= tmp_y;
}
- cur_area= fabs(cur_area) / 2;
- cur_cx= cur_cx / (org_n_points - 1);
- cur_cy= cur_cy / (org_n_points - 1);
+
+ if (fabs(cur_area) > 1e-10)
+ {
+ cur_cx= sum_cx / cur_area / 3.0;
+ cur_cy= sum_cy / cur_area / 3.0;
+ }
+ else
+ {
+ cur_cx= cur_cx / (org_n_points - 1);
+ cur_cy= cur_cy / (org_n_points - 1);
+ }
+
+ cur_area= fabs(cur_area);
if (!first_loop)
{
diff -Nru mariadb-10.1-10.1.25/sql/sp.cc mariadb-10.1-10.1.30/sql/sp.cc
--- mariadb-10.1-10.1.25/sql/sp.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sp.cc 2017-12-21 15:48:49.000000000 +0000
@@ -760,6 +760,7 @@
else
{
sp= thd->lex->sphead;
+ sp->set_select_number(thd->select_number);
}
thd->pop_internal_handler();
diff -Nru mariadb-10.1-10.1.25/sql/sp_head.cc mariadb-10.1-10.1.30/sql/sp_head.cc
--- mariadb-10.1-10.1.25/sql/sp_head.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sp_head.cc 2017-12-21 15:48:49.000000000 +0000
@@ -141,7 +141,6 @@
case DECIMAL_RESULT:
if (item->field_type() != MYSQL_TYPE_BIT)
return item->val_str(str);
- else {/* Bit type is handled as binary string */}
/* fall through */
case STRING_RESULT:
{
@@ -598,7 +597,7 @@
m_flags(0),
m_sp_cache_version(0),
m_creation_ctx(0),
- unsafe_flags(0),
+ unsafe_flags(0), m_select_number(1),
m_recursion_level(0),
m_next_cached_sp(0),
m_cont_level(0)
@@ -1137,6 +1136,19 @@
if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet))
DBUG_RETURN(TRUE);
+ /*
+ Normally the counter is not reset between parsing and first execution,
+ but it is possible in case of error to have parsing on one CALL and
+ first execution (where VIEW will be parsed and added). So we store the
+ counter after parsing and restore it before execution just to avoid
+ repeating SELECT numbers.
+
+ Other problem is that it can be more SELECTs parsed in case of fixing
+ error causes previous interruption of the SP. So it is save not just
+ assign old value but add it.
+ */
+ thd->select_number+= m_select_number;
+
/* init per-instruction memroot */
init_sql_alloc(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0));
@@ -1470,6 +1482,16 @@
m_recursion_level + 1));
m_first_instance->m_first_free_instance= this;
+ /*
+ This execution of the SP was aborted with an error (e.g. "Table not
+ found"). However it might still have consumed some numbers from the
+ thd->select_number counter. The next sp->exec() call must not use the
+ consumed numbers, so we remember the first free number (We know that
+ nobody will use it as this execution has stopped with an error).
+ */
+ if (err_status)
+ set_select_number(thd->select_number);
+
DBUG_RETURN(err_status);
}
@@ -2101,7 +2123,6 @@
if (!err_status)
{
err_status= execute(thd, TRUE);
- DBUG_PRINT("info", ("execute returned %d", (int) err_status));
}
if (save_log_general)
@@ -2519,10 +2540,18 @@
*full_access= ((!check_table_access(thd, SELECT_ACL, &tables, FALSE,
1, TRUE) &&
(tables.grant.privilege & SELECT_ACL) != 0) ||
+ /* Check if user owns the routine. */
(!strcmp(sp->m_definer_user.str,
thd->security_ctx->priv_user) &&
!strcmp(sp->m_definer_host.str,
- thd->security_ctx->priv_host)));
+ thd->security_ctx->priv_host)) ||
+ /* Check if current role or any of the sub-granted roles
+ own the routine. */
+ (sp->m_definer_host.length == 0 &&
+ (!strcmp(sp->m_definer_user.str,
+ thd->security_ctx->priv_role) ||
+ check_role_is_granted(thd->security_ctx->priv_role, NULL,
+ sp->m_definer_user.str))));
if (!*full_access)
return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str,
sp->m_type == TYPE_ENUM_PROCEDURE);
@@ -4307,4 +4336,3 @@
lex->add_to_query_tables(table);
return table;
}
-
diff -Nru mariadb-10.1-10.1.25/sql/sp_head.h mariadb-10.1-10.1.30/sql/sp_head.h
--- mariadb-10.1-10.1.25/sql/sp_head.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sp_head.h 2017-12-21 15:48:49.000000000 +0000
@@ -232,6 +232,7 @@
*/
uint32 unsafe_flags;
+ uint m_select_number;
public:
inline Stored_program_creation_ctx *get_creation_ctx()
{
@@ -521,6 +522,8 @@
sp_pcontext *get_parse_context() { return m_pcont; }
+ void set_select_number(uint num) { m_select_number= num; }
+
private:
MEM_ROOT *m_thd_root; ///< Temp. store for thd's mem_root
diff -Nru mariadb-10.1-10.1.25/sql/sp_rcontext.cc mariadb-10.1-10.1.30/sql/sp_rcontext.cc
--- mariadb-10.1-10.1.25/sql/sp_rcontext.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sp_rcontext.cc 2017-12-21 15:48:49.000000000 +0000
@@ -331,8 +331,7 @@
/* Reset error state. */
thd->clear_error();
- thd->killed= NOT_KILLED; // Some errors set thd->killed
- // (e.g. "bad data").
+ thd->reset_killed(); // Some errors set thd->killed, (e.g. "bad data").
/* Add a frame to handler-call-stack. */
Sql_condition_info *cond_info=
diff -Nru mariadb-10.1-10.1.25/sql/sql_acl.cc mariadb-10.1-10.1.30/sql/sql_acl.cc
--- mariadb-10.1-10.1.25/sql/sql_acl.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sql_acl.cc 2017-12-21 15:48:49.000000000 +0000
@@ -634,9 +634,6 @@
char *hostname, char *rolename,
bool with_admin_option)
{
- if (!this)
- return true;
-
size_t uname_l = safe_strlen(username);
size_t hname_l = safe_strlen(hostname);
size_t rname_l = safe_strlen(rolename);
@@ -2285,37 +2282,42 @@
}
-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;
}
@@ -3749,9 +3751,21 @@
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 */
@@ -5654,6 +5668,7 @@
{
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
@@ -6746,17 +6761,14 @@
DBUG_RETURN(return_val);
}
-
-static 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;
}
@@ -6823,7 +6835,15 @@
}
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);
@@ -8473,6 +8493,17 @@
mysql_mutex_unlock(&acl_cache->lock);
}
+static int check_role_is_granted_callback(ACL_USER_BASE *grantee, void *data)
+{
+ LEX_CSTRING *rolename= static_cast(data);
+ if (rolename->length == grantee->user.length &&
+ !strcmp(rolename->str, grantee->user.str))
+ return -1; // End search, we've found our role.
+
+ /* Keep looking, we haven't found our role yet. */
+ return 0;
+}
+
/*
Initialize a TABLE_LIST array and open grant tables
@@ -9499,13 +9530,13 @@
}
}
- 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)
@@ -10452,7 +10483,6 @@
}
#endif /*NO_EMBEDDED_ACCESS_CHECKS */
-
SHOW_VAR acl_statistics[] = {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
{"column_grants", (char*)show_column_grants, SHOW_SIMPLE_FUNC},
@@ -10468,6 +10498,43 @@
{NullS, NullS, SHOW_LONG},
};
+/* Check if a role is granted to a user/role. We traverse the role graph
+ and return true if we find a match.
+
+ hostname == NULL means we are looking for a role as a starting point,
+ otherwise a user.
+*/
+bool check_role_is_granted(const char *username,
+ const char *hostname,
+ const char *rolename)
+{
+ DBUG_ENTER("check_role_is_granted");
+ bool result= false;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ ACL_USER_BASE *root;
+ mysql_mutex_lock(&acl_cache->lock);
+ if (hostname)
+ root= find_user_exact(username, hostname);
+ else
+ root= find_acl_role(username);
+
+ LEX_CSTRING role_lex;
+ role_lex.str= rolename;
+ role_lex.length= strlen(rolename);
+
+ if (root && /* No grantee, nothing to search. */
+ traverse_role_graph_down(root, &role_lex, check_role_is_granted_callback,
+ NULL) == -1)
+ {
+ /* We have found the role during our search. */
+ result= true;
+ }
+
+ /* We haven't found the role or we had no initial grantee to start from. */
+ mysql_mutex_unlock(&acl_cache->lock);
+#endif
+ DBUG_RETURN(result);
+}
int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond)
{
@@ -12839,4 +12906,3 @@
MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */
}
maria_declare_plugin_end;
-
diff -Nru mariadb-10.1-10.1.25/sql/sql_acl.h mariadb-10.1-10.1.30/sql/sql_acl.h
--- mariadb-10.1-10.1.25/sql/sql_acl.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sql_acl.h 2017-12-21 15:48:49.000000000 +0000
@@ -406,6 +406,14 @@
extern SHOW_VAR acl_statistics[];
+/* Check if a role is granted to a user/role.
+
+ If hostname == NULL, search for a role as the starting grantee.
+*/
+bool check_role_is_granted(const char *username,
+ const char *hostname,
+ const char *rolename);
+
#ifndef DBUG_OFF
extern ulong role_global_merges, role_db_merges, role_table_merges,
role_column_merges, role_routine_merges;
diff -Nru mariadb-10.1-10.1.25/sql/sql_admin.cc mariadb-10.1-10.1.30/sql/sql_admin.cc
--- mariadb-10.1-10.1.25/sql/sql_admin.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sql_admin.cc 2017-12-21 15:48:49.000000000 +0000
@@ -66,7 +66,6 @@
if (thd->get_stmt_da()->is_ok())
thd->get_stmt_da()->reset_diagnostics_area();
table_list->table= NULL;
- result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
DBUG_RETURN(result_code);
}
diff -Nru mariadb-10.1-10.1.25/sql/sql_base.cc mariadb-10.1-10.1.30/sql/sql_base.cc
--- mariadb-10.1-10.1.25/sql/sql_base.cc 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sql_base.cc 2017-12-21 15:48:49.000000000 +0000
@@ -400,7 +400,7 @@
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
! in_use->killed)
{
- in_use->killed= KILL_SYSTEM_THREAD;
+ in_use->set_killed(KILL_SYSTEM_THREAD);
mysql_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
{
@@ -1245,6 +1245,7 @@
thd->variables.character_set_client= cs_save;
thd->get_stmt_da()->set_overwrite_status(true);
+ thd->transaction.stmt.mark_dropped_temp_table();
if ((error= (mysql_bin_log.write(&qinfo) || error)))
{
/*
@@ -7852,13 +7853,15 @@
bool setup_fields(THD *thd, Item **ref_pointer_array,
List
- &fields, enum_mark_columns mark_used_columns,
- List
- *sum_func_list, bool allow_sum_func)
+ List
- *sum_func_list, List
- *pre_fix,
+ bool allow_sum_func)
{
reg2 Item *item;
enum_mark_columns save_mark_used_columns= thd->mark_used_columns;
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
List_iterator
- it(fields);
bool save_is_item_list_lookup;
+ bool make_pre_fix= (pre_fix && (pre_fix->elements == 0));
DBUG_ENTER("setup_fields");
DBUG_PRINT("enter", ("ref_pointer_array: %p", ref_pointer_array));
@@ -7905,6 +7908,9 @@
thd->lex->current_select->cur_pos_in_select_list= 0;
while ((item= it++))
{
+ if (make_pre_fix)
+ pre_fix->push_back(item, thd->stmt_arena->mem_root);
+
if ((!item->fixed && item->fix_fields(thd, it.ref())) ||
(item= *(it.ref()))->check_cols(1))
{
@@ -9135,7 +9141,7 @@
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
!in_use->killed)
{
- in_use->killed= KILL_SYSTEM_THREAD;
+ in_use->set_killed(KILL_SYSTEM_THREAD);
mysql_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
{
diff -Nru mariadb-10.1-10.1.25/sql/sql_base.h mariadb-10.1-10.1.30/sql/sql_base.h
--- mariadb-10.1-10.1.25/sql/sql_base.h 2017-07-01 18:20:19.000000000 +0000
+++ mariadb-10.1-10.1.30/sql/sql_base.h 2017-12-21 15:48:49.000000000 +0000
@@ -174,7 +174,8 @@
List
- *sum_func_list, uint wild_num);
bool setup_fields(THD *thd, Item** ref_pointer_array,
List
- &item, enum_mark_columns mark_used_columns,
- List
- *sum_func_list, bool allow_sum_func);
+ List