Commit 92f87f2c authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove changed_pages_bitmap

The innodb_changed_pages plugin only was part of XtraDB, never InnoDB.
It would be useful for incremental backups.
We will remove the code from mariadb-backup for now, because it cannot
serve any useful purpose until the server part has been implemented.
parent 47122a61
...@@ -57,7 +57,6 @@ ADD_DEFINITIONS(${SSL_DEFINES}) ...@@ -57,7 +57,6 @@ ADD_DEFINITIONS(${SSL_DEFINES})
MYSQL_ADD_EXECUTABLE(mariadb-backup MYSQL_ADD_EXECUTABLE(mariadb-backup
xtrabackup.cc xtrabackup.cc
innobackupex.cc innobackupex.cc
changed_page_bitmap.cc
datasink.cc datasink.cc
ds_buffer.cc ds_buffer.cc
ds_compress.cc ds_compress.cc
......
...@@ -73,7 +73,6 @@ mysql_flavor_t server_flavor = FLAVOR_UNKNOWN; ...@@ -73,7 +73,6 @@ mysql_flavor_t server_flavor = FLAVOR_UNKNOWN;
unsigned long mysql_server_version = 0; unsigned long mysql_server_version = 0;
/* server capabilities */ /* server capabilities */
bool have_changed_page_bitmaps = false;
bool have_backup_locks = false; bool have_backup_locks = false;
bool have_lock_wait_timeout = false; bool have_lock_wait_timeout = false;
bool have_galera_enabled = false; bool have_galera_enabled = false;
...@@ -606,34 +605,6 @@ Query the server to find out what backup capabilities it supports. ...@@ -606,34 +605,6 @@ Query the server to find out what backup capabilities it supports.
bool bool
detect_mysql_capabilities_for_backup() detect_mysql_capabilities_for_backup()
{ {
const char *query = "SELECT 'INNODB_CHANGED_PAGES', COUNT(*) FROM "
"INFORMATION_SCHEMA.PLUGINS "
"WHERE PLUGIN_NAME LIKE 'INNODB_CHANGED_PAGES'";
char *innodb_changed_pages = NULL;
mysql_variable vars[] = {
{"INNODB_CHANGED_PAGES", &innodb_changed_pages}, {NULL, NULL}};
if (xtrabackup_incremental) {
read_mysql_variables(mysql_connection, query, vars, true);
ut_ad(innodb_changed_pages != NULL);
have_changed_page_bitmaps = (atoi(innodb_changed_pages) == 1);
/* INNODB_CHANGED_PAGES are listed in
INFORMATION_SCHEMA.PLUGINS in MariaDB, but
FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS
is not supported for versions below 10.1.6
(see MDEV-7472) */
if (server_flavor == FLAVOR_MARIADB &&
mysql_server_version < 100106) {
have_changed_page_bitmaps = false;
}
free_mysql_variables(vars);
}
/* do some sanity checks */ /* do some sanity checks */
if (opt_galera_info && !have_galera_enabled) { if (opt_galera_info && !have_galera_enabled) {
msg("--galera-info is specified on the command " msg("--galera-info is specified on the command "
...@@ -1997,18 +1968,6 @@ select_history() ...@@ -1997,18 +1968,6 @@ select_history()
return(true); return(true);
} }
bool
flush_changed_page_bitmaps()
{
if (xtrabackup_incremental && have_changed_page_bitmaps &&
!xtrabackup_incremental_force_scan) {
xb_mysql_query(mysql_connection,
"FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS", false);
}
return(true);
}
/*********************************************************************//** /*********************************************************************//**
Deallocate memory, disconnect from server, etc. Deallocate memory, disconnect from server, etc.
@return true on success. */ @return true on success. */
......
...@@ -10,7 +10,6 @@ extern mysql_flavor_t server_flavor; ...@@ -10,7 +10,6 @@ extern mysql_flavor_t server_flavor;
extern unsigned long mysql_server_version; extern unsigned long mysql_server_version;
/* server capabilities */ /* server capabilities */
extern bool have_changed_page_bitmaps;
extern bool have_backup_locks; extern bool have_backup_locks;
extern bool have_lock_wait_timeout; extern bool have_lock_wait_timeout;
extern bool have_galera_enabled; extern bool have_galera_enabled;
...@@ -39,9 +38,6 @@ capture_tool_command(int argc, char **argv); ...@@ -39,9 +38,6 @@ capture_tool_command(int argc, char **argv);
bool bool
select_history(); select_history();
bool
flush_changed_page_bitmaps();
void void
backup_cleanup(); backup_cleanup();
......
This diff is collapsed.
/******************************************************
XtraBackup: hot backup tool for InnoDB
(c) 2009-2012 Percona Inc.
Originally Created 3/3/2009 Yasufumi Kinoshita
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
*******************************************************/
/* Changed page bitmap interface */
#ifndef XB_CHANGED_PAGE_BITMAP_H
#define XB_CHANGED_PAGE_BITMAP_H
#include <ut0rbt.h>
#include <fil0fil.h>
/* The changed page bitmap structure */
typedef ib_rbt_t xb_page_bitmap;
struct xb_page_bitmap_range_struct;
/* The bitmap range iterator over one space id */
typedef struct xb_page_bitmap_range_struct xb_page_bitmap_range;
/****************************************************************//**
Read the disk bitmap and build the changed page bitmap tree for the
LSN interval incremental_lsn to checkpoint_lsn_start.
@return the built bitmap tree */
xb_page_bitmap*
xb_page_bitmap_init(void);
/*=====================*/
/****************************************************************//**
Free the bitmap tree. */
void
xb_page_bitmap_deinit(
/*==================*/
xb_page_bitmap* bitmap); /*!<in/out: bitmap tree */
/****************************************************************//**
Set up a new bitmap range iterator over a given space id changed
pages in a given bitmap.
@return bitmap range iterator */
xb_page_bitmap_range*
xb_page_bitmap_range_init(
/*======================*/
xb_page_bitmap* bitmap, /*!< in: bitmap to iterate over */
ulint space_id); /*!< in: space id */
/****************************************************************//**
Get the next page id that has its bit set or cleared, i.e. equal to
bit_value.
@return page id */
ulint
xb_page_bitmap_range_get_next_bit(
/*==============================*/
xb_page_bitmap_range* bitmap_range, /*!< in/out: bitmap range */
ibool bit_value); /*!< in: bit value */
/****************************************************************//**
Free the bitmap range iterator. */
void
xb_page_bitmap_range_deinit(
/*========================*/
xb_page_bitmap_range* bitmap_range); /*! in/out: bitmap range */
#endif
...@@ -238,8 +238,7 @@ xb_fil_cur_open( ...@@ -238,8 +238,7 @@ xb_fil_cur_open(
/ cursor->page_size); / cursor->page_size);
cursor->read_filter = read_filter; cursor->read_filter = read_filter;
cursor->read_filter->init(&cursor->read_filter_ctxt, cursor, cursor->read_filter->init(&cursor->read_filter_ctxt, cursor);
node->space->id);
return(XB_FIL_CUR_SUCCESS); return(XB_FIL_CUR_SUCCESS);
} }
...@@ -503,10 +502,6 @@ xb_fil_cur_close( ...@@ -503,10 +502,6 @@ xb_fil_cur_close(
/*=============*/ /*=============*/
xb_fil_cur_t *cursor) /*!< in/out: source file cursor */ xb_fil_cur_t *cursor) /*!< in/out: source file cursor */
{ {
if (cursor->read_filter) {
cursor->read_filter->deinit(&cursor->read_filter_ctxt);
}
aligned_free(cursor->buf); aligned_free(cursor->buf);
cursor->buf = NULL; cursor->buf = NULL;
......
...@@ -32,29 +32,13 @@ Perform read filter context initialization that is common to all read ...@@ -32,29 +32,13 @@ Perform read filter context initialization that is common to all read
filters. */ filters. */
static static
void void
common_init( rf_pass_through_init(
/*========*/
xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter context */ xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter context */
const xb_fil_cur_t* cursor) /*!<in: file cursor */ const xb_fil_cur_t* cursor) /*!<in: file cursor */
{ {
ctxt->offset = 0; ctxt->offset = 0;
ctxt->data_file_size = cursor->statinfo.st_size; ctxt->data_file_size = cursor->statinfo.st_size;
ctxt->buffer_capacity = cursor->buf_size; ctxt->buffer_capacity = cursor->buf_size;
ctxt->page_size = cursor->page_size;
}
/****************************************************************//**
Initialize the pass-through read filter. */
static
void
rf_pass_through_init(
/*=================*/
xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter context */
const xb_fil_cur_t* cursor, /*!<in: file cursor */
ulint space_id __attribute__((unused)))
/*!<in: space id we are reading */
{
common_init(ctxt, cursor);
} }
/****************************************************************//** /****************************************************************//**
...@@ -65,143 +49,25 @@ rf_pass_through_get_next_batch( ...@@ -65,143 +49,25 @@ rf_pass_through_get_next_batch(
/*===========================*/ /*===========================*/
xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter
context */ context */
ib_int64_t* read_batch_start, /*!<out: starting read int64_t* read_batch_start, /*!<out: starting read
offset in bytes for the
next batch of pages */
ib_int64_t* read_batch_len) /*!<out: length in
bytes of the next batch
of pages */
{
*read_batch_start = ctxt->offset;
*read_batch_len = ctxt->data_file_size - ctxt->offset;
if (*read_batch_len > (ib_int64_t)ctxt->buffer_capacity) {
*read_batch_len = ctxt->buffer_capacity;
}
ctxt->offset += *read_batch_len;
}
/****************************************************************//**
Deinitialize the pass-through read filter. */
static
void
rf_pass_through_deinit(
/*===================*/
xb_read_filt_ctxt_t* ctxt __attribute__((unused)))
/*!<in: read filter context */
{
}
/****************************************************************//**
Initialize the changed page bitmap-based read filter. Assumes that
the bitmap is already set up in changed_page_bitmap. */
static
void
rf_bitmap_init(
/*===========*/
xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter
context */
const xb_fil_cur_t* cursor, /*!<in: read cursor */
ulint space_id) /*!<in: space id */
{
common_init(ctxt, cursor);
ctxt->bitmap_range = xb_page_bitmap_range_init(changed_page_bitmap,
space_id);
ctxt->filter_batch_end = 0;
}
/****************************************************************//**
Get the next batch of pages for the bitmap read filter. */
static
void
rf_bitmap_get_next_batch(
/*=====================*/
xb_read_filt_ctxt_t* ctxt, /*!<in/out: read filter
context */
ib_int64_t* read_batch_start, /*!<out: starting read
offset in bytes for the offset in bytes for the
next batch of pages */ next batch of pages */
ib_int64_t* read_batch_len) /*!<out: length in int64_t* read_batch_len) /*!<out: length in
bytes of the next batch bytes of the next batch
of pages */ of pages */
{ {
ulint start_page_id;
const ulint page_size = ctxt->page_size;
start_page_id = (ulint)(ctxt->offset / page_size);
xb_a (ctxt->offset % page_size == 0);
if (start_page_id == ctxt->filter_batch_end) {
/* Used up all the previous bitmap range, get some more */
ulint next_page_id;
/* Find the next changed page using the bitmap */
next_page_id = xb_page_bitmap_range_get_next_bit
(ctxt->bitmap_range, TRUE);
if (next_page_id == ULINT_UNDEFINED) {
*read_batch_len = 0;
return;
}
ctxt->offset = next_page_id * page_size;
/* Find the end of the current changed page block by searching
for the next cleared bitmap bit */
ctxt->filter_batch_end
= xb_page_bitmap_range_get_next_bit(ctxt->bitmap_range,
FALSE);
xb_a(next_page_id < ctxt->filter_batch_end);
}
*read_batch_start = ctxt->offset; *read_batch_start = ctxt->offset;
if (ctxt->filter_batch_end == ULINT_UNDEFINED) {
/* No more cleared bits in the bitmap, need to copy all the
remaining pages. */
*read_batch_len = ctxt->data_file_size - ctxt->offset; *read_batch_len = ctxt->data_file_size - ctxt->offset;
} else {
*read_batch_len = ctxt->filter_batch_end * page_size
- ctxt->offset;
}
/* If the page block is larger than the buffer capacity, limit it to if (*read_batch_len > (int64_t)ctxt->buffer_capacity) {
buffer capacity. The subsequent invocations will continue returning
the current block in buffer-sized pieces until ctxt->filter_batch_end
is reached, trigerring the next bitmap query. */
if (*read_batch_len > (ib_int64_t)ctxt->buffer_capacity) {
*read_batch_len = ctxt->buffer_capacity; *read_batch_len = ctxt->buffer_capacity;
} }
ctxt->offset += *read_batch_len; ctxt->offset += *read_batch_len;
xb_a (ctxt->offset % page_size == 0);
xb_a (*read_batch_start % page_size == 0);
xb_a (*read_batch_len % page_size == 0);
}
/****************************************************************//**
Deinitialize the changed page bitmap-based read filter. */
static
void
rf_bitmap_deinit(
/*=============*/
xb_read_filt_ctxt_t* ctxt) /*!<in/out: read filter context */
{
xb_page_bitmap_range_deinit(ctxt->bitmap_range);
} }
/* The pass-through read filter */ /* The pass-through read filter */
xb_read_filt_t rf_pass_through = { xb_read_filt_t rf_pass_through = {
&rf_pass_through_init, &rf_pass_through_init,
&rf_pass_through_get_next_batch, &rf_pass_through_get_next_batch,
&rf_pass_through_deinit
};
/* The changed page bitmap-based read filter */
xb_read_filt_t rf_bitmap = {
&rf_bitmap_init,
&rf_bitmap_get_next_batch,
&rf_bitmap_deinit
}; };
...@@ -25,42 +25,27 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA ...@@ -25,42 +25,27 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#ifndef XB_READ_FILT_H #ifndef XB_READ_FILT_H
#define XB_READ_FILT_H #define XB_READ_FILT_H
#include "changed_page_bitmap.h" #include <cstdint>
#include <cstddef>
typedef ulint space_id_t;
struct xb_fil_cur_t; struct xb_fil_cur_t;
/* The read filter context */ /* The read filter context */
struct xb_read_filt_ctxt_t { struct xb_read_filt_ctxt_t {
ib_int64_t offset; /*!< current file offset */ int64_t offset; /*!< current file offset */
ib_int64_t data_file_size; /*!< data file size */ int64_t data_file_size; /*!< data file size */
size_t buffer_capacity;/*!< read buffer capacity */ size_t buffer_capacity;/*!< read buffer capacity */
space_id_t space_id; /*!< space id */
/* The following fields used only in bitmap filter */
/* Move these to union if any other filters are added in future */
xb_page_bitmap_range *bitmap_range; /*!< changed page bitmap range
iterator for space_id */
ulint page_size; /*!< page size */
ulint filter_batch_end;/*!< the ending page id of the
current changed page block in
the bitmap */
/** TODO: remove this default constructor */
xb_read_filt_ctxt_t() : page_size(0) {}
}; };
/* The read filter */ /* The read filter */
struct xb_read_filt_t { struct xb_read_filt_t {
void (*init)(xb_read_filt_ctxt_t* ctxt, void (*init)(xb_read_filt_ctxt_t* ctxt,
const xb_fil_cur_t* cursor, const xb_fil_cur_t* cursor);
ulint space_id);
void (*get_next_batch)(xb_read_filt_ctxt_t* ctxt, void (*get_next_batch)(xb_read_filt_ctxt_t* ctxt,
ib_int64_t* read_batch_start, int64_t* read_batch_start,
ib_int64_t* read_batch_len); int64_t* read_batch_len);
void (*deinit)(xb_read_filt_ctxt_t* ctxt);
}; };
extern xb_read_filt_t rf_pass_through; extern xb_read_filt_t rf_pass_through;
extern xb_read_filt_t rf_bitmap;
#endif #endif
...@@ -101,7 +101,6 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA ...@@ -101,7 +101,6 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "ds_buffer.h" #include "ds_buffer.h"
#include "ds_tmpfile.h" #include "ds_tmpfile.h"
#include "xbstream.h" #include "xbstream.h"
#include "changed_page_bitmap.h"
#include "read_filt.h" #include "read_filt.h"
#include "backup_wsrep.h" #include "backup_wsrep.h"
#include "innobackupex.h" #include "innobackupex.h"
...@@ -155,7 +154,6 @@ char *xtrabackup_incremental; ...@@ -155,7 +154,6 @@ char *xtrabackup_incremental;
lsn_t incremental_lsn; lsn_t incremental_lsn;
lsn_t incremental_to_lsn; lsn_t incremental_to_lsn;
lsn_t incremental_last_lsn; lsn_t incremental_last_lsn;
xb_page_bitmap *changed_page_bitmap;
char *xtrabackup_incremental_basedir; /* for --backup */ char *xtrabackup_incremental_basedir; /* for --backup */
char *xtrabackup_extra_lsndir; /* for --backup with --extra-lsndir */ char *xtrabackup_extra_lsndir; /* for --backup with --extra-lsndir */
...@@ -424,6 +422,7 @@ char orig_argv1[FN_REFLEN]; ...@@ -424,6 +422,7 @@ char orig_argv1[FN_REFLEN];
pthread_mutex_t backup_mutex; pthread_mutex_t backup_mutex;
pthread_cond_t scanned_lsn_cond; pthread_cond_t scanned_lsn_cond;
typedef decltype(fil_space_t::id) space_id_t;
typedef std::map<space_id_t,std::string> space_id_to_name_t; typedef std::map<space_id_t,std::string> space_id_to_name_t;
struct ddl_tracker_t { struct ddl_tracker_t {
...@@ -2855,12 +2854,7 @@ static my_bool xtrabackup_copy_datafile(ds_ctxt *ds_data, ...@@ -2855,12 +2854,7 @@ static my_bool xtrabackup_copy_datafile(ds_ctxt *ds_data,
goto skip; goto skip;
} }
if (!changed_page_bitmap) {
read_filter = &rf_pass_through; read_filter = &rf_pass_through;
}
else {
read_filter = &rf_bitmap;
}
res = xb_fil_cur_open(&cursor, read_filter, node, thread_n, ULLONG_MAX); res = xb_fil_cur_open(&cursor, read_filter, node, thread_n, ULLONG_MAX);
if (res == XB_FIL_CUR_SKIP) { if (res == XB_FIL_CUR_SKIP) {
...@@ -4788,11 +4782,6 @@ static bool xtrabackup_backup_func() ...@@ -4788,11 +4782,6 @@ static bool xtrabackup_backup_func()
log_copying_stop = os_event_create(0); log_copying_stop = os_event_create(0);
os_thread_create(log_copying_thread); os_thread_create(log_copying_thread);
/* FLUSH CHANGED_PAGE_BITMAPS call */
if (!flush_changed_page_bitmaps()) {
goto fail;
}
ut_a(xtrabackup_parallel > 0); ut_a(xtrabackup_parallel > 0);
if (xtrabackup_parallel > 1) { if (xtrabackup_parallel > 1) {
...@@ -4876,9 +4865,6 @@ static bool xtrabackup_backup_func() ...@@ -4876,9 +4865,6 @@ static bool xtrabackup_backup_func()
goto fail; goto fail;
} }
if (changed_page_bitmap) {
xb_page_bitmap_deinit(changed_page_bitmap);
}
backup_datasinks.destroy(); backup_datasinks.destroy();
msg("Redo log (from LSN " LSN_PF " to " LSN_PF msg("Redo log (from LSN " LSN_PF " to " LSN_PF
......
...@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA ...@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <my_getopt.h> #include <my_getopt.h>
#include "datasink.h" #include "datasink.h"
#include "xbstream.h" #include "xbstream.h"
#include "changed_page_bitmap.h" #include "fil0fil.h"
#include <set> #include <set>
#define XB_TOOL_NAME "mariadb-backup" #define XB_TOOL_NAME "mariadb-backup"
...@@ -86,8 +86,6 @@ extern uint opt_protocol; ...@@ -86,8 +86,6 @@ extern uint opt_protocol;
/* The last checkpoint LSN at the backup startup time */ /* The last checkpoint LSN at the backup startup time */
extern lsn_t checkpoint_lsn_start; extern lsn_t checkpoint_lsn_start;
extern xb_page_bitmap *changed_page_bitmap;
extern char *xtrabackup_incremental; extern char *xtrabackup_incremental;
extern my_bool xtrabackup_incremental_force_scan; extern my_bool xtrabackup_incremental_force_scan;
......
--innodb --loose-changed_page_bitmaps --innodb-sys-tables --innodb-flush-log-at-trx-commit=2 --sequence --innodb --innodb-sys-tables --innodb-flush-log-at-trx-commit=2 --sequence
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