[MDEV-12112] corruption in encrypted table may be overlooked Created: 2017-02-23 Updated: 2019-11-06 Resolved: 2018-12-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Backup |
| Affects Version/s: | 10.1.22, 10.1.28, 10.2.9 |
| Fix Version/s: | 10.4.1, 10.1.38, 10.2.20, 10.3.12 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrii Nikitin (Inactive) | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
mariabackup may overlook file corruptions as shown in steps below: 1. Start MySQL Server with Encryption enabled
3. Wait some time to make sure that all pages are flushed and query below shows 0 dirty pages:
4. Corrupt t.ibd with commands below (replace data_directory with actual data directory):
5. Create backup , observe no errors :
6. Check table with innochecksum to confirm that it is really corrupted:
7. (optional) make sure innochecksum doesn't complain about the other table t1:
Without rest encryption the same steps result in backup error:
|
| Comments |
| Comment by Andrii Nikitin (Inactive) [ 2017-10-28 ] | |||||||||||||||||||||||||||||||||||||||||
|
added 10.2 to version list, still relevant in current 10.1 | |||||||||||||||||||||||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2018-12-13 ] | |||||||||||||||||||||||||||||||||||||||||
|
The following test case repeats the reported scenario:
Problem is that mariabackup always read the encrypted pages and checks the post-encryption checksum only and copies the page even though | |||||||||||||||||||||||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2018-12-14 ] | |||||||||||||||||||||||||||||||||||||||||
|
Patch is in bb-10.2-23578 | |||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-14 ] | |||||||||||||||||||||||||||||||||||||||||
|
I cleaned up thiru’s fix, backported to 10.1 and merged all the way up to 10.4. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Based on more work from thiru, I pushed a follow-up fix to 10.1. It turns out that page_compressed=1 pages are not being checked for consistency. That was filed as | |||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-19 ] | |||||||||||||||||||||||||||||||||||||||||
|
As part of a follow-up fix to MDEV-18025, I improved the test case so that it computes a valid checksum for the ‘encrypted’ page and writes it to all 3 locations. That is, by the old rules, this page would look like a valid encrypted page as well as a valid unencrypted page. Only by decrypting and checking the ‘before-encryption’ checksum we will detect the page as corrupted. This test (and the extra decrypt step in mariabackup --backup) was motivated by a support case where a seemingly corrupted page has the same checksum in all 3 locations. For page_compressed=1 pages (encrypted or not), the only way to validate the page checksum is to attempt to (optionally decrypt and) decompress the data and to compute the checksum. |