Merge branch '10.2' into 10.3

This commit is contained in:
Sergei Golubchik 2019-03-29 19:40:56 +01:00
commit 4e1d3f83b7
49 changed files with 642 additions and 254 deletions

View File

@ -502,6 +502,8 @@ IF(UNIX)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme)
ENDIF()
INCLUDE(build_depends)
INCLUDE(CPack)
IF(WIN32 AND SIGNCODE)

View File

@ -95,8 +95,8 @@ IF(WIN32)
ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
SET(CHECKMODULE /usr/bin/checkmodule CACHE FILEPATH "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "")
ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")

39
cmake/build_depends.cmake Normal file
View File

@ -0,0 +1,39 @@
IF(RPM)
MACRO(FIND_DEP V)
SET(out ${V}_DEP)
IF (NOT DEFINED ${out})
IF(EXISTS ${${V}} AND NOT IS_DIRECTORY ${${V}})
EXECUTE_PROCESS(COMMAND ${ARGN} RESULT_VARIABLE res OUTPUT_VARIABLE O OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE()
SET(res 1)
ENDIF()
IF (res)
SET(O)
ELSE()
MESSAGE(STATUS "Need ${O} for ${${V}}")
ENDIF()
SET(${out} ${O} CACHE INTERNAL "Package that contains ${${V}}" FORCE)
ENDIF()
ENDMACRO()
GET_CMAKE_PROPERTY(ALL_VARS CACHE_VARIABLES)
FOREACH (V ${ALL_VARS})
GET_PROPERTY(H CACHE ${V} PROPERTY HELPSTRING)
IF (H MATCHES "^Have library [^/]" AND ${V})
STRING(REGEX REPLACE "^Have library " "" L ${H})
SET(V ${L}_LIBRARY)
FIND_LIBRARY(${V} ${L})
ENDIF()
GET_PROPERTY(T CACHE ${V} PROPERTY TYPE)
IF ((T STREQUAL FILEPATH OR V MATCHES "^CMAKE_COMMAND$") AND ${V} MATCHES "^/")
IF (RPM)
FIND_DEP(${V} rpm -q --qf "%{NAME}" -f ${${V}})
ELSE() # must be DEB
MESSAGE(FATAL_ERROR "Not implemented")
ENDIF ()
SET(BUILD_DEPS ${BUILD_DEPS} ${${V}_DEP})
ENDIF()
ENDFOREACH()
LIST(REMOVE_DUPLICATES BUILD_DEPS)
STRING(REPLACE ";" " " CPACK_RPM_BUILDREQUIRES "${BUILD_DEPS}")
ENDIF(RPM)

View File

@ -83,6 +83,12 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define _sysconfdir ${INSTALL_SYSCONFDIR}
%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb
%define restart_flag %{restart_flag_dir}/need-restart
%{?filter_setup:
%filter_from_provides /perl(\\\\(mtr\\\\|My::\\\\)/d
%filter_from_requires /\\\\(lib\\\\(ft\\\\|lzma\\\\|tokuportability\\\\)\\\\)\\\\|\\\\(perl(\\\\(.*mtr\\\\|My::\\\\|.*HandlerSocket\\\\|Mysql\\\\)\\\\)/d
%filter_setup
}
")
# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
@ -202,7 +208,7 @@ ALTERNATIVE_NAME("server" "mysql-server")
ALTERNATIVE_NAME("test" "mysql-test")
# Argh! Different distributions call packages differently, to be a drop-in
# replacement we have to fake distribution-specificic dependencies
# replacement we have to fake distribution-specific dependencies
IF(RPM MATCHES "(rhel|centos)6")
ALTERNATIVE_NAME("client" "mysql")
@ -218,36 +224,6 @@ ELSEIF(RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3")
ENDIF()
# workaround for lots of perl dependencies added by rpmbuild
SETA(CPACK_RPM_test_PACKAGE_PROVIDES
"perl(lib::mtr_gcov.pl)"
"perl(lib::mtr_gprof.pl)"
"perl(lib::mtr_io.pl)"
"perl(lib::mtr_misc.pl)"
"perl(lib::mtr_process.pl)"
"perl(lib::v1/mtr_cases.pl)"
"perl(lib::v1/mtr_gcov.pl)"
"perl(lib::v1/mtr_gprof.pl)"
"perl(lib::v1/mtr_im.pl)"
"perl(lib::v1/mtr_io.pl)"
"perl(lib::v1/mtr_match.pl)"
"perl(lib::v1/mtr_misc.pl)"
"perl(lib::v1/mtr_process.pl)"
"perl(lib::v1/mtr_report.pl)"
"perl(lib::v1/mtr_stress.pl)"
"perl(lib::v1/mtr_timer.pl)"
"perl(lib::v1/mtr_unique.pl)"
"perl(mtr_cases)"
"perl(mtr_io.pl)"
"perl(mtr_match)"
"perl(mtr_misc.pl)"
"perl(mtr_gcov.pl)"
"perl(mtr_gprof.pl)"
"perl(mtr_process.pl)"
"perl(mtr_report)"
"perl(mtr_results)"
"perl(mtr_unique)")
# If we want to build build MariaDB-shared-compat,
# extract compat libraries from MariaDB-shared-5.3 rpm
FILE(GLOB compat53 RELATIVE ${CMAKE_SOURCE_DIR}
@ -294,4 +270,24 @@ IF(compat53 AND compat101)
ENDIF()
ENDIF()
################
IF(CMAKE_VERSION VERSION_GREATER "3.9.99")
SET(CPACK_SOURCE_GENERATOR "RPM")
SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
"-DBUILD_CONFIG=mysql_release"
"-DRPM=${RPM}"
"-DCPACK_RPM_BUILD_SOURCE_DIRS_PREFIX=/usr/src/debug/${CPACK_RPM_PACKAGE_NAME}-${VERSION}"
)
MACRO(ADDIF var)
IF(DEFINED ${var})
SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS "-D${var}=${${var}}")
ENDIF()
ENDMACRO()
ADDIF(BUILD_CONFIG)
ADDIF(WITH_SSL)
ENDIF()
ENDIF(RPM)

View File

@ -15,18 +15,19 @@
SET(CPACK_SOURCE_IGNORE_FILES
\\\\.git/
\\\\.gitignore
CMakeCache\\\\.txt
cmake_dist\\\\.cmake
CPackSourceConfig\\\\.cmake
CPackConfig.cmake
/cmake_install\\\\.cmake
/CTestTestfile\\\\.cmake
\\\\.gitignore$
\\\\.gitattributes$
CMakeCache\\\\.txt$
cmake_dist\\\\.cmake$
CPackSourceConfig\\\\.cmake$
CPackConfig.cmake$
/cmake_install\\\\.cmake$
/CTestTestfile\\\\.cmake$
/CMakeFiles/
/version_resources/
/_CPack_Packages/
$\\\\.gz
$\\\\.zip
\\\\.gz$
\\\\.zip$
/CMakeFiles/
/version_resources/
/_CPack_Packages/
@ -49,5 +50,6 @@ include/config\\\\.h$
include/my_config\\\\.h$
/autom4te\\\\.cache/
errmsg\\\\.sys$
\\\\.rpm$
#
)

View File

@ -33,10 +33,15 @@ SET(MY_WARNING_FLAGS
-Wnon-virtual-dtor
-Wvla
-Wwrite-strings
-Werror
)
IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
SET(WHERE)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized)
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF")
RETURN()
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(WHERE DEBUG)
ENDIF()

View File

@ -37,3 +37,8 @@ SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC)
MESSAGE("== Configuring MariaDB Connector/C")
ADD_SUBDIRECTORY(libmariadb)
#remove after merging libmariadb > v3.0.9
IF(TARGET caching_sha2_password AND CMAKE_C_FLAGS_DEBUG MATCHES "-Werror")
SET_PROPERTY(TARGET caching_sha2_password APPEND_STRING PROPERTY COMPILE_FLAGS -Wno-unused-function)
ENDIF()

View File

@ -233,9 +233,6 @@ MACRO(MYSQL_ADD_PLUGIN)
IF (NOT ARG_CLIENT)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server${ver}" PARENT_SCOPE)
ENDIF()
# workarounds for cmake issues #13248 and #12864:
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE)
IF(NOT ARG_CLIENT AND UNIX)
IF (NOT ARG_CONFIG)

View File

@ -40,22 +40,14 @@ MACRO(CHECK_SYSTEMD)
SET(LIBSYSTEMD systemd)
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES ${LIBSYSTEMD})
CHECK_C_SOURCE_COMPILES(
"
#include <systemd/sd-daemon.h>
int main()
{
sd_listen_fds(0);
}"
HAVE_SYSTEMD)
CHECK_LIBRARY_EXISTS(systemd sd_listen_fds "" HAVE_SYSTEMD_SD_LISTEN_FDS)
CHECK_INCLUDE_FILES(systemd/sd-daemon.h HAVE_SYSTEMD_SD_DAEMON_H)
CHECK_FUNCTION_EXISTS(sd_listen_fds HAVE_SYSTEMD_SD_LISTEN_FDS)
CHECK_FUNCTION_EXISTS(sd_notify HAVE_SYSTEMD_SD_NOTIFY)
CHECK_FUNCTION_EXISTS(sd_notifyf HAVE_SYSTEMD_SD_NOTIFYF)
SET(CMAKE_REQUIRED_LIBRARIES)
IF(HAVE_SYSTEMD AND HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
IF(HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF)
ADD_DEFINITIONS(-DHAVE_SYSTEMD)
SET(HAVE_SYSTEMD TRUE)
SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery)
IF(DEB)
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")

View File

@ -32,17 +32,18 @@
*/
#undef MYSQL_PLUGIN_EXPORT
#if defined(_MSC_VER)
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
#endif
#define MYSQL_PLUGIN_EXPORT_C __declspec(dllexport)
#else /*_MSC_VER */
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C"
#else
#define MYSQL_PLUGIN_EXPORT
#endif
#define MYSQL_PLUGIN_EXPORT_C
#endif
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_PLUGIN_EXPORT_C
#define C_MODE_START extern "C" {
#define C_MODE_END }
#else
#define MYSQL_PLUGIN_EXPORT MYSQL_PLUGIN_EXPORT_C
#define C_MODE_START
#define C_MODE_END
#endif
#ifndef MYSQL_ABI_CHECK
@ -60,11 +61,12 @@
#define MYSQL_CLIENT_MAX_PLUGINS 3
#define mysql_declare_client_plugin(X) \
MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \
C_MODE_START MYSQL_PLUGIN_EXPORT_C \
struct st_mysql_client_plugin_ ## X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_ ## X ## _PLUGIN, \
MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION,
#define mysql_end_client_plugin }
#define mysql_end_client_plugin }; C_MODE_END
/* generic plugin header structure */
#define MYSQL_CLIENT_PLUGIN_HEADER \

View File

@ -624,4 +624,61 @@ SELECT MAX(pk) FROM t1;
MAX(pk)
NULL
DROP TABLE t1;
#
# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value
#
set names utf8;
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=4;
set use_stat_tables=preferably;
set @save_histogram_size= @@histogram_size;
set histogram_size=255;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(min_value, 1)) length(min_value)
A7 254
select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(max_value, 1)) length(max_value)
A5 254
analyze select * from t1 where a >= 'ӥ';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1';
Warnings:
Warning 1265 Data truncated for column 'min_value' at row 1
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(min_value, 1)) length(min_value)
D3 255
analyze select * from t1 where a >= 'ӥ';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where
set names latin1;
drop table t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1';
select min_value from mysql.column_stats where db_name='test' and table_name='t1';
min_value
2004-0-31123
select * from t1;
col1
2004-01-01
2004-02-29
0000-10-31
drop table t1;
set @@sql_mode= @save_sql_mode;
set use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;

