Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
76481f00
Commit
76481f00
authored
Aug 01, 2024
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bb-10.11-release' into bb-11.1-release
parents
17e0e9e7
0eca69c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
2 deletions
+125
-2
mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
...uite/encryption/r/innodb_encryption_discard_import.result
+41
-0
mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
.../suite/encryption/t/innodb_encryption_discard_import.test
+55
-1
storage/innobase/fil/fil0crypt.cc
storage/innobase/fil/fil0crypt.cc
+23
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+1
-1
storage/innobase/include/fil0crypt.h
storage/innobase/include/fil0crypt.h
+5
-0
No files found.
mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
View file @
76481f00
SET @start_encr_threads = @@global.innodb_encryption_threads;
SET @start_encrypt_tables = @@global.innodb_encrypt_tables;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
...
...
@@ -116,3 +118,42 @@ NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
UNLOCK TABLES;
DROP TABLE t1, t2, t3;
#
# MDEV-34670 IMPORT TABLESPACE unnecessary traverses
# tablespace list
#
SET GLOBAL innodb_encrypt_tables= OFF;
SET GLOBAL innodb_encryption_threads= 0;
CREATE TABLE t1(f1 int,f2 text)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, "InnoDB");
CREATE TABLE t2 LIKE t1;
ALTER TABLE t2 DISCARD TABLESPACE;
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
SET GLOBAL innodb_encryption_threads=2;
SET GLOBAL innodb_encrypt_tables = ON;
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
NAME
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
NAME
innodb_system
test/t1
test/t2
SET GLOBAL innodb_encrypt_tables = OFF;
# Wait max 10 min for key encryption threads to decrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
NAME
innodb_system
test/t1
test/t2
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
NAME
DROP TABLE t1, t2;
SET GLOBAL innodb_encryption_threads=@start_encr_threads;
SET GLOBAL innodb_encrypt_tables=@start_encrypt_tables;
mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
View file @
76481f00
...
...
@@ -2,7 +2,8 @@
--
source
include
/
have_example_key_management_plugin
.
inc
--
source
include
/
not_valgrind
.
inc
--
source
include
/
not_embedded
.
inc
SET
@
start_encr_threads
=
@@
global
.
innodb_encryption_threads
;
SET
@
start_encrypt_tables
=
@@
global
.
innodb_encrypt_tables
;
let
MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
let
SEARCH_RANGE
=
10000000
...
...
@@ -124,3 +125,56 @@ FLUSH TABLES t1, t2, t3 FOR EXPORT;
UNLOCK
TABLES
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-34670 IMPORT TABLESPACE unnecessary traverses
--
echo
# tablespace list
--
echo
#
SET
GLOBAL
innodb_encrypt_tables
=
OFF
;
SET
GLOBAL
innodb_encryption_threads
=
0
;
CREATE
TABLE
t1
(
f1
int
,
f2
text
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
,
"InnoDB"
);
CREATE
TABLE
t2
LIKE
t1
;
ALTER
TABLE
t2
DISCARD
TABLESPACE
;
FLUSH
TABLES
t1
FOR
EXPORT
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
UNLOCK
TABLES
;
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SET
GLOBAL
innodb_encryption_threads
=
2
;
SET
GLOBAL
innodb_encrypt_tables
=
ON
;
--
let
$tables_count
=
`select count(*) + @@global.innodb_undo_tablespaces + 1 from information_schema.tables where engine = 'InnoDB'`
--
echo
# Wait max 10 min for key encryption threads to encrypt all spaces
--
let
$wait_timeout
=
600
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
>=
$tables_count
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
<>
0
;
--
source
include
/
wait_condition
.
inc
--
sorted_result
SELECT
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
=
0
AND
NAME
NOT
LIKE
'innodb_undo%'
AND
NAME
NOT
LIKE
'mysql/innodb_%_stats'
AND
NAME
NOT
LIKE
'mysql/transaction_registry'
;
--
sorted_result
SELECT
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
<>
0
AND
NAME
NOT
LIKE
'innodb_undo%'
AND
NAME
NOT
LIKE
'mysql/innodb_%_stats'
AND
NAME
NOT
LIKE
'mysql/transaction_registry'
;
SET
GLOBAL
innodb_encrypt_tables
=
OFF
;
--
echo
# Wait max 10 min for key encryption threads to decrypt all spaces
--
let
$wait_timeout
=
600
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
<>
0
;
--
source
include
/
wait_condition
.
inc
--
sorted_result
SELECT
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
=
0
AND
NAME
NOT
LIKE
'innodb_undo%'
AND
NAME
NOT
LIKE
'mysql/innodb_%_stats'
AND
NAME
NOT
LIKE
'mysql/transaction_registry'
;
--
sorted_result
SELECT
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_TABLESPACES_ENCRYPTION
WHERE
MIN_KEY_VERSION
<>
0
AND
NAME
NOT
LIKE
'innodb_undo%'
AND
NAME
NOT
LIKE
'mysql/innodb_%_stats'
AND
NAME
NOT
LIKE
'mysql/transaction_registry'
;
DROP
TABLE
t1
,
t2
;
SET
GLOBAL
innodb_encryption_threads
=@
start_encr_threads
;
SET
GLOBAL
innodb_encrypt_tables
=@
start_encrypt_tables
;
storage/innobase/fil/fil0crypt.cc
View file @
76481f00
...
...
@@ -1348,6 +1348,8 @@ inline bool fil_space_t::acquire_if_not_stopped()
bool
fil_crypt_must_default_encrypt
()
{
/* prevents a race condition with fil_crypt_set_rotate_key_age() */
mysql_mutex_assert_owner
(
&
fil_system
.
mutex
);
return
!
srv_fil_crypt_rotate_key_age
||
!
srv_encrypt_rotate
;
}
...
...
@@ -2201,6 +2203,27 @@ void fil_crypt_set_rotation_iops(uint val)
mysql_mutex_unlock
(
&
fil_crypt_threads_mutex
);
}
/** Add the import tablespace to default_encrypt list
if necessary and signal fil_crypt_threads
@param space imported tablespace */
void
fil_crypt_add_imported_space
(
fil_space_t
*
space
)
{
mysql_mutex_lock
(
&
fil_crypt_threads_mutex
);
mysql_mutex_lock
(
&
fil_system
.
mutex
);
if
(
fil_crypt_must_default_encrypt
())
{
fil_system
.
default_encrypt_tables
.
push_back
(
*
space
);
space
->
is_in_default_encrypt
=
true
;
}
mysql_mutex_unlock
(
&
fil_system
.
mutex
);
pthread_cond_broadcast
(
&
fil_crypt_threads_cond
);
mysql_mutex_unlock
(
&
fil_crypt_threads_mutex
);
}
/*********************************************************************
Adjust encrypt tables
@param[in] val New setting for innodb-encrypt-tables */
...
...
storage/innobase/handler/ha_innodb.cc
View file @
76481f00
...
...
@@ -13328,7 +13328,7 @@ ha_innobase::discard_or_import_tablespace(
|
HA_STATUS_VARIABLE
|
HA_STATUS_AUTO
);
fil_crypt_
set_encrypt_tables
(
srv_encrypt_tables
);
fil_crypt_
add_imported_space
(
m_prebuilt
->
table
->
space
);
}
}
...
...
storage/innobase/include/fil0crypt.h
View file @
76481f00
...
...
@@ -337,6 +337,11 @@ Adjust rotation iops
@param[in] val New max roation iops */
void
fil_crypt_set_rotation_iops
(
uint
val
);
/** Add the import tablespace to default_encrypt list
if necessary and signal fil_crypt_threads
@param space imported tablespace */
void
fil_crypt_add_imported_space
(
fil_space_t
*
space
);
/*********************************************************************
Adjust encrypt tables
@param[in] val New setting for innodb-encrypt-tables */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment