Skip to content

Commit

Permalink
Merge 10.2 into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 9, 2019
2 parents f11d425 + c65cb24 commit 892378f
Show file tree
Hide file tree
Showing 35 changed files with 356 additions and 299 deletions.
4 changes: 1 addition & 3 deletions extra/mariabackup/fil_cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,9 @@ static bool page_is_corrupted(const byte *page, ulint page_no,

memcpy(tmp_page, page, page_size);

bool decrypted = false;
if (!space->crypt_data
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
|| !fil_space_decrypt(space, tmp_frame, tmp_page,
&decrypted)) {
|| !fil_space_decrypt(space, tmp_frame, tmp_page)) {
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,8 @@ static int prepare_export()
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
" --console --skip-log-error --skip-log-bin --bootstrap < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe,
orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""),
xtrabackup_use_memory);
Expand All @@ -1540,7 +1541,8 @@ static int prepare_export()
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
" --console --log-error= --skip-log-bin --bootstrap < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe,
(my_defaults_group_suffix?my_defaults_group_suffix:""),
xtrabackup_use_memory);
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
Binary file added mysql-test/std_data/binlog_before_20574.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
connection master;
include/rpl_stop_server.inc [server_number=1]
# Data in binlog
# CREATE TABLE t1 (a INT);
# INSERT INTO t1 VALUES (1),(2),(3);
# REPLACE INTO t1 VALUES (4);
include/rpl_start_server.inc [server_number=1]
connection slave;
RESET SLAVE;
RESET MASTER;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
include/start_slave.inc
DESC t1;
Field Type Null Key Default Extra
a int(11) YES NULL
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
DROP TABLE t1;
include/rpl_end.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted binlogs, SHOW BINLOG EVENTS reports the correct one.
# Test replicating off old master.
# Test case Desc:- When new server reads the data from old server binlog which
# does not send START_ENCRYPTION_EVENT to slave.
# We simulate old master by copying in pre-generated binlog files from earlier
# server versions with encrypted binlog.
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc

--connection slave
--source include/stop_slave.inc

--connection master
--let $datadir= `SELECT @@datadir`

--let $rpl_server_number= 1
--source include/rpl_stop_server.inc

--remove_file $datadir/master-bin.000001
--remove_file $datadir/master-bin.state
--echo # Data in binlog
--echo # CREATE TABLE t1 (a INT);
--echo # INSERT INTO t1 VALUES (1),(2),(3);
--echo # REPLACE INTO t1 VALUES (4);

--copy_file $MYSQL_TEST_DIR/std_data/binlog_before_20574.bin $datadir/master-bin.000001

--let $rpl_server_number= 1
--source include/rpl_start_server.inc

--source include/wait_until_connected_again.inc
--save_master_pos

--connection slave
RESET SLAVE;
RESET MASTER;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
--source include/start_slave.inc
--sync_with_master
DESC t1;
SELECT * FROM t1 ORDER BY a;

DROP TABLE t1;
--source include/rpl_end.inc
9 changes: 9 additions & 0 deletions mysql-test/suite/binlog_encryption/binlog_row_annotate.result
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list []
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
Expand Down Expand Up @@ -342,6 +345,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list []
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
Expand Down Expand Up @@ -502,6 +508,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list []
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/binlog_encryption/mysqlbinlog.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ INSERT INTO t1 VALUES (1),(2),(3);
REPLACE INTO t1 VALUES (4);
DROP TABLE t1;
FLUSH LOGS;
FOUND 1 /Ignorable event type 164.*/ in binlog_enc.sql
3 changes: 3 additions & 0 deletions mysql-test/suite/binlog_encryption/mysqlbinlog.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ let outfile=$MYSQLTEST_VARDIR/tmp/binlog_enc.sql;
exec $MYSQL_BINLOG $local > $outfile;
exec $MYSQL_BINLOG $local --force-read >> $outfile;
exec $MYSQL_BINLOG $remote >> $outfile;
--let SEARCH_FILE= $outfile
--let SEARCH_PATTERN= Ignorable event type 164.*
--source include/search_pattern_in_file.inc
remove_file $outfile;

18 changes: 16 additions & 2 deletions mysql-test/suite/mariabackup/partial.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CREATE TABLE t2(i int) ENGINE INNODB;

echo # xtrabackup backup;

let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir;
--enable_result_log
Expand All @@ -25,13 +25,27 @@ EOF
write_file $targetdir/test/junk.frm;
EOF

let server_cnf=$targetdir/server.cnf;
copy_file $MYSQLTEST_VARDIR/my.cnf $server_cnf;

# Emulate server config file turnes on binary logs
perl;
my $binlog_path="$ENV{'targetdir'}/mysqld-bin";
my $config_path=$ENV{'server_cnf'};
open(my $fd, '>>', "$config_path");
print $fd "\n[mysqld]\n";
print $fd "log-bin=$binlog_path\n";
close $fd;
EOF

echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$server_cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
--enable_result_log

list_files $targetdir/test *.cfg;
# There must not be binary logs created on --prepare step
list_files $targetdir/ mysqld-bin.*;

let $MYSQLD_DATADIR= `select @@datadir`;
ALTER TABLE t1 DISCARD TABLESPACE;
Expand Down
13 changes: 5 additions & 8 deletions sql-common/client_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
There is no reference counting and no unloading either.
*/

