Merge 10.1 into 10.2

This commit is contained in:
Marko Mäkelä 2019-07-18 13:10:09 +03:00
commit 6962855185
15 changed files with 201 additions and 51 deletions

View file

@ -1534,6 +1534,7 @@ end:
{
my_fwrite(result_file, (const uchar *) tmp_str.str, tmp_str.length,
MYF(MY_NABP));
fflush(result_file);
my_free(tmp_str.str);
}
}

View file

@ -1,4 +1,4 @@
Windows bug: happens when a new line is exactly at the right offset.
Windows bug: new line disappears when it is exactly at the right offset.
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.

View file

@ -0,0 +1,16 @@
RESET MASTER;
include/stop_dump_threads.inc
# Step-1: Execute some dummy statements.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
# Step-2: Disable binary log temporarily and drop the table 't1'.
set @@SESSION.SQL_LOG_BIN = 0;
DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;
# Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
# Step-4: Wait till dump thread transfer is completed.
# Step-5: Check that the data is there.
# Step-6: Cleanup
# kill the dump thread serving the mysqlbinlog --stop-never process
include/stop_dump_threads.inc
DROP TABLE t1;

View file

@ -0,0 +1,66 @@
# ==== Purpose ====
#
# Test verifies that continuous streaming of binary log content using the
# "mysqlbinlog --stop-never" option and sourcing it to mysql client works
# fine.
#
# ==== Implementation ====
#
# Steps:
# 1 - Create a table on a server on which binary log is enabled and insert
# a row.
# 2 - Disable the binary log on the server and drop the table.
# 3 - Capture the binary log output using "mysqlbinlog --stop_never" option
# and source it to mysql client.
# 4 - Query the PROCESSLIST table to ensure that the dump thread which is
# serving "stop_never" option has read entire binlog.
# 5 - Verify that the table is populated on the server.
# 6 - Cleanup.
#
# ==== References ====
#
# MDEV-11154: Write_on_release_cache(log_event.cc) function will not write
# "COMMIT", if use "mysqlbinlog ... | mysql ..."
--source include/not_windows.inc
# Test is not specific to any binlog format. Hence Running only for 'row'.
--source include/have_binlog_format_row.inc
# binlog file name is needed in the test. To use master-bin.000001,
# RESET MASTER is needed.
RESET MASTER;
# kill the dump threads if there any dump threads (may be from previous test)
--source include/stop_dump_threads.inc
--echo # Step-1: Execute some dummy statements.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
--echo # Step-2: Disable binary log temporarily and drop the table 't1'.
set @@SESSION.SQL_LOG_BIN = 0;
DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;
--echo # Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
--write_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
(`$MYSQL_BINLOG --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT`) < /dev/null > /dev/null 2>&1 &
EOF
--exec /bin/bash $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
--echo # Step-4: Wait till dump thread transfer is completed.
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
--source include/wait_condition.inc
--echo # Step-5: Check that the data is there.
let $count= 1;
let $table= test.t1;
source include/wait_until_rows_count.inc;
--echo # Step-6: Cleanup
--echo # kill the dump thread serving the mysqlbinlog --stop-never process
--source include/stop_dump_threads.inc
DROP TABLE t1;
--remove_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh

View file

@ -0,0 +1,36 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
include/save_master_gtid.inc
connection slave;
include/wait_for_slave_sql_error.inc [errno=1286]
Last_Error = 'Error 'Unknown storage engine 'innodb'' on query. Default database: 'test'. Query: 'create table t1 (a int) engine=innodb''
STOP SLAVE IO_THREAD;
include/wait_for_slave_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
include/sync_with_master_gtid.inc
show tables;
Tables_in_test
t2
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
show create table t3;
ERROR 42S02: Table 'test.t3' doesn't exist
connection master;
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
CALL mtr.add_suppression('Slave: Unknown storage engine .* Error_code: 1286');
include/rpl_end.inc

View file

@ -0,0 +1 @@
--loose-disable-innodb --replicate-ignore-table=test.t3

View file

