summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2019-04-27 09:18:11 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2019-04-27 09:18:11 +0300
commit6447adb8ebc8544bef2cfcdf48e15dfc7e34dc52 (patch)
treeab20ff4762fb5b8406ed665f9682354cd6bc3ff3
parent1a29767cd9a78ac396c4f1b4ae2f570cc3289c1f (diff)
downloadmariadb-git-bb-10.1-MDEV-14180.tar.gz
Fix compiler errors/warnings and use os_wait_event forbb-10.1-MDEV-14180
key rotation list.
-rw-r--r--storage/xtradb/fil/fil0crypt.cc35
-rw-r--r--storage/xtradb/fil/fil0fil.cc28
2 files changed, 39 insertions, 24 deletions
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 2e67a101a6a..4a85fa799d2 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1541,10 +1541,6 @@ fil_crypt_find_space_to_rotate(
while (!state->should_shutdown() && state->space) {
fil_crypt_read_crypt_data(state->space);
- ib_logf(IB_LOG_LEVEL_INFO,
- "Investigating tablespace %d:%s from rotation list",
- state->space->id, state->space->name);
-
if (fil_crypt_space_needs_rotation(state, key_state, recheck)) {
ut_ad(key_state->key_id);
/* init state->min_key_version_found before
@@ -1558,6 +1554,11 @@ fil_crypt_find_space_to_rotate(
} else {
state->space = fil_space_keyrotate_next(state->space);
}
+
+ if (!state->space) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Not found a tablespace ");
+ }
}
/* if we didn't find any space return iops */
@@ -1645,9 +1646,6 @@ fil_crypt_find_page_to_rotate(
bool found = crypt_data->rotate_state.max_offset >=
crypt_data->rotate_state.next_offset;
- fprintf(stderr, "JAN: trying to find page for rotation from id %d:%s\n",space->id,space->name);
- fflush(stderr);
-
if (found) {
state->offset = crypt_data->rotate_state.next_offset;
ulint remaining = crypt_data->rotate_state.max_offset -
@@ -2211,7 +2209,16 @@ DECLARE_THREAD(fil_crypt_thread)(
* new rotate_key_age */
os_event_reset(fil_crypt_threads_event);
- if (os_event_wait_time(fil_crypt_threads_event, 1000000) == 0) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Thread #%u going to sleep",
+ thread_no);
+
+ if (srv_fil_crypt_rotate_key_age && encryption_can_rotate()) {
+ if (os_event_wait_time(fil_crypt_threads_event, 1000000) == 0) {
+ break;
+ }
+ } else {
+ os_event_wait(fil_crypt_threads_event);
break;
}
@@ -2241,6 +2248,10 @@ DECLARE_THREAD(fil_crypt_thread)(
while (!thr.should_shutdown() &&
fil_crypt_find_space_to_rotate(&new_state, &thr, &recheck)) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Thr #%u found a space %lu:%s",
+ thread_no, thr.space->id, thr.space->name);
+
/* we found a space to rotate */
fil_crypt_start_rotate_space(&new_state, &thr);
@@ -2404,19 +2415,19 @@ fil_crypt_set_encrypt_tables(
is either disabled or not supported by encryption
plugin add this tablespace to key rotation list to
make required state change. */
- if ((!space->crypt_data && srv_encrypt_tables)
+ if (((!space->crypt_data && srv_encrypt_tables)
|| (space->crypt_data &&
(space->crypt_data->should_encrypt()
- || space->crypt_data->should_decrypt()))
+ || space->crypt_data->should_decrypt())))
&& (!srv_fil_crypt_rotate_key_age || !encryption_can_rotate())) {
ib_logf(IB_LOG_LEVEL_INFO,
- "Adding tablespace %d:%s to rotation list",
+ "Adding tablespace %lu:%s to rotation list",
space->id, space->name);
UT_LIST_ADD_LAST(rotation_list, fil_system->rotation_list, space);
space->is_in_rotation_list = true;
}
}
- } while(space = UT_LIST_GET_NEXT(space_list, space));
+ } while((space = UT_LIST_GET_NEXT(space_list, space)));
mutex_exit(&fil_system->mutex);
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 042bef7d57e..4b3052f2dd9 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -657,13 +657,13 @@ fil_node_open_file(
is either disabled or not supported by encryption
plugin add this tablespace to key rotation list to
make required state change. */
- if ((!node->space->crypt_data && srv_encrypt_tables)
+ if (((!node->space->crypt_data && srv_encrypt_tables)
|| (node->space->crypt_data
&& (node->space->crypt_data->should_encrypt()
- || node->space->crypt_data->should_decrypt()))
+ || node->space->crypt_data->should_decrypt())))
&& (!srv_fil_crypt_rotate_key_age || !encryption_can_rotate())) {
ib_logf(IB_LOG_LEVEL_INFO,
- "Adding tablespace %d:%s to rotation list",
+ "Adding tablespace %lu:%s to rotation list",
space->id, space->name);
UT_LIST_ADD_LAST(rotation_list, fil_system->rotation_list, node->space);
node->space->is_in_rotation_list = true;
@@ -1447,7 +1447,7 @@ fil_space_create(
&& (mode == FIL_ENCRYPTION_ON /*|| mode == FIL_ENCRYPTION_OFF*/ ||
srv_encrypt_tables)) {
ib_logf(IB_LOG_LEVEL_INFO,
- "Adding tablespace %d:%s to rotation list",
+ "Adding tablespace %lu:%s to rotation list",
space->id, space->name);
/* Key rotation is not enabled, need to inform background
encryption threads. */
@@ -6944,7 +6944,7 @@ fil_space_remove_from_keyrotation(
if (space->n_pending_ops == 0 && space->is_in_rotation_list) {
space->is_in_rotation_list = false;
ib_logf(IB_LOG_LEVEL_INFO,
- "Removing really space %d:%s from rotation list",
+ "Removing really space %lu:%s from rotation list",
space->id,space->name);
ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space);
@@ -6976,17 +6976,21 @@ fil_space_keyrotate_next(
processed this item. To avoid other threads again taking it we
remove also it from the list. */
if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0
- || (space && space == UT_LIST_GET_FIRST(fil_system->rotation_list))) {
+ /* || (space && space == UT_LIST_GET_FIRST(fil_system->rotation_list))*/) {
if (space) {
ut_ad(space->n_pending_ops > 0);
space->n_pending_ops--;
ib_logf(IB_LOG_LEVEL_INFO,
- "Removing 2 space %d:%s from rotation list pending %d",
+ "Removing 2 space %lu:%s from rotation list pending %lu",
space->id,space->name, space->n_pending_ops);
fil_space_remove_from_keyrotation(space);
}
mutex_exit(&fil_system->mutex);
+
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "No space found");
+
return(NULL);
}
@@ -7007,7 +7011,7 @@ fil_space_keyrotate_next(
space = UT_LIST_GET_NEXT(rotation_list, space);
ib_logf(IB_LOG_LEVEL_INFO,
- "Removing space %d:%s from rotation list pending %d",
+ "Removing space %lu:%s from rotation list pending %lu",
old->id,old->name, old->n_pending_ops);
fil_space_remove_from_keyrotation(old);
}
@@ -7021,17 +7025,17 @@ fil_space_keyrotate_next(
old = space;
space = UT_LIST_GET_NEXT(rotation_list, space);
- ib_logf(IB_LOG_LEVEL_INFO,
- "Removing space %d:%s from rotation list pending %d",
- old->id,old->name, old->n_pending_ops);
fil_space_remove_from_keyrotation(old);
}
if (space != NULL) {
space->n_pending_ops++;
ib_logf(IB_LOG_LEVEL_INFO,
- "New space %d:%s from rotation list pending %d",
+ "New space %lu:%s from rotation list pending %lu",
space->id,space->name, space->n_pending_ops);
+ } else {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "No space found");
}
mutex_exit(&fil_system->mutex);