Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2019-06-11 13:00:18 +03:00
commit b42dbdbccd
46 changed files with 612 additions and 128 deletions

View File

@ -72,10 +72,10 @@ MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
TARGET_LINK_LIBRARIES(mysql_plugin ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)
TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB})
TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB} mysys_ssl)
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc ../sql/password.c)
TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB})
TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB} mysys_ssl)
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")

View File

@ -979,6 +979,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1);
}
break;
case (int) OPT_DEFAULT_CHARSET:
if (default_charset == disabled_my_option)
default_charset= (char *)mysql_universal_client_charset;
break;
}
return 0;
}

View File

@ -5189,7 +5189,11 @@ next_file_item_1:
goto next_datadir_item;
}
snprintf(dbpath, sizeof(dbpath)-1, "%s/%s", path, dbinfo.name);
snprintf(dbpath, sizeof(dbpath), "%.*s/%.*s",
OS_FILE_MAX_PATH/2-1,
path,
OS_FILE_MAX_PATH/2-1,
dbinfo.name);
os_normalize_path(dbpath);

View File

@ -21,6 +21,17 @@ use strict;
use warnings;
use Carp;
# Define all MariaDB options that the user should be able to specify
# many times in the config file. Note that options must be written
# using '-' instead of '_' here!
my %multipart_options=
(
"plugin-load-add" => 1,
"optimizer-switch" => 1,
);
sub new {
my ($class, $option_name, $option_value)= @_;
my $self= bless { name => $option_name,
@ -327,7 +338,6 @@ sub new {
# Skip comment
next;
}
else {
croak "Unexpected line '$line' found in '$path'";
}
@ -355,6 +365,11 @@ sub insert {
if ( defined $option ) {
#print "option: $option, value: $value\n";
my $tmp_option= $option;
$tmp_option =~ s/_/-/g;
# If the option is an option that one can specify many times, always add
$if_not_exist= 1 if ($multipart_options{$tmp_option});
# Add the option to the group
$group->insert($option, $value, $if_not_exist);

View File

@ -311,7 +311,7 @@ sub post_check_client_groups {
$first_mysqld->name());
# Then generate [client.<suffix>] for each [mysqld.<suffix>]
foreach my $mysqld ( $config->like('mysqld.') ) {
foreach my $mysqld ( $config->like('mysqld\.') ) {
$self->post_check_client_group($config,
'client'.$mysqld->after('mysqld'),
$mysqld->name())
@ -333,7 +333,7 @@ sub post_check_embedded_group {
my $mysqld= $config->group('mysqld') or
croak "Can't run with embedded, config has no default mysqld section";
my $first_mysqld= $config->first_like('mysqld.') or
my $first_mysqld= $config->first_like('mysqld\.') or
croak "Can't run with embedded, config has no mysqld";
my %no_copy = map { $_ => 1 }
@ -372,7 +372,7 @@ sub resolve_at_variable {
}
$res .= $after;
$config->insert($group->name(), $option->name(), $res)
$option->{value}= $res;
}
@ -457,7 +457,7 @@ sub new_config {
}
$self->run_section_rules($config,
'mysqld.',
'mysqld\.',
@mysqld_rules);
# [mysqlbinlog] need additional settings

View File

@ -7290,5 +7290,60 @@ pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
# End of 10.2 tests
#
# MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1),(5);
CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET @tmp19714=@@optimizer_switch;
SET optimizer_switch='subquery_cache=off';
explain format=json
SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"pseudo_bits_condition": "1 = t1.a or <in_optimizer>(1,<exists>(subquery#3))",
"table": {
"table_name": "t2",
"access_type": "system",
"rows": 1,
"filtered": 100
},
"subqueries": [
{
"query_block": {
"select_id": 3,
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "1 = t3.c"
}
}
}
]
}
}
]
}
}
SET optimizer_switch=@tmp19714;
drop table t1,t2,t3;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;

View File

@ -8,5 +8,28 @@ set @join_cache_level_for_subselect_test=@@join_cache_level;
--source subselect.test
--echo #
--echo # MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON
--echo #
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1),(5);
# t2 must be MyISAM or Aria and contain 1 row
CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET @tmp19714=@@optimizer_switch;
SET optimizer_switch='subquery_cache=off';
explain format=json
SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SET optimizer_switch=@tmp19714;
drop table t1,t2,t3;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;

View File

@ -3607,6 +3607,33 @@ b row_number() over (partition by sum(a)+1)
2000 1
drop table t1;
#
# MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF,
# window functions and views
#
create table t1 (id int, n1 int);
insert into t1 values (1,1),(2,1),(3,2),(4,4);
explain
select max(n1) over (partition by 'abc') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
select max(n1) over (partition by 'abc') from t1;
max(n1) over (partition by 'abc')
4
4
4
4
explain
select rank() over (partition by 'abc' order by 'xyz') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
select rank() over (partition by 'abc' order by 'xyz') from t1;
rank() over (partition by 'abc' order by 'xyz')
1
1
1
1
drop table t1;
#
# End of 10.2 tests
#
#

View File

@ -2325,6 +2325,22 @@ select b, row_number() over (partition by sum(a)+1) from t1 group by b;
drop table t1;
--echo #
--echo # MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF,
--echo # window functions and views
--echo #
create table t1 (id int, n1 int);
insert into t1 values (1,1),(2,1),(3,2),(4,4);
explain
select max(n1) over (partition by 'abc') from t1;
select max(n1) over (partition by 'abc') from t1;
explain
select rank() over (partition by 'abc' order by 'xyz') from t1;
select rank() over (partition by 'abc' order by 'xyz') from t1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -0,0 +1,71 @@
#
# Preparatory cleanup.
#
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
DROP TABLE IF EXISTS t1;
#
# We need a fixed timestamp to avoid varying results.
#
SET timestamp=1000000000;
#
# We need big packets.
#
# Capture initial value to reset at the end of the test
# Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 10*1024*1024*1024;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '10737418240'
max_allowed_packet is a global variable.
In order for the preceding change in max_allowed_packets' value
to be seen and used, we must start a new connection.
The change does not take effect with the current one.
For simplicity, we just disconnect / reconnect connection default here.
disconnect default;
connect default, localhost,root,,;
#
# Delete all existing binary logs.
#
RESET MASTER;
#
# Create a test table.
#
use mysqltest;
CREATE TABLE t1 (
c1 LONGTEXT
) DEFAULT CHARSET latin1;
#
# Show how many rows are affected by each statement.
#
#
# Insert some big rows.
#
insert 1024MB data twice
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 67108864));
affected rows: 1
INSERT INTO t1 VALUES (REPEAT('MegaByteBlckMany', 67108864));
affected rows: 1
#
# Flush all log buffers to the log file.
#
FLUSH LOGS;
affected rows: 0
#
# Call mysqlbinlog to display the log file contents.
# NOTE: The output of mysqlbinlog is redirected to
# $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
# If you want to examine it, disable remove_file
# at the bottom of the test script.
#
#
# Cleanup.
#
# reset variable value to pass testcase checks
SET @@global.max_allowed_packet = 16777216;
affected rows: 0
DROP TABLE t1;
affected rows: 0
drop database if exists mysqltest;
affected rows: 0
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out

View File

@ -0,0 +1,110 @@
# mysqlbinlog_big.test
#
# Show that mysqlbinlog can handle big rows.
#
#
# The *huge* output of mysqlbinlog will be redirected to
# $MYSQLTEST_VARDIR/$mysqlbinlog_output
#
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
--source include/have_binlog_format_row.inc
--source include/have_log_bin.inc
# This is a big test.
--source include/big_test.inc
--echo #
--echo # Preparatory cleanup.
--echo #
--disable_warnings
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo #
--echo # We need a fixed timestamp to avoid varying results.
--echo #
SET timestamp=1000000000;
--echo #
--echo # We need big packets.
--echo #
--echo # Capture initial value to reset at the end of the test
# use let $<var> = query_get_value as FLUSH statements
# in the test will set @<var> values to NULL
let $orig_max_allowed_packet =
query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
--echo # Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 10*1024*1024*1024;
--echo max_allowed_packet is a global variable.
--echo In order for the preceding change in max_allowed_packets' value
--echo to be seen and used, we must start a new connection.
--echo The change does not take effect with the current one.
--echo For simplicity, we just disconnect / reconnect connection default here.
disconnect default;
connect (default, localhost,root,,);
--echo #
--echo # Delete all existing binary logs.
--echo #
RESET MASTER;
--echo #
--echo # Create a test table.
--echo #
use mysqltest;
eval CREATE TABLE t1 (
c1 LONGTEXT
) DEFAULT CHARSET latin1;
--echo #
--echo # Show how many rows are affected by each statement.
--echo #
--enable_info
--echo #
--echo # Insert some big rows.
--echo #
--echo insert 1024MB data twice
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 67108864));
INSERT INTO t1 VALUES (REPEAT('MegaByteBlckMany', 67108864));
--echo #
--echo # Flush all log buffers to the log file.
--echo #
FLUSH LOGS;
--echo #
--echo # Call mysqlbinlog to display the log file contents.
--echo # NOTE: The output of mysqlbinlog is redirected to
--echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo # If you want to examine it, disable remove_file
--echo # at the bottom of the test script.
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
--exec $MYSQL_BINLOG -B -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo #
--echo # Cleanup.
--echo #
--echo # reset variable value to pass testcase checks
eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
DROP TABLE t1;
drop database if exists mysqltest;
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
#
# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
#
--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output

View File

@ -0,0 +1,39 @@
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
INSERT INTO t1 VALUES(1, repeat('Nesamani', 10));
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `ENCRYPTED`=YES
# Wait max 10 min for key encryption threads to encrypt all spaces
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `ENCRYPTED`=YES
DROP TABLE t1;

View File

@ -0,0 +1,3 @@
--innodb-encrypt-tables=ON
--innodb-encryption-threads=4
--innodb-tablespaces-encryption

View File

@ -0,0 +1,46 @@
-- source include/have_innodb.inc
-- source include/have_example_key_management_plugin.inc
-- source include/not_valgrind.inc
-- source include/not_embedded.inc
let MYSQLD_DATADIR = `SELECT @@datadir`;
--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
INSERT INTO t1 VALUES(1, repeat('Nesamani', 10));
SELECT COUNT(*) FROM t1;
SHOW CREATE TABLE t1;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING <> 0
--source include/wait_condition.inc
--source include/shutdown_mysqld.inc
--source include/start_mysqld.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT COUNT(*) FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;

View File

@ -1779,3 +1779,24 @@
fun:CRYPTO_malloc
fun:ENGINE_new
}
#
# OpenSSL 1.0.1l problems
#
{
OpenSSL 1.0.1l wrong jump
Memcheck:Cond
fun:bcmp
obj:/usr/lib64/libcrypto.so*
fun:FIPS_selftest
}
{
OpenSSL 1.0.1l wrong jump 2
Memcheck:Cond
obj:/usr/lib64/libcrypto.so*
fun:FIPS_mode_set
obj:/usr/lib64/libcrypto.so*
}

View File

@ -74,7 +74,7 @@ IF(HAVE_MLOCK)
ENDIF()
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
TARGET_LINK_LIBRARIES(mysys dbug strings mysys_ssl ${ZLIB_LIBRARY}
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
DTRACE_INSTRUMENT(mysys)

View File

@ -25,8 +25,8 @@ MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c ${REF10_SOURCES} MODULE_ONLY)
# client plugin and unit test ed25519-t can use the library
MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY
CLIENT LINK_LIBRARIES mysys_ssl ref10 COMPONENT ClientPlugins)
CLIENT LINK_LIBRARIES ref10 mysys_ssl COMPONENT ClientPlugins)
IF(WITH_UNIT_TESTS)
MY_ADD_TESTS(ed25519 LINK_LIBRARIES mysys ref10)
MY_ADD_TESTS(ed25519 LINK_LIBRARIES ref10 mysys_ssl)
ENDIF()

