mariadb/mysql-test/suite/encryption/t
Monty 7762ee5dbe MDEV-25180 Atomic ALTER TABLE
MDEV-25604 Atomic DDL: Binlog event written upon recovery does not
           have default database

The purpose of this task is to ensure that ALTER TABLE is atomic even if
the MariaDB server would be killed at any point of the alter table.
This means that either the ALTER TABLE succeeds (including that triggers,
the status tables and the binary log are updated) or things should be
reverted to their original state.

If the server crashes before the new version is fully up to date and
commited, it will revert to the original table and remove all
temporary files and tables.
If the new version is commited, crash recovery will use the new version,
and update triggers, the status tables and the binary log.
The one execption is ALTER TABLE .. RENAME .. where no changes are done
to table definition. This one will work as RENAME and roll back unless
the whole statement completed, including updating the binary log (if
enabled).

Other changes:
- Added handlerton->check_version() function to allow the ddl recovery
  code to check, in case of inplace alter table, if the table in the
  storage engine is of the new or old version.
- Added handler->table_version() so that an engine can report the current
  version of the table. This should be changed each time the table
  definition changes.
- Added  ha_signal_ddl_recovery_done() and
  handlerton::signal_ddl_recovery_done() to inform all handlers when
  ddl recovery has been done. (Needed by InnoDB).
- Added handlerton call inplace_alter_table_committed, to signal engine
  that ddl_log has been closed for the alter table query.
- Added new handerton flag
  HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT to signal when we
  should call hton->notify_tabledef_changed() during
  mysql_inplace_alter_table. This was required as MyRocks and InnoDB
  needed the call at different times.
- Added function server_uuid_value() to be able to generate a temporary
  xid when ddl recovery writes the query to the binary log. This is
  needed to be able to handle crashes during ddl log recovery.
- Moved freeing of the frm definition to end of mysql_alter_table() to
  remove duplicate code and have a common exit strategy.

-------
InnoDB part of atomic ALTER TABLE
(Implemented by Marko Mäkelä)
innodb_check_version(): Compare the saved dict_table_t::def_trx_id
to determine whether an ALTER TABLE operation was committed.

We must correctly recover dict_table_t::def_trx_id for this to work.
Before purge removes any trace of DB_TRX_ID from system tables, it
will make an effort to load the user table into the cache, so that
the dict_table_t::def_trx_id can be recovered.

ha_innobase::table_version(): return garbage, or the trx_id that would
be used for committing an ALTER TABLE operation.

In InnoDB, table names starting with #sql-ib will remain special:
they will be dropped on startup. This may be revisited later in
MDEV-18518 when we implement proper undo logging and rollback
for creating or dropping multiple tables in a transaction.

Table names starting with #sql will retain some special meaning:
dict_table_t::parse_name() will not consider such names for
MDL acquisition, and dict_table_rename_in_cache() will treat such
names specially when handling FOREIGN KEY constraints.

Simplify InnoDB DROP INDEX.
Prevent purge wakeup

To ensure that dict_table_t::def_trx_id will be recovered correctly
in case the server is killed before ddl_log_complete(), we will block
the purge of any history in SYS_TABLES, SYS_INDEXES, SYS_COLUMNS
between ha_innobase::commit_inplace_alter_table(commit=true)
(purge_sys.stop_SYS()) and purge_sys.resume_SYS().
The completion callback purge_sys.resume_SYS() must be between
ddl_log_complete() and MDL release.

--------

MyRocks support for atomic ALTER TABLE
(Implemented by Sergui Petrunia)

Implement these SE API functions:
- ha_rocksdb::table_version()
- hton->check_version = rocksdb_check_versionMyRocks data dictionary
  now stores table version for each table.
  (Absence of table version record is interpreted as table_version=0,
  that is, which means no upgrade changes are needed)
- For inplace alter table of a partitioned table, call the underlying
  handlerton when checking if the table is ok. This assumes that the
  partition engine commits all changes at once.
