Skip to content
Permalink
Browse files
Merge 10.2 into 10.3
  • Loading branch information
dr-m committed Jul 27, 2021
2 parents 2575eaa + afe00bb commit f50eb0d
Show file tree
Hide file tree
Showing 35 changed files with 402 additions and 268 deletions.
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB Corporation.
Copyright (c) 2010, 2021, 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
@@ -283,7 +283,8 @@ extern int my_umask_dir,
extern my_bool my_use_symdir;

extern ulong my_default_record_cache_size;
extern my_bool my_disable_locking, my_disable_async_io,
extern MYSQL_PLUGIN_IMPORT my_bool my_disable_locking;
extern my_bool my_disable_async_io,
my_disable_flush_key_blocks, my_disable_symlinks;
extern my_bool my_disable_sync, my_disable_copystat_in_redel;
extern char wild_many,wild_one,wild_prefix;
@@ -4565,6 +4565,28 @@ drop procedure sp1;
drop procedure sp2;
drop table t1;
#
# MDEV-26202: Recursive CTE used indirectly twice
# (fixed by the patch forMDEV-26025)
#
with recursive
rcte as ( SELECT 1 AS a
UNION ALL
SELECT cast(a + 1 as unsigned int) FROM rcte WHERE a < 3),
cte1 AS (SELECT a FROM rcte),
cte2 AS (SELECT a FROM cte1),
cte3 AS ( SELECT a FROM cte2)
SELECT * FROM cte2, cte3;
a a
1 1
2 1
3 1
1 2
2 2
3 2
1 3
2 3
3 3
#
# End of 10.2 tests
#
#
@@ -2919,6 +2919,20 @@ drop procedure sp2;

drop table t1;

--echo #
--echo # MDEV-26202: Recursive CTE used indirectly twice
--echo # (fixed by the patch forMDEV-26025)
--echo #

with recursive
rcte as ( SELECT 1 AS a
UNION ALL
SELECT cast(a + 1 as unsigned int) FROM rcte WHERE a < 3),
cte1 AS (SELECT a FROM rcte),
cte2 AS (SELECT a FROM cte1),
cte3 AS ( SELECT a FROM cte2)
SELECT * FROM cte2, cte3;

--echo #
--echo # End of 10.2 tests
--echo #
@@ -2,6 +2,9 @@
# MySQL >= 5.0
#

# The test can take hours with valgrind
--source include/not_valgrind.inc

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

@@ -4,6 +4,8 @@
# MySQL >= 5.0
#

# The test can take hours with valgrind
--source include/not_valgrind.inc

# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@@ -18,6 +18,9 @@
# - with annotated events, default checksums and minimal binlog row image
#

# The test can take very long time with valgrind
--source include/not_valgrind.inc

--source include/have_partition.inc
--source encryption_algorithms.inc
--source include/have_innodb.inc
@@ -1,6 +1,9 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc

# The test can take very long time with valgrind
--source include/not_valgrind.inc

