Bug #94665 enabling undo-tablespace encryption doesn't mark tablespace encryption flag
Submitted: 15 Mar 2019 5:14 Modified: 1 May 2019 20:51
Reporter: Krunal Bauskar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.15 OS:Any
Assigned to: CPU Architecture:Any

[15 Mar 2019 5:14] Krunal Bauskar
Description:
* I am trying to enable innodb undo tablespace encryption by setting innodb_undo_log_encrypt=1 by passing it as server argument during startup.

* Error log confirms that it is has enabled encryption for the undo tablespace.

2019-03-15T05:10:06.486252Z 0 [Note] [MY-012880] [InnoDB] Encryption is enabled for undo tablespace 'innodb_undo_001'.
2019-03-15T05:10:06.486296Z 0 [Note] [MY-012880] [InnoDB] Encryption is enabled for undo tablespace 'innodb_undo_002'.

* But if I query innodb_tablespaces table then I get a different picture.
[As we can see below the encryption flag for innodb_undo_001 and innodb_undo_002 is not marked as Y that denotes encryption].

mysql> select @@innodb_undo_log_encrypt;
+---------------------------+
| @@innodb_undo_log_encrypt |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select space, name, encryption from information_schema.innodb_tablespaces;
+------------+------------------+------------+
| space      | name             | encryption |
+------------+------------------+------------+
| 4294967294 | mysql            | N          |
| 4294967293 | innodb_temporary | N          |
| 4294967279 | innodb_undo_001  | N          |
| 4294967278 | innodb_undo_002  | N          |
|          1 | sys/sys_config   | N          |
+------------+------------------+------------+
5 rows in set (0.00 sec)

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.15    |
+-----------+
1 row in set (0.00 sec)

How to repeat:
* Start server with innodb_undo_log_encrypt=1 and relevant keyring arugment needed to enable encryption. I have used keyring_file.

* Check the tables and error log as mentioned above.

Error log needs log_error_verbosity=3
[15 Mar 2019 11:40] MySQL Verification Team
Hello Krunal,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[4 Apr 2019 14:25] Satya Bodapati
Work around patch:
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 3610acda2a3..885cc965fcb 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -6617,6 +6617,15 @@ static int i_s_dict_fill_innodb_tablespaces(
     space_type = "Single";
   }

+  if (fsp_is_global_temporary(space_id) || fsp_is_undo_tablespace(space_id)) {
+    fil_space_t* space = fil_space_get(space_id);
+    is_encrypted = FSP_FLAGS_GET_ENCRYPTION(space->flags);
+  }
+
   fields = table_to_fill->field;

   OK(fields[INNODB_TABLESPACES_SPACE]->store(space_id, true));

Real fix is to update DD
[8 Apr 2019 9:41] Satya Bodapati
updated workaround (better fix):

+  if (fsp_is_global_temporary(space_id) || fsp_is_undo_tablespace(space_id)) {
+    fil_space_t *space = fil_space_acquire_silent(space_id);
+    if (space != nullptr) {
+      is_encrypted = FSP_FLAGS_GET_ENCRYPTION(space->flags);
+      fil_space_release(space);
+    }
+  }
[1 May 2019 20:51] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.17 release, and here's the changelog entry:

The INFORMATION_SCHEMA.INNODB_TABLESPACES ENCRYPTION column was not
updated after enabling undo tablespace encryption.