View File

@ -401,4 +401,44 @@ SELECT MAX(pk) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value
--echo #
set names utf8;
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=4;
set use_stat_tables=preferably;
set @save_histogram_size= @@histogram_size;
set histogram_size=255;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
analyze table t1;
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where db_name='test' and table_name='t1';
analyze select * from t1 where a >= 'ӥ';
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1';
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
analyze select * from t1 where a >= 'ӥ';
set names latin1;
drop table t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
analyze table t1;
update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1';
select min_value from mysql.column_stats where db_name='test' and table_name='t1';
select * from t1;
drop table t1;
set @@sql_mode= @save_sql_mode;
set use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;

View File

@ -651,6 +651,63 @@ SELECT MAX(pk) FROM t1;
MAX(pk)
NULL
DROP TABLE t1;
#
# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value
#
set names utf8;
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=4;
set use_stat_tables=preferably;
set @save_histogram_size= @@histogram_size;
set histogram_size=255;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(min_value, 1)) length(min_value)
A7 254
select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(max_value, 1)) length(max_value)
A5 254
analyze select * from t1 where a >= 'ӥ';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1';
Warnings:
Warning 1265 Data truncated for column 'min_value' at row 1
select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1';
HEX(RIGHT(min_value, 1)) length(min_value)
D3 255
analyze select * from t1 where a >= 'ӥ';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where
set names latin1;
drop table t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1';
select min_value from mysql.column_stats where db_name='test' and table_name='t1';
min_value
2004-0-31123
select * from t1;
col1
2004-01-01
2004-02-29
0000-10-31
drop table t1;
set @@sql_mode= @save_sql_mode;
set use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;

View File

