1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.0-galera' into 10.1

This commit is contained in:
Oleksandr Byelkin
2019-01-31 09:34:34 +01:00
21 changed files with 6055 additions and 77 deletions

View File

@@ -26,7 +26,7 @@ ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
# Set the patch version # Set the patch version
SET(WSREP_PATCH_VERSION "23") SET(WSREP_PATCH_VERSION "24")
# Obtain wsrep API version # Obtain wsrep API version
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION

View File

@@ -139,8 +139,6 @@ my $opt_start_exit;
my $start_only; my $start_only;
my $file_wsrep_provider; my $file_wsrep_provider;
our @global_suppressions;
END { END {
if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ ) if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ )
{ {
@@ -195,8 +193,6 @@ my @DEFAULT_SUITES= qw(
sys_vars- sys_vars-
unit- unit-
vcol- vcol-
wsrep-
galera-
); );
my $opt_suites; my $opt_suites;
@@ -357,7 +353,6 @@ my $opt_max_test_fail= env_or_val(MTR_MAX_TEST_FAIL => 10);
my $opt_core_on_failure= 0; my $opt_core_on_failure= 0;
my $opt_parallel= $ENV{MTR_PARALLEL} || 1; my $opt_parallel= $ENV{MTR_PARALLEL} || 1;
my $opt_port_group_size = $ENV{MTR_PORT_GROUP_SIZE} || 20;
# lock file to stop tests # lock file to stop tests
my $opt_stop_file= $ENV{MTR_STOP_FILE}; my $opt_stop_file= $ENV{MTR_STOP_FILE};
@@ -1118,7 +1113,6 @@ sub command_line_setup {
# Specify ports # Specify ports
'build-thread|mtr-build-thread=i' => \$opt_build_thread, 'build-thread|mtr-build-thread=i' => \$opt_build_thread,
'port-base|mtr-port-base=i' => \$opt_port_base, 'port-base|mtr-port-base=i' => \$opt_port_base,
'port-group-size=s' => \$opt_port_group_size,
# Test case authoring # Test case authoring
'record' => \$opt_record, 'record' => \$opt_record,
@@ -1824,16 +1818,16 @@ sub set_build_thread_ports($) {
$ENV{MTR_BUILD_THREAD}= $build_thread; $ENV{MTR_BUILD_THREAD}= $build_thread;
# Calculate baseport # Calculate baseport
$baseport= $build_thread * $opt_port_group_size + 10000; $baseport= $build_thread * 20 + 10000;
if ( $baseport < 5001 or $baseport + $opt_port_group_size >= 32767 ) if ( $baseport < 5001 or $baseport + 19 >= 32767 )
{ {
mtr_error("MTR_BUILD_THREAD number results in a port", mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767", "outside 5001 - 32767",
"($baseport - $baseport + $opt_port_group_size)"); "($baseport - $baseport + 19)");
} }
mtr_report("Using MTR_BUILD_THREAD $build_thread,", mtr_report("Using MTR_BUILD_THREAD $build_thread,",
"with reserved ports $baseport..".($baseport+($opt_port_group_size-1))); "with reserved ports $baseport..".($baseport+19));
} }
@@ -2994,8 +2988,8 @@ sub kill_leftovers ($) {
sub check_ports_free ($) sub check_ports_free ($)
{ {
my $bthread= shift; my $bthread= shift;
my $portbase = $bthread * $opt_port_group_size + 10000; my $portbase = $bthread * 10 + 10000;
for ($portbase..$portbase+($opt_port_group_size-1)){ for ($portbase..$portbase+9){
if (mtr_ping_port($_)){ if (mtr_ping_port($_)){
mtr_report(" - 'localhost:$_' was not free"); mtr_report(" - 'localhost:$_' was not free");
return 0; # One port was not free return 0; # One port was not free
@@ -4407,7 +4401,6 @@ sub extract_warning_lines ($$) {
# Perl code. # Perl code.
my @antipatterns = my @antipatterns =
( (
@global_suppressions,
qr/error .*connecting to master/, qr/error .*connecting to master/,
qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/, qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/,
qr/InnoDB: Error: table `test`.`t[12]` .*does not exist in the InnoDB internal/, qr/InnoDB: Error: table `test`.`t[12]` .*does not exist in the InnoDB internal/,
@@ -6117,8 +6110,6 @@ Options that specify ports
build-thread=# Can be set in environment variable MTR_BUILD_THREAD. build-thread=# Can be set in environment variable MTR_BUILD_THREAD.
Set MTR_BUILD_THREAD="auto" to automatically aquire Set MTR_BUILD_THREAD="auto" to automatically aquire
a build thread id that is unique to current host a build thread id that is unique to current host
port-group-size=N Reserve groups of TCP ports of size N for each MTR thread
Options for test case authoring Options for test case authoring

File diff suppressed because it is too large Load Diff

2291
mysql-test/r/grant.test Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
#
# Specific tests for case sensitive file systems
# i.e. lower_case_filesystem=OFF
#
-- source include/have_case_sensitive_file_system.inc
-- source include/not_embedded.inc
connect (master,localhost,root,,);
connection master;
create database d1;
grant all on d1.* to 'sample'@'localhost' identified by 'password';
flush privileges;
connect (sample,localhost,sample,password,d1);
connection sample;
select database();
--error ER_DBACCESS_DENIED_ERROR
create database d2;
--error ER_DBACCESS_DENIED_ERROR
create database D1;
disconnect sample;
--source include/wait_until_disconnected.inc
connection master;
drop user 'sample'@'localhost';
drop database if exists d1;
disconnect master;
--source include/wait_until_disconnected.inc
connection default;
# End of 4.1 tests
#
# Bug#41049 does syntax "grant" case insensitive?
#
CREATE DATABASE d1;
USE d1;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
connect (con1,localhost,user_1,,d1);
--error ER_TABLEACCESS_DENIED_ERROR
select * from t1;
select * from T1;
connection default;
GRANT SELECT ON t1 to user_1@localhost;
connection con1;
select * from information_schema.table_privileges;
connection default;
disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
USE test;
CREATE DATABASE db1;
USE db1;
CREATE PROCEDURE p1() BEGIN END;
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
GRANT USAGE ON db1.* to user_1@localhost;
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
GRANT UPDATE ON db1.* to USER_1@localhost;
connect (con1,localhost,user_1,,db1);
call p1();
call P1();
select f1(1);
connect (con2,localhost,USER_1,,db1);
--error ER_PROCACCESS_DENIED_ERROR
call p1();
--error ER_PROCACCESS_DENIED_ERROR
call P1();
--error ER_PROCACCESS_DENIED_ERROR
select f1(1);
connection default;
disconnect con1;
disconnect con2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
# End of 5.0 tests
--echo #
--echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
--echo #
CREATE TABLE t1(a INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
#
# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures
#
create database TEST;
create procedure TEST.pr() begin end;
create procedure test.pr() begin end;
--exec $MYSQL_UPGRADE --force 2>&1
drop procedure test.pr;
drop database TEST;
# End of 5.5 tests
#
# MDEV-9014 SHOW TRIGGERS not case sensitive
#
create table t1 (a int);
create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,417 @@
# Description
# -----------
# Numeric floating point.
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
SELECT 10,10.0,10.,.1e+2,100.0e-1;
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
SELECT 2147483647E+02,21474836.47E+06;
create table t1 (f1 float(24),f2 float(52));
# We mask out Privileges column because it differs for embedded server
--replace_column 8 #
show full columns from t1;
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
drop table t1;
create table t1 (datum double);
insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
select * from t1;
select * from t1 where datum < 1.5;
select * from t1 where datum > 1.5;
select * from t1 where datum = 1.5;
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
select a from t1 order by a;
select min(a) from t1;
drop table t1;
#
# BUG#3612, BUG#4393, BUG#4356, BUG#4394
#
create table t1 (c1 double, c2 varchar(20));
insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
# Floats are a bit different in PS
--disable_ps_protocol
select * from t2;
--enable_ps_protocol
show create table t2;
drop table t1,t2;
# Bug #1022: When a table contains a 'float' field,
# and one of the functions MAX, MIN, or AVG is used on that field,
# the system crashes.
create table t1 (a float);
insert into t1 values (1);
select max(a),min(a),avg(a) from t1;
drop table t1;
#
# FLOAT/DOUBLE/DECIMAL handling
#
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(7,6));
# We mask out Privileges column because it differs for embedded server
--replace_column 8 #
show full columns from t1;
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
select a from t1 order by a;
select min(a) from t1;
drop table t1;
--error 1425
create table t1 (a float(200,100), b double(200,100));
#
# float in a char(1) field
#
create table t1 (c20 char);
insert into t1 values (5000.0);
insert into t1 values (0.5e4);
drop table t1;
# Errors
--error 1063
create table t1 (f float(54)); # Should give an error
--disable_warnings
drop table if exists t1;
--enable_warnings
# Don't allow 'double unsigned' to be set to a negative value (Bug #7700)
create table t1 (d1 double, d2 double unsigned);
insert into t1 set d1 = -1.0;
update t1 set d2 = d1;
select * from t1;
drop table t1;
# Ensure that maximum values as the result of number of decimals
# being specified in table schema are enforced (Bug #7361)
create table t1 (f float(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
select * from t1;
drop table if exists t1;
create table t1 (f double(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
select * from t1;
drop table if exists t1;
# Check conversion of floats to character field (Bug #7774)
create table t1 (c char(20));
insert into t1 values (5e-28);
select * from t1;
drop table t1;
create table t1 (c char(6));
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
select * from t1;
drop table t1;
#
# Test of comparison of integer with float-in-range (Bug #7840)
# This is needed because some ODBC applications (like Foxpro) uses
# floats for everything.
#
CREATE TABLE t1 (
reckey int unsigned NOT NULL,
recdesc varchar(50) NOT NULL,
PRIMARY KEY (reckey)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (108, 'Has 108 as key');
INSERT INTO t1 VALUES (109, 'Has 109 as key');
select * from t1 where reckey=108;
select * from t1 where reckey=1.08E2;
select * from t1 where reckey=109;
select * from t1 where reckey=1.09E2;
drop table t1;
#
# Bug #13372 (decimal union)
#
create table t1 (d double(10,1));
create table t2 (d double(10,9));
insert into t1 values ("100000000.0");
insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
show create table t3;
drop table t1, t2, t3;
#
# Bug #9855 (inconsistent column type for create select
#
create table t1 select 105213674794682365.00 + 0.0 x;
show warnings;
desc t1;
drop table t1;
create table t1 select 0.0 x;
desc t1;
create table t2 select 105213674794682365.00 y;
desc t2;
create table t3 select x+y a from t1,t2;
show warnings;
desc t3;
drop table t1,t2,t3;
#
# Bug #22129: A small double precision number becomes zero
#
# check if underflows are detected correctly
select 1e-308, 1.00000001e-300, 100000000e-300;
# check if overflows are detected correctly
select 10e307;
#
# Bug #19690: ORDER BY eliminates rows from the result
#
create table t1(a int, b double(8, 2));
insert into t1 values
(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
(1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
(5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
(3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16),
(6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
explain select sum(b) s from t1 group by a;
select sum(b) s from t1 group by a;
select sum(b) s from t1 group by a having s <> 0;
select sum(b) s from t1 group by a having s <> 0 order by s;
select sum(b) s from t1 group by a having s <=> 0;
select sum(b) s from t1 group by a having s <=> 0 order by s;
alter table t1 add key (a, b);
explain select sum(b) s from t1 group by a;
select sum(b) s from t1 group by a;
select sum(b) s from t1 group by a having s <> 0;
select sum(b) s from t1 group by a having s <> 0 order by s;
select sum(b) s from t1 group by a having s <=> 0;
select sum(b) s from t1 group by a having s <=> 0 order by s;
drop table t1;
--echo End of 4.1 tests
#
# bug #12694 (float(m,d) specifications)
#
--error 1427
create table t1 (s1 float(0,2));
--error 1427
create table t1 (s1 float(1,2));
#
# MySQL Bugs: #11589: mysqltest --ps-protocol, strange output, float/double/real with zerofill
#
CREATE TABLE t1 (
f1 real zerofill,
f2 double zerofill,
f3 float zerofill);
INSERT INTO t1 VALUES ( 0.314152e+1, 0.314152e+1, 0.314152e+1);
let $my_stmt= select f1, f2, f3 FROM t1;
eval PREPARE stmt1 FROM '$my_stmt';
select f1, f2, f3 FROM t1;
eval $my_stmt;
EXECUTE stmt1;
DROP TABLE t1;
# Bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
#
create table t1 (f1 double(200, 0));
insert into t1 values (1e199), (-1e199);
insert into t1 values (1e200), (-1e200);
insert into t1 values (2e200), (-2e200);
select f1 + 0e0 from t1;
drop table t1;
create table t1 (f1 float(30, 0));
insert into t1 values (1e29), (-1e29);
insert into t1 values (1e30), (-1e30);
insert into t1 values (2e30), (-2e30);
select f1 + 0e0 from t1;
drop table t1;
#
# Bug #12860 "Difference in zero padding of exponent between Unix and Windows"
#
create table t1 (c char(6));
insert into t1 values (2e6),(2e-5);
select * from t1;
drop table t1;
#
# Bug #21497 "DOUBLE truncated to unusable value"
#
CREATE TABLE d1 (d DOUBLE);
INSERT INTO d1 VALUES (1.7976931348623157E+308);
SELECT * FROM d1;
--error ER_ILLEGAL_VALUE_FOR_TYPE
INSERT INTO d1 VALUES (1.79769313486232e+308);
SELECT * FROM d1;
DROP TABLE d1;
#
# Bug #26788 "mysqld (debug) aborts when inserting specific numbers into char
# fields"
#
create table t1 (a char(20));
insert into t1 values (1.225e-05);
select a+0 from t1;
drop table t1;
#
# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
# windows.
#
create table t1(d double, u bigint unsigned);
insert into t1(d) values (9.22337203685479e18),
(1.84e19);
update t1 set u = d;
select u from t1;
drop table t1;
#
# Bug #21205: Different number of digits for float/doble/real in --ps-protocol
#
CREATE TABLE t1 (f1 DOUBLE);
INSERT INTO t1 VALUES(-1.79769313486231e+308);
SELECT f1 FROM t1;
DROP TABLE t1;
--echo #
--echo # Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
--echo #
--echo # Ignoring output from misc. float operations
--disable_result_log
let $nine_65=
99999999999999999999999999999999999999999999999999999999999999999;
select format(-1.7976931348623157E+307,256) as foo;
select least(-1.1111111111111111111111111,
- group_concat(1.7976931348623157E+308)) as foo;
eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
($nine_65)) into @a;
--enable_result_log
--echo End of 5.0 tests
--echo #
--echo # Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
--echo #
select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
--echo #
--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
--echo #
SELECT LEFT('a',EXP(50));
SELECT LEFT('a', COALESCE(1e30));
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES (1e30);
SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
DROP TABLE t1;
PREPARE stmt FROM 'SELECT LEFT(111,?)';
SET @a=1e30;
EXECUTE stmt USING @a;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (1e30),(0);
SELECT LEFT('a', SUM(a)) FROM t1;
SELECT LEFT('a', AVG(a)) FROM t1;
DROP TABLE t1;
--echo #
--echo # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265
--echo # (WARN_DATA_TRUNCATED)
--echo #
CREATE TABLE t1 (f FLOAT);
INSERT INTO t1 VALUES ('1.');
INSERT INTO t1 VALUES ('2.0.');
INSERT INTO t1 VALUES ('.');
SELECT * FROM t1 ORDER BY f;
DROP TABLE t1;
--echo #
--echo # Start of 10.0 tests
--echo #
--echo #
--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
--echo #
CREATE TABLE t1 (a DATETIME PRIMARY KEY);
INSERT INTO t1 VALUES ('1999-01-01 00:00:00');
CREATE TABLE t2 (a DOUBLE);
INSERT INTO t2 VALUES (19990101000000);
INSERT INTO t2 VALUES (990101000000);
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
--echo # t2 should NOT be eliminated
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns
--echo #
CREATE TABLE t1 (a TIME(6) PRIMARY KEY);
INSERT INTO t1 VALUES ('10:20:30');
CREATE TABLE t2 (a DOUBLE);
INSERT INTO t2 VALUES (102030),(102030.000000001);
SELECT t1.* FROM t1 JOIN t2 USING(a);
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1 JOIN t2 USING(a);
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
--echo # t2 should NOT be elimitated
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
DROP TABLE t1,t2;
--echo #
--echo # End of 10.0 tests
--echo #

View File

@@ -10,5 +10,6 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2 select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null; left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below: there should be *no* variables listed below:
wsrep_certification_rules
drop table t1; drop table t1;
drop table t2; drop table t2;

View File

@@ -29,6 +29,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME WSREP_CERTIFICATION_RULES
SESSION_VALUE NULL
GLOBAL_VALUE strict
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE strict
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Certification rules to use in the cluster. Possible values are: "strict": stricter rules that could result in more certification failures. "optimized": relaxed rules that allow more concurrency and cause less certification failures.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST strict,optimized
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_CERTIFY_NONPK VARIABLE_NAME WSREP_CERTIFY_NONPK
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE ON GLOBAL_VALUE ON

View File

@@ -4439,6 +4439,22 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
else else
thd->variables.collation_database= thd->db_charset; thd->variables.collation_database= thd->db_charset;
{
const CHARSET_INFO *cs= thd->charset();
/*
We cannot ask for parsing a statement using a character set
without state_maps (parser internal data).
*/
if (!cs->state_map)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"character_set cannot be parsed");
thd->is_slave_error= true;
goto end;
}
}
/* /*
Record any GTID in the same transaction, so slave state is Record any GTID in the same transaction, so slave state is
transactionally consistent. transactionally consistent.
@@ -7943,6 +7959,11 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F. we keep the flags set to UNDEF_F.
*/ */
uint bytes_read= ((val + val_len) - buf_start); uint bytes_read= ((val + val_len) - buf_start);
if (bytes_read > event_len)
{
error= true;
goto err;
}
if ((data_written - bytes_read) > 0) if ((data_written - bytes_read) > 0)
{ {
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +

View File

@@ -4940,6 +4940,19 @@ static Sys_var_mybool Sys_wsrep_certify_nonPK(
GLOBAL_VAR(wsrep_certify_nonPK), GLOBAL_VAR(wsrep_certify_nonPK),
CMD_LINE(OPT_ARG), DEFAULT(TRUE)); CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static const char *wsrep_certification_rules_names[]= { "strict", "optimized", NullS };
static Sys_var_enum Sys_wsrep_certification_rules(
"wsrep_certification_rules",
"Certification rules to use in the cluster. Possible values are: "
"\"strict\": stricter rules that could result in more certification "
"failures. "
"\"optimized\": relaxed rules that allow more concurrency and "
"cause less certification failures.",
GLOBAL_VAR(wsrep_certification_rules), CMD_LINE(REQUIRED_ARG),
wsrep_certification_rules_names, DEFAULT(WSREP_CERTIFICATION_RULES_STRICT),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(0));
static Sys_var_mybool Sys_wsrep_causal_reads( static Sys_var_mybool Sys_wsrep_causal_reads(
"wsrep_causal_reads", "Setting this variable is equivalent " "wsrep_causal_reads", "Setting this variable is equivalent "
"to setting wsrep_sync_wait READ flag", "to setting wsrep_sync_wait READ flag",

View File

@@ -77,6 +77,7 @@ ulong wsrep_max_ws_size = 1073741824UL;//max ws (RBR buffer) size
ulong wsrep_max_ws_rows = 65536; // max number of rows in ws ulong wsrep_max_ws_rows = 65536; // max number of rows in ws
int wsrep_to_isolation = 0; // # of active TO isolation threads int wsrep_to_isolation = 0; // # of active TO isolation threads
my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key
ulong wsrep_certification_rules = WSREP_CERTIFICATION_RULES_STRICT;
long wsrep_max_protocol_version = 3; // maximum protocol version to use long wsrep_max_protocol_version = 3; // maximum protocol version to use
ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC; ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC;
my_bool wsrep_recovery = 0; // recovery my_bool wsrep_recovery = 0; // recovery

View File

@@ -30,6 +30,7 @@ typedef struct st_mysql_show_var SHOW_VAR;
#include "mdl.h" #include "mdl.h"
#include "mysqld.h" #include "mysqld.h"
#include "sql_table.h" #include "sql_table.h"
#include "wsrep_mysqld_c.h"
#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX #define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX

26
sql/wsrep_mysqld_c.h Normal file
View File

@@ -0,0 +1,26 @@
/* Copyright 2018-2018 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef WSREP_MYSQLD_C_H
#define WSREP_MYSQLD_C_H
enum enum_wsrep_certification_rules {
WSREP_CERTIFICATION_RULES_STRICT,
WSREP_CERTIFICATION_RULES_OPTIMIZED
};
extern ulong wsrep_certification_rules;
#endif /* WSREP_MYSQLD_C_H */

View File

@@ -112,6 +112,7 @@ MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[];
#include "fts0priv.h" #include "fts0priv.h"
#include "page0zip.h" #include "page0zip.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#include "dict0priv.h"
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X)) #define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
@@ -134,7 +135,7 @@ MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[];
# endif /* MYSQL_PLUGIN_IMPORT */ # endif /* MYSQL_PLUGIN_IMPORT */
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "dict0priv.h" #include "../../../wsrep/wsrep_api.h"
#include "../storage/innobase/include/ut0byte.h" #include "../storage/innobase/include/ut0byte.h"
#include <mysql/service_md5.h> #include <mysql/service_md5.h>
@@ -8449,7 +8450,8 @@ report_error:
&& wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(user_thd) && !wsrep_consistency_check(user_thd)
&& !wsrep_thd_ignore_table(user_thd)) { && !wsrep_thd_ignore_table(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR; error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
@@ -8972,7 +8974,8 @@ func_exit:
{ {
DBUG_PRINT("wsrep", ("update row key")); DBUG_PRINT("wsrep", ("update row key"));
if (wsrep_append_keys(user_thd, false, old_row, new_row)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, old_row,
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED"); WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
err = HA_ERR_INTERNAL_ERROR; err = HA_ERR_INTERNAL_ERROR;
@@ -9036,7 +9039,8 @@ ha_innobase::delete_row(
wsrep_on(user_thd) && wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd)) !wsrep_thd_ignore_table(user_thd))
{ {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail")); DBUG_PRINT("wsrep", ("delete fail"));
error = (dberr_t) HA_ERR_INTERNAL_ERROR; error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
@@ -10282,8 +10286,22 @@ wsrep_dict_foreign_find_index(
ibool check_charsets, ibool check_charsets,
ulint check_null); ulint check_null);
inline
const char*
wsrep_key_type_to_str(wsrep_key_type type)
{
switch (type) {
case WSREP_KEY_SHARED:
return "shared";
case WSREP_KEY_SEMI:
return "semi";
case WSREP_KEY_EXCLUSIVE:
return "exclusive";
};
return "unknown";
}
extern dberr_t ulint
wsrep_append_foreign_key( wsrep_append_foreign_key(
/*===========================*/ /*===========================*/
trx_t* trx, /*!< in: trx */ trx_t* trx, /*!< in: trx */
@@ -10291,7 +10309,8 @@ wsrep_append_foreign_key(
const rec_t* rec, /*!<in: clustered index record */ const rec_t* rec, /*!<in: clustered index record */
dict_index_t* index, /*!<in: clustered index */ dict_index_t* index, /*!<in: clustered index */
ibool referenced, /*!<in: is check for referenced table */ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */ wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{ {
ut_a(trx); ut_a(trx);
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
@@ -10389,10 +10408,11 @@ wsrep_append_foreign_key(
rcode = wsrep_rec_get_foreign_key( rcode = wsrep_rec_get_foreign_key(
&key[1], &len, rec, index, idx, &key[1], &len, rec, index, idx,
wsrep_protocol_version > 1); wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) { if (rcode != DB_SUCCESS) {
WSREP_ERROR( WSREP_ERROR(
"FK key set failed: %lu (%lu %lu), index: %s %s, %s", "FK key set failed: %lu (%lu %s), index: %s %s, %s",
rcode, referenced, shared, rcode, referenced, wsrep_key_type_to_str(key_type),
(index && index->name) ? index->name : (index && index->name) ? index->name :
"void index", "void index",
(index && index->table_name) ? index->table_name : (index && index->table_name) ? index->table_name :
@@ -10400,6 +10420,7 @@ wsrep_append_foreign_key(
wsrep_thd_query(thd)); wsrep_thd_query(thd));
return DB_ERROR; return DB_ERROR;
} }
strncpy(cache_key, strncpy(cache_key,
(wsrep_protocol_version > 1) ? (wsrep_protocol_version > 1) ?
((referenced) ? ((referenced) ?
@@ -10444,7 +10465,7 @@ wsrep_append_foreign_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %zu", rcode)); DBUG_PRINT("wsrep", ("row key failed: %zu", rcode));
@@ -10466,15 +10487,16 @@ wsrep_append_key(
TABLE *table, TABLE *table,
const char* key, const char* key,
uint16_t key_len, uint16_t key_len,
bool shared wsrep_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
) )
{ {
DBUG_ENTER("wsrep_append_key"); DBUG_ENTER("wsrep_append_key");
bool const copy = true; bool const copy = true;
#ifdef WSREP_DEBUG_PRINT #ifdef WSREP_DEBUG_PRINT
fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ", fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
(shared) ? "Shared" : "Exclusive", wsrep_key_type_to_str(key_type),
thd_get_thread_id(thd), (long long)trx->id, key_len, wsrep_thd_thread_id(thd), trx->id, key_len,
table_share->table_name.str, wsrep_thd_query(thd)); table_share->table_name.str, wsrep_thd_query(thd));
for (int i=0; i<key_len; i++) { for (int i=0; i<key_len; i++) {
fprintf(stderr, "%hhX, ", key[i]); fprintf(stderr, "%hhX, ", key[i]);
@@ -10501,7 +10523,7 @@ wsrep_append_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
@@ -10538,7 +10560,8 @@ int
ha_innobase::wsrep_append_keys( ha_innobase::wsrep_append_keys(
/*==================*/ /*==================*/
THD *thd, THD *thd,
bool shared, wsrep_key_type key_type, /*!< in: access type of this key
(shared, exclusive, semi...) */
const uchar* record0, /* in: row in MySQL format */ const uchar* record0, /* in: row in MySQL format */
const uchar* record1) /* in: row in MySQL format */ const uchar* record1) /* in: row in MySQL format */
{ {
@@ -10570,7 +10593,7 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, table, keyval, thd, trx, table_share, table, keyval,
len, shared); len, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
else else
@@ -10623,10 +10646,11 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, table, thd, trx, table_share, table,
keyval0, len+1, shared); keyval0, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
if (key_info->flags & HA_NOSAME || shared) if (key_info->flags & HA_NOSAME ||
key_type == WSREP_KEY_SHARED)
key_appended = true; key_appended = true;
} }
else else
@@ -10643,7 +10667,7 @@ ha_innobase::wsrep_append_keys(
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, thd, trx, table_share,
table, table,
keyval1, len+1, shared); keyval1, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
} }
@@ -10659,7 +10683,7 @@ ha_innobase::wsrep_append_keys(
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table, if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16, (const char*) digest, 16,
shared))) { key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
@@ -10669,7 +10693,7 @@ ha_innobase::wsrep_append_keys(
if ((rcode = wsrep_append_key(thd, trx, table_share, if ((rcode = wsrep_append_key(thd, trx, table_share,
table, table,
(const char*) digest, (const char*) digest,
16, shared))) { 16, key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
} }

View File

@@ -26,6 +26,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0stats.h" #include "dict0stats.h"
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/* Structure defines translation table between mysql index and innodb /* Structure defines translation table between mysql index and innodb
index structures */ index structures */
struct innodb_idx_translate_t { struct innodb_idx_translate_t {
@@ -115,7 +119,7 @@ class ha_innobase: public handler
dict_index_t* innobase_get_index(uint keynr); dict_index_t* innobase_get_index(uint keynr);
#ifdef WITH_WSREP #ifdef WITH_WSREP
int wsrep_append_keys(THD *thd, bool shared, int wsrep_append_keys(THD *thd, wsrep_key_type key_type,
const uchar* record0, const uchar* record1); const uchar* record0, const uchar* record1);
#endif #endif
/* Init values for the class: */ /* Init values for the class: */

View File

@@ -55,6 +55,11 @@ Created 4/20/1996 Heikki Tuuri
#include "fts0types.h" #include "fts0types.h"
#include "m_string.h" #include "m_string.h"
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#include "wsrep_mysqld_c.h"
#endif /* WITH_WSREP */
/************************************************************************* /*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there IMPORTANT NOTE: Any operation that generates redo MUST check that there
is enough space in the redo log before for that operation. This is is enough space in the redo log before for that operation. This is
@@ -933,11 +938,11 @@ row_ins_invalidate_query_cache(
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
dberr_t wsrep_append_foreign_key(trx_t *trx, dberr_t wsrep_append_foreign_key(trx_t *trx,
dict_foreign_t* foreign, dict_foreign_t* foreign,
const rec_t* clust_rec, const rec_t* clust_rec,
dict_index_t* clust_index, dict_index_t* clust_index,
ibool referenced, ibool referenced,
ibool shared); enum wsrep_key_type key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/*********************************************************************//** /*********************************************************************//**
@@ -1296,7 +1301,7 @@ row_ins_foreign_check_on_constraint(
foreign, foreign,
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE); FALSE, WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"WSREP: foreign key append failed: %d\n", err); "WSREP: foreign key append failed: %d\n", err);
@@ -1638,16 +1643,34 @@ run_again:
} }
if (check_ref) { if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP #ifdef WITH_WSREP
enum wsrep_key_type key_type = WSREP_KEY_EXCLUSIVE;
#endif WITH_WSREP
err = DB_SUCCESS;
#ifdef WITH_WSREP
if (upd_node != NULL) {
key_type = WSREP_KEY_SHARED;
} else {
switch (wsrep_certification_rules) {
case WSREP_CERTIFICATION_RULES_STRICT:
key_type = WSREP_KEY_EXCLUSIVE;
break;
case WSREP_CERTIFICATION_RULES_OPTIMIZED:
key_type = WSREP_KEY_SEMI;
break;
}
}
err = wsrep_append_foreign_key( err = wsrep_append_foreign_key(
thr_get_trx(thr), thr_get_trx(thr),
foreign, foreign,
rec, rec,
check_index, check_index,
check_ref, check_ref,
(upd_node) ? TRUE : FALSE); key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
goto end_scan; goto end_scan;
} else if (foreign->type != 0) { } else if (foreign->type != 0) {
/* There is an ON UPDATE or ON DELETE /* There is an ON UPDATE or ON DELETE

View File

@@ -110,6 +110,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "fts0priv.h" #include "fts0priv.h"
#include "page0zip.h" #include "page0zip.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#include "dict0priv.h"
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X)) #define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
@@ -133,7 +134,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
# endif /* MYSQL_PLUGIN_IMPORT */ # endif /* MYSQL_PLUGIN_IMPORT */
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "dict0priv.h" #include "../../../wsrep/wsrep_api.h"
#include "../storage/innobase/include/ut0byte.h" #include "../storage/innobase/include/ut0byte.h"
#include <mysql/service_md5.h> #include <mysql/service_md5.h>
@@ -8894,6 +8895,7 @@ no_commit:
error = row_insert_for_mysql((byte*) record, prebuilt); error = row_insert_for_mysql((byte*) record, prebuilt);
DEBUG_SYNC(user_thd, "ib_after_row_insert"); DEBUG_SYNC(user_thd, "ib_after_row_insert");
/* Handle duplicate key errors */ /* Handle duplicate key errors */
if (auto_inc_used) { if (auto_inc_used) {
ulonglong auto_inc; ulonglong auto_inc;
@@ -9035,7 +9037,7 @@ report_error:
&& wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(user_thd) && !wsrep_consistency_check(user_thd)
&& !wsrep_thd_ignore_table(user_thd)) { && !wsrep_thd_ignore_table(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR; error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
@@ -9556,7 +9558,8 @@ func_exit:
{ {
DBUG_PRINT("wsrep", ("update row key")); DBUG_PRINT("wsrep", ("update row key"));
if (wsrep_append_keys(user_thd, false, old_row, new_row)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, old_row,
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED"); WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
err = HA_ERR_INTERNAL_ERROR; err = HA_ERR_INTERNAL_ERROR;
@@ -9619,7 +9622,8 @@ ha_innobase::delete_row(
wsrep_on(user_thd) && wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd)) !wsrep_thd_ignore_table(user_thd))
{ {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail")); DBUG_PRINT("wsrep", ("delete fail"));
error = (dberr_t) HA_ERR_INTERNAL_ERROR; error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
@@ -10850,8 +10854,22 @@ wsrep_dict_foreign_find_index(
ibool check_charsets, ibool check_charsets,
ulint check_null); ulint check_null);
inline
const char*
wsrep_key_type_to_str(wsrep_key_type type)
{
switch (type) {
case WSREP_KEY_SHARED:
return "shared";
case WSREP_KEY_SEMI:
return "semi";
case WSREP_KEY_EXCLUSIVE:
return "exclusive";
};
return "unknown";
}
extern dberr_t ulint
wsrep_append_foreign_key( wsrep_append_foreign_key(
/*===========================*/ /*===========================*/
trx_t* trx, /*!< in: trx */ trx_t* trx, /*!< in: trx */
@@ -10859,7 +10877,8 @@ wsrep_append_foreign_key(
const rec_t* rec, /*!<in: clustered index record */ const rec_t* rec, /*!<in: clustered index record */
dict_index_t* index, /*!<in: clustered index */ dict_index_t* index, /*!<in: clustered index */
ibool referenced, /*!<in: is check for referenced table */ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */ wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{ {
ut_a(trx); ut_a(trx);
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
@@ -10957,10 +10976,11 @@ wsrep_append_foreign_key(
rcode = wsrep_rec_get_foreign_key( rcode = wsrep_rec_get_foreign_key(
&key[1], &len, rec, index, idx, &key[1], &len, rec, index, idx,
wsrep_protocol_version > 1); wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) { if (rcode != DB_SUCCESS) {
WSREP_ERROR( WSREP_ERROR(
"FK key set failed: %lu (%lu %lu), index: %s %s, %s", "FK key set failed: %lu (%lu %s), index: %s %s, %s",
rcode, referenced, shared, rcode, referenced, wsrep_key_type_to_str(key_type),
(index && index->name) ? index->name : (index && index->name) ? index->name :
"void index", "void index",
(index && index->table_name) ? index->table_name : (index && index->table_name) ? index->table_name :
@@ -10968,6 +10988,7 @@ wsrep_append_foreign_key(
wsrep_thd_query(thd)); wsrep_thd_query(thd));
return DB_ERROR; return DB_ERROR;
} }
strncpy(cache_key, strncpy(cache_key,
(wsrep_protocol_version > 1) ? (wsrep_protocol_version > 1) ?
((referenced) ? ((referenced) ?
@@ -11012,7 +11033,7 @@ wsrep_append_foreign_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %zu", rcode)); DBUG_PRINT("wsrep", ("row key failed: %zu", rcode));
@@ -11034,14 +11055,15 @@ wsrep_append_key(
TABLE *table, TABLE *table,
const char* key, const char* key,
uint16_t key_len, uint16_t key_len,
bool shared wsrep_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
) )
{ {
DBUG_ENTER("wsrep_append_key"); DBUG_ENTER("wsrep_append_key");
bool const copy = true; bool const copy = true;
#ifdef WSREP_DEBUG_PRINT #ifdef WSREP_DEBUG_PRINT
fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ", fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
(shared) ? "Shared" : "Exclusive", wsrep_key_type_to_str(key_type),
thd_get_thread_id(thd), (long long)trx->id, key_len, thd_get_thread_id(thd), (long long)trx->id, key_len,
table_share->table_name.str, wsrep_thd_query(thd)); table_share->table_name.str, wsrep_thd_query(thd));
for (int i=0; i<key_len; i++) { for (int i=0; i<key_len; i++) {
@@ -11069,7 +11091,7 @@ wsrep_append_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
@@ -11106,7 +11128,8 @@ int
ha_innobase::wsrep_append_keys( ha_innobase::wsrep_append_keys(
/*==================*/ /*==================*/
THD *thd, THD *thd,
bool shared, wsrep_key_type key_type, /*!< in: access type of this key
(shared, exclusive, semi...) */
const uchar* record0, /* in: row in MySQL format */ const uchar* record0, /* in: row in MySQL format */
const uchar* record1) /* in: row in MySQL format */ const uchar* record1) /* in: row in MySQL format */
{ {
@@ -11138,7 +11161,7 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, table, keyval, thd, trx, table_share, table, keyval,
len, shared); len, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
else else
@@ -11191,10 +11214,11 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, table, thd, trx, table_share, table,
keyval0, len+1, shared); keyval0, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
if (key_info->flags & HA_NOSAME || shared) if (key_info->flags & HA_NOSAME ||
key_type == WSREP_KEY_SHARED)
key_appended = true; key_appended = true;
} }
else else
@@ -11211,7 +11235,7 @@ ha_innobase::wsrep_append_keys(
rcode = wsrep_append_key( rcode = wsrep_append_key(
thd, trx, table_share, thd, trx, table_share,
table, table,
keyval1, len+1, shared); keyval1, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
} }
@@ -11227,7 +11251,7 @@ ha_innobase::wsrep_append_keys(
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table, if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16, (const char*) digest, 16,
shared))) { key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
@@ -11237,7 +11261,7 @@ ha_innobase::wsrep_append_keys(
if ((rcode = wsrep_append_key(thd, trx, table_share, if ((rcode = wsrep_append_key(thd, trx, table_share,
table, table,
(const char*) digest, (const char*) digest,
16, shared))) { 16, key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
} }

View File

@@ -26,6 +26,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0stats.h" #include "dict0stats.h"
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/* Structure defines translation table between mysql index and innodb /* Structure defines translation table between mysql index and innodb
index structures */ index structures */
struct innodb_idx_translate_t { struct innodb_idx_translate_t {
@@ -115,7 +119,7 @@ class ha_innobase: public handler
dict_index_t* innobase_get_index(uint keynr); dict_index_t* innobase_get_index(uint keynr);
#ifdef WITH_WSREP #ifdef WITH_WSREP
int wsrep_append_keys(THD *thd, bool shared, int wsrep_append_keys(THD *thd, wsrep_key_type key_type,
const uchar* record0, const uchar* record1); const uchar* record0, const uchar* record1);
#endif #endif
/* Init values for the class: */ /* Init values for the class: */

View File

@@ -55,6 +55,11 @@ Created 4/20/1996 Heikki Tuuri
#include "fts0types.h" #include "fts0types.h"
#include "m_string.h" #include "m_string.h"
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#include "wsrep_mysqld_c.h"
#endif /* WITH_WSREP */
/************************************************************************* /*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there IMPORTANT NOTE: Any operation that generates redo MUST check that there
is enough space in the redo log before for that operation. This is is enough space in the redo log before for that operation. This is
@@ -939,11 +944,11 @@ row_ins_invalidate_query_cache(
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
dberr_t wsrep_append_foreign_key(trx_t *trx, dberr_t wsrep_append_foreign_key(trx_t *trx,
dict_foreign_t* foreign, dict_foreign_t* foreign,
const rec_t* clust_rec, const rec_t* clust_rec,
dict_index_t* clust_index, dict_index_t* clust_index,
ibool referenced, ibool referenced,
ibool shared); enum wsrep_key_type key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/*********************************************************************//** /*********************************************************************//**
@@ -1302,7 +1307,7 @@ row_ins_foreign_check_on_constraint(
foreign, foreign,
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE); FALSE, WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"WSREP: foreign key append failed: %d\n", err); "WSREP: foreign key append failed: %d\n", err);
@@ -1650,16 +1655,34 @@ run_again:
} }
if (check_ref) { if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP #ifdef WITH_WSREP
enum wsrep_key_type key_type = WSREP_KEY_EXCLUSIVE;
#endif /* WITH_WSREP */
err = DB_SUCCESS;
#ifdef WITH_WSREP
if (upd_node != NULL) {
key_type = WSREP_KEY_SHARED;
} else {
switch (wsrep_certification_rules) {
case WSREP_CERTIFICATION_RULES_STRICT:
key_type = WSREP_KEY_EXCLUSIVE;
break;
case WSREP_CERTIFICATION_RULES_OPTIMIZED:
key_type = WSREP_KEY_SEMI;
break;
}
}
err = wsrep_append_foreign_key( err = wsrep_append_foreign_key(
thr_get_trx(thr), thr_get_trx(thr),
foreign, foreign,
rec, rec,
check_index, check_index,
check_ref, check_ref,
(upd_node) ? TRUE : FALSE); key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
goto end_scan; goto end_scan;
} else if (foreign->type != 0) { } else if (foreign->type != 0) {
/* There is an ON UPDATE or ON DELETE /* There is an ON UPDATE or ON DELETE

View File

@@ -116,7 +116,6 @@ if(NOT MINGW)
win32/zlib1.rc # If present will override custom build rule below. win32/zlib1.rc # If present will override custom build rule below.
) )
endif() endif()
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
@@ -145,4 +144,4 @@ elseif(UNIX)
if(NOT APPLE) if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif() endif()
endif() endif()