1
1
/*****************************************************************************
3
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4
Copyright (C) 2009 Google Inc.
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
18
/*****************************************************************************
20
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
21
Copyright (c) 2009, Google Inc.
6
23
Portions of this file contain modifications contributed and copyrighted by
7
24
Google, Inc. Those modifications are gratefully acknowledged and are described
102
119
log_reserve_and_write_fast(
103
120
/*=======================*/
104
const void* str, /*!< in: string */
121
byte* str, /*!< in: string */
105
122
ulint len, /*!< in: string length */
106
ib_uint64_t* start_lsn);/*!< out: start lsn of the log record */
123
ib_uint64_t* start_lsn,/*!< out: start lsn of the log record */
124
ibool* success);/*!< out: TRUE if success */
107
125
/***********************************************************************//**
108
126
Releases the log mutex. */
556
574
log_refresh_stats(void);
557
575
/*===================*/
558
/**********************************************************
559
Shutdown the log system but do not release all the memory. */
564
/**********************************************************
565
Free the log system data structures. */
571
577
extern log_t* log_sys;
579
585
#define LOG_RECOVER 98887331
581
587
/* The counting of lsn's starts from this value: this must be non-zero */
582
#define LOG_START_LSN ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
588
#define LOG_START_LSN ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
584
590
#define LOG_BUFFER_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE)
585
591
#define LOG_ARCHIVE_BUF_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE / 4)
716
722
ulint lsn_offset; /*!< the offset of the above lsn */
717
723
ulint n_pending_writes;/*!< number of currently pending flush
718
724
writes for this log group */
719
byte** file_header_bufs_ptr;/*!< unaligned buffers */
720
725
byte** file_header_bufs;/*!< buffers for each file
721
726
header in the group */
722
#ifdef UNIV_LOG_ARCHIVE
723
727
/*-----------------------------*/
724
byte** archive_file_header_bufs_ptr;/*!< unaligned buffers */
725
728
byte** archive_file_header_bufs;/*!< buffers for each file
726
729
header in the group */
727
730
ulint archive_space_id;/*!< file space which
740
743
completion function then sets the new
741
744
value to ..._file_no */
742
745
ulint next_archived_offset; /*!< like the preceding field */
743
#endif /* UNIV_LOG_ARCHIVE */
744
746
/*-----------------------------*/
745
747
ib_uint64_t scanned_lsn; /*!< used only in recovery: recovery scan
746
748
succeeded up to this lsn in this log
748
byte* checkpoint_buf_ptr;/*!< unaligned checkpoint header */
749
750
byte* checkpoint_buf; /*!< checkpoint header is written from
750
751
this buffer to the group */
751
752
UT_LIST_NODE_T(log_group_t)
763
764
#ifndef UNIV_HOTBACKUP
764
765
mutex_t mutex; /*!< mutex protecting the log */
765
766
#endif /* !UNIV_HOTBACKUP */
767
mutex_t log_flush_order_mutex;/*!< mutex to serialize access to
768
the flush list when we are putting
769
dirty blocks in the list. The idea
770
behind this mutex is to be able
771
to release log_sys->mutex during
772
mtr_commit and still ensure that
773
insertions in the flush_list happen
775
byte* buf_ptr; /* unaligned log buffer */
776
767
byte* buf; /*!< log buffer */
777
768
ulint buf_size; /*!< log buffer size in bytes */
778
769
ulint max_buf_free; /*!< recommended maximum value of
817
808
written to some log group; for this to
818
809
be advanced, it is enough that the
819
810
write i/o has been completed for all
821
Note that since InnoDB currently
822
has only one log group therefore
823
this value is redundant. Also it
824
is possible that this value
826
flushed_to_disk_lsn transiently.
827
It is appropriate to use either
828
flushed_to_disk_lsn or
829
write_lsn which are always
830
up-to-date and accurate. */
831
812
ib_uint64_t write_lsn; /*!< end lsn for the current running
833
814
ulint write_end_offset;/*!< the data in buffer has
961
941
#endif /* UNIV_LOG_ARCHIVE */
964
/** Test if flush order mutex is owned. */
965
#define log_flush_order_mutex_own() \
966
mutex_own(&log_sys->log_flush_order_mutex)
968
/** Acquire the flush order mutex. */
969
#define log_flush_order_mutex_enter() do { \
970
mutex_enter(&log_sys->log_flush_order_mutex); \
972
/** Release the flush order mutex. */
973
# define log_flush_order_mutex_exit() do { \
974
mutex_exit(&log_sys->log_flush_order_mutex); \
977
944
#ifdef UNIV_LOG_ARCHIVE
978
945
/** Archiving state @{ */
979
946
#define LOG_ARCH_ON 71