mariadb/storage
Marko Mäkelä 36a971724e MDEV-13167 InnoDB key rotation is not skipping unused pages
In key rotation, we must initialize unallocated but previously
initialized pages, so that if encryption is enabled on a table,
all clear-text data for the page will eventually be overwritten.
But we should not rotate keys on pages that were never allocated
after the data file was created.

According to the latching order rules, after acquiring the
tablespace latch, no page latches of previously allocated user pages
may be acquired. So, key rotation should check the page allocation
status after acquiring the page latch, not before. But, the latching
order rules also prohibit accessing pages that were not allocated first,
and then acquiring the tablespace latch. Such behaviour would indeed
result in a deadlock when running the following tests:
encryption.innodb_encryption-page-compression
encryption.innodb-checksum-algorithm

Because the key rotation is accessing potentially unallocated pages, it
cannot reliably check if these pages were allocated. It can only check
the page header. If the page number is zero, we can assume that the
page is unallocated.

fil_crypt_rotate_pages(): Skip pages that are known to be uninitialized.

fil_crypt_rotate_page(): Detect uninitialized pages by FIL_PAGE_OFFSET.
Page 0 is never encrypted, and on other pages that are initialized,
FIL_PAGE_OFFSET must contain the page number.

fil_crypt_is_page_uninitialized(): Remove. It suffices to check the
page number field in fil_crypt_rotate_page().
2017-08-23 10:14:28 +03:00
..
archive Merge branch '10.1' into 10.2 2017-07-08 09:56:28 +02:00
blackhole
cassandra Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
connect Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
csv Merge 10.0 into 10.1 2017-05-23 08:59:03 +03:00
example
federated Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
federatedx Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
heap Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
innobase MDEV-13167 InnoDB key rotation is not skipping unused pages 2017-08-23 10:14:28 +03:00
maria Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
mroonga Merge branch '10.1' into 10.2 2017-07-08 09:56:28 +02:00
myisam Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
myisammrg Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
oqgraph Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
perfschema Merge 10.1 into 10.2 2017-05-23 11:09:47 +03:00
rocksdb Fix rocksdb.bulk_load test 2017-08-21 16:12:09 +03:00
sequence Fix several compile warnings on Windows 2017-03-17 08:56:57 +00:00
sphinx Merge 10.1 into 10.2 2017-05-22 09:46:51 +03:00
spider Merge branch '10.1' into 10.2 2017-07-08 09:56:28 +02:00
test_sql_discovery store/show vcols as item->print() 2016-12-12 20:35:41 +01:00
tokudb Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
xtradb Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00