@ -0,0 +1,39 @@
--source include/master-slave.inc
--source include/have_innodb.inc
--connection master
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
--source include/save_master_gtid.inc
--connection slave
# Using ER_UNKNOWN_STORAGE_ENGINE wont work
let $slave_sql_errno= 1286;
--source include/wait_for_slave_sql_error.inc
--let $status_items= Last_Error
--source include/show_slave_status.inc
STOP SLAVE IO_THREAD;
source include/wait_for_slave_to_stop.inc;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
show tables;
show create table t2;
--error ER_NO_SUCH_TABLE
show create table t1;
--error ER_NO_SUCH_TABLE
show create table t3;
--connection master
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
CALL mtr.add_suppression('Slave: Unknown storage engine .* Error_code: 1286');
--source include/rpl_end.inc

View file

@ -42,7 +42,7 @@ perl;
$re2=join('|', @plugins);
$skip=0;
open(F, '<', "$ENV{MYSQL_TMP_DIR}/mysqld--help.txt") or die;
print "Windows bug: happens when a new line is exactly at the right offset.\n";
print "Windows bug: new line disappears when it is exactly at the right offset.\n";
while (<F>) {
next if 1../The following groups are read/;
# formatting, skip line consisting entirely of dashes and blanks

View file

@ -296,7 +296,7 @@ class Write_on_release_cache
public:
enum flag
{
FLUSH_F
FLUSH_F= 1
};
typedef unsigned short flag_set;

View file

@ -564,14 +564,14 @@ inline bool is_system_table_name(const char *name, uint length)
SYNOPSIS
open_table_def()
thd Thread handler
thd Thread handler
share Fill this with table definition
db_flags Bit mask of the following flags: OPEN_VIEW
flags Bit mask of the following flags: OPEN_VIEW
NOTES
This function is called when the table definition is not cached in
table definition cache
The data is returned in 'share', which is alloced by
The data is returned in 'share', which is allocated by
alloc_table_share().. The code assumes that share is initialized.
*/

View file

@ -114,7 +114,6 @@ IF(CONNECT_WITH_LIBXML2)
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SET(ZLIB_LIBRARY "z") # see ZLIB_INCLUDE_DIR below
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
add_definitions(-DLIBXML2_SUPPORT)
@ -333,14 +332,6 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
# Don't link with bundled zlib and systel libxml2 at the same time.
# System libxml2 uses system zlib, might conflict with the bundled one.
IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB)
GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES)
LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR})
SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS})
ENDIF()
IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS

View file

@ -1113,26 +1113,26 @@ buf_page_is_corrupted(
the first page of each file of the system tablespace.
Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) {
ulint i = 0;
do {
if (read_buf[i]) {
return true;
}
} while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
/* Checksum fields can have valid value as zero.
If the page is not empty then do the checksum
calculation for the page. */
bool all_zeroes = true;
for (size_t i = 0; i < srv_page_size; i++) {
#ifndef UNIV_INNOCHECKSUM
if (!space || !space->id) {
/* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
in the system tablespace. */
i += 8;
}
#endif
do {
if (read_buf[i]) {
return true;
if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
&& (!space || !space->id)) {
i += 8;
}
} while (++i < srv_page_size);
return false;
#endif
if (read_buf[i]) {
all_zeroes = false;
break;
}
}
if (all_zeroes) {
return false;
}
}
switch (curr_algo) {

View file

@ -950,24 +950,25 @@ buf_page_is_corrupted(
the first page of each file of the system tablespace.
Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) {
ulint i = 0;
do {
if (read_buf[i]) {
return true;
/* Checksum fields can have valid value as zero.
If the page is not empty then do the checksum
calculation for the page. */
bool all_zeroes = true;
for (size_t i = 0; i < srv_page_size; i++) {
if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
&& (!space || space->id)) {
i += 8;
}
} while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
if (!space || !space->id) {
/* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
in the system tablespace. */
i += 8;
}
do {
if (read_buf[i]) {
return true;
all_zeroes = false;
break;
}
} while (++i < srv_page_size);
return false;
}
if (all_zeroes) {
return false;
}
}
switch (curr_algo) {

View file

@ -50,7 +50,7 @@ if [ $1 = 1 ] ; then
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{mysqld_user}:%{mysqld_group} $datadir
chown -R -f %{mysqld_user}:%{mysqld_group} $datadir
if [ ! -e $datadir/mysql ]; then
# Create data directory

View file

@ -124,6 +124,8 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
ADD_CONVENIENCE_LIBRARY(zlib STATIC
${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
RESTRICT_SYMBOL_EXPORTS(zlib)
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
@ -142,7 +144,4 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
elseif(UNIX)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
endif()