summaryrefslogtreecommitdiff
path: root/storage/xtradb/include
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-10-16 10:36:28 +0200
committerSergei Golubchik <sergii@pisem.net>2012-10-16 10:36:28 +0200
commitd9a8799205d160688f81362356dd2323eb8a91ea (patch)
treea25584d7adfc190bb0312b6d10cdcb62e17a20d1 /storage/xtradb/include
parentabefaab57b4b884b74ff9bd3c63f86c018d0e5de (diff)
parent96d3a797eedfe9304cc6416c7d71c7e543695870 (diff)
downloadmariadb-git-d9a8799205d160688f81362356dd2323eb8a91ea.tar.gz
XtraDB 1.1.8-29.0
Diffstat (limited to 'storage/xtradb/include')
-rw-r--r--storage/xtradb/include/buf0lru.h11
-rw-r--r--storage/xtradb/include/log0log.h5
-rw-r--r--storage/xtradb/include/log0online.h111
-rw-r--r--storage/xtradb/include/log0recv.h37
-rw-r--r--storage/xtradb/include/os0file.h9
-rw-r--r--storage/xtradb/include/os0sync.h28
-rw-r--r--storage/xtradb/include/srv0srv.h23
-rw-r--r--storage/xtradb/include/univ.i2
-rw-r--r--storage/xtradb/include/ut0rbt.h22
9 files changed, 237 insertions, 11 deletions
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index c3672a65ed7..efaa758f27a 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -94,13 +94,12 @@ buf_LRU_insert_zip_clean(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns TRUE, it will temporarily
-release buf_pool->mutex. Furthermore, the page frame will no longer be
-accessible via bpage.
+NOTE: This will temporarily release buf_pool_mutex. Furthermore, the
+page frame will no longer be accessible via bpage.
-The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
-release these two mutexes after the call. No other
-buf_page_get_mutex() may be held when calling this function.
+The caller must hold buf_page_get_mutex(bpage) and release this mutex
+after the call. No other buf_page_get_mutex() may be held when
+calling this function.
@return TRUE if freed, FALSE otherwise. */
UNIV_INTERN
ibool
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 857ec0946c2..96c4b81695a 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -977,6 +977,11 @@ struct log_struct{
become signaled */
/* @} */
#endif /* UNIV_LOG_ARCHIVE */
+ ib_uint64_t tracked_lsn; /*!< log tracking has advanced to this
+ lsn. Field accessed atomically where
+ 64-bit atomic ops are supported,
+ protected by the log sys mutex
+ otherwise. */
};
/** Test if flush order mutex is owned. */
diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h
new file mode 100644
index 00000000000..0e0ca169f6f
--- /dev/null
+++ b/storage/xtradb/include/log0online.h
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+Copyright (c) 2011-2012, Percona Inc. All Rights Reserved.
+
+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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/**************************************************//**
+@file include/log0online.h
+Online database log parsing for changed page tracking
+*******************************************************/
+
+#ifndef log0online_h
+#define log0online_h
+
+#include "univ.i"
+#include "os0file.h"
+
+/*********************************************************************//**
+Initializes the online log following subsytem. */
+UNIV_INTERN
+void
+log_online_read_init();
+/*===================*/
+
+/*********************************************************************//**
+Shuts down the online log following subsystem. */
+UNIV_INTERN
+void
+log_online_read_shutdown();
+/*=======================*/
+
+/*********************************************************************//**
+Reads and parses the redo log up to last checkpoint LSN to build the changed
+page bitmap which is then written to disk. */
+UNIV_INTERN
+void
+log_online_follow_redo_log();
+/*=========================*/
+
+/** The iterator through all bits of changed pages bitmap blocks */
+struct log_bitmap_iterator_struct
+{
+ char in_name[FN_REFLEN]; /*!< the file name for bitmap
+ input */
+ os_file_t in; /*!< the bitmap input file */
+ ib_uint64_t in_offset; /*!< the next write position in the
+ bitmap output file */
+ ib_uint32_t bit_offset; /*!< bit offset inside of bitmap
+ block*/
+ ib_uint64_t start_lsn; /*!< Start lsn of the block */
+ ib_uint64_t end_lsn; /*!< End lsn of the block */
+ ib_uint32_t space_id; /*!< Block space id */
+ ib_uint32_t first_page_id; /*!< First block page id */
+ ibool changed; /*!< true if current page was changed */
+ byte* page; /*!< Bitmap block */
+};
+
+typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
+
+#define LOG_BITMAP_ITERATOR_START_LSN(i) \
+ ((i).start_lsn)
+#define LOG_BITMAP_ITERATOR_END_LSN(i) \
+ ((i).end_lsn)
+#define LOG_BITMAP_ITERATOR_SPACE_ID(i) \
+ ((i).space_id)
+#define LOG_BITMAP_ITERATOR_PAGE_NUM(i) \
+ ((i).first_page_id + (i).bit_offset)
+#define LOG_BITMAP_ITERATOR_PAGE_CHANGED(i) \
+ ((i).changed)
+
+/*********************************************************************//**
+Initializes log bitmap iterator.
+@return TRUE if the iterator is initialized OK, FALSE otherwise. */
+UNIV_INTERN
+ibool
+log_online_bitmap_iterator_init(
+/*============================*/
+ log_bitmap_iterator_t *i); /*!<in/out: iterator */
+
+/*********************************************************************//**
+Releases log bitmap iterator. */
+UNIV_INTERN
+void
+log_online_bitmap_iterator_release(
+/*===============================*/
+ log_bitmap_iterator_t *i); /*!<in/out: iterator */
+
+/*********************************************************************//**
+Iterates through bits of saved bitmap blocks.
+Sequentially reads blocks from bitmap file(s) and interates through
+their bits. Ignores blocks with wrong checksum.
+@return TRUE if iteration is successful, FALSE if all bits are iterated. */
+UNIV_INTERN
+ibool
+log_online_bitmap_iterator_next(
+/*============================*/
+ log_bitmap_iterator_t *i); /*!<in/out: iterator */
+
+#endif
diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h
index 15065267250..fdffd86e4c4 100644
--- a/storage/xtradb/include/log0recv.h
+++ b/storage/xtradb/include/log0recv.h
@@ -32,6 +32,28 @@ Created 9/20/1997 Heikki Tuuri
#include "hash0hash.h"
#include "log0log.h"
+/******************************************************//**
+Checks the 4-byte checksum to the trailer checksum field of a log
+block. We also accept a log block in the old format before
+InnoDB-3.23.52 where the checksum field contains the log block number.
+@return TRUE if ok, or if the log block may be in the format of InnoDB
+version predating 3.23.52 */
+UNIV_INTERN
+ibool
+log_block_checksum_is_ok_or_old_format(
+/*===================================*/
+ const byte* block); /*!< in: pointer to a log block */
+
+/*******************************************************//**
+Calculates the new value for lsn when more data is added to the log. */
+UNIV_INTERN
+ib_uint64_t
+recv_calc_lsn_on_data_add(
+/*======================*/
+ ib_uint64_t lsn, /*!< in: old lsn */
+ ib_uint64_t len); /*!< in: this many bytes of data is
+ added, log block headers not included */
+
#ifdef UNIV_HOTBACKUP
extern ibool recv_replay_file_ops;
@@ -182,6 +204,21 @@ UNIV_INTERN
void
recv_recovery_rollback_active(void);
/*===============================*/
+
+/*******************************************************************//**
+Tries to parse a single log record and returns its length.
+@return length of the record, or 0 if the record was not complete */
+UNIV_INTERN
+ulint
+recv_parse_log_rec(
+/*===============*/
+ byte* ptr, /*!< in: pointer to a buffer */
+ byte* end_ptr,/*!< in: pointer to the buffer end */
+ byte* type, /*!< out: type */
+ ulint* space, /*!< out: space id */
+ ulint* page_no,/*!< out: page number */
+ byte** body); /*!< out: log record body start */
+
/*******************************************************//**
Scans log from a buffer and stores new log data to the parsing buffer.
Parses and hashes the log records if new data found. Unless
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 5b1f9339845..4c795d93141 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -197,6 +197,7 @@ extern ulint srv_log_block_size;
extern mysql_pfs_key_t innodb_file_data_key;
extern mysql_pfs_key_t innodb_file_log_key;
extern mysql_pfs_key_t innodb_file_temp_key;
+extern mysql_pfs_key_t innodb_file_bmp_key;
/* Following four macros are instumentations to register
various file I/O operations with performance schema.
@@ -867,6 +868,14 @@ os_file_set_eof(
/*============*/
FILE* file); /*!< in: file to be truncated */
/***********************************************************************//**
+Truncates a file at the specified position.
+@return TRUE if success */
+UNIV_INTERN
+ibool
+os_file_set_eof_at(
+ os_file_t file, /*!< in: handle to a file */
+ ib_uint64_t new_len);/*!< in: new file length */
+/***********************************************************************//**
NOTE! Use the corresponding macro os_file_flush(), not directly this function!
Flushes the write buffers of a given file to the disk.
@return TRUE if success */
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index 6a99c60226b..887a40c64ea 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -265,7 +265,11 @@ Atomic compare-and-swap and increment for InnoDB. */
#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
-#define HAVE_ATOMIC_BUILTINS
+# define HAVE_ATOMIC_BUILTINS
+
+# ifdef HAVE_IB_GCC_ATOMIC_BUILTINS_64
+# define HAVE_ATOMIC_BUILTINS_64
+# endif
/**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to
@@ -304,6 +308,9 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
os_atomic_increment(ptr, amount)
+# define os_atomic_increment_uint64(ptr, amount) \
+ os_atomic_increment(ptr, amount)
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
@@ -312,12 +319,13 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
#elif defined(HAVE_IB_SOLARIS_ATOMICS)
-#define HAVE_ATOMIC_BUILTINS
+# define HAVE_ATOMIC_BUILTINS
+# define HAVE_ATOMIC_BUILTINS_64
/* If not compiling with GCC or GCC doesn't support the atomic
intrinsics and running on Solaris >= 10 use Solaris atomics */
-#include <atomic.h>
+# include <atomic.h>
/**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to
@@ -357,6 +365,9 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
atomic_add_long_nv(ptr, amount)
+# define os_atomic_increment_uint64(ptr, amount) \
+ atomic_add_64_nv(ptr, amount)
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
@@ -365,7 +376,11 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
#elif defined(HAVE_WINDOWS_ATOMICS)
-#define HAVE_ATOMIC_BUILTINS
+# define HAVE_ATOMIC_BUILTINS
+
+# ifndef _WIN32
+# define HAVE_ATOMIC_BUILTINS_64
+# endif
/* On Windows, use Windows atomics / interlocked */
# ifdef _WIN64
@@ -403,6 +418,11 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
((ulint) (win_xchg_and_add(ptr, amount) + amount))
+# define os_atomic_increment_uint64(ptr, amount) \
+ ((ib_uint64_t) (InterlockedExchangeAdd64( \
+ (ib_int64_t*) ptr, \
+ (ib_int64_t) amount) + amount))
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val.
InterlockedExchange() operates on LONG, and the LONG will be
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index a40683e00f1..b8820f1b7c9 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -69,6 +69,14 @@ extern os_event_t srv_error_event;
/* This event is set at shutdown to wakeup threads from sleep */
extern os_event_t srv_shutdown_event;
+/* This event is set on checkpoint completion to wake the redo log parser
+thread */
+extern os_event_t srv_checkpoint_completed_event;
+
+/* This event is set on the online redo log following thread exit to signal
+that the (slow) shutdown may proceed */
+extern os_event_t srv_redo_log_thread_finished_event;
+
/* If the last data file is auto-extended, we add this many pages to it
at a time */
#define SRV_AUTO_EXTEND_INCREMENT \
@@ -136,6 +144,11 @@ extern char* srv_doublewrite_file;
extern ibool srv_recovery_stats;
+extern my_bool srv_track_changed_pages;
+
+extern
+ulonglong srv_changed_pages_limit;
+
extern ibool srv_auto_extend_last_data_file;
extern ulint srv_last_file_size_max;
extern char** srv_log_group_home_dirs;
@@ -402,6 +415,7 @@ extern mysql_pfs_key_t srv_error_monitor_thread_key;
extern mysql_pfs_key_t srv_monitor_thread_key;
extern mysql_pfs_key_t srv_master_thread_key;
extern mysql_pfs_key_t srv_purge_thread_key;
+extern mysql_pfs_key_t srv_log_tracking_thread_key;
/* This macro register the current thread and its key with performance
schema */
@@ -697,6 +711,15 @@ srv_LRU_dump_restore_thread(
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/******************************************************************//**
+A thread which follows the redo log and outputs the changed page bitmap.
+@return a dummy value */
+UNIV_INTERN
+os_thread_ret_t
+srv_redo_log_follow_thread(
+/*=======================*/
+ void* arg); /*!< in: a dummy parameter required by
+ os_thread_create */
+/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@return FALSE if not all information printed
due to failure to obtain necessary mutex */
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index ce59a3f2741..9aee2a0c7f9 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -54,7 +54,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 8
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 28.1
+#define PERCONA_INNODB_VERSION 29.0
#endif
/* The following is the InnoDB version as shown in
diff --git a/storage/xtradb/include/ut0rbt.h b/storage/xtradb/include/ut0rbt.h
index e26b637ae13..cd9df1c1a3d 100644
--- a/storage/xtradb/include/ut0rbt.h
+++ b/storage/xtradb/include/ut0rbt.h
@@ -116,6 +116,10 @@ struct ib_rbt_bound_struct {
/* Compare a key with the node value (t is tree, k is key, n is node)*/
#define rbt_compare(t, k, n) (t->compare(k, n->value))
+/* Node size. FIXME: name might clash, but currently it does not, so for easier
+ maintenance do not rename it for now. */
+#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
+
/**********************************************************************//**
Free an instance of a red black tree */
UNIV_INTERN
@@ -187,6 +191,17 @@ rbt_add_node(
ib_rbt_bound_t* parent, /*!< in: parent */
const void* value); /*!< in: this value is copied
to the node */
+/****************************************************************//**
+Add a new caller-provided node to tree at the specified position.
+The node must have its key fields initialized correctly.
+@return added node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_add_preallocated_node(
+/*======================*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: parent */
+ ib_rbt_node_t* node); /*!< in: node */
/**********************************************************************//**
Return the left most data node in the tree
@return left most node */
@@ -273,6 +288,13 @@ void
rbt_clear(
/*======*/
ib_rbt_t* tree); /*!< in: rb tree */
+/****************************************************************//**
+Clear the tree without deleting and freeing its nodes. */
+UNIV_INTERN
+void
+rbt_reset(
+/*======*/
+ ib_rbt_t* tree); /*!< in: rb tree */
/**********************************************************************//**
Merge the node from dst into src. Return the number of nodes merged.
@return no. of recs merged */