diff options
author | Eugene Kosov <claprix@yandex.ru> | 2020-03-16 11:10:01 +0300 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2020-03-16 17:27:51 +0300 |
commit | 7dafab7569e97355701da092b7edfda2f2d1810e (patch) | |
tree | 505d0b3cab70e9d0fe7d6ed2729ac327fd0898ba /storage/innobase/include/log0log.h | |
parent | 0c2365c4e3c89c3b284315e19a7d95221b524868 (diff) | |
download | mariadb-git-7dafab7569e97355701da092b7edfda2f2d1810e.tar.gz |
MDEV-21949 key rotation for innodb_encrypt_log is not working in 10.5
log_t::has_encryption_key_rotation(): checks whether
key rotation is supported.
In a subsequent redo log format version, this key rotation
may be broken again.
Diffstat (limited to 'storage/innobase/include/log0log.h')
-rw-r--r-- | storage/innobase/include/log0log.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 4aa9c83e32e..d8988f4a123 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -337,7 +337,7 @@ log_refresh_stats(void); #define LOG_BLOCK_KEY 4 /* encryption key version before LOG_BLOCK_CHECKSUM; - in log_t::FORMAT_ENC_10_4 only */ + after log_t::FORMAT_ENC_10_4 only */ #define LOG_BLOCK_CHECKSUM 4 /* 4 byte checksum of the log block contents; in InnoDB versions < 3.23.52 this did not contain the @@ -742,17 +742,21 @@ public: void set_check_flush_or_checkpoint(bool flag= true) { check_flush_or_checkpoint_.store(flag, std::memory_order_relaxed); } + bool has_encryption_key_rotation() const { + return log.format == FORMAT_ENC_10_4 || log.format == FORMAT_ENC_10_5; + } + /** @return the log block header + trailer size */ unsigned framing_size() const { - return log.format == FORMAT_ENC_10_4 + return has_encryption_key_rotation() ? LOG_BLOCK_HDR_SIZE + LOG_BLOCK_KEY + LOG_BLOCK_CHECKSUM : LOG_BLOCK_HDR_SIZE + LOG_BLOCK_CHECKSUM; } /** @return the log block payload size */ unsigned payload_size() const { - return log.format == FORMAT_ENC_10_4 + return has_encryption_key_rotation() ? OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE - LOG_BLOCK_CHECKSUM - LOG_BLOCK_KEY : OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE - LOG_BLOCK_CHECKSUM; @@ -760,7 +764,7 @@ public: /** @return the log block trailer offset */ unsigned trailer_offset() const { - return log.format == FORMAT_ENC_10_4 + return has_encryption_key_rotation() ? OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM - LOG_BLOCK_KEY : OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM; } |