summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/log0log.ic
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-12-22 17:06:50 +0100
committerSergei Golubchik <sergii@pisem.net>2013-12-22 17:06:50 +0100
commitffa8c4cfcc41d4f160e3bdfca5cfd4b01a7d6e63 (patch)
tree728585c36f22a5db3cea796430883d0ebc5c05eb /storage/xtradb/include/log0log.ic
parente27c34f9e4ca15c797fcd3191ee5679c2f237a09 (diff)
parent52c26f7a1f675185d2ef1a28aca7f9bcc67c6414 (diff)
downloadmariadb-git-ffa8c4cfcc41d4f160e3bdfca5cfd4b01a7d6e63.tar.gz
Percona-Server-5.6.14-rel62.0 merge
support ha_innodb.so as a dynamic plugin. * remove obsolete *,innodb_plugin.rdiff files * s/--plugin-load=/--plugin-load-add=/ * MYSQL_PLUGIN_IMPORT glob_hostname[] * use my_error instead of push_warning_printf(ER_DEFAULT) * don't use tdc_size and tc_size in a module update test cases (XtraDB is 5.6.14, InnoDB is 5.6.10) * copy new tests over * disable some tests for (old) InnoDB * delete XtraDB tests that no longer apply small compatibility changes: * s/HTON_EXTENDED_KEYS/HTON_SUPPORTS_EXTENDED_KEYS/ * revert unnecessary InnoDB changes to make it a bit closer to the upstream fix XtraDB to compile on Windows (both as a static and a dynamic plugin) disable XtraDB on Windows (deadlocks) and where no atomic ops are available (e.g. CentOS 5) storage/innobase/handler/ha_innodb.cc: revert few unnecessary changes to make it a bit closer to the original InnoDB storage/innobase/include/univ.i: correct the version to match what it was merged from
Diffstat (limited to 'storage/xtradb/include/log0log.ic')
-rw-r--r--storage/xtradb/include/log0log.ic81
1 files changed, 67 insertions, 14 deletions
diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic
index 0088df41225..7724d94b51a 100644
--- a/storage/xtradb/include/log0log.ic
+++ b/storage/xtradb/include/log0log.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Oracle and/or its affiliates. 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
@@ -11,8 +11,8 @@ 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -26,6 +26,9 @@ Created 12/9/1995 Heikki Tuuri
#include "os0file.h"
#include "mach0data.h"
#include "mtr0mtr.h"
+#include "srv0mon.h"
+#include "srv0srv.h"
+#include "ut0crc32.h"
#ifdef UNIV_LOG_DEBUG
/******************************************************//**
@@ -192,13 +195,13 @@ UNIV_INLINE
ulint
log_block_convert_lsn_to_no(
/*========================*/
- ib_uint64_t lsn) /*!< in: lsn of a byte within the block */
+ lsn_t lsn) /*!< in: lsn of a byte within the block */
{
return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) & 0x3FFFFFFFUL) + 1);
}
/************************************************************//**
-Calculates the checksum for a log block.
+Calculates the checksum for a log block using the current algorithm.
@return checksum */
UNIV_INLINE
ulint
@@ -206,6 +209,17 @@ log_block_calc_checksum(
/*====================*/
const byte* block) /*!< in: log block */
{
+ return(log_checksum_algorithm_ptr(block));
+}
+/************************************************************//**
+Calculates the checksum for a log block using the default InnoDB algorithm.
+@return checksum */
+UNIV_INLINE
+ulint
+log_block_calc_checksum_innodb(
+/*===========================*/
+ const byte* block) /*!< in: log block */
+{
ulint sum;
ulint sh;
ulint i;
@@ -228,6 +242,30 @@ log_block_calc_checksum(
}
/************************************************************//**
+Calculates the checksum for a log block using the CRC32 algorithm.
+@return checksum */
+UNIV_INLINE
+ulint
+log_block_calc_checksum_crc32(
+/*==========================*/
+ const byte* block) /*!< in: log block */
+{
+ return(ut_crc32(block, OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE));
+}
+
+/************************************************************//**
+Calculates the checksum for a log block using the "no-op" algorithm.
+@return checksum */
+UNIV_INLINE
+ulint
+log_block_calc_checksum_none(
+/*=========================*/
+ const byte* block) /*!< in: log block */
+{
+ return(LOG_NO_CHECKSUM_MAGIC);
+}
+
+/************************************************************//**
Gets a log block checksum field value.
@return checksum */
UNIV_INLINE
@@ -260,8 +298,8 @@ UNIV_INLINE
void
log_block_init(
/*===========*/
- byte* log_block, /*!< in: pointer to the log buffer */
- ib_uint64_t lsn) /*!< in: lsn within the log block */
+ byte* log_block, /*!< in: pointer to the log buffer */
+ lsn_t lsn) /*!< in: lsn within the log block */
{
ulint no;
@@ -282,8 +320,8 @@ UNIV_INLINE
void
log_block_init_in_old_format(
/*=========================*/
- byte* log_block, /*!< in: pointer to the log buffer */
- ib_uint64_t lsn) /*!< in: lsn within the log block */
+ byte* log_block, /*!< in: pointer to the log buffer */
+ lsn_t lsn) /*!< in: lsn within the log block */
{
ulint no;
@@ -304,12 +342,12 @@ Writes to the log the string given. The log must be released with
log_release.
@return end lsn of the log record, zero if did not succeed */
UNIV_INLINE
-ib_uint64_t
+lsn_t
log_reserve_and_write_fast(
/*=======================*/
const void* str, /*!< in: string */
ulint len, /*!< in: string length */
- ib_uint64_t* start_lsn)/*!< out: start lsn of the log record */
+ lsn_t* start_lsn)/*!< out: start lsn of the log record */
{
ulint data_len;
#ifdef UNIV_LOG_LSN_DEBUG
@@ -374,6 +412,9 @@ log_reserve_and_write_fast(
log_sys->lsn += len;
+ MONITOR_SET(MONITOR_LSN_CHECKPOINT_AGE,
+ log_sys->lsn - log_sys->last_checkpoint_lsn);
+
#ifdef UNIV_LOG_DEBUG
log_check_log_recs(log_sys->buf + log_sys->old_buf_free,
log_sys->buf_free - log_sys->old_buf_free,
@@ -411,11 +452,11 @@ log_release(void)
Gets the current lsn.
@return current lsn */
UNIV_INLINE
-ib_uint64_t
+lsn_t
log_get_lsn(void)
/*=============*/
{
- ib_uint64_t lsn;
+ lsn_t lsn;
mutex_enter(&(log_sys->mutex));
@@ -450,13 +491,25 @@ Gets the log group capacity. It is OK to read the value without
holding log_sys->mutex because it is constant.
@return log group capacity */
UNIV_INLINE
-ulint
+lsn_t
log_get_capacity(void)
/*==================*/
{
return(log_sys->log_group_capacity);
}
+/****************************************************************
+Get log_sys::max_modified_age_async. It is OK to read the value without
+holding log_sys::mutex because it is constant.
+@return max_modified_age_async */
+UNIV_INLINE
+lsn_t
+log_get_max_modified_age_async(void)
+/*================================*/
+{
+ return(log_sys->max_modified_age_async);
+}
+
/***********************************************************************//**
Checks if there is need for a log buffer flush or a new checkpoint, and does
this if yes. Any database operation should call this when it has modified