~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/innobase/log/log0recv.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "trx0undo.h"
43
43
#include "trx0rec.h"
44
44
#include "fil0fil.h"
 
45
#include "xtrabackup_api.h"
45
46
#ifndef UNIV_HOTBACKUP
46
47
# include "buf0rea.h"
47
48
# include "srv0srv.h"
57
58
UNIV_INTERN ibool       recv_replay_file_ops    = TRUE;
58
59
#endif /* !UNIV_HOTBACKUP */
59
60
 
 
61
#include <boost/scoped_array.hpp>
 
62
 
60
63
#include <drizzled/errmsg_print.h>
61
64
 
62
65
/** Log records are stored in the hash table in chunks at most of this size;
623
626
/***********************************************************************//**
624
627
Checks the consistency of the checkpoint info
625
628
@return TRUE if ok */
626
 
static
627
629
ibool
628
630
recv_check_cp_is_consistent(
629
631
/*========================*/
653
655
/********************************************************//**
654
656
Looks for the maximum consistent checkpoint from the log groups.
655
657
@return error code or DB_SUCCESS */
656
 
static
657
658
ulint
658
659
recv_find_max_checkpoint(
659
660
/*=====================*/
703
704
 
704
705
                        group->lsn = mach_read_from_8(
705
706
                                buf + LOG_CHECKPOINT_LSN);
706
 
                        group->lsn_offset = mach_read_from_4(
707
 
                                buf + LOG_CHECKPOINT_OFFSET);
 
707
 
 
708
#ifdef UNIV_LOG_ARCHIVE
 
709
#error "UNIV_LOG_ARCHIVE could not be enabled"
 
710
#endif
 
711
                        {
 
712
                                ib_uint64_t tmp_lsn_offset = mach_read_from_8(
 
713
                                        buf + LOG_CHECKPOINT_ARCHIVED_LSN);
 
714
                                if (sizeof(ulint) != 4
 
715
                                    && tmp_lsn_offset != IB_ULONGLONG_MAX) {
 
716
                                        group->lsn_offset = (ulint) tmp_lsn_offset;
 
717
                        } else {
 
718
                                        group->lsn_offset = mach_read_from_4(
 
719
                                                buf + LOG_CHECKPOINT_OFFSET);
 
720
                                }
 
721
                        }
 
722
 
708
723
                        checkpoint_no = mach_read_from_8(
709
724
                                buf + LOG_CHECKPOINT_NO);
710
725
 
822
837
InnoDB-3.23.52 where the checksum field contains the log block number.
823
838
@return TRUE if ok, or if the log block may be in the format of InnoDB
824
839
version predating 3.23.52 */
825
 
static
826
840
ibool
827
841
log_block_checksum_is_ok_or_old_format(
828
842
/*===================================*/
2887
2901
        log_group_t*    max_cp_group;
2888
2902
        log_group_t*    up_to_date_group;
2889
2903
        ulint           max_cp_field;
 
2904
        ulint           log_hdr_log_block_size;
2890
2905
        ib_uint64_t     checkpoint_lsn;
2891
2906
        ib_uint64_t     checkpoint_no;
2892
2907
        ib_uint64_t     old_scanned_lsn;
2896
2911
        ib_uint64_t     archived_lsn;
2897
2912
#endif /* UNIV_LOG_ARCHIVE */
2898
2913
        byte*           buf;
2899
 
        byte            log_hdr_buf[LOG_FILE_HDR_SIZE];
 
2914
        boost::scoped_array<byte>       log_hdr_buf_base(
 
2915
                new byte[LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE]);
 
2916
        byte*           log_hdr_buf
 
2917
                = (byte *)ut_align(log_hdr_buf_base.get(), OS_FILE_LOG_BLOCK_SIZE);
2900
2918
        ulint           err;
2901
2919
 
2902
2920
#ifdef UNIV_LOG_ARCHIVE
2921
2939
          drizzled::errmsg_printf(drizzled::error::INFO,
2922
2940
                                  "InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on Skipping log redo.");
2923
2941
 
2924
 
                return(DB_SUCCESS);
 
2942
          return(DB_SUCCESS);
2925
2943
        }
2926
2944
 
2927
2945
        recv_recovery_on = TRUE;
2980
2998
                 log_hdr_buf, max_cp_group);
2981
2999
        }
2982
3000
 
 
3001
        log_hdr_log_block_size
 
3002
                = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE);
 
3003
        if (log_hdr_log_block_size == 0) {
 
3004
                /* 0 means default value */
 
3005
                log_hdr_log_block_size = 512;
 
3006
        }
 
3007
        if (log_hdr_log_block_size != srv_log_block_size) {
 
3008
                drizzled::errmsg_printf(drizzled::error::ERROR,
 
3009
                           "InnoDB: Error: The block size of ib_logfile (%lu) "
 
3010
                           "is not equal to innodb_log_block_size.\n"
 
3011
                           "InnoDB: Error: Suggestion - Recreate log files.\n",
 
3012
                           log_hdr_log_block_size);
 
3013
                return(DB_ERROR);
 
3014
        }
 
3015
 
2983
3016
#ifdef UNIV_LOG_ARCHIVE
2984
3017
        group = UT_LIST_GET_FIRST(log_sys->log_groups);
2985
3018
 
3260
3293
        that the data dictionary tables will be free of any locks.
3261
3294
        The data dictionary latch should guarantee that there is at
3262
3295
        most one data dictionary transaction active at a time. */
 
3296
        if (! srv_apply_log_only)
3263
3297
        trx_rollback_or_clean_recovered(FALSE);
3264
3298
}
3265
3299