You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.3 KiB

20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
  1. /*****************************************************************************
  2. Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free Software
  5. Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along with
  10. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  11. Place, Suite 330, Boston, MA 02111-1307 USA
  12. *****************************************************************************/
  13. /**************************************************//**
  14. @file include/trx0rec.ic
  15. Transaction undo log record
  16. Created 3/26/1996 Heikki Tuuri
  17. *******************************************************/
  18. #ifndef UNIV_HOTBACKUP
  19. /**********************************************************************//**
  20. Reads from an undo log record the record type.
  21. @return record type */
  22. UNIV_INLINE
  23. ulint
  24. trx_undo_rec_get_type(
  25. /*==================*/
  26. const trx_undo_rec_t* undo_rec) /*!< in: undo log record */
  27. {
  28. return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1));
  29. }
  30. /**********************************************************************//**
  31. Reads from an undo log record the record compiler info.
  32. @return compiler info */
  33. UNIV_INLINE
  34. ulint
  35. trx_undo_rec_get_cmpl_info(
  36. /*=======================*/
  37. const trx_undo_rec_t* undo_rec) /*!< in: undo log record */
  38. {
  39. return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT);
  40. }
  41. /**********************************************************************//**
  42. Returns TRUE if an undo log record contains an extern storage field.
  43. @return TRUE if extern */
  44. UNIV_INLINE
  45. ibool
  46. trx_undo_rec_get_extern_storage(
  47. /*============================*/
  48. const trx_undo_rec_t* undo_rec) /*!< in: undo log record */
  49. {
  50. if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) {
  51. return(TRUE);
  52. }
  53. return(FALSE);
  54. }
  55. /**********************************************************************//**
  56. Reads the undo log record number.
  57. @return undo no */
  58. UNIV_INLINE
  59. undo_no_t
  60. trx_undo_rec_get_undo_no(
  61. /*=====================*/
  62. const trx_undo_rec_t* undo_rec) /*!< in: undo log record */
  63. {
  64. const byte* ptr;
  65. ptr = undo_rec + 3;
  66. return(mach_dulint_read_much_compressed(ptr));
  67. }
  68. /**********************************************************************//**
  69. Returns the start of the undo record data area.
  70. @return offset to the data area */
  71. UNIV_INLINE
  72. ulint
  73. trx_undo_rec_get_offset(
  74. /*====================*/
  75. undo_no_t undo_no) /*!< in: undo no read from node */
  76. {
  77. return (3 + mach_dulint_get_much_compressed_size(undo_no));
  78. }
  79. /***********************************************************************//**
  80. Copies the undo record to the heap.
  81. @return own: copy of undo log record */
  82. UNIV_INLINE
  83. trx_undo_rec_t*
  84. trx_undo_rec_copy(
  85. /*==============*/
  86. const trx_undo_rec_t* undo_rec, /*!< in: undo log record */
  87. mem_heap_t* heap) /*!< in: heap where copied */
  88. {
  89. ulint len;
  90. len = mach_read_from_2(undo_rec)
  91. - ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
  92. return(mem_heap_dup(heap, undo_rec, len));
  93. }
  94. #endif /* !UNIV_HOTBACKUP */