Commit 4901f31c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into 10.3

parents c3a80175 59950df5
......@@ -51,6 +51,36 @@ static void add_to_plugin_load_list(const char *plugin_def)
static char XTRABACKUP_EXE[] = "xtrabackup";
/*
Read "plugin-load" value (encryption plugin) from backup-my.cnf during
prepare phase.
The value is stored during backup phase.
*/
static std::string get_encryption_plugin_from_cnf()
{
FILE *f = fopen("backup-my.cnf", "r");
if (!f)
{
msg("cannot open backup-my.cnf for reading\n");
exit(EXIT_FAILURE);
}
char line[512];
std::string plugin_load;
while (fgets(line, sizeof(line), f))
{
if (strncmp(line, "plugin_load=", 12) == 0)
{
plugin_load = line + 12;
// remote \n at the end of string
plugin_load.resize(plugin_load.size() - 1);
break;
}
}
fclose(f);
return plugin_load;
}
void encryption_plugin_backup_init(MYSQL *mysql)
{
MYSQL_RES *result;
......@@ -78,7 +108,17 @@ void encryption_plugin_backup_init(MYSQL *mysql)
std::string plugin_load(name);
if (library)
{
/* Remove shared library suffixes, in case we'll prepare on different OS.*/
const char *extensions[] = { ".dll", ".so", 0 };
for (size_t i = 0; extensions[i]; i++)
{
const char *ext = extensions[i];
if (ends_with(library, ext))
library[strlen(library) - strlen(ext)] = 0;
}
plugin_load += std::string("=") + library;
}
oss << "plugin_load=" << plugin_load << std::endl;
......@@ -140,14 +180,18 @@ extern int finalize_encryption_plugin(st_plugin_int *plugin);
void encryption_plugin_prepare_init(int argc, char **argv)
{
if (!xb_plugin_load)
std::string plugin_load= get_encryption_plugin_from_cnf();
if (plugin_load.size())
{
msg("Loading encryption plugin from %s\n", plugin_load.c_str());
}
else
{
finalize_encryption_plugin(0);
return;
}
add_to_plugin_load_list(xb_plugin_load);
add_to_plugin_load_list(plugin_load.c_str());
if (xb_plugin_dir)
strncpy(opt_plugin_dir, xb_plugin_dir, FN_REFLEN);
......
......@@ -709,7 +709,6 @@ enum options_xtrabackup
OPT_INNODB_LOG_CHECKSUMS,
OPT_XTRA_INCREMENTAL_FORCE_SCAN,
OPT_DEFAULTS_GROUP,
OPT_PLUGIN_LOAD,
OPT_INNODB_ENCRYPT_LOG,
OPT_CLOSE_FILES,
OPT_CORE_FILE,
......@@ -1268,11 +1267,7 @@ struct my_option xb_server_options[] =
&xb_plugin_dir, &xb_plugin_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "plugin-load", OPT_PLUGIN_LOAD, "encrypton plugin to load during 'prepare' phase.",
&xb_plugin_load, &xb_plugin_load,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "innodb-encrypt-log", OPT_INNODB_ENCRYPT_LOG, "encrypton plugin to load",
{ "innodb-encrypt-log", OPT_INNODB_ENCRYPT_LOG, "Whether to encrypt innodb log",
&srv_encrypt_log, &srv_encrypt_log,
0, GET_BOOL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
......
This diff is collapsed.
......@@ -1279,8 +1279,6 @@ void btr_search_drop_page_hash_when_freed(const page_id_t& page_id)
mtr_t mtr;
dberr_t err = DB_SUCCESS;
ut_d(export_vars.innodb_ahi_drop_lookups++);
mtr_start(&mtr);
/* If the caller has a latch on the page, then the caller must
......
......@@ -1068,10 +1068,6 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG},
{"available_undo_logs",
(char*) &export_vars.innodb_available_undo_logs, SHOW_LONG},
#ifdef UNIV_DEBUG
{"ahi_drop_lookups",
(char*) &export_vars.innodb_ahi_drop_lookups, SHOW_LONG},
#endif /* UNIV_DEBUG */
/* Status variables for page compression */
{"page_compression_saved",
......
......@@ -186,32 +186,6 @@ struct recv_t{
rec_list;/*!< list of log records for this page */
};
/** States of recv_addr_t */
enum recv_addr_state {
/** not yet processed */
RECV_NOT_PROCESSED,
/** page is being read */
RECV_BEING_READ,
/** log records are being applied on the page */
RECV_BEING_PROCESSED,
/** log records have been applied on the page */
RECV_PROCESSED,
/** log records have been discarded because the tablespace
does not exist */
RECV_DISCARDED
};
/** Hashed page file address struct */
struct recv_addr_t{
enum recv_addr_state state;
/*!< recovery state of the page */
unsigned space:32;/*!< space id */
unsigned page_no:32;/*!< page number */
UT_LIST_BASE_NODE_T(recv_t)
rec_list;/*!< list of log records for this page */
hash_node_t addr_hash;/*!< hash node in the hash bucket chain */
};
struct recv_dblwr_t {
/** Add a page frame to the doublewrite recovery buffer. */
void add(byte* page) {
......
......@@ -1014,12 +1014,6 @@ struct export_var_t{
of used row log buffer */
ulint innodb_onlineddl_pct_progress; /*!< Online alter progress */
#ifdef UNIV_DEBUG
ulint innodb_ahi_drop_lookups; /*!< number of adaptive hash
index lookups when freeing
file pages */
#endif /* UNIV_DEBUG */
int64_t innodb_page_compression_saved;/*!< Number of bytes saved
by page compression */
int64_t innodb_index_pages_written; /*!< Number of index pages
......
......@@ -169,6 +169,35 @@ typedef std::map<
static recv_spaces_t recv_spaces;
/** States of recv_addr_t */
enum recv_addr_state {
/** not yet processed */
RECV_NOT_PROCESSED,
/** page is being read */
RECV_BEING_READ,
/** log records are being applied on the page */
RECV_BEING_PROCESSED,
/** log records have been applied on the page */
RECV_PROCESSED,
/** log records have been discarded because the tablespace
does not exist */
RECV_DISCARDED
};
/** Hashed page file address struct */
struct recv_addr_t{
/** recovery state of the page */
recv_addr_state state;
/** tablespace identifier */
unsigned space:32;
/** page number */
unsigned page_no:32;
/** list of log records for this page */
UT_LIST_BASE_NODE_T(recv_t) rec_list;
/** hash node in the hash bucket chain */
hash_node_t addr_hash;
};
/** Report optimized DDL operation (without redo log),
corresponding to MLOG_INDEX_LOAD.
@param[in] space_id tablespace identifier
......@@ -1174,6 +1203,7 @@ recv_parse_or_apply_log_rec_body(
redo log been written with something
older than InnoDB Plugin 1.0.4. */
ut_ad(offs == FIL_PAGE_TYPE
|| srv_is_undo_tablespace(space_id)
|| offs == IBUF_TREE_SEG_HEADER
+ IBUF_HEADER + FSEG_HDR_OFFSET
|| offs == PAGE_BTR_IBUF_FREE_LIST
......@@ -1199,6 +1229,7 @@ recv_parse_or_apply_log_rec_body(
ut_ad(0
/* fil_crypt_rotate_page() writes this */
|| offs == FIL_PAGE_SPACE_ID
|| srv_is_undo_tablespace(space_id)
|| offs == IBUF_TREE_SEG_HEADER
+ IBUF_HEADER + FSEG_HDR_SPACE
|| offs == IBUF_TREE_SEG_HEADER
......
......@@ -1076,9 +1076,7 @@ row_purge_parse_undo_rec(
ut_ad(!node->table->is_temporary());
if (!fil_table_accessible(node->table)) {
dict_table_close(node->table, FALSE, FALSE);
node->table = NULL;
goto err_exit;
goto close_exit;
}
switch (type) {
......@@ -1113,6 +1111,7 @@ row_purge_parse_undo_rec(
dict_set_corrupted() works on an index, and
we do not have an index to call it with. */
dict_table_close(node->table, FALSE, FALSE);
node->table = NULL;
err_exit:
rw_lock_s_unlock(dict_operation_lock);
return(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment