~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/log0log.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
 
 
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.
8
 
 
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.
12
 
 
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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
/*****************************************************************************
19
 
 
20
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
21
 
Copyright (c) 2009, Google Inc.
 
3
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
 
4
Copyright (C) 2009 Google Inc.
22
5
 
23
6
Portions of this file contain modifications contributed and copyrighted by
24
7
Google, Inc. Those modifications are gratefully acknowledged and are described
35
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
36
19
 
37
20
You should have received a copy of the GNU General Public License along with
38
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
39
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
21
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
22
St, Fifth Floor, Boston, MA 02110-1301 USA
40
23
 
41
24
*****************************************************************************/
42
25
 
118
101
ib_uint64_t
119
102
log_reserve_and_write_fast(
120
103
/*=======================*/
121
 
        byte*           str,    /*!< in: string */
 
104
        const void*     str,    /*!< in: string */
122
105
        ulint           len,    /*!< in: string length */
123
 
        ib_uint64_t*    start_lsn,/*!< out: start lsn of the log record */
124
 
        ibool*          success);/*!< out: TRUE if success */
 
106
        ib_uint64_t*    start_lsn);/*!< out: start lsn of the log record */
125
107
/***********************************************************************//**
126
108
Releases the log mutex. */
127
109
UNIV_INLINE
573
555
void
574
556
log_refresh_stats(void);
575
557
/*===================*/
 
558
/**********************************************************
 
559
Shutdown the log system but do not release all the memory. */
 
560
UNIV_INTERN
 
561
void
 
562
log_shutdown(void);
 
563
/*==============*/
 
564
/**********************************************************
 
565
Free the log system data structures. */
 
566
UNIV_INTERN
 
567
void
 
568
log_mem_free(void);
 
569
/*==============*/
576
570
 
577
571
extern log_t*   log_sys;
578
572
 
585
579
#define LOG_RECOVER     98887331
586
580
 
587
581
/* The counting of lsn's starts from this value: this must be non-zero */
588
 
#define LOG_START_LSN   ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
 
582
#define LOG_START_LSN           ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
589
583
 
590
584
#define LOG_BUFFER_SIZE         (srv_log_buffer_size * UNIV_PAGE_SIZE)
591
585
#define LOG_ARCHIVE_BUF_SIZE    (srv_log_buffer_size * UNIV_PAGE_SIZE / 4)
722
716
        ulint           lsn_offset;     /*!< the offset of the above lsn */
723
717
        ulint           n_pending_writes;/*!< number of currently pending flush
724
718
                                        writes for this log group */
 
719
        byte**          file_header_bufs_ptr;/*!< unaligned buffers */
725
720
        byte**          file_header_bufs;/*!< buffers for each file
726
721
                                        header in the group */
 
722
#ifdef UNIV_LOG_ARCHIVE
727
723
        /*-----------------------------*/
 
724
        byte**          archive_file_header_bufs_ptr;/*!< unaligned buffers */
728
725
        byte**          archive_file_header_bufs;/*!< buffers for each file
729
726
                                        header in the group */
730
727
        ulint           archive_space_id;/*!< file space which
743
740
                                        completion function then sets the new
744
741
                                        value to ..._file_no */
745
742
        ulint           next_archived_offset; /*!< like the preceding field */
 
743
#endif /* UNIV_LOG_ARCHIVE */
746
744
        /*-----------------------------*/
747
745
        ib_uint64_t     scanned_lsn;    /*!< used only in recovery: recovery scan
748
746
                                        succeeded up to this lsn in this log
749
747
                                        group */
 
748
        byte*           checkpoint_buf_ptr;/*!< unaligned checkpoint header */
750
749
        byte*           checkpoint_buf; /*!< checkpoint header is written from
751
750
                                        this buffer to the group */
752
751
        UT_LIST_NODE_T(log_group_t)
764
763
#ifndef UNIV_HOTBACKUP
765
764
        mutex_t         mutex;          /*!< mutex protecting the log */
766
765
#endif /* !UNIV_HOTBACKUP */
 
766
 
 
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
 
774
                                        in the LSN order. */
 
775
        byte*           buf_ptr;        /* unaligned log buffer */
767
776
        byte*           buf;            /*!< log buffer */
768
777
        ulint           buf_size;       /*!< log buffer size in bytes */
769
778
        ulint           max_buf_free;   /*!< recommended maximum value of
808
817
                                        written to some log group; for this to
809
818
                                        be advanced, it is enough that the
810
819
                                        write i/o has been completed for all
811
 
                                        log groups */
 
820
                                        log groups.
 
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
 
825
                                        falls behind the
 
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. */
812
831
        ib_uint64_t     write_lsn;      /*!< end lsn for the current running
813
832
                                        write */
814
833
        ulint           write_end_offset;/*!< the data in buffer has
900
919
                                        should wait for this without owning
901
920
                                        the log mutex */
902
921
#endif /* !UNIV_HOTBACKUP */
 
922
        byte*           checkpoint_buf_ptr;/* unaligned checkpoint header */
903
923
        byte*           checkpoint_buf; /*!< checkpoint header is read to this
904
924
                                        buffer */
905
925
        /* @} */
941
961
#endif /* UNIV_LOG_ARCHIVE */
942
962
};
943
963
 
 
964
/** Test if flush order mutex is owned. */
 
965
#define log_flush_order_mutex_own()     \
 
966
        mutex_own(&log_sys->log_flush_order_mutex)
 
967
 
 
968
/** Acquire the flush order mutex. */
 
969
#define log_flush_order_mutex_enter() do {              \
 
970
        mutex_enter(&log_sys->log_flush_order_mutex);   \
 
971
} while (0)
 
972
/** Release the flush order mutex. */
 
973
# define log_flush_order_mutex_exit() do {              \
 
974
        mutex_exit(&log_sys->log_flush_order_mutex);    \
 
975
} while (0)
 
976
 
944
977
#ifdef UNIV_LOG_ARCHIVE
945
978
/** Archiving state @{ */
946
979
#define LOG_ARCH_ON             71