@ -1076,6 +1076,15 @@ t1 CREATE TABLE `t1` (
`a` longtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t1 (a int);
alter table t1 add column b blob, alter column b set default "foo";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` blob DEFAULT 'foo'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# End of 10.2 test
#

View File

@ -694,6 +694,11 @@ CREATE TABLE t1 (a TEXT(1431655798) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
DROP TABLE t1;
# ALTER SET DEFAULT
create table t1 (a int);
alter table t1 add column b blob, alter column b set default "foo";
show create table t1;
drop table t1;
--echo #
--echo # End of 10.2 test

View File

@ -0,0 +1,17 @@
create table categories(
cat_id int not null primary key,
cat_name varchar(255) not null,
cat_description text
) engine=innodb;
create table products(
prd_id int not null auto_increment primary key,
prd_name varchar(355) not null,
prd_price decimal,
cat_id int not null,
foreign key fk_cat(cat_id)
references categories(cat_id)
on update cascade
) engine=innodb;
insert into categories values (1, 'drinks', 'drinks');
update categories set cat_description=2 where cat_id=1;
drop table products, categories;

View File

@ -0,0 +1,26 @@
source include/have_innodb.inc;
source include/have_binlog_format_statement.inc;
#
# MDEV-18466 Unsafe to log updates on tables referenced by foreign keys with triggers in statement format
#
create table categories(
cat_id int not null primary key,
cat_name varchar(255) not null,
cat_description text
) engine=innodb;
create table products(
prd_id int not null auto_increment primary key,
prd_name varchar(355) not null,
prd_price decimal,
cat_id int not null,
foreign key fk_cat(cat_id)
references categories(cat_id)
on update cascade
) engine=innodb;
insert into categories values (1, 'drinks', 'drinks');
update categories set cat_description=2 where cat_id=1;
drop table products, categories;

View File

@ -0,0 +1,23 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (i INT);
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10;
include/start_slave.inc
connection master;
INSERT INTO t1 VALUES (1);
include/sync_slave_io_with_master.inc
connection slave;
"Sleeping for 15"
# Asserted this: Seconds_Behind_Master should be less than MASTER_DELAY
# Asserted this: One row shoule be found in table t1.
"======= Clean up ========"
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID=no, MASTER_DELAY=0;
START SLAVE;
connection master;
DROP TABLE t1;
connection slave;
connection master;
include/rpl_end.inc

View File

@ -0,0 +1,15 @@
include/master-slave.inc
[connection master]
CREATE USER test_user@localhost;
SET PASSWORD FOR test_user@localhost = password('PWD');
GRANT ALL ON *.* TO test_user@localhost WITH GRANT OPTION;
connect conn_test,localhost,test_user,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection conn_test;
CREATE TABLE t1 (f1 INT);
CREATE TABLE t2 (f2 VARCHAR(64));
CREATE TRIGGER tr_before BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
CREATE DEFINER='root'@'localhost' TRIGGER tr_after AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
INSERT INTO t1 VALUES (1);
DROP USER 'test_user'@'localhost';
DROP TABLE t1, t2;
include/rpl_end.inc

View File

@ -0,0 +1,58 @@
# ==== Purpose ====
#
# Test verifies that when "Master_Delay" is specified on slave with GTIDS there
# will not be any extra delay initially.
#
# ==== Implementation ====
#
# Steps:
# 0 - Stop the slave and execute CHANGE MASTER command with
# master_use_gtid= curren_pos and master_delay= 10
# 1 - On slave introduce a sleep of 15 seconds and check that the
# Seconds_Behind_Master is within specified master_delay limit. It should
# not be more that "10" seconds.
#
# ==== References ====
#
# MDEV-13895: GTID and Master_Delay causes excessive initial delay
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
CREATE TABLE t1 (i INT);
--sync_slave_with_master
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10;
--source include/start_slave.inc
--connection master
INSERT INTO t1 VALUES (1);
--source include/sync_slave_io_with_master.inc
--connection slave
--let $actual_delay= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1)
--let $sleep_time= `SELECT 5 + $actual_delay`
--echo "Sleeping for $sleep_time"
--sleep $sleep_time
--let $assert_cond= [SHOW SLAVE STATUS, Seconds_Behind_Master, 1] <= 10
--let $assert_text= Seconds_Behind_Master should be less than MASTER_DELAY
--source include/rpl_assert.inc
# The row should be available in table after master_delay=20 seconds.
--let $assert_text= One row shoule be found in table t1.
--let $assert_cond= COUNT(*) = 1 FROM t1
--source include/rpl_assert.inc
--echo "======= Clean up ========"
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID=no, MASTER_DELAY=0;
START SLAVE;
--connection master
DROP TABLE t1;
--sync_slave_with_master
--connection master
--source include/rpl_end.inc

View File

@ -0,0 +1,42 @@
# ==== Purpose ====
#
# Test verifies that when applier thread tries to access 'variable_name' of
# INFORMATION_SCHEMA.SESSION_VARIABLES table through triggers it successfully
# retrieves all the session variables.
#
# ==== Implementation ====
#
# Steps:
# 0 - Create two tables t1 and t2.
# 1 - Create a trigger such that it reads the names of all session variables
# from INFORMATION_SCHEMA.SESSION_VARIABLES table and populates one of the
# tables.
# 2 - Do a DML on master and wait for it to be replicated and ensure that
# slave is in sync with master and it is up and running.
#
# ==== References ====
#
# MDEV-14784: Slave crashes in show_status_array upon running a trigger with
# select from I_S
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
--enable_connect_log
CREATE USER test_user@localhost;
SET PASSWORD FOR test_user@localhost = password('PWD');
GRANT ALL ON *.* TO test_user@localhost WITH GRANT OPTION;
connect(conn_test,localhost,test_user,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
--connection conn_test
CREATE TABLE t1 (f1 INT);
CREATE TABLE t2 (f2 VARCHAR(64));
CREATE TRIGGER tr_before BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
CREATE DEFINER='root'@'localhost' TRIGGER tr_after AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
INSERT INTO t1 VALUES (1);
--disable_connect_log
# Cleanup
--connection master
DROP USER 'test_user'@'localhost';
DROP TABLE t1, t2;
--source include/rpl_end.inc

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2014 Google Inc.
Copyright (c) 2014, 2017 MariaDB Corporation
Copyright (c) 2014, 2019, 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
@ -93,7 +93,8 @@ public:
this->key= key;
this->klen= klen;
this->buf_len= 0;
memcpy(oiv, iv, ivlen);
if (ivlen)
memcpy(oiv, iv, ivlen);
DBUG_ASSERT(ivlen == 0 || ivlen == sizeof(oiv));
int res= MyCTX::init(cipher, encrypt, key, klen, iv, ivlen);

View File

@ -8,6 +8,7 @@ IF(HAVE_PAM_APPL_H)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)
FIND_LIBRARY(PAM_LIBRARY pam)
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY)
ENDIF(HAVE_PAM_APPL_H)

View File

@ -6958,8 +6958,11 @@ Field_longstr::check_string_copy_error(const String_copier *copier,
if (likely(!(pos= copier->most_important_error_pos())))
return FALSE;
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
set_warning_truncated_wrong_value("string", tmp);
if (!is_stat_field)
{
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
set_warning_truncated_wrong_value("string", tmp);
}
return TRUE;
}

View File

@ -9687,9 +9687,9 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all,
*/
if (!xid || !need_unlog)
DBUG_RETURN(BINLOG_COOKIE_DUMMY(cache_mngr->delayed_error));
else
DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id,
cache_mngr->delayed_error));
DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id,
cache_mngr->delayed_error));
}
/*

View File

@ -2377,31 +2377,8 @@ ER_TABLE_NOT_LOCKED
spa "Tabla '%-.192s' no fue trabada con LOCK TABLES"
swe "Tabell '%-.192s' är inte låst med LOCK TABLES"
ukr "Таблицю '%-.192s' не було блоковано з LOCK TABLES"
ER_BLOB_CANT_HAVE_DEFAULT 42000
cze "Blob položka '%-.192s' nemůže mít defaultní hodnotu"
dan "BLOB feltet '%-.192s' kan ikke have en standard værdi"
nla "Blob veld '%-.192s' can geen standaardwaarde bevatten"
eng "BLOB/TEXT column '%-.192s' can't have a default value"
est "BLOB-tüüpi tulp '%-.192s' ei saa omada vaikeväärtust"
fre "BLOB '%-.192s' ne peut avoir de valeur par défaut"
ger "BLOB/TEXT-Feld '%-.192s' darf keinen Vorgabewert (DEFAULT) haben"
greek "Τα Blob πεδία '%-.192s' δεν μπορούν να έχουν προκαθορισμένες τιμές (default value)"
hindi "BLOB/TEXT कॉलम '%-.192s' का डिफ़ॉल्ट मान नहीं हो सकता"
hun "A(z) '%-.192s' blob objektumnak nem lehet alapertelmezett erteke"
ita "Il campo BLOB '%-.192s' non puo` avere un valore di default"
jpn "BLOB/TEXT 列 '%-.192s' にはデフォルト値を指定できません。"
kor "BLOB 칼럼 '%-.192s' 는 디폴트 값을 가질 수 없습니다."
nor "Blob feltet '%-.192s' kan ikke ha en standard verdi"
norwegian-ny "Blob feltet '%-.192s' kan ikkje ha ein standard verdi"
pol "Pole typu blob '%-.192s' nie może mieć domy?lnej warto?ci"
por "Coluna BLOB '%-.192s' não pode ter um valor padrão (default)"
rum "Coloana BLOB '%-.192s' nu poate avea o valoare default"
rus "Невозможно указывать значение по умолчанию для столбца BLOB '%-.192s'"
serbian "BLOB kolona '%-.192s' ne može imati default vrednost"
slo "Pole BLOB '%-.192s' nemôže mať implicitnú hodnotu"
spa "Campo Blob '%-.192s' no puede tener valores patron"
swe "BLOB fält '%-.192s' kan inte ha ett DEFAULT-värde"
ukr "Стовбець BLOB '%-.192s' не може мати значення по замовчуванню"
ER_UNUSED_17
eng "You should never see it"
ER_WRONG_DB_NAME 42000
cze "Nepřípustné jméno databáze '%-.100s'"
dan "Ugyldigt database navn '%-.100s'"

View File

@ -3879,12 +3879,6 @@ apply_event_and_update_pos_setup(Log_event* ev, THD* thd, rpl_group_info *rgi)
thd->variables.server_id = ev->server_id;
thd->set_time(); // time the query
thd->lex->current_select= 0;
if (!ev->when)
{
my_hrtime_t hrtime= my_hrtime();
ev->when= hrtime_to_my_time(hrtime);
ev->when_sec_part= hrtime_sec_part(hrtime);
}
thd->variables.option_bits=
(thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) |
(ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0);

View File

@ -552,6 +552,7 @@ sp_head::sp_head(sp_package *parent, const Sp_handler *sph)
DBUG_ENTER("sp_head::sp_head");
m_security_ctx.init();
m_backpatch.empty();
m_backpatch_goto.empty();
m_cont_backpatch.empty();

View File

@ -238,17 +238,17 @@ int Geometry::as_wkt(String *wkt, const char **end)
static const uchar type_keyname[]= "type";
static const int type_keyname_len= 4;
static const uint type_keyname_len= 4;
static const uchar coord_keyname[]= "coordinates";
static const int coord_keyname_len= 11;
static const uint coord_keyname_len= 11;
static const uchar geometries_keyname[]= "geometries";
static const int geometries_keyname_len= 10;
static const uint geometries_keyname_len= 10;
static const uchar features_keyname[]= "features";
static const int features_keyname_len= 8;
static const uint features_keyname_len= 8;
static const uchar geometry_keyname[]= "geometry";
static const int geometry_keyname_len= 8;
static const uint geometry_keyname_len= 8;
static const int max_keyname_len= 11; /*'coordinates' keyname is the longest.*/
static const uint max_keyname_len= 11; /*'coordinates' keyname is the longest.*/
static const uchar feature_type[]= "feature";
static const int feature_type_len= 7;

View File

@ -566,7 +566,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (!table->table->part_info)
{
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
goto err2;
thd->resume_subsequent_commits(suspended_wfc);
DBUG_RETURN(TRUE);
}
if (set_part_state(alter_info, table->table->part_info, PART_ADMIN))
{
@ -1219,9 +1220,6 @@ err:
}
close_thread_tables(thd); // Shouldn't be needed
thd->mdl_context.release_transactional_locks();
#ifdef WITH_PARTITION_STORAGE_ENGINE
err2:
#endif
thd->resume_subsequent_commits(suspended_wfc);
DBUG_RETURN(TRUE);
}

