mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
MariaDB data-at-rest encryption (innodb_encrypt_tables) had repurposed the same unused data field that was repurposed in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN) field of SPATIAL INDEX. Because of this, MariaDB was unable to support encryption on SPATIAL INDEX pages. Furthermore, InnoDB page checksums skipped some bytes, and there are multiple variations and checksum algorithms. By default, InnoDB accepts all variations of all algorithms that ever existed. This unnecessarily weakens the page checksums. We hereby introduce two more innodb_checksum_algorithm variants (full_crc32, strict_full_crc32) that are special in a way: When either setting is active, newly created data files will carry a flag (fil_space_t::full_crc32()) that indicates that all pages of the file will use a full CRC-32C checksum over the entire page contents (excluding the bytes where the checksum is stored, at the very end of the page). Such files will always use that checksum, no matter what the parameter innodb_checksum_algorithm is assigned to. For old files, the old checksum algorithms will continue to be used. The value strict_full_crc32 will be equivalent to strict_crc32 and the value full_crc32 will be equivalent to crc32. ROW_FORMAT=COMPRESSED tables will only use the old format. These tables do not support new features, such as larger innodb_page_size or instant ADD/DROP COLUMN. They may be deprecated in the future. We do not want an unnecessary file format change for them. The new full_crc32() format also cleans up the MariaDB tablespace flags. We will reserve flags to store the page_compressed compression algorithm, and to store the compressed payload length, so that checksum can be computed over the compressed (and possibly encrypted) stream and can be validated without decrypting or decompressing the page. In the full_crc32 format, there no longer are separate before-encryption and after-encryption checksums for pages. The single checksum is computed on the page contents that is written to the file. We do not make the new algorithm the default for two reasons. First, MariaDB 10.4.2 was a beta release, and the default values of parameters should not change after beta. Second, we did not yet implement the full_crc32 format for page_compressed pages. This will be fixed in MDEV-18644. This is joint work with Marko Mäkelä.
80 lines
3.0 KiB
Plaintext
80 lines
3.0 KiB
Plaintext
--source include/innodb_page_size.inc
|
|
--source include/not_embedded.inc
|
|
|
|
let datadir= `select @@datadir`;
|
|
let page_size= `select @@innodb_page_size`;
|
|
|
|
--echo #
|
|
--echo # MDEV-15333 MariaDB (still) slow start
|
|
--echo #
|
|
|
|
# Ensure that on normal startup, no data files are read.
|
|
# Note: just like in MySQL, all .ibd files will still be
|
|
# opened at least once.
|
|
|
|
--echo # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files
|
|
--echo # of tables with .isl file or DATA DIRECTORY attribute.
|
|
--echo # FIXME: This is much more noisy than MariaDB 10.1!
|
|
call mtr.add_suppression("\\[ERROR\\] InnoDB: Tablespace flags are invalid in datafile: .*test.t[rcd]\\.ibd");
|
|
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
|
|
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
|
|
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");
|
|
call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for `test`\\.`td` because it could not be opened\\.");
|
|
|
|
CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT
|
|
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
|
|
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
|
eval CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
|
|
STATS_PERSISTENT=0 DATA DIRECTORY='$MYSQL_TMP_DIR';
|
|
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--move_file $datadir/test/tr.ibd $datadir/test/tr0.ibd
|
|
--move_file $datadir/test/tc.ibd $datadir/test/tc0.ibd
|
|
--move_file $MYSQL_TMP_DIR/test/td.ibd $datadir/test/td0.ibd
|
|
# TODO: test that MariaDB does not even attempt to open the files
|
|
#--mkdir $datadir/test/tr.ibd
|
|
#--mkdir $datadir/test/tc.ibd
|
|
#--mkdir $MYSQL_TMP_DIR/test/td.ibd
|
|
|
|
perl;
|
|
die unless open OUT, ">", "$ENV{datadir}/test/tr.ibd";
|
|
print OUT "foo " x $ENV{page_size};
|
|
close OUT or die;
|
|
die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd";
|
|
print OUT "bar " x $ENV{page_size};
|
|
close OUT or die;
|
|
die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd";
|
|
print OUT "xyz " x $ENV{page_size};
|
|
close OUT or die;
|
|
EOF
|
|
|
|
--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
|
|
--source include/start_mysqld.inc
|
|
--let $restart_parameters=
|
|
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
# TODO: test that MariaDB does not even attempt to open the files
|
|
#--rmdir $datadir/test/tr.ibd
|
|
#--rmdir $datadir/test/tc.ibd
|
|
#--rmdir $MYSQL_TMP_DIR/test/td.ibd
|
|
--remove_file $datadir/test/tr.ibd
|
|
--remove_file $datadir/test/tc.ibd
|
|
--remove_file $MYSQL_TMP_DIR/test/td.ibd
|
|
|
|
--move_file $datadir/test/tr0.ibd $datadir/test/tr.ibd
|
|
--move_file $datadir/test/tc0.ibd $datadir/test/tc.ibd
|
|
--move_file $datadir/test/td0.ibd $MYSQL_TMP_DIR/test/td.ibd
|
|
|
|
--source include/start_mysqld.inc
|
|
SELECT * FROM tr;
|
|
SELECT * FROM tc;
|
|
SELECT * FROM td;
|
|
DROP TABLE tr,tc,td;
|