1/***************************************************************************** 2 3Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. 4 5This program is free software; you can redistribute it and/or modify 6it under the terms of the GNU General Public License, version 2.0, 7as published by the Free Software Foundation. 8 9This program is also distributed with certain software (including 10but not limited to OpenSSL) that is licensed under separate terms, 11as designated in a particular file or component or in included license 12documentation. The authors of MySQL hereby grant you an additional 13permission to link the program and your derivative works with the 14separately licensed software that they have included with MySQL. 15 16This program is distributed in the hope that it will be useful, 17but WITHOUT ANY WARRANTY; without even the implied warranty of 18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19GNU General Public License, version 2.0, for more details. 20 21You should have received a copy of the GNU General Public License along with 22this program; if not, write to the Free Software Foundation, Inc., 2351 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25*****************************************************************************/ 26 27/**************************************************//** 28@file include/trx0rec.ic 29Transaction undo log record 30 31Created 3/26/1996 Heikki Tuuri 32*******************************************************/ 33 34#ifndef UNIV_HOTBACKUP 35/**********************************************************************//** 36Reads from an undo log record the record type. 37@return record type */ 38UNIV_INLINE 39ulint 40trx_undo_rec_get_type( 41/*==================*/ 42 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 43{ 44 return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1)); 45} 46 47/**********************************************************************//** 48Reads from an undo log record the record compiler info. 49@return compiler info */ 50UNIV_INLINE 51ulint 52trx_undo_rec_get_cmpl_info( 53/*=======================*/ 54 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 55{ 56 return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT); 57} 58 59/**********************************************************************//** 60Returns TRUE if an undo log record contains an extern storage field. 61@return TRUE if extern */ 62UNIV_INLINE 63ibool 64trx_undo_rec_get_extern_storage( 65/*============================*/ 66 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 67{ 68 if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) { 69 70 return(TRUE); 71 } 72 73 return(FALSE); 74} 75 76/**********************************************************************//** 77Reads the undo log record number. 78@return undo no */ 79UNIV_INLINE 80undo_no_t 81trx_undo_rec_get_undo_no( 82/*=====================*/ 83 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 84{ 85 const byte* ptr; 86 87 ptr = undo_rec + 3; 88 89 return(mach_ull_read_much_compressed(ptr)); 90} 91 92/**********************************************************************//** 93Returns the start of the undo record data area. 94@return offset to the data area */ 95UNIV_INLINE 96ulint 97trx_undo_rec_get_offset( 98/*====================*/ 99 undo_no_t undo_no) /*!< in: undo no read from node */ 100{ 101 return(3 + mach_ull_get_much_compressed_size(undo_no)); 102} 103 104/***********************************************************************//** 105Copies the undo record to the heap. 106@return own: copy of undo log record */ 107UNIV_INLINE 108trx_undo_rec_t* 109trx_undo_rec_copy( 110/*==============*/ 111 const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ 112 mem_heap_t* heap) /*!< in: heap where copied */ 113{ 114 ulint len; 115 116 len = mach_read_from_2(undo_rec) 117 - ut_align_offset(undo_rec, UNIV_PAGE_SIZE); 118 ut_ad(len < UNIV_PAGE_SIZE); 119 return((trx_undo_rec_t*) mem_heap_dup(heap, undo_rec, len)); 120} 121#endif /* !UNIV_HOTBACKUP */ 122