1/***************************************************************************** 2 3Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. 4 5This program is free software; you can redistribute it and/or modify it under 6the terms of the GNU General Public License as published by the Free Software 7Foundation; version 2 of the License. 8 9This program is distributed in the hope that it will be useful, but WITHOUT 10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13You should have received a copy of the GNU General Public License along with 14this program; if not, write to the Free Software Foundation, Inc., 1551 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 16 17*****************************************************************************/ 18 19/**************************************************//** 20@file include/trx0rec.ic 21Transaction undo log record 22 23Created 3/26/1996 Heikki Tuuri 24*******************************************************/ 25 26/**********************************************************************//** 27Reads from an undo log record the record type. 28@return record type */ 29UNIV_INLINE 30ulint 31trx_undo_rec_get_type( 32/*==================*/ 33 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 34{ 35 return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1)); 36} 37 38/**********************************************************************//** 39Reads the undo log record number. 40@return undo no */ 41UNIV_INLINE 42undo_no_t 43trx_undo_rec_get_undo_no( 44/*=====================*/ 45 const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 46{ 47 const byte* ptr; 48 49 ptr = undo_rec + 3; 50 51 return(mach_u64_read_much_compressed(ptr)); 52} 53 54/***********************************************************************//** 55Copies the undo record to the heap. 56@return own: copy of undo log record */ 57UNIV_INLINE 58trx_undo_rec_t* 59trx_undo_rec_copy( 60/*==============*/ 61 const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ 62 mem_heap_t* heap) /*!< in: heap where copied */ 63{ 64 ulint len; 65 66 len = mach_read_from_2(undo_rec) 67 - ut_align_offset(undo_rec, srv_page_size); 68 ut_ad(len < srv_page_size); 69 trx_undo_rec_t* rec = static_cast<trx_undo_rec_t*>( 70 mem_heap_dup(heap, undo_rec, len)); 71 mach_write_to_2(rec, len); 72 return rec; 73} 74