Commit b7ff2f1b authored by Jan Lindström's avatar Jan Lindström

MDEV-7472: Implementation of user statements for handling the xtradb changed page bitmaps

Introduce a new dummy INFORMATION_SCHEMA.CHANGED_PAGE_BITMAPS table to XtraDB
with reset_table callback to allow FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS
to be called from innobackupex.
parent d3b7eb7b
...@@ -96,6 +96,9 @@ The following options may be given as the first argument: ...@@ -96,6 +96,9 @@ The following options may be given as the first argument:
--bulk-insert-buffer-size=# --bulk-insert-buffer-size=#
Size of tree cache used in bulk insert optimisation. Note Size of tree cache used in bulk insert optimisation. Note
that this is a limit per thread! that this is a limit per thread!
--changed-page-bitmaps[=name]
Enable or disable CHANGED_PAGE_BITMAPS plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--character-set-client-handshake --character-set-client-handshake
Don't ignore client side character set value sent during Don't ignore client side character set value sent during
handshake. handshake.
...@@ -1126,6 +1129,7 @@ binlog-optimize-thread-scheduling TRUE ...@@ -1126,6 +1129,7 @@ binlog-optimize-thread-scheduling TRUE
binlog-row-event-max-size 1024 binlog-row-event-max-size 1024
binlog-stmt-cache-size 32768 binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608 bulk-insert-buffer-size 8388608
changed-page-bitmaps ON
character-set-client-handshake TRUE character-set-client-handshake TRUE
character-set-filesystem binary character-set-filesystem binary
character-set-server latin1 character-set-server latin1
......
FLUSH NO_WRITE_TO_BINLOG changed_page_bitmaps;
select * from information_schema.changed_page_bitmaps;
dummy
0
--changed-page-bitmaps
--innodb-track-changed-pages
-- source include/have_xtradb.inc
-- source include/not_embedded.inc
FLUSH NO_WRITE_TO_BINLOG changed_page_bitmaps;
select * from information_schema.changed_page_bitmaps;
...@@ -4240,7 +4240,6 @@ innobase_flush_logs( ...@@ -4240,7 +4240,6 @@ innobase_flush_logs(
Synchronously read and parse the redo log up to the last Synchronously read and parse the redo log up to the last
checkpoint to write the changed page bitmap. checkpoint to write the changed page bitmap.
@return 0 to indicate success. Current implementation cannot fail. */ @return 0 to indicate success. Current implementation cannot fail. */
static
my_bool my_bool
innobase_flush_changed_page_bitmaps() innobase_flush_changed_page_bitmaps()
/*=================================*/ /*=================================*/
...@@ -20791,7 +20790,8 @@ i_s_innodb_changed_pages, ...@@ -20791,7 +20790,8 @@ i_s_innodb_changed_pages,
i_s_innodb_mutexes, i_s_innodb_mutexes,
i_s_innodb_sys_semaphore_waits, i_s_innodb_sys_semaphore_waits,
i_s_innodb_tablespaces_encryption, i_s_innodb_tablespaces_encryption,
i_s_innodb_tablespaces_scrubbing i_s_innodb_tablespaces_scrubbing,
i_s_innodb_changed_page_bitmaps
maria_declare_plugin_end; maria_declare_plugin_end;
/** @brief Initialize the default value of innodb_commit_concurrency. /** @brief Initialize the default value of innodb_commit_concurrency.
......
...@@ -9459,3 +9459,128 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits = ...@@ -9459,3 +9459,128 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits =
STRUCT_FLD(version_info, INNODB_VERSION_STR), STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
}; };
static ST_FIELD_INFO innodb_changed_page_bitmaps_fields_info[] =
{
{STRUCT_FLD(field_name, "dummy"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
END_OF_ST_FIELD_INFO
};
/*******************************************************************//**
Function to populate INFORMATION_SCHEMA.CHANGED_PAGE_BITMAPS
@return 0 on success */
static
int
fill_changed_page_bitmaps_table(
/*============================*/
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ) /*!< in: condition (not used) */
{
Field** fields = tables->table->field;
DBUG_ENTER("fill_changed_page_bitmaps");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to user without PROCESS_ACL privilege */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
}
OK(field_store_ulint(fields[0], 0));
OK(schema_table_store_record(thd, tables->table));
DBUG_RETURN(0);
}
/*******************************************************************//**
Flush support for changed_page_bitmaps table.
@return 0 on success */
static
int
flush_changed_page_bitmaps()
/*========================*/
{
DBUG_ENTER("flush_changed_page_bitmaps");
if (srv_track_changed_pages) {
os_event_reset(srv_checkpoint_completed_event);
log_online_follow_redo_log();
}
DBUG_RETURN(0);
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.CHANGED_PAGE_BITMAP
@return 0 on success */
static
int
innodb_changed_page_bitmaps_init(
/*=============================*/
void* p) /*!< in/out: table schema object */
{
ST_SCHEMA_TABLE* schema;
DBUG_ENTER("innodb_changed_page_bitmaps_init");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_changed_page_bitmaps_fields_info;
schema->fill_table = fill_changed_page_bitmaps_table;
schema->reset_table= flush_changed_page_bitmaps;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_mysql_plugin i_s_innodb_changed_page_bitmaps =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
/* pointer to type-specific plugin descriptor */
/* void* */
STRUCT_FLD(info, &i_s_info),
/* plugin name */
/* const char* */
STRUCT_FLD(name, "CHANGED_PAGE_BITMAPS"),
/* plugin author (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(author, maria_plugin_author),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(descr, "XtraDB dummy changed_page_bitmaps table"),
/* the plugin license (PLUGIN_LICENSE_XXX) */
/* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
/* the function to invoke when plugin is loaded */
/* int (*)(void*); */
STRUCT_FLD(init, innodb_changed_page_bitmaps_init),
/* the function to invoke when plugin is unloaded */
/* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
/* plugin version (for SHOW PLUGINS) */
/* unsigned int */
STRUCT_FLD(version, INNODB_VERSION_SHORT),
/* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
};
...@@ -67,6 +67,7 @@ extern struct st_mysql_plugin i_s_innodb_mutexes; ...@@ -67,6 +67,7 @@ extern struct st_mysql_plugin i_s_innodb_mutexes;
extern struct st_maria_plugin i_s_innodb_tablespaces_encryption; extern struct st_maria_plugin i_s_innodb_tablespaces_encryption;
extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing; extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing;
extern struct st_mysql_plugin i_s_innodb_sys_semaphore_waits; extern struct st_mysql_plugin i_s_innodb_sys_semaphore_waits;
extern struct st_mysql_plugin i_s_innodb_changed_page_bitmaps;
/** maximum number of buffer page info we would cache. */ /** maximum number of buffer page info we would cache. */
#define MAX_BUF_INFO_CACHED 10000 #define MAX_BUF_INFO_CACHED 10000
......
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