summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0fil.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-29 11:32:46 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-29 11:32:46 +0300
commit90a91936852368774559a3ef2660e63e1e6f50e3 (patch)
tree97004f253bea0db37606928b592ae3bc70fa6672 /storage/innobase/fil/fil0fil.cc
parentfcb68ffe3dfb1c841852bd62a9aac9708888f4e9 (diff)
parent6eefeb6fea05ff17d010d173ef244a1d92078d71 (diff)
downloadmariadb-git-90a91936852368774559a3ef2660e63e1e6f50e3.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/fil/fil0fil.cc')
-rw-r--r--storage/innobase/fil/fil0fil.cc54
1 files changed, 26 insertions, 28 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 76b325c61fb..9fb9e1a4138 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -5216,25 +5216,29 @@ fil_space_t::acquire() and fil_space_t::release() are invoked here which
blocks a concurrent operation from dropping the tablespace.
@param[in] prev_space Pointer to the previous fil_space_t.
If NULL, use the first fil_space_t on fil_system.space_list.
+@param[in] recheck recheck of the tablespace is needed or
+ still encryption thread does write page0 for it
+@param[in] key_version key version of the key state thread
@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
+@retval NULL if this was the last */
fil_space_t*
-fil_space_keyrotate_next(
- fil_space_t* prev_space)
+fil_system_t::keyrotate_next(
+ fil_space_t* prev_space,
+ bool recheck,
+ uint key_version)
{
- fil_space_t* space = prev_space;
- fil_space_t* old = NULL;
-
mutex_enter(&fil_system.mutex);
- if (UT_LIST_GET_LEN(fil_system.rotation_list) == 0) {
- if (space) {
- space->release();
- fil_space_remove_from_keyrotation(space);
- }
- mutex_exit(&fil_system.mutex);
- return(NULL);
- }
+ /* If one of the encryption threads already started the encryption
+ of the table then don't remove the unencrypted spaces from
+ rotation list
+
+ If there is a change in innodb_encrypt_tables variables value then
+ don't remove the last processed tablespace from the rotation list. */
+ const bool remove = ((!recheck || prev_space->crypt_data)
+ && (!key_version == !srv_encrypt_tables));
+
+ fil_space_t* space = prev_space;
if (prev_space == NULL) {
space = UT_LIST_GET_FIRST(fil_system.rotation_list);
@@ -5245,22 +5249,17 @@ fil_space_keyrotate_next(
/* Move on to the next fil_space_t */
space->release();
- old = space;
space = UT_LIST_GET_NEXT(rotation_list, space);
- fil_space_remove_from_keyrotation(old);
- }
-
- /* Skip spaces that are being created by fil_ibd_create(),
- or dropped. Note that rotation_list contains only
- space->purpose == FIL_TYPE_TABLESPACE. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping())) {
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->is_stopping())) {
+ space = UT_LIST_GET_NEXT(rotation_list, space);
+ }
- old = space;
- space = UT_LIST_GET_NEXT(rotation_list, space);
- fil_space_remove_from_keyrotation(old);
+ if (remove) {
+ fil_space_remove_from_keyrotation(prev_space);
+ }
}
if (space != NULL) {
@@ -5268,7 +5267,6 @@ fil_space_keyrotate_next(
}
mutex_exit(&fil_system.mutex);
-
return(space);
}