View File

@ -1013,7 +1013,7 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len,
const char *file, size_t file_len,
const char *status, size_t status_len);
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
extern st_plugin_int *hton2plugin[MAX_HA];
extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA];
/* Transaction log maintains type definitions */
enum log_status

View File

@ -44,11 +44,6 @@ public:
first_check= true;
}
void cleanup()
{
group_fields.empty();
}
/*
Check if the current row is in a different group than the previous row
this function was called for.
@ -86,6 +81,10 @@ public:
}
return 0;
}
~Group_bound_tracker()
{
group_fields.delete_elements();
}
private:
List<Cached_item> group_fields;
@ -215,7 +214,6 @@ public:
{
if (peer_tracker)
{
peer_tracker->cleanup();
delete peer_tracker;
peer_tracker= NULL;
}
@ -285,7 +283,6 @@ class Item_sum_dense_rank: public Item_sum_int
{
if (peer_tracker)
{
peer_tracker->cleanup();
delete peer_tracker;
peer_tracker= NULL;
}
@ -547,7 +544,6 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
{
if (peer_tracker)
{
peer_tracker->cleanup();
delete peer_tracker;
peer_tracker= NULL;
}

View File

@ -9411,8 +9411,10 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break;
case (int) OPT_SKIP_RESOLVE:
opt_skip_name_resolve= 1;
opt_specialflag|=SPECIAL_NO_RESOLVE;
if ((opt_skip_name_resolve= (argument != disabled_my_option)))
opt_specialflag|= SPECIAL_NO_RESOLVE;
else
opt_specialflag&= ~SPECIAL_NO_RESOLVE;
break;
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
@ -9471,6 +9473,8 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
break;
case OPT_PLUGIN_LOAD:
free_list(opt_plugin_load_list_ptr);
if (argument == disabled_my_option)
break; // Resets plugin list
/* fall through */
case OPT_PLUGIN_LOAD_ADD:
opt_plugin_load_list_ptr->push_back(new i_string(argument));

View File

@ -904,6 +904,11 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->add_member("outer_ref_condition");
write_item(writer, outer_ref_cond);
}
if (pseudo_bits_cond)
{
writer->add_member("pseudo_bits_condition");
write_item(writer, pseudo_bits_cond);
}
/* we do not print HAVING which always evaluates to TRUE */
if (having || (having_value == Item::COND_FALSE))

View File

@ -236,6 +236,7 @@ public:
/* Expensive constant condition */
Item *exec_const_cond;
Item *outer_ref_cond;
Item *pseudo_bits_cond;
/* HAVING condition */
Item *having;

View File

@ -25755,6 +25755,7 @@ int JOIN::save_explain_data_intern(Explain_query *output,
xpl_sel->exec_const_cond= exec_const_cond;
xpl_sel->outer_ref_cond= outer_ref_cond;
xpl_sel->pseudo_bits_cond= pseudo_bits_cond;
if (tmp_having)
xpl_sel->having= tmp_having;
else

View File

@ -6097,10 +6097,12 @@ database_corrupted:
if (err == DB_PAGE_CORRUPTED
|| err == DB_DECRYPTION_FAILED) {
const page_id_t corrupt_page_id = bpage->id;
buf_corrupt_page_release(bpage, space);
if (recv_recovery_is_on()) {
recv_recover_corrupt_page(bpage);
recv_recover_corrupt_page(corrupt_page_id);
}
space->release_for_io();

View File

@ -215,77 +215,6 @@ struct buf_pools_list_size_t {
};
#endif /* !UNIV_INNOCHECKSUM */
/** Page identifier. */
class page_id_t {
public:
/** Constructor from (space, page_no).
@param[in] space tablespace id
@param[in] page_no page number */
page_id_t(ulint space, ulint page_no)
: m_space(uint32_t(space)), m_page_no(uint32(page_no))
{
ut_ad(space <= 0xFFFFFFFFU);
ut_ad(page_no <= 0xFFFFFFFFU);
}
bool operator==(const page_id_t& rhs) const
{
return m_space == rhs.m_space && m_page_no == rhs.m_page_no;
}
bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); }
bool operator<(const page_id_t& rhs) const
{
if (m_space == rhs.m_space) {
return m_page_no < rhs.m_page_no;
}
return m_space < rhs.m_space;
}
/** Retrieve the tablespace id.
@return tablespace id */
uint32_t space() const { return m_space; }
/** Retrieve the page number.
@return page number */
uint32_t page_no() const { return m_page_no; }
/** Retrieve the fold value.
@return fold value */
ulint fold() const { return (m_space << 20) + m_space + m_page_no; }
/** Reset the page number only.
@param[in] page_no page number */
inline void set_page_no(ulint page_no)
{
m_page_no = uint32_t(page_no);
ut_ad(page_no <= 0xFFFFFFFFU);
}
private:
/** Tablespace id. */
uint32_t m_space;
/** Page number. */
uint32_t m_page_no;
/** Declare the overloaded global operator<< as a friend of this
class. Refer to the global declaration for further details. Print
the given page_id_t object.
@param[in,out] out the output stream
@param[in] page_id the page_id_t object to be printed
@return the output stream */
friend
std::ostream&
operator<<(
std::ostream& out,
const page_id_t page_id);
};
/** Print the given page_id_t object.
@param[in,out] out the output stream
@param[in] page_id the page_id_t object to be printed

View File

@ -125,6 +125,77 @@ this must be equal to srv_page_size */
#define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES)
/* @} */
/** Page identifier. */
class page_id_t {
public:
/** Constructor from (space, page_no).
@param[in] space tablespace id
@param[in] page_no page number */
page_id_t(ulint space, ulint page_no)
: m_space(uint32_t(space)), m_page_no(uint32(page_no))
{
ut_ad(space <= 0xFFFFFFFFU);
ut_ad(page_no <= 0xFFFFFFFFU);
}
bool operator==(const page_id_t& rhs) const
{
return m_space == rhs.m_space && m_page_no == rhs.m_page_no;
}
bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); }
bool operator<(const page_id_t& rhs) const
{
if (m_space == rhs.m_space) {
return m_page_no < rhs.m_page_no;
}
return m_space < rhs.m_space;
}
/** Retrieve the tablespace id.
@return tablespace id */
uint32_t space() const { return m_space; }
/** Retrieve the page number.
@return page number */
uint32_t page_no() const { return m_page_no; }
/** Retrieve the fold value.
@return fold value */
ulint fold() const { return (m_space << 20) + m_space + m_page_no; }
/** Reset the page number only.
@param[in] page_no page number */
void set_page_no(ulint page_no)
{
m_page_no = uint32_t(page_no);
ut_ad(page_no <= 0xFFFFFFFFU);
}
private:
/** Tablespace id. */
uint32_t m_space;
/** Page number. */
uint32_t m_page_no;
/** Declare the overloaded global operator<< as a friend of this
class. Refer to the global declaration for further details. Print
the given page_id_t object.
@param[in,out] out the output stream
@param[in] page_id the page_id_t object to be printed
@return the output stream */
friend
std::ostream&
operator<<(
std::ostream& out,
const page_id_t page_id);
};
#ifndef UNIV_INNOCHECKSUM
#include "ut0mutex.h"

View File

@ -51,8 +51,8 @@ recv_find_max_checkpoint(ulint* max_field)
/** Reduces recv_sys->n_addrs for the corrupted page.
This function should called when srv_force_recovery > 0.
@param[in] bpage buffer pool page */
void recv_recover_corrupt_page(buf_page_t* bpage);
@param[in] page_id page id of the corrupted page */
void recv_recover_corrupt_page(page_id_t page_id);
/** Apply any buffered redo log to a page that was just read from a data file.
@param[in,out] bpage buffer pool page */