#if defined(_MSC_VER)
/* Silence warnings about variable 'unused' being used. */
#define FORCE_INIT_OF_VARS 1
#endif

#include <my_global.h>
#include "mysql.h"
#include <my_sys.h>
Expand Down Expand Up @@ -243,12 +238,12 @@ int mysql_client_plugin_init()
struct st_mysql_client_plugin **builtin;
va_list unused;
DBUG_ENTER("mysql_client_plugin_init");
LINT_INIT_STRUCT(unused);

if (initialized)
DBUG_RETURN(0);

bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
bzero(&unused, sizeof unused);

mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0));
Expand Down Expand Up @@ -306,9 +301,7 @@ struct st_mysql_client_plugin *
mysql_client_register_plugin(MYSQL *mysql,
struct st_mysql_client_plugin *plugin)
{
va_list unused;
DBUG_ENTER("mysql_client_register_plugin");
LINT_INIT_STRUCT(unused);

if (is_not_initialized(mysql, plugin->name))
DBUG_RETURN(NULL);
Expand All @@ -324,7 +317,11 @@ mysql_client_register_plugin(MYSQL *mysql,
plugin= NULL;
}
else
{
va_list unused;
bzero(&unused, sizeof unused);
plugin= add_plugin(mysql, plugin, 0, 0, unused);
}

mysql_mutex_unlock(&LOCK_load_client_plugin);
DBUG_RETURN(plugin);
Expand Down
34 changes: 18 additions & 16 deletions sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,19 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
alg != BINLOG_CHECKSUM_ALG_OFF))
event_len= event_len - BINLOG_CHECKSUM_LEN;

/*
Create an object of Ignorable_log_event for unrecognized sub-class.
So that SLAVE SQL THREAD will only update the position and continue.
We should look for this flag first instead of judging by event_type
Any event can be Ignorable_log_event if it has this flag on.
look into @note of Ignorable_log_event
*/
if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F)
{
ev= new Ignorable_log_event(buf, fdle,
get_type_str((Log_event_type) event_type));
goto exit;
}
switch(event_type) {
case QUERY_EVENT:
ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT);
Expand Down Expand Up @@ -2222,24 +2235,13 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
ev = new Start_encryption_log_event(buf, event_len, fdle);
break;
default:
/*
Create an object of Ignorable_log_event for unrecognized sub-class.
So that SLAVE SQL THREAD will only update the position and continue.
*/
if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F)
{
ev= new Ignorable_log_event(buf, fdle,
get_type_str((Log_event_type) event_type));
}
else
{
DBUG_PRINT("error",("Unknown event code: %d",
(uchar) buf[EVENT_TYPE_OFFSET]));
ev= NULL;
break;
}
DBUG_PRINT("error",("Unknown event code: %d",
(uchar) buf[EVENT_TYPE_OFFSET]));
ev= NULL;
break;
}
}
exit:

if (ev)
{
Expand Down
11 changes: 11 additions & 0 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6741,7 +6741,18 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
mi->last_queued_gtid.seq_no == 1000)
goto skip_relay_logging;
});
goto default_action;
#endif
case START_ENCRYPTION_EVENT:
if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F)
{
/*
If the event was not requested by the slave (the slave did not ask for
it), i.e. has end_log_pos=0, we do not increment mi->master_log_pos
*/
inc_pos= uint4korr(buf+LOG_POS_OFFSET) ? event_len : 0;
break;
}
/* fall through */
default:
default_action:
Expand Down
26 changes: 0 additions & 26 deletions sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3751,32 +3751,6 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
goto end;
}

if (get_use_stat_tables_mode(thd) > NEVER && tables->table)
{
TABLE_SHARE *table_share= tables->table->s;
if (table_share && table_share->table_category == TABLE_CATEGORY_USER &&
table_share->tmp_table == NO_TMP_TABLE)
{
if (table_share->stats_cb.stats_can_be_read ||
!alloc_statistics_for_table_share(thd, table_share, FALSE))
{
if (table_share->stats_cb.stats_can_be_read)
{
KEY *key_info= table_share->key_info;
KEY *key_info_end= key_info + table_share->keys;
KEY *table_key_info= tables->table->key_info;
for ( ; key_info < key_info_end; key_info++, table_key_info++)
table_key_info->read_stats= key_info->read_stats;
Field **field_ptr= table_share->field;
Field **table_field_ptr= tables->table->field;
for ( ; *field_ptr; field_ptr++, table_field_ptr++)
(*table_field_ptr)->read_stats= (*field_ptr)->read_stats;
tables->table->stats_is_read= table_share->stats_cb.stats_is_read;
}
}
}
}

process_view_routines:
/*
Again we may need cache all routines used by this view and add
Expand Down
1 change: 0 additions & 1 deletion sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
invoker.init();
prepare_derived_at_open= FALSE;
create_tmp_table_for_derived= FALSE;
force_read_stats= FALSE;
save_prep_leaf_list= FALSE;
org_charset= 0;
/* Restore THR_THD */
Expand Down
3 changes: 0 additions & 3 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -2444,9 +2444,6 @@ class THD :public Statement,
*/
bool create_tmp_table_for_derived;

/* The flag to force reading statistics from EITS tables */
bool force_read_stats;

bool save_prep_leaf_list;

/* container for handler's private per-connection data */
Expand Down
Loading

0 comments on commit 892378f

Please sign in to comment.