Skip to content

Commit

Permalink
Implemented PS-5937 (Merge MySQL 5.7.29 up to 67891b7) (merge with co…
Browse files Browse the repository at this point in the history
…nflicts)
  • Loading branch information
inikep committed Jan 15, 2020
2 parents 3740ccf + 67891b7 commit fd66a5e
Show file tree
Hide file tree
Showing 109 changed files with 3,705 additions and 486 deletions.
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<<<<<<< HEAD
Percona Server 5.7
------------------
||||||| merged common ancestors
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
=======
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
>>>>>>> 67891b7

Percona Server is a branch of MySQL 5.7 bringing higher performance,
reliability and more features.
Expand Down
8 changes: 8 additions & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=7
<<<<<<< HEAD
MYSQL_VERSION_PATCH=28
MYSQL_VERSION_EXTRA=-31
||||||| merged common ancestors
MYSQL_VERSION_PATCH=28
MYSQL_VERSION_EXTRA=
=======
MYSQL_VERSION_PATCH=29
MYSQL_VERSION_EXTRA=
>>>>>>> 67891b7
7 changes: 0 additions & 7 deletions client/dump/mysql_crawler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,6 @@ void Mysql_crawler::enumerate_views(const Database& db)
const Mysql::Tools::Base::Mysql_query_runner::Row& is_view= **view_it;
if (is_view[0] == "1")
{
/* Check if view dependent objects exists */
if (runner->run_query(std::string("LOCK TABLES ")
+ this->get_quoted_object_full_name(db.get_name(), table_name)
+ " READ") != 0)
return;
else
runner->run_query(std::string("UNLOCK TABLES"));
View* view= new View(this->generate_new_object_id(),
table_name,
db.get_name(),
Expand Down
33 changes: 29 additions & 4 deletions client/dump/mysqldump_tool_chain_maker.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -31,6 +31,8 @@
#include "sql_formatter.h"
#include "mysqldump_tool_chain_maker_options.h"
#include <boost/algorithm/string.hpp>
#include "view.h"
#include "m_ctype.h"

using namespace Mysql::Tools::Dump;

Expand All @@ -52,12 +54,35 @@ I_object_reader* Mysqldump_tool_chain_maker::create_chain(
{
return NULL;
}
if (!m_options->is_object_included_in_dump(
dynamic_cast<Abstract_data_object*>(
dump_task->get_related_db_object())))

Abstract_data_object* object= dynamic_cast<Abstract_data_object*>(
dump_task->get_related_db_object());
if (!m_options->is_object_included_in_dump(object))
{
return NULL;
}
/*
View dependency check is moved post filteration. This will ensure that
only filtered out views will be checked for their dependecies. This
allows mysqlpump to dump a database even when there exsits an invalid
view in another database which user is not interested to dump. I_S views
are skipped from this check.
*/
if (object && (dynamic_cast<View*>(object) != NULL) &&
my_strcasecmp(&my_charset_latin1, object->get_schema().c_str(),
INFORMATION_SCHEMA_DB_NAME))
{
Mysql::Tools::Base::Mysql_query_runner* runner= this->get_runner();
/* Check if view dependent objects exists */
if (runner->run_query(std::string("LOCK TABLES ")
+ this->get_quoted_object_full_name(object->get_schema(),
object->get_name()) + " READ") != 0)
return NULL;
else
runner->run_query(std::string("UNLOCK TABLES"));
delete runner;
}

if (m_main_object_reader == NULL)
{
I_output_writer* writer;
Expand Down
3 changes: 2 additions & 1 deletion include/mysql_com.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -634,6 +634,7 @@ ulong STDCALL net_field_length_checked(uchar **packet, ulong max_length);
my_ulonglong net_field_length_ll(uchar **packet);
uchar *net_store_length(uchar *pkg, ulonglong length);
unsigned int net_length_size(ulonglong num);
unsigned int net_field_length_size(const unsigned char *pos);
#endif

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions include/welcome_copyright_notice.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand All @@ -23,7 +23,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_

#define COPYRIGHT_NOTICE_CURRENT_YEAR "2019"
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2020"

/*
This define specifies copyright notice which is displayed by every MySQL
Expand Down
60 changes: 60 additions & 0 deletions mysql-test/include/escape_sql.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ==== Purpose ====
#
# Escape occurences of " or ' in a string, in order to be used inside
# an SQL statement.
#
# ==== Usage ====
#
# --let $escape_string= String
# [--let $enclosing_char= "|' (default is ")]
# --source include/escape_sql.inc
# --echo $escape_string
#
# Parameters:
# $escape_string
# String to search for occurences of the $enclosing_char and
# escape them according to SQL syntax. It is also the output
# parameter.

# $enclosing_char
# The character that will be used to enclose $escape_string when
# included in an SQL statement.
#

if (!$escape_string)
{
--die Error: set $escape_string before sourcing escape_sql.inc
}

if ($escape_string != '')
{
--let $_enclosing_char= "
if ($enclosing_char)
{
--let $_enclosing_char= $enclosing_char
}
--let $_output_filename= `SELECT UUID()`
--let $_output_filename= $MYSQLTEST_VARDIR/tmp/$_output_filename
--let full_output_filename= $_output_filename
--let to_replace= $escape_string
--let used_quote= $_enclosing_char
perl;
my $out= $ENV{'full_output_filename'};
my $to_replace= $ENV{'to_replace'};
my $quote= $ENV{'used_quote'};
$to_replace =~ s/$quote/$quote$quote/g;
open(FILE, ">", $out) or die "Error $? opening $output_filename: $!";
print FILE $to_replace or die "Error $? writing to $output_filename: $!";
close FILE or die "Error $? closing $output_filename: $!";
chmod 0777, $out;
EOF
--let $escape_string= `SELECT LOAD_FILE('$_output_filename')`
}
# Cleanup
--remove_file $_output_filename
7 changes: 7 additions & 0 deletions mysql-test/include/have_slave_repository_type_table.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--let $mi_repo= `SELECT @@GLOBAL.master_info_repository='FILE'`
--let $rli_repo= `SELECT @@GLOBAL.relay_log_info_repository='FILE'`

if (`SELECT $mi_repo = 1 OR $rli_repo = 1`)
{
--skip Test runs only when slave repository type = TABLE
}
36 changes: 36 additions & 0 deletions mysql-test/include/read_only_bug28438114.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Test that $query correctly checks read_only flag even if this
# flag is set while the query is blocked waiting for protection
# global read lock. Used by test for bug#28438114 in read_only.test.
#

--enable_connect_log
connection default;
FLUSH TABLES WITH READ LOCK;

connection con1;
--echo # DDL statement will block waiting for GRL.
--send_eval $query

connection con2;
--echo # Wait until statement is blocked waiting for GRL.
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = "Waiting for global read lock";
--source include/wait_condition.inc
SET GLOBAL READ_ONLY= 1;

connection default;
--echo # Unblock the DDL statement.
UNLOCK TABLES;

connection con1;
--echo # Without patch for BUG#28438114, the DDL statement will succeed even
--echo # though read only mode was set.
--error ER_OPTION_PREVENTS_STATEMENT
--reap

--echo # Clean up.
connection default;
SET GLOBAL READ_ONLY= 0;
--disable_connect_log
9 changes: 9 additions & 0 deletions mysql-test/include/show_slave_status.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ while ($_show_slave_status_items)
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`

--let $_show_slave_status_value= query_get_value($show_slave_status_cmd, $_show_slave_status_name, 1)

if ($_show_slave_status_value)
{
--let $escape_string= $_show_slave_status_value
--let $enclosing_char= "
--source include/escape_sql.inc
--let $_show_slave_status_value= $escape_string
}
--let $_slave_field_result_replace= /[\\]/\// $slave_field_result_replace
--replace_regex $_slave_field_result_replace
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/r/insert_debug.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
CREATE TABLE t1(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
INSERT INTO t1(c1, c2, c3) VALUES('A1','B1','IT1'), ('A2','B2','IT1'), ('A3','B3','IT1'), ('A4','B4','IT1'), ('A5','B5','IT1'), ('A6','B6','IT1'), ('A7','B7','IT1');
CREATE TABLE t2(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
INSERT INTO t2(c1, c2, c3) VALUES ('A3','B3','IT2'), ('A2','B2','IT2'), ('A4','B4','IT2'), ('A5','B5','II2');
CREATE TABLE result(id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10),
c3 VARCHAR(10), update_count INT DEFAULT 0, UNIQUE KEY uniq_idx (c1,c2), PRIMARY KEY (id)) ENGINE = innodb;
SET DEBUG_SYNC = "ha_write_row_end WAIT_FOR flushed EXECUTE 1";
INSERT INTO result(c1, c2, c3) SELECT * FROM t1 ON DUPLICATE KEY UPDATE c2=t1.c2, c3='UT1', update_count=update_count+1;
INSERT INTO result(c1, c2, c3) SELECT * FROM t2 ON DUPLICATE KEY UPDATE c2=t2.c2, c3='UT2', update_count=update_count+1;
SET DEBUG_SYNC = "now SIGNAL flushed";
SELECT * FROM result;
id c1 c2 c3 update_count
1 A1 B1 IT1 0
2 A3 B3 UT1 1
3 A2 B2 UT1 1
4 A4 B4 UT1 1
5 A5 B5 UT1 1
9 A6 B6 IT1 0
10 A7 B7 IT1 0
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE result;
31 changes: 31 additions & 0 deletions mysql-test/r/lowercase_table4.result
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,34 @@ REFERENCED_TABLE_NAME Customer
DROP TABLE Product_Order;
DROP TABLE Product;
DROP TABLE Customer;
#
# Bug#29957361: TABLE NOT IN THE SHOW TABLES WITH LOWER_CASE_TABLE_NAMES=2
#
CREATE DATABASE my_db;
USE my_db;
CREATE TABLE UPPERCASE_MYISAM (a INT) ENGINE=MYISAM;
CREATE TABLE lowercase_myisam (a INT) ENGINE=MYISAM;
CREATE TABLE UPPERCASE_INNODB (a INT) ENGINE=InnoDB;
CREATE TABLE lowercase_innodb (a INT) ENGINE=InnoDB;
SHOW TABLES;
Tables_in_my_db
UPPERCASE_INNODB
UPPERCASE_MYISAM
lowercase_innodb
lowercase_myisam
CREATE USER 'test_user'@'localhost';
GRANT SELECT ON my_db.UPPERCASE_MYISAM TO 'test_user'@'localhost';
GRANT SELECT ON my_db.lowercase_myisam TO 'test_user'@'localhost';
GRANT SELECT ON my_db.UPPERCASE_INNODB TO 'test_user'@'localhost';
GRANT SELECT ON my_db.lowercase_innodb TO 'test_user'@'localhost';
USE my_db;
# Without the patch, tables with uppercase table names were not displayed.
SHOW TABLES;
Tables_in_my_db
UPPERCASE_INNODB
UPPERCASE_MYISAM
lowercase_innodb
lowercase_myisam
DROP USER 'test_user'@'localhost';
DROP DATABASE my_db;
USE test;
6 changes: 6 additions & 0 deletions mysql-test/r/mysql_config_editor.result
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ user = test_user4
##############################################
# Tests for mysql_config_editor's help command
##############################################
<<<<<<< HEAD
Copyright (c) 2009-2019 Percona LLC and/or its affiliates
Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
||||||| merged common ancestors
Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
=======
Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
>>>>>>> 67891b7

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Expand Down
27 changes: 27 additions & 0 deletions mysql-test/r/mysqlpump.result
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,30 @@ master_info_repository FILE
SHOW VARIABLES LIKE "relay_log_info_repository";
Variable_name Value
relay_log_info_repository FILE
#
# Bug #27096081: MYSQLPUMP VALIDATES ALL DATABASE OBJECTS BY
# IGNORING --INCLUDE_DATABASES OPTION
#
CREATE DATABASE db1;
USE db1;
CREATE TABLE t1(id INT);
INSERT INTO t1 SELECT 1;
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE DATABASE db2;
USE db2;
CREATE TABLE t2(id INT);
INSERT INTO t2 SELECT 1;
CREATE USER 'u1'@'%' IDENTIFIED BY 'abc';
GRANT ALL ON *.* TO 'u1'@'%';
FLUSH PRIVILEGES;
USE db2;
CREATE VIEW v2 AS SELECT * FROM t2;
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u1`@`%` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`id` AS `id` from `t2` latin1 latin1_swedish_ci
DROP USER 'u1'@'%';
FLUSH PRIVILEGES;
CREATE USER 'u1'@'%' IDENTIFIED BY 'abc';
DROP USER 'u1'@'%';
DROP DATABASE db1;
DROP DATABASE db2;
Loading

0 comments on commit fd66a5e

Please sign in to comment.