View File

@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@ -796,9 +796,7 @@ os_file_rename
os_aio
os_file_read
os_file_read_no_error_handling
os_file_read_no_error_handling_int_fd
os_file_write
os_file_write_int_fd
The wrapper functions have the prefix of "innodb_". */
@ -1174,13 +1172,9 @@ to original un-instrumented file I/O APIs */
# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \
os_file_read_no_error_handling_func(type, file, buf, offset, n, o)
# define os_file_read_no_error_handling_int_fd(type, file, buf, offset, n) \
os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL)
# define os_file_write(type, name, file, buf, offset, n) \
os_file_write_func(type, name, file, buf, offset, n)
# define os_file_write_int_fd(type, name, file, buf, offset, n) \
os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n)
# define os_file_flush(file) os_file_flush_func(file)

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 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

View File

@ -370,7 +370,9 @@ row_merge_buf_sort(
/********************************************************************//**
Write a merge block to the file system.
@return whether the request was completed successfully */
@return whether the request was completed successfully
@retval false on error
@retval true on success */
UNIV_INTERN
bool
row_merge_write(

View File

@ -2175,8 +2175,8 @@ skip_log:
/** Reduces recv_sys->n_addrs for the corrupted page.
This function should called when srv_force_recovery > 0.
@param[in] bpage buffer pool page */
void recv_recover_corrupt_page(buf_page_t* bpage)
@param[in] page_id page id of the corrupted page */
void recv_recover_corrupt_page(page_id_t page_id)
{
ut_ad(srv_force_recovery);
mutex_enter(&recv_sys->mutex);
@ -2187,7 +2187,7 @@ void recv_recover_corrupt_page(buf_page_t* bpage)
}
recv_addr_t* recv_addr = recv_get_fil_addr_struct(
bpage->id.space(), bpage->id.page_no());
page_id.space(), page_id.page_no());
ut_ad(recv_addr->state != RECV_WILL_NOT_READ);

View File

@ -4984,7 +4984,8 @@ Requests a synchronous write operation.
@param[out] buf buffer from which to write
@param[in] offset file offset from the start where to read
@param[in] n number of bytes to read, starting from offset
@return DB_SUCCESS if request was successful, false if fail */
@return error code
@retval DB_SUCCESS if the operation succeeded */
dberr_t
os_file_write_func(
const IORequest& type,
@ -5441,7 +5442,8 @@ Requests a synchronous positioned read operation.
@param[out] buf buffer where to read
@param[in] offset file offset from the start where to read
@param[in] n number of bytes to read, starting from offset
@return DB_SUCCESS or error code */
@return error code
@retval DB_SUCCESS if the operation succeeded */
dberr_t
os_file_read_func(
const IORequest& type,

View File

@ -3416,8 +3416,12 @@ page_corrupted:
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ src)) {
not_encrypted:
if (!page_compressed
&& !block->page.zip.data) {
if (block->page.id.page_no() == 0
&& block->page.zip.data) {
block->page.zip.data = src;
frame_changed = true;
} else if (!page_compressed
&& !block->page.zip.data) {
block->frame = src;
frame_changed = true;
} else {
@ -3508,7 +3512,11 @@ not_encrypted:
}
if (frame_changed) {
block->frame = dst;
if (block->page.zip.data) {
block->page.zip.data = dst;
} else {
block->frame = dst;
}
}
src = io_buffer + (i * size);

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2018, 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 the Free Software
@ -1115,7 +1115,9 @@ row_merge_read(
/********************************************************************//**
Write a merge block to the file system.
@return whether the request was completed successfully */
@return whether the request was completed successfully
@retval false on error
@retval true on success */
UNIV_INTERN
bool
row_merge_write(

View File

@ -2724,9 +2724,12 @@ int ha_maria::external_lock(THD *thd, int lock_type)
}
}
} /* if transactional table */
DBUG_RETURN(maria_lock_database(file, !table->s->tmp_table ?
int result = maria_lock_database(file, !table->s->tmp_table ?
lock_type : ((lock_type == F_UNLCK) ?
F_UNLCK : F_EXTRA_LCK)));
F_UNLCK : F_EXTRA_LCK));
if (!file->s->base.born_transactional)
file->state= &file->s->state.state; // Restore state if clone
DBUG_RETURN(result);
}
int ha_maria::start_stmt(THD *thd, thr_lock_type lock_type)

View File

@ -1,5 +1,3 @@
#!/bin/awk
/Query_time:/ {
results["Rows_examined:"] = "uninit";
results["RocksDB_key_skipped:"] = "uninit";

View File

@ -1,2 +1,4 @@
#!/bin/bash
src_data_dir="${MYSQLTEST_VARDIR}/mysqld.1/data/"
python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('${src_data_dir}/slocket')"

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
COPY_LOG=$1

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
# Insert 100 batches of 100 records each to a table with following schema:

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
# Initially loads a chunk of data.

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
# Insert 10 batches of 10 records each to a table with following schema:

View File

@ -1,2 +1,4 @@
#!/bin/bash
src_data_dir="${MYSQLTEST_VARDIR}/mysqld.1/data/"
rm "${src_data_dir}/slocket"

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
binlog_line=($(grep -o "Last binlog file position [0-9]*, file name .*\.[0-9]*" ${MYSQLTEST_VARDIR}/log/mysqld.2.err | tail -1))

View File

@ -2348,6 +2348,12 @@ static void test_ps_query_cache()
"(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')");
myquery(rc);
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(lmysql, "set global query_cache_type=ON");
myquery(rc);
rc= mysql_query(lmysql, "set local query_cache_type=ON");
@ -2504,9 +2510,9 @@ static void test_ps_query_cache()
if (lmysql != mysql)
mysql_close(lmysql);
rc= mysql_query(mysql, "set global query_cache_size=default");
rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size");
myquery(rc);
rc= mysql_query(mysql, "set global query_cache_type=default");
rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type");
myquery(rc);
}
@ -13441,6 +13447,12 @@ static void test_open_cursor_prepared_statement_query_cache()
return;
}
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(mysql, "set global query_cache_type=ON");
myquery(rc);
rc= mysql_query(mysql, "set local query_cache_type=ON");
@ -13467,9 +13479,9 @@ static void test_open_cursor_prepared_statement_query_cache()
check_execute(stmt, rc);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "set global query_cache_type=default");
rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type");
myquery(rc);
rc= mysql_query(mysql, "set global query_cache_size=default");
rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size");
myquery(rc);
}
@ -18254,6 +18266,12 @@ static void test_bug36326()
myquery(rc);
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
myquery(rc);
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1");
myquery(rc);
rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1");
@ -18281,8 +18299,8 @@ static void test_bug36326()
DIE_UNLESS(rc == 1);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_size = default");
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = default");
rc= mysql_query(mysql, "SET GLOBAL query_cache_size = @save_query_cache_size");
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = @save_query_cache_type");
myquery(rc);
DBUG_VOID_RETURN;

View File

@ -14,10 +14,10 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
aes byte_order
byte_order
LINK_LIBRARIES mysys)
MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl)
ADD_DEFINITIONS(${SSL_DEFINES})
MY_ADD_TESTS(ma_dyncol LINK_LIBRARIES mysys)

View File

@ -31,6 +31,6 @@ TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
MY_ADD_TEST(explain_filename)
ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc)
TARGET_LINK_LIBRARIES(mf_iocache-t mysys mytap)
TARGET_LINK_LIBRARIES(mf_iocache-t mysys mytap mysys_ssl)
ADD_DEPENDENCIES(mf_iocache-t GenError)
MY_ADD_TEST(mf_iocache)