2021-05-19 22:54:13 +02:00
..
aria_tiny.test MDEV-25507 CHECK on encrypted Aria table complains about "Wrong LSN" 2021-04-30 15:45:07 +03:00
compressed_import_tablespace.opt MDEV-19695 Import tablespace doesn't work with ROW_FORMAT=COMPRESSED encrypted tablespace 2019-06-06 12:54:34 +05:30
compressed_import_tablespace.test Merge 10.3 into 10.4 2019-06-12 08:37:27 +03:00
corrupted_during_recovery.combinations MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
corrupted_during_recovery.test MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
create_or_replace.opt MDEV-23776: Re-apply the fix and make the test more robust 2020-09-22 13:08:09 +03:00
create_or_replace.test MDEV-23776: Re-apply the fix and make the test more robust 2020-09-22 13:08:09 +03:00
create_or_replace_big.opt MDEV-23776: Split encryption.create_or_replace 2020-09-21 16:14:35 +03:00
create_or_replace_big.test MDEV-23776: Split encryption.create_or_replace 2020-09-21 16:14:35 +03:00
debug_key_management.opt Test debug_key_management fails sporadically in buildbot. 2015-10-29 10:35:37 +02:00
debug_key_management.test MDEV-12041: innodb_encrypt_log key rotation 2018-08-13 16:04:37 +03:00
encrypt_and_grep.opt MDEV-12253: Buffer pool blocks are accessed after they have been freed 2017-04-26 15:19:16 +03:00
encrypt_and_grep.test Merge branch '10.2' into 10.3 2018-03-28 17:31:57 +02:00
encryption_force.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
encryption_force.test MDEV-14219 Allow online table rebuild when encryption or compression parameters change 2017-10-31 09:10:25 +02:00
file_creation.opt Problem: 2019-08-16 18:11:32 +05:30
file_creation.test Merge 10.3 into 10.4, except for MDEV-20265 2019-08-23 08:06:17 +03:00
filekeys-data.enc move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys-data.key MDEV-7993 file_key_management_filekey doesn't work as expected with FILE: 2015-05-13 14:27:16 +02:00
filekeys-tooshort.enc MDEV-10888: encryption.filekeys_emptyfile fails in buildbot with valgrind 2016-09-27 07:54:27 +03:00
filekeys_badtest.inc MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
filekeys_emptyfile.opt MDEV-9613: keyfile without any keys crashes mysqld on loading file_key_management plugin 2016-03-22 22:20:33 +02:00
filekeys_emptyfile.test MDEV-9613: keyfile without any keys crashes mysqld on loading file_key_management plugin 2016-03-22 22:20:33 +02:00
filekeys_encfile.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_bad.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_bad.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_badfile.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_badfile.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_file.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_file.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_no.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_encfile_no.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_goodtest.inc Merge 10.1 into 10.2 2017-11-01 09:55:00 +02:00
filekeys_nofile.test fix the encryption.filekeys_nofile test 2015-10-10 14:19:02 +02:00
filekeys_plugin.inc misc encryption tests fixes 2015-06-27 09:40:54 +02:00
filekeys_plugin.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_plugin_exists.inc Fix test failures seen on buildbot where file_key_management plugin 2015-09-17 16:40:31 +03:00
filekeys_syntax.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_syntax.test file_key_management plugin: complain if key id 1 is not found 2015-06-02 19:00:23 +02:00
filekeys_tooshort.opt MDEV-10888: encryption.filekeys_emptyfile fails in buildbot with valgrind 2016-09-27 07:54:27 +03:00
filekeys_tooshort.test MDEV-10888: encryption.filekeys_emptyfile fails in buildbot with valgrind 2016-09-27 07:54:27 +03:00
filekeys_unencfile.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
filekeys_unencfile.test move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
innochecksum.test MDEV-23511 shutdown_server 10 times out, causing server kill at shutdown 2020-08-21 14:48:53 +03:00
innodb-bad-key-change.combinations Add encryption.innodb-redo-badkey,strict_full_crc32 2019-10-11 08:24:30 +03:00
innodb-bad-key-change.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-bad-key-change.test MDEV-19335 adjustment for innodb_checksum_algorithm=full_crc32 2019-10-10 15:24:14 +03:00
innodb-bad-key-change2.combinations Add encryption.innodb-redo-badkey,strict_full_crc32 2019-10-11 08:24:30 +03:00
innodb-bad-key-change2.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-bad-key-change2.test MDEV-19335 adjustment for innodb_checksum_algorithm=full_crc32 2019-10-10 15:24:14 +03:00
innodb-bad-key-change3.combinations Add encryption.innodb-redo-badkey,strict_full_crc32 2019-10-11 08:24:30 +03:00
innodb-bad-key-change3.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb-bad-key-change4.combinations Add encryption.innodb-redo-badkey,strict_full_crc32 2019-10-11 08:24:30 +03:00
innodb-bad-key-change4.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-bad-key-change4.test MDEV-19335 adjustment for innodb_checksum_algorithm=full_crc32 2019-10-10 15:24:14 +03:00
innodb-checksum-algorithm.test MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
innodb-compressed-blob.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-compressed-blob.test MDEV-18733 MariaDB slow start after crash recovery 2019-04-03 19:56:03 +03:00
innodb-discard-import-change.combinations MDEV-15527 fixup for innodb_checksum_algorithm=full_crc32 2021-03-31 10:55:21 +03:00
innodb-discard-import-change.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb-discard-import.combinations MDEV-15527 fixup for innodb_checksum_algorithm=full_crc32 2021-03-31 10:55:21 +03:00
innodb-discard-import.test Merge branch '10.1' into 10.2 2018-06-21 23:47:39 +02:00
innodb-encr-threads.test InnoDB: check if scrubbing is enabled before scanning the tablespace 2015-05-15 18:12:02 +02:00
innodb-encryption-alter.test MDEV-25180 Atomic ALTER TABLE 2021-05-19 22:54:13 +02:00
innodb-encryption-disable.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-encryption-disable.test Merge 10.2 into 10.3 2019-04-04 19:41:12 +03:00
innodb-first-page-read.opt MDEV-12610: MariaDB start is slow 2017-06-09 13:15:39 +03:00
innodb-force-corrupt.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-force-corrupt.test MDEV-22010: Allow mariadbd in mtr suppressions 2020-04-07 17:20:38 +03:00
innodb-key-rotation-disable.opt MDEV-11738: Mariadb uses 100% of several of my 8 cpus doing nothing 2017-03-14 16:23:10 +02:00
innodb-key-rotation-disable.test Merge 10.2 into 10.3 2019-05-02 21:45:13 +03:00
innodb-missing-key.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-missing-key.test Merge 10.2 into 10.3 2019-04-04 19:41:12 +03:00
innodb-page_encryption-32k.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
innodb-page_encryption-32k.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb-page_encryption.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb-page_encryption_compression.test Clean up some encryption tests 2020-10-17 13:13:01 +03:00
innodb-page_encryption_log_encryption.opt MDEV-8143: InnoDB: Database page corruption on disk or a failed file read 2015-05-14 11:32:24 +03:00
innodb-page_encryption_log_encryption.test Clean up some encryption tests 2020-10-17 13:13:01 +03:00
innodb-read-only.opt MDEV-11835: InnoDB: Failing assertion: free_slot != NULL on 2017-01-19 08:19:08 +02:00
innodb-read-only.test MDEV-11835: InnoDB: Failing assertion: free_slot != NULL on 2017-01-19 08:19:08 +02:00
innodb-redo-badkey.combinations Add encryption.innodb-redo-badkey,strict_full_crc32 2019-10-11 08:24:30 +03:00
innodb-redo-badkey.opt Work around MDEV-13542 Crashing on a corrupted page is unhelpful 2017-08-16 13:09:56 +03:00
innodb-redo-badkey.test MDEV-15053 Reduce buf_pool_t::mutex contention 2020-06-05 12:35:46 +03:00
innodb-redo-nokeys.opt MDEV-12253: Buffer pool blocks are accessed after they have been freed 2017-04-26 15:19:16 +03:00
innodb-redo-nokeys.test MDEV-22010: Allow mariadbd in mtr suppressions 2020-04-07 17:20:38 +03:00
innodb-remove-encryption.test MDEV-23855: Remove fil_system.LRU and reduce fil_system.mutex contention 2020-10-26 17:09:01 +02:00
innodb-spatial-index.opt MDEV-11974: MariaDB 10.2 encryption does not support spatial indexes 2017-02-08 09:05:15 +02:00
innodb-spatial-index.test MDEV-18644: Support full_crc32 for page_compressed 2019-03-18 14:08:43 +02:00
innodb_encrypt_freed.opt MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon MariaBackup prepare in buf_flush_init_for_writing with innodb_log_optimize_ddl=off 2021-02-14 10:11:03 +03:00
innodb_encrypt_freed.test MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon MariaBackup prepare in buf_flush_init_for_writing with innodb_log_optimize_ddl=off 2021-02-14 10:11:03 +03:00
innodb_encrypt_key_rotation_age.opt MDEV-14398 innodb_encryption_rotate_key_age=0 causes innodb_encrypt_tables to be ignored 2019-05-02 13:31:59 +03:00
innodb_encrypt_key_rotation_age.test MDEV-23855: Remove fil_system.LRU and reduce fil_system.mutex contention 2020-10-26 17:09:01 +02:00
innodb_encrypt_log.opt MDEV-14425 deprecate and ignore innodb_log_files_in_group 2020-02-19 12:21:59 +03:00
innodb_encrypt_log.test MDEV-23397 Remove deprecated InnoDB options in 10.6 2020-08-04 12:51:59 +03:00
innodb_encrypt_log_corruption.opt Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
innodb_encrypt_log_corruption.test MDEV-11782: Redefine the innodb_encrypt_log format 2017-02-15 08:07:20 +02:00
innodb_encrypt_temporary_tables.combinations MDEV-20340 Encrypted temporary tables cannot be read with full_crc32 2019-08-14 10:32:52 +03:00
innodb_encrypt_temporary_tables.opt Merge 10.4 into 10.5 2019-08-13 18:57:00 +03:00
innodb_encrypt_temporary_tables.test Merge 10.3 into 10.4 2020-07-31 18:09:08 +03:00
innodb_encryption-page-compression.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
innodb_encryption-page-compression.test Disable from valgrind big innodb tests that doesn't run well in valgrind 2020-10-21 03:09:29 +03:00
innodb_encryption.opt MDEV-9010 Encryption preset file contains different configuration preset then documentation 2015-10-29 10:46:37 +01:00
innodb_encryption.test MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon MariaBackup prepare in buf_flush_init_for_writing with innodb_log_optimize_ddl=off 2021-02-14 10:11:03 +03:00
innodb_encryption_discard_import.opt MDEV-23399: Performance regression with write workloads 2020-10-15 17:04:56 +03:00
innodb_encryption_discard_import.test Merge 10.2 into 10.3 2018-04-23 09:49:58 +03:00
innodb_encryption_filekeys.opt MDEV-8832: Encryption meta data should not be stored when ENCRYPTED=DEFAULT and innodb-encrypt-tables=OFF 2015-09-23 17:34:36 +03:00
innodb_encryption_filekeys.test MDEV-15672: encryption.innodb_encryption_filekeys - typo in I_S column name: ENCRYPTION_SHCEME 2018-04-13 14:03:12 +03:00
innodb_encryption_is.opt MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION 2016-03-18 11:48:49 +02:00
innodb_encryption_is.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb_encryption_row_compressed.opt MDEV-9931: InnoDB reads first page of every .ibd file at startup 2016-09-22 16:38:24 +03:00
innodb_encryption_row_compressed.test MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state 2017-05-10 09:06:57 +03:00
innodb_encryption_tables.opt move encryption tests to a dedicate suite 2015-05-13 14:27:16 +02:00
innodb_encryption_tables.test Fixed bugs found by valgrind 2020-05-15 10:44:05 +03:00
innodb_first_page.opt Tests: removed --transaction-registry option [#387] 2017-12-21 12:51:57 +03:00
innodb_first_page.test MDEV-20907 Set innodb_log_files_in_group=1 by default 2019-10-28 17:11:10 +02:00
innodb_onlinealter_encryption.opt MDEV-12253: Buffer pool blocks are accessed after they have been freed 2017-04-26 15:19:16 +03:00
innodb_onlinealter_encryption.test Remove deprecated InnoDB file format parameters 2017-06-02 09:36:14 +03:00
innodb_page_encryption_key_change.test Write information about restart in .result 2019-04-01 19:47:24 +03:00
second_plugin-12863.test MDEV-12863 No table can be created after second encryption plugin attempted to load 2017-08-08 14:52:08 +02:00
tempfiles.combinations MDEV-14868 MariaDB server crashes after using ROLLBACK TO when encrypt_tmp_files=ON 2018-02-08 22:54:37 +01:00
tempfiles.opt fix encryption.tempfiles to check that encrypt_tmp_files is ON 2018-02-08 22:54:37 +01:00
tempfiles.test Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
tempfiles_encrypted.opt MDEV-23867: insert... select crash in compute_window_func 2020-10-23 22:36:47 +05:30
tempfiles_encrypted.test Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00