[MDEV-13318] Crash recovery failure after the server is killed during innodb_encrypt_log startup Created: 2017-07-13 Updated: 2020-10-19 Resolved: 2017-09-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Backup, Storage Engine - InnoDB |
| Affects Version/s: | 10.1.3, 10.2.4, 10.3.0 |
| Fix Version/s: | 10.2.9, 10.3.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrii Nikitin (Inactive) | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Description |
|
basic tests work, but e.g. if I force checkpoint in xb_file_key_management test by restarting Server right before backup:
Then backup operation
will not be able parse logs ( note 'aborted at' is bigger than 'recovery from' ):
Full log:
|
| Comments |
| Comment by Marko Mäkelä [ 2017-08-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
LSN=1637690 rounded down to a multiple of 512 is LSN 1637376. This (together with the invalid redo log record type 71) means that Mariabackup was unable to read the encrypted redo log file. Where exactly was the line
added? Please post an exact patch. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrii Nikitin (Inactive) [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry - I wanted to verify in current tree and it somehow escaped my queue. Exact patch:
I've checked 10.2.8 fails similar way:
Current 10.2 tree fails little differently: backup succeeds, just InnoDB cannot start after restore:
With original error in Server log:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrii Nikitin (Inactive) [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
10.1 still isn't affected.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is a bug that was introduced in The function log_crypt() was computing the initialization vector incorrectly. A log write that comprises multiple redo log would derive the initialization vector for every block from the same LSN. Recovery or backup cannot know how many blocks were written per request. Maybe most writes actually are performed one 512-byte redo log block at a time? In this modified test, apparently there is only one redo log block that needs to be decrypted. Mariabackup --prepare is using the wrong initialization vector, because its log-scanning logic slightly differs from the normal server startup. This bug should not only affect backup, but also the crash recovery from MariaDB 10.2.4 or later when using innodb_encrypt_log=ON. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The bug that I suspected to have been introduced in The problem at hand seems to be unique to Mariabackup. I am still debugging it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Starting with MariaDB 10.2.2, log_write_up_to() introduces the variable pad_size. The unused pad_size bytes would be encrypted as well, wasting CPU. I think that it is cleanest to invoke log_crypt() directly from log_write_up_to(), on the actual payload bytes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The test case revealed several problems:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I believe that many of these problems exist in the MariaDB 10.1 impelmentation of innodb_encrypt_log. Backporting the fix would be nontrivial, because the redo log encryption code was significantly cleaned up by | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2017-09-12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ok to push. |