View File

@ -6061,16 +6061,18 @@ int THD::decide_logging_format(TABLE_LIST *tables)
replicated_tables_count++;
if (table->lock_type <= TL_READ_NO_INSERT &&
table->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
has_read_tables= true;
else if (table->table->found_next_number_field &&
(table->lock_type >= TL_WRITE_ALLOW_WRITE))
if (table->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
{
has_auto_increment_write_tables= true;
has_auto_increment_write_tables_not_first= found_first_not_own_table;
if (table->table->s->next_number_keypart != 0)
has_write_table_auto_increment_not_first_in_pk= true;
if (table->lock_type <= TL_READ_NO_INSERT)
has_read_tables= true;
else if (table->table->found_next_number_field &&
(table->lock_type >= TL_WRITE_ALLOW_WRITE))
{
has_auto_increment_write_tables= true;
has_auto_increment_write_tables_not_first= found_first_not_own_table;
if (table->table->s->next_number_keypart != 0)
has_write_table_auto_increment_not_first_in_pk= true;
}
}
if (table->lock_type >= TL_WRITE_ALLOW_WRITE)

View File

@ -1058,7 +1058,9 @@ public:
else
{
table_field->collected_stats->min_value->val_str(&val);
stat_field->store(val.ptr(), val.length(), &my_charset_bin);
size_t length= Well_formed_prefix(val.charset(), val.ptr(),
MY_MIN(val.length(), stat_field->field_length)).length();
stat_field->store(val.ptr(), length, &my_charset_bin);
}
break;
case COLUMN_STAT_MAX_VALUE:
@ -1067,7 +1069,9 @@ public:
else
{
table_field->collected_stats->max_value->val_str(&val);
stat_field->store(val.ptr(), val.length(), &my_charset_bin);
size_t length= Well_formed_prefix(val.charset(), val.ptr(),
MY_MIN(val.length(), stat_field->field_length)).length();
stat_field->store(val.ptr(), length, &my_charset_bin);
}
break;
case COLUMN_STAT_NULLS_RATIO:
@ -3053,7 +3057,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
}
}
table->stats_is_read= TRUE;
DBUG_RETURN(0);

View File

@ -8164,11 +8164,6 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (alter)
{
if (def->real_field_type() == MYSQL_TYPE_BLOB)
{
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change.str);
goto err;
}
if ((def->default_value= alter->default_value)) // Use new default
def->flags&= ~NO_DEFAULT_VALUE_FLAG;
else

View File

@ -108,7 +108,7 @@ BOOL exclude_service(mysqld_service_properties *props)
}
if ((props->version_major == 0) ||
(props->version_major > 5 && props->version_major < 10) ||
(props->version_major == 5 && props->version_minor > 6))
(props->version_major == 5 && props->version_minor > 7))
{
return TRUE;
}

View File

@ -220,7 +220,7 @@ bool wsrep_sst_wait ()
total_wtime += difftime(end_time, start_time);
WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
"WSREP state transfer ongoing, current seqno: %" PRId64 " waited %f secs", local_seqno, total_wtime);
}
}
@ -1472,7 +1472,7 @@ void wsrep_SE_init_wait()
total_wtime += difftime(end_time, start_time);
WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
"WSREP state transfer ongoing, current seqno: %" PRId64 " waited %f secs", local_seqno, total_wtime);
}
}

View File

@ -40,6 +40,10 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT )
macro(DISABLE_WARNING W)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-error=${W}")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-${W}" DEBUG)
endmacro()
#
# OS specific C flags, definitions and source files.
@ -47,14 +51,15 @@ add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT )
IF(UNIX)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations")
if(NOT WITH_WARNINGS)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
DISABLE_WARNING("unused-function")
DISABLE_WARNING("unused-variable")
DISABLE_WARNING("unused-value")
DISABLE_WARNING("parentheses")
DISABLE_WARNING("strict-aliasing")
DISABLE_WARNING("misleading-indentation")
DISABLE_WARNING("format-truncation")
DISABLE_WARNING("implicit-fallthrough")
DISABLE_WARNING("type-limits")
endif(NOT WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU )
@ -168,7 +173,8 @@ IF(CONNECT_WITH_ODBC)
# the library 'libiodbc' gets compiled with 'sql'h.
# This will also need changes in the sources (e.g. #include <isql.h>).
find_path(ODBC_INCLUDE_DIR sql.h
find_file(ODBC_INCLUDES sql.h
PATHS
/usr/include
/usr/include/odbc
/usr/local/include
@ -178,7 +184,7 @@ IF(CONNECT_WITH_ODBC)
#"C:/Program Files/Microsoft SDKs/Windows/v7.0A/include"
#"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include"
#"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/include"
DOC "Specify the directory containing sql.h."
DOC "Specify the path to sql.h."
)
find_library(ODBC_LIBRARY
@ -197,9 +203,10 @@ IF(CONNECT_WITH_ODBC)
DOC "Specify the ODBC driver manager library here."
)
mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDE_DIR)
mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDES)
IF(ODBC_INCLUDE_DIR AND ODBC_LIBRARY)
IF(ODBC_INCLUDES AND ODBC_LIBRARY)
get_filename_component(ODBC_INCLUDE_DIR "${ODBC_INCLUDES}" PATH)
set(CMAKE_REQUIRED_LIBRARIES ${ODBC_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${ODBC_INCLUDE_DIR})
CHECK_CXX_SOURCE_COMPILES(

View File

@ -32,6 +32,10 @@
/****************************************************************************/
#include "mycat.h"
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
bool MongoEnabled(void);
#endif // JAVA_SUPPORT || CMGO_SUPPORT
/****************************************************************************/
/* Structures used to pass info between CONNECT and ha_connect. */
/****************************************************************************/

View File

@ -102,10 +102,6 @@
extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // !__WIN__
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
bool MongoEnabled(void);
#endif // JAVA_SUPPORT || CMGO_SUPPORT
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
/***********************************************************************/

View File

@ -392,7 +392,7 @@ buf_dump(
if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool "
ULINTPF "/" ULINTPF ", "
ULINTPF "/%lu, "
"page " ULINTPF "/" ULINTPF,
i + 1, srv_buf_pool_instances,
j + 1, n_pages);

View File

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -284,6 +285,7 @@ public:
m_trx(trx),
m_flush_observer(observer)
{
ut_ad(!dict_index_is_spatial(index));
#ifdef UNIV_DEBUG
if (m_flush_observer)
my_atomic_addlint(&m_index->table->space->redo_skipped_count,

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -41,20 +41,9 @@ Created 3/26/1996 Heikki Tuuri
// Forward declaration
struct mtr_t;
// Forward declaration
class FlushObserver;
struct rw_trx_hash_element_t;
/** Set flush observer for the transaction
@param[in/out] trx transaction struct
@param[in] observer flush observer */
void
trx_set_flush_observer(
trx_t* trx,
FlushObserver* observer);
/******************************************************************//**
Set detailed error message for the transaction. */
void
@ -1054,8 +1043,11 @@ public:
/*------------------------------*/
char* detailed_error; /*!< detailed error message for last
error, or empty. */
FlushObserver* flush_observer; /*!< flush observer */
private:
/** flush observer used to track flushing of non-redo logged pages
during bulk create index */
FlushObserver* flush_observer;
public:
/* Lock wait statistics */
ulint n_rec_lock_waits;
/*!< Number of record lock waits,
@ -1108,6 +1100,20 @@ public:
return(assign_temp_rseg());
}
/** Set the innodb_log_optimize_ddl page flush observer
@param[in,out] space tablespace
@param[in,out] stage performance_schema accounting */
void set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage);
/** Remove the flush observer */
void remove_flush_observer();
/** @return the flush observer */
FlushObserver* get_flush_observer() const
{
return flush_observer;
}
bool is_referenced()
{

View File

@ -1675,7 +1675,7 @@ row_fts_merge_insert(
/* Create bulk load instance */
ins_ctx.btr_bulk = UT_NEW_NOKEY(
BtrBulk(aux_index, trx, psort_info[0].psort_common->trx
->flush_observer));
->get_flush_observer()));
/* Create tuple for insert */
ins_ctx.tuple = dtuple_create(heap, dict_index_get_n_fields(aux_index));

View File

@ -1738,7 +1738,6 @@ row_merge_read_clustered_index(
mem_heap_t* mtuple_heap = NULL;
mtuple_t prev_mtuple;
mem_heap_t* conv_heap = NULL;
FlushObserver* observer = trx->flush_observer;
double curr_progress = 0.0;
ib_uint64_t read_rows = 0;
ib_uint64_t table_total_rows = 0;
@ -2334,9 +2333,8 @@ write_buffers:
bool skip_sort = skip_pk_sort
&& dict_index_is_clust(merge_buf[0]->index);
for (ulint i = 0; i < n_index; i++, skip_sort = false) {
for (ulint k = 0, i = 0; i < n_index; i++, skip_sort = false) {
row_merge_buf_t* buf = merge_buf[i];
merge_file_t* file = &files[i];
ulint rows_added = 0;
if (dict_index_is_spatial(buf->index)) {
@ -2365,6 +2363,8 @@ write_buffers:
|| trx_id_check(row->fields[new_trx_id_col].data,
trx->id));
merge_file_t* file = &files[k++];
if (UNIV_LIKELY
(row && (rows_added = row_merge_buf_add(
buf, fts_index, old_table, new_table,
@ -2372,6 +2372,15 @@ write_buffers:
conv_heap, &err,
&v_heap, eval_table, trx)))) {
/* Set the page flush observer for the
transaction when buffering the very first
record for a non-redo-logged operation. */
if (file->n_rec == 0 && i == 0
&& innodb_log_optimize_ddl) {
trx->set_flush_observer(
new_table->space, stage);
}
/* If we are creating FTS index,
a single row can generate more
records for tokenized word */
@ -2511,7 +2520,7 @@ write_buffers:
clust_btr_bulk = UT_NEW_NOKEY(
BtrBulk(index[i],
trx,
observer/**/));
trx->get_flush_observer()));
} else {
clust_btr_bulk->latch();
}
@ -2624,8 +2633,9 @@ write_buffers:
trx->error_key_num = i;
goto all_done;);
BtrBulk btr_bulk(index[i], trx,
observer);
BtrBulk btr_bulk(
index[i], trx,
trx->get_flush_observer());
err = row_merge_insert_index_tuples(
index[i], old_table,
@ -4639,47 +4649,26 @@ row_merge_build_indexes(
}
trx_start_if_not_started_xa(trx, true);
ulint n_merge_files = 0;
/* Check if we need a flush observer to flush dirty pages.
Since we disable redo logging in bulk load, so we should flush
dirty pages before online log apply, because online log apply enables
redo logging(we can do further optimization here).
1. online add index: flush dirty pages right before row_log_apply().
2. table rebuild: flush dirty pages before row_log_table_apply().
we use bulk load to create all types of indexes except spatial index,
for which redo logging is enabled. If we create only spatial indexes,
we don't need to flush dirty pages at all. */
bool need_flush_observer = bool(innodb_log_optimize_ddl);
if (need_flush_observer) {
need_flush_observer = old_table != new_table;
for (i = 0; i < n_indexes; i++) {
if (!dict_index_is_spatial(indexes[i])) {
need_flush_observer = true;
}
for (ulint i = 0; i < n_indexes; i++)
{
if (!dict_index_is_spatial(indexes[i])) {
n_merge_files++;
}
}
FlushObserver* flush_observer = NULL;
if (need_flush_observer) {
flush_observer = UT_NEW_NOKEY(
FlushObserver(new_table->space, trx, stage));
trx_set_flush_observer(trx, flush_observer);
}
merge_files = static_cast<merge_file_t*>(
ut_malloc_nokey(n_indexes * sizeof *merge_files));
ut_malloc_nokey(n_merge_files * sizeof *merge_files));
/* Initialize all the merge file descriptors, so that we
don't call row_merge_file_destroy() on uninitialized
merge file descriptor */
for (i = 0; i < n_indexes; i++) {
for (i = 0; i < n_merge_files; i++) {
merge_files[i].fd = OS_FILE_CLOSED;
merge_files[i].offset = 0;
merge_files[i].n_rec = 0;
}
total_static_cost = COST_BUILD_INDEX_STATIC * n_indexes + COST_READ_CLUSTERED_INDEX;
@ -4758,7 +4747,7 @@ row_merge_build_indexes(
" and create temporary files");
}
for (i = 0; i < n_indexes; i++) {
for (i = 0; i < n_merge_files; i++) {
total_index_blocks += merge_files[i].offset;
}
@ -4771,7 +4760,7 @@ row_merge_build_indexes(
/* Now we have files containing index entries ready for
sorting and inserting. */
for (i = 0; i < n_indexes; i++) {
for (ulint k = 0, i = 0; i < n_indexes; i++) {
dict_index_t* sort_idx = indexes[i];
if (dict_index_is_spatial(sort_idx)) {
@ -4850,13 +4839,13 @@ wait_again:
#ifdef FTS_INTERNAL_DIAG_PRINT
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else if (merge_files[i].fd != OS_FILE_CLOSED) {
} else if (merge_files[k].fd != OS_FILE_CLOSED) {
char buf[NAME_LEN + 1];
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[i].offset /
(total_dynamic_cost * merge_files[k].offset /
total_index_blocks)) /
(total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100;
@ -4880,7 +4869,7 @@ wait_again:
}
error = row_merge_sort(
trx, &dup, &merge_files[i],
trx, &dup, &merge_files[k],
block, &tmpfd, true,
pct_progress, pct_cost,
crypt_block, new_table->space_id,
@ -4903,10 +4892,10 @@ wait_again:
if (error == DB_SUCCESS) {
BtrBulk btr_bulk(sort_idx, trx,
flush_observer);
trx->get_flush_observer());
pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[i].offset /
(total_dynamic_cost * merge_files[k].offset /
total_index_blocks)) /
(total_static_cost + total_dynamic_cost) *
PCT_COST_INSERT_INDEX * 100;
@ -4923,9 +4912,9 @@ wait_again:
error = row_merge_insert_index_tuples(
sort_idx, old_table,
merge_files[i].fd, block, NULL,
merge_files[k].fd, block, NULL,
&btr_bulk,
merge_files[i].n_rec, pct_progress, pct_cost,
merge_files[k].n_rec, pct_progress, pct_cost,
crypt_block, new_table->space_id,
stage);
@ -4944,7 +4933,7 @@ wait_again:
}
/* Close the temporary file to free up space. */
row_merge_file_destroy(&merge_files[i]);
row_merge_file_destroy(&merge_files[k++]);
if (indexes[i]->type & DICT_FTS) {
row_fts_psort_info_destroy(psort_info, merge_info);
@ -4956,7 +4945,12 @@ wait_again:
ut_ad(sort_idx->online_status
== ONLINE_INDEX_COMPLETE);
} else {
if (flush_observer) {
if (dict_index_is_spatial(indexes[i])) {
/* We never disable redo logging for
creating SPATIAL INDEX. Avoid writing any
unnecessary MLOG_INDEX_LOAD record. */
} else if (FlushObserver* flush_observer =
trx->get_flush_observer()) {
flush_observer->flush();
row_merge_write_redo(indexes[i]);
}
@ -4998,7 +4992,7 @@ func_exit:
row_merge_file_destroy_low(tmpfd);
for (i = 0; i < n_indexes; i++) {
for (i = 0; i < n_merge_files; i++) {
row_merge_file_destroy(&merge_files[i]);
}
@ -5055,8 +5049,7 @@ func_exit:
DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE(););
if (flush_observer != NULL) {
ut_ad(need_flush_observer);
if (FlushObserver* flush_observer = trx->get_flush_observer()) {
DBUG_EXECUTE_IF("ib_index_build_fail_before_flush",
error = DB_INTERRUPTED;
@ -5068,7 +5061,7 @@ func_exit:
flush_observer->flush();
UT_DELETE(flush_observer);
trx->remove_flush_observer();
if (trx_is_interrupted(trx)) {
error = DB_INTERRUPTED;

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -71,17 +71,6 @@ typedef std::set<
std::less<table_id_t>,
ut_allocator<table_id_t> > table_id_set;
/** Set flush observer for the transaction
@param[in/out] trx transaction struct
@param[in] observer flush observer */
void
trx_set_flush_observer(
trx_t* trx,
FlushObserver* observer)
{
trx->flush_observer = observer;
}
/*************************************************************//**
Set detailed error message for the transaction. */
void
@ -172,7 +161,7 @@ trx_init(
trx->lock.table_cached = 0;
trx->flush_observer = NULL;
ut_ad(trx->get_flush_observer() == NULL);
}
/** For managing the life-cycle of the trx_t instance that we get
@ -865,6 +854,21 @@ static trx_rseg_t* trx_assign_rseg_low()
return(rseg);
}
/** Set the innodb_log_optimize_ddl page flush observer
@param[in,out] space tablespace
@param[in,out] stage performance_schema accounting */
void trx_t::set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage)
{
flush_observer = UT_NEW_NOKEY(FlushObserver(space, this, stage));
}
/** Remove the flush observer */
void trx_t::remove_flush_observer()
{
UT_DELETE(flush_observer);
flush_observer = NULL;
}
/** Assign a rollback segment for modifying temporary tables.
@return the assigned rollback segment */
trx_rseg_t*

View File

@ -77,7 +77,7 @@ namespace mrn {
}
private:
static const unsigned int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5;
static const int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5;
mysql_mutex_t *mutex_;
LIST *pool_;

View File

@ -3750,20 +3750,32 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx)
- For a COMMIT statement that finishes a multi-statement transaction
- For a statement that has its own transaction
*/
// First, commit without syncing. This establishes the commit order
tx->set_sync(false);
bool tx_had_writes = tx->get_write_count()? true : false ;
if (tx->commit()) {
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
}
thd_wakeup_subsequent_commits(thd, 0);
if (tx_had_writes && rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC)
if (thd->slave_thread)
{
rocksdb::Status s= rdb->FlushWAL(true);
if (!s.ok())
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
// An attempt to make parallel slave performant (not fully successful,
// see MDEV-15372):
// First, commit without syncing. This establishes the commit order
tx->set_sync(false);
bool tx_had_writes = tx->get_write_count()? true : false ;
if (tx->commit()) {
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
}
thd_wakeup_subsequent_commits(thd, 0);
if (tx_had_writes && rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC)
{
rocksdb::Status s= rdb->FlushWAL(true);
if (!s.ok())
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
else
{
/* Not a slave thread */
if (tx->commit()) {
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
}
}
} else {
/*

View File

@ -7684,7 +7684,7 @@ int spider_get_sts(
int sts_sync_level,
uint flag
) {
int get_type;
int get_type __attribute__ ((unused));
int error_num = 0;
bool need_to_get = TRUE;
DBUG_ENTER("spider_get_sts");
@ -7841,7 +7841,7 @@ int spider_get_crd(
#endif
int crd_sync_level
) {
int get_type;
int get_type __attribute__ ((unused));
int error_num = 0;
bool need_to_get = TRUE;
DBUG_ENTER("spider_get_crd");
@ -9253,7 +9253,7 @@ int spider_discover_table_structure(
#endif
Open_tables_backup open_tables_backup;
TABLE *table_tables;
uint str_len;
uint str_len __attribute__ ((unused));
char buf[MAX_FIELD_WIDTH];
spider_string str(buf, sizeof(buf), system_charset_info);
DBUG_ENTER("spider_discover_table_structure");

View File

@ -1407,7 +1407,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state)
if (!json_key_matches(je, &key_name))
continue;
}
if ((uint) (cur_step - state->paths[p_c].last_step) == state->cur_depth)
if (cur_step == state->paths[p_c].last_step + state->cur_depth)
path_found= TRUE;
else
{
@ -1440,7 +1440,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state)
cur_step->n_item == state->array_counters[state->cur_depth])
{
/* Array item matches. */
if ((uint) (cur_step - state->paths[p_c].last_step) == state->cur_depth)
if (cur_step == state->paths[p_c].last_step + state->cur_depth)
path_found= TRUE;
else
{
@ -1845,4 +1845,3 @@ int json_path_compare(const json_path_t *a, const json_path_t *b,
return json_path_parts_compare(a->steps+1, a->last_step,
b->steps+1, b->last_step, vt);
}

View File

@ -358,7 +358,7 @@ void mdev17133()
// random size 2nd read
res= my_b_read(&info, buf_i + total + MY_MIN(19, curr_read_size),
19 >= curr_read_size ? 0 : curr_read_size - 19);
ok(res == 0, "rest of read %lu", curr_read_size - 19);
ok(res == 0, "rest of read %zu", curr_read_size - 19);
// mark read bytes in the used part of the cache buffer
memset(info.buffer, 0, info.read_pos - info.buffer);