summaryrefslogtreecommitdiff
path: root/storage/innobase/include/fil0fil.h
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-04-01 11:50:21 +0300
committerSergei Golubchik <serg@mariadb.org>2015-04-07 23:44:56 +0200
commitb4a4d82396dce58496a9d0741fec505452d753f6 (patch)
tree2faf7221af0af4241997bfe97dc643d19e93adb2 /storage/innobase/include/fil0fil.h
parent47c344b00fa6878e5d1ce4235f8016a1ec995967 (diff)
downloadmariadb-git-b4a4d82396dce58496a9d0741fec505452d753f6.tar.gz
InnoDB/XtraDB Encryption cleanup.
Step 1: -- Remove page encryption from dictionary (per table encryption will be handled by storing crypt_data to page 0) -- Remove encryption/compression from os0file and all functions before that (compression will be added to buf0buf.cc) -- Use same CRYPT_SCHEME_1 for all encryption methods -- Do some code cleanups to confort InnoDB coding style
Diffstat (limited to 'storage/innobase/include/fil0fil.h')
-rw-r--r--storage/innobase/include/fil0fil.h306
1 files changed, 10 insertions, 296 deletions
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index e4f16b24392..2c6c5804f65 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -26,7 +26,6 @@ Created 10/25/1995 Heikki Tuuri
#ifndef fil0fil_h
#define fil0fil_h
-#define MSG_CANNOT_DECRYPT "can not decrypt"
#include "univ.i"
#ifndef UNIV_INNOCHECKSUM
@@ -136,24 +135,6 @@ extern fil_addr_t fil_addr_null;
used to encrypt the page + 32-bit checksum
or 64 bits of zero if no encryption
*/
-/** If page type is FIL_PAGE_COMPRESSED then the 8 bytes starting at
-FIL_PAGE_FILE_FLUSH_LSN are broken down as follows: */
-
-/** Control information version format (u8) */
-static const ulint FIL_PAGE_VERSION = FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
-
-/** Compression algorithm (u8) */
-static const ulint FIL_PAGE_ALGORITHM_V1 = FIL_PAGE_VERSION + 1;
-
-/** Original page type (u16) */
-static const ulint FIL_PAGE_ORIGINAL_TYPE_V1 = FIL_PAGE_ALGORITHM_V1 + 1;
-
-/** Original data size in bytes (u16)*/
-static const ulint FIL_PAGE_ORIGINAL_SIZE_V1 = FIL_PAGE_ORIGINAL_TYPE_V1 + 2;
-
-/** Size after compression (u16)*/
-static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
-
#define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this
contains the space id of the page */
#define FIL_PAGE_SPACE_ID FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID
@@ -173,10 +154,7 @@ static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
/* @} */
/** File page types (values of FIL_PAGE_TYPE) @{ */
-#define FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED 35631 /* page compressed +
- encrypted page */
#define FIL_PAGE_PAGE_COMPRESSED 34354 /*!< page compressed page */
-#define FIL_PAGE_PAGE_ENCRYPTED 34355 /*!< Page encrypted page */
#define FIL_PAGE_INDEX 17855 /*!< B-tree node */
#define FIL_PAGE_UNDO_LOG 2 /*!< Undo log page */
#define FIL_PAGE_INODE 3 /*!< Index node */
@@ -203,6 +181,9 @@ static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
#ifndef UNIV_INNOCHECKSUM
+/* structure containing encryption specification */
+typedef struct fil_space_crypt_struct fil_space_crypt_t;
+
/** The number of fsyncs done to the log */
extern ulint fil_n_log_flushes;
@@ -214,9 +195,6 @@ extern ulint fil_n_pending_tablespace_flushes;
/** Number of files currently open */
extern ulint fil_n_file_opened;
-/* structure containing encryption specification */
-typedef struct fil_space_crypt_struct fil_space_crypt_t;
-
struct fsp_open_info {
ibool success; /*!< Has the tablespace been opened? */
const char* check_msg; /*!< fil_check_first_page() message */
@@ -997,13 +975,11 @@ fil_io(
appropriately aligned */
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
- ulint* write_size, /*!< in/out: Actual write size initialized
+ ulint* write_size) /*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
actual page size does not decrease. */
- lsn_t lsn, /*!< in: lsn of the newest modification */
- bool encrypt_later) /*!< in: should we encrypt the page */
__attribute__((nonnull(8)));
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
@@ -1256,6 +1232,7 @@ fil_user_tablespace_restore_page(
/*******************************************************************//**
Return space flags */
+UNIV_INLINE
ulint
fil_space_flags(
/*===========*/
@@ -1281,12 +1258,6 @@ fil_space_t*
fil_space_get_by_id(
/*================*/
ulint id); /*!< in: space id */
-/*******************************************************************//**
-Return space name */
-char*
-fil_space_name(
-/*===========*/
- fil_space_t* space); /*!< in: space */
/******************************************************************
Get id of first tablespace or ULINT_UNDEFINED if none */
@@ -1301,270 +1272,13 @@ ulint
fil_get_next_space(
ulint id); /*!< in: space id */
-/*********************************************************************
-Init global resources needed for tablespace encryption/decryption */
-void
-fil_space_crypt_init();
-
-/*********************************************************************
-Cleanup global resources needed for tablespace encryption/decryption */
-void
-fil_space_crypt_cleanup();
-
-/*********************************************************************
-Create crypt data, i.e data that is used for a single tablespace */
-fil_space_crypt_t *
-fil_space_create_crypt_data();
-
-/*********************************************************************
-Destroy crypt data */
-UNIV_INTERN
-void
-fil_space_destroy_crypt_data(
-/*=========================*/
- fil_space_crypt_t **crypt_data); /*!< in/out: crypt data */
-
-/*********************************************************************
-Get crypt data for a space*/
-fil_space_crypt_t *
-fil_space_get_crypt_data(
-/*======================*/
- ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Set crypt data for a space*/
-void
-fil_space_set_crypt_data(
-/*======================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data); /*!< in: crypt data */
-
-/*********************************************************************
-Compare crypt data*/
-int
-fil_space_crypt_compare(
-/*======================*/
- const fil_space_crypt_t* crypt_data1, /*!< in: crypt data */
- const fil_space_crypt_t* crypt_data2); /*!< in: crypt data */
-
-/*********************************************************************
-Read crypt data from buffer page */
-fil_space_crypt_t *
-fil_space_read_crypt_data(
-/*======================*/
- ulint space, /*!< in: tablespace id */
- const byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
-
-/*********************************************************************
-Write crypt data to buffer page */
-void
-fil_space_write_crypt_data(
-/*=======================*/
- ulint space, /*!< in: tablespace id */
- byte* page, /*!< in: buffer page */
- ulint offset, /*!< in: offset where to store data */
- ulint maxsize, /*!< in: max space available to store crypt data in */
- mtr_t * mtr); /*!< in: mini-transaction */
-
-/*********************************************************************
-Clear crypt data from page 0 (used for import tablespace) */
-void
-fil_space_clear_crypt_data(
-/*======================*/
- byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
-
-/*********************************************************************
-Parse crypt data log record */
-byte*
-fil_parse_write_crypt_data(
-/*=======================*/
- byte* ptr, /*!< in: start of log record */
- byte* end_ptr, /*!< in: end of log record */
- buf_block_t*); /*!< in: buffer page to apply record to */
-
-/*********************************************************************
-Check if extra buffer shall be allocated for decrypting after read */
-UNIV_INTERN
-bool
-fil_space_check_encryption_read(
-/*==============================*/
- ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Check if page shall be encrypted before write */
-UNIV_INTERN
-bool
-fil_space_check_encryption_write(
-/*==============================*/
- ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Encrypt buffer page */
-void
-fil_space_encrypt(
-/*===============*/
- ulint space, /*!< in: tablespace id */
- ulint offset, /*!< in: page no */
- lsn_t lsn, /*!< in: page lsn */
- const byte* src_frame,/*!< in: page frame */
- ulint size, /*!< in: size of data to encrypt */
- byte* dst_frame, /*!< in: where to encrypt to */
- ulint page_encryption_key); /*!< in: page encryption key id if page
- encrypted */
-
-/*********************************************************************
-Decrypt buffer page */
-void
-fil_space_decrypt(
-/*===============*/
- ulint space, /*!< in: tablespace id */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to decrypt to */
-
-
-/*********************************************************************
-Decrypt buffer page
-@return true if page was encrypted */
-bool
-fil_space_decrypt(
-/*===============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- const byte* src_frame,/*!< in: page frame */
- ulint page_size, /*!< in: page size */
- byte* dst_frame); /*!< in: where to decrypt to */
-
-/*********************************************************************
-fil_space_verify_crypt_checksum
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
-@return true if page is encrypted AND OK, false otherwise */
-bool
-fil_space_verify_crypt_checksum(
-/*===============*/
- const byte* src_frame,/*!< in: page frame */
- ulint zip_size); /*!< in: size of data to encrypt */
-
-/*********************************************************************
-Init threads for key rotation */
-void
-fil_crypt_threads_init();
-
-/*********************************************************************
-Set thread count (e.g start or stops threads) used for key rotation */
-void
-fil_crypt_set_thread_cnt(
-/*=====================*/
- uint new_cnt); /*!< in: requested #threads */
-
-/*********************************************************************
-End threads for key rotation */
-void
-fil_crypt_threads_end();
-
-/*********************************************************************
-Cleanup resources for threads for key rotation */
-void
-fil_crypt_threads_cleanup();
-
-/*********************************************************************
-Set rotate key age */
-void
-fil_crypt_set_rotate_key_age(
-/*=====================*/
- uint rotate_age); /*!< in: requested rotate age */
-
-/*********************************************************************
-Set rotation threads iops */
-void
-fil_crypt_set_rotation_iops(
-/*=====================*/
- uint iops); /*!< in: requested iops */
-
-/*********************************************************************
-Mark a space as closing */
-UNIV_INTERN
-void
-fil_space_crypt_mark_space_closing(
-/*===============*/
- ulint space); /*!< in: tablespace id */
-
-/*********************************************************************
-Wait for crypt threads to stop accessing space */
-UNIV_INTERN
-void
-fil_space_crypt_close_tablespace(
-/*===============*/
- ulint space); /*!< in: tablespace id */
-
-/** Struct for retreiving info about encryption */
-struct fil_space_crypt_status_t {
- ulint space; /*!< tablespace id */
- ulint scheme; /*!< encryption scheme */
- uint min_key_version; /*!< min key version */
- uint current_key_version;/*!< current key version */
- uint keyserver_requests;/*!< no of key requests to key server */
- bool rotating; /*!< is key rotation ongoing */
- bool flushing; /*!< is flush at end of rotation ongoing */
- ulint rotate_next_page_number; /*!< next page if key rotating */
- ulint rotate_max_page_number; /*!< max page if key rotating */
-};
-
-/*********************************************************************
-Get crypt status for a space
-@return 0 if crypt data found */
-int
-fil_space_crypt_get_status(
-/*==================*/
- ulint id, /*!< in: space id */
- struct fil_space_crypt_status_t * status); /*!< out: status */
-
-/** Struct for retreiving statistics about encryption key rotation */
-struct fil_crypt_stat_t {
- ulint pages_read_from_cache;
- ulint pages_read_from_disk;
- ulint pages_modified;
- ulint pages_flushed;
- ulint estimated_iops;
-};
-
-/*********************************************************************
-Get crypt rotation statistics */
-void
-fil_crypt_total_stat(
-/*==================*/
- fil_crypt_stat_t* stat); /*!< out: crypt stat */
-
-/** Struct for retreiving info about scrubbing */
-struct fil_space_scrub_status_t {
- ulint space; /*!< tablespace id */
- bool compressed; /*!< is space compressed */
- time_t last_scrub_completed; /*!< when was last scrub completed */
- bool scrubbing; /*!< is scrubbing ongoing */
- time_t current_scrub_started; /*!< when started current scrubbing */
- ulint current_scrub_active_threads; /*!< current scrub active threads */
- ulint current_scrub_page_number; /*!< current scrub page no */
- ulint current_scrub_max_page_number; /*!< current scrub max page no */
-};
-
-/*********************************************************************
-Get scrub status for a space
-@return 0 if no scrub info found */
-int
-fil_space_get_scrub_status(
-/*==================*/
- ulint id, /*!< in: space id */
- struct fil_space_scrub_status_t * status); /*!< out: status */
#endif
-/*******************************************************************//**
-Return page type name */
-const char*
-fil_get_page_type_name(
-/*===================*/
- ulint page_type); /*!< in: FIL_PAGE_TYPE */
+#ifndef UNIV_INNOCHECKSUM
+#ifndef UNIV_NONINL
+#include "fil0fil.ic"
+#endif
+#endif
#endif /* fil0fil_h */