create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
@@ -48,12 +48,6 @@ while ($cnt)
{
real_sleep 1;
dec $cnt;
if ($cnt == 200)
{
--disable_query_log
set global innodb_encrypt_tables = on;
--enable_query_log
}
}
}
if (!$success)
@@ -84,12 +78,6 @@ while ($cnt)
{
real_sleep 1;
dec $cnt;
if ($cnt == 200)
{
--disable_query_log
set global innodb_encrypt_tables = off;
--enable_query_log
}
}
}
if (!$success)
@@ -119,12 +107,6 @@ while ($cnt)
{
real_sleep 1;
dec $cnt;
if ($cnt == 200)
{
--disable_query_log
set global innodb_encrypt_tables=on;
--enable_query_log
}
}
}
if (!$success)
@@ -0,0 +1,52 @@
CREATE TABLE parent(parent_id int not null AUTO_INCREMENT PRIMARY KEY,
parent_name varchar(80)) ENGINE=InnoDB;
CREATE TABLE child(child_id int not null AUTO_INCREMENT PRIMARY KEY,
child_name varchar(80),
child_parent_id int not null,
CONSTRAINT `fk_child_parent`
FOREIGN KEY (child_parent_id) REFERENCES parent (parent_id)
ON DELETE CASCADE
ON UPDATE CASCADE) ENGINE=InnoDB;
INSERT INTO parent VALUES (1, 'first'),(2,'second'),(3,'foo'),(4,'tmp');
INSERT INTO child VALUES (NULL,'first_child',1);
INSERT INTO child VALUES (NULL,'second_child',1);
INSERT INTO child VALUES (NULL,'first_child2',2);
INSERT INTO child VALUES (NULL,'first_child3',2);
INSERT INTO child VALUES (NULL,'first_child4',3);
BEGIN;
UPDATE parent SET parent_name = 'bar' WHERE parent_id = 2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET SESSION innodb_lock_wait_timeout=2;
UPDATE child SET child_parent_id = 5 where child_parent_id = 2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection node_1;
COMMIT;
SELECT * FROM parent;
parent_id parent_name
1 first
2 bar
3 foo
4 tmp
SELECT * FROM child;
child_id child_name child_parent_id
1 first_child 1
3 second_child 1
5 first_child2 2
7 first_child3 2
9 first_child4 3
connection node_2;
SELECT * FROM parent;
parent_id parent_name
1 first
2 bar
3 foo
4 tmp
SELECT * FROM child;
child_id child_name child_parent_id
1 first_child 1
3 second_child 1
5 first_child2 2
7 first_child3 2
9 first_child4 3
DROP TABLE child, parent;
disconnect node_1a;
@@ -0,0 +1,40 @@
--source include/galera_cluster.inc

CREATE TABLE parent(parent_id int not null AUTO_INCREMENT PRIMARY KEY,
parent_name varchar(80)) ENGINE=InnoDB;

CREATE TABLE child(child_id int not null AUTO_INCREMENT PRIMARY KEY,
child_name varchar(80),
child_parent_id int not null,
CONSTRAINT `fk_child_parent`
FOREIGN KEY (child_parent_id) REFERENCES parent (parent_id)
ON DELETE CASCADE
ON UPDATE CASCADE) ENGINE=InnoDB;

INSERT INTO parent VALUES (1, 'first'),(2,'second'),(3,'foo'),(4,'tmp');
INSERT INTO child VALUES (NULL,'first_child',1);
INSERT INTO child VALUES (NULL,'second_child',1);
INSERT INTO child VALUES (NULL,'first_child2',2);
INSERT INTO child VALUES (NULL,'first_child3',2);
INSERT INTO child VALUES (NULL,'first_child4',3);

BEGIN;
UPDATE parent SET parent_name = 'bar' WHERE parent_id = 2;

--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET SESSION innodb_lock_wait_timeout=2;
--error ER_LOCK_WAIT_TIMEOUT
UPDATE child SET child_parent_id = 5 where child_parent_id = 2;

--connection node_1
COMMIT;
SELECT * FROM parent;
SELECT * FROM child;

--connection node_2

SELECT * FROM parent;
SELECT * FROM child;
DROP TABLE child, parent;

--disconnect node_1a
@@ -809,15 +809,18 @@ generated_email_id int as (email_id),
PRIMARY KEY (id),
KEY mautic_generated_sent_date_email_id (generated_email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE emails_metadata (
email_id int,
PRIMARY KEY (email_id),
CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan');
INSERT INTO emails_metadata VALUES (1);
UPDATE emails SET id=2;
DELETE FROM emails;
DROP TABLE email_stats;
DROP TABLE emails_metadata;
@@ -670,20 +670,23 @@ CREATE TABLE email_stats (
PRIMARY KEY (id),
KEY mautic_generated_sent_date_email_id (generated_email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
ON UPDATE CASCADE
) ENGINE=InnoDB;


CREATE TABLE emails_metadata (
email_id int,
PRIMARY KEY (email_id),
CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;


INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan');
INSERT INTO emails_metadata VALUES (1);

UPDATE emails SET id=2;
DELETE FROM emails;

DROP TABLE email_stats;
@@ -1,6 +1,8 @@
-- source include/have_innodb.inc
-- source include/have_innodb_lz4.inc
-- source include/not_embedded.inc
# The test can take very long time with valgrind
--source include/not_valgrind.inc

# lz4
set global innodb_compression_algorithm = 2;
@@ -114,7 +114,7 @@ qsort_t my_qsort(void *base_ptr, size_t count, size_t size, qsort_cmp cmp)
stack[0].low=stack[0].high=0;
#endif
pivot = (char *) my_alloca((int) size);
ptr_cmp= size == sizeof(char*) && !((low - (char*) 0)& (sizeof(char*)-1));
ptr_cmp= size == sizeof(char*) && (intptr_t)low % sizeof(char*) == 0;

/* The following loop sorts elements between high and low */
do
@@ -1,5 +1,5 @@
// Copyright (c) 2014, Google Inc.
// Copyright (c) 2017, MariaDB Corporation.
// Copyright (c) 2017, 2021, MariaDB Corporation.

/**************************************************//**
@file btr/btr0scrub.cc
@@ -830,20 +830,12 @@ btr_scrub_page(

/**************************************************************//**
Start iterating a space */
UNIV_INTERN
bool
btr_scrub_start_space(
/*===================*/
ulint space, /*!< in: space */
btr_scrub_t* scrub_data) /*!< in/out: scrub data */
bool btr_scrub_start_space(const fil_space_t &space, btr_scrub_t *scrub_data)
{
bool found;
scrub_data->space = space;
scrub_data->space = space.id;
scrub_data->current_table = NULL;
scrub_data->current_index = NULL;
const page_size_t page_size = fil_space_get_page_size(space, &found);

scrub_data->compressed = page_size.is_compressed();
scrub_data->compressed = FSP_FLAGS_GET_ZIP_SSIZE(space.flags) != 0;
scrub_data->scrubbing = check_scrub_setting(scrub_data);
return scrub_data->scrubbing;
}
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (c) 2014, 2020, MariaDB Corporation.
Copyright (c) 2014, 2021, 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
@@ -1091,6 +1091,33 @@ struct rotate_thread_t {
}
};

/** Avoid the removal of the tablespace from
default_encrypt_list only when
1) Another active encryption thread working on tablespace
2) Eligible for tablespace key rotation
3) Tablespace is in flushing phase
@return true if tablespace should be removed from
default encrypt */
static bool fil_crypt_must_remove(const fil_space_t &space)
{
ut_ad(space.purpose == FIL_TYPE_TABLESPACE);
fil_space_crypt_t *crypt_data = space.crypt_data;
ut_ad(mutex_own(&fil_system.mutex));
const ulong encrypt_tables= srv_encrypt_tables;
if (!crypt_data)
return !encrypt_tables;
if (!crypt_data->is_key_found())
return true;

mutex_enter(&crypt_data->mutex);
const bool remove= (space.is_stopping() || crypt_data->not_encrypted()) &&
(!crypt_data->rotate_state.flushing &&
!encrypt_tables == !!crypt_data->min_key_version &&
!crypt_data->rotate_state.active_threads);
mutex_exit(&crypt_data->mutex);
return remove;
}

/***********************************************************************
Check if space needs rotation given a key_state
@param[in,out] state Key rotation state
@@ -1172,7 +1199,7 @@ fil_crypt_space_needs_rotation(
key_state->rotate_key_age);

crypt_data->rotate_state.scrubbing.is_active =
btr_scrub_start_space(space->id, &state->scrub_data);
btr_scrub_start_space(*space, &state->scrub_data);

time_t diff = time(0) - crypt_data->rotate_state.scrubbing.
last_scrub_completed;
@@ -1428,8 +1455,7 @@ inline fil_space_t *fil_system_t::default_encrypt_next(
If there is a change in innodb_encrypt_tables variables
value then don't remove the last processed tablespace
from the default encrypt list. */
if (released && (!recheck || space->crypt_data) &&
!encrypt == !srv_encrypt_tables)
if (released && !recheck && fil_crypt_must_remove(*space))
{
ut_a(!default_encrypt_tables.empty());
default_encrypt_tables.remove(*space);

0 comments on commit f50eb0d

Please sign in to comment.