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.

126 lines
4.8 KiB

20 years ago
20 years ago
20 years ago
20 years ago
  1. /******************************************************
  2. Row versions
  3. (c) 1997 Innobase Oy
  4. Created 2/6/1997 Heikki Tuuri
  5. *******************************************************/
  6. #ifndef row0vers_h
  7. #define row0vers_h
  8. #include "univ.i"
  9. #include "data0data.h"
  10. #include "dict0types.h"
  11. #include "trx0types.h"
  12. #include "que0types.h"
  13. #include "rem0types.h"
  14. #include "mtr0mtr.h"
  15. #include "read0types.h"
  16. /*********************************************************************
  17. Finds out if an active transaction has inserted or modified a secondary
  18. index record. NOTE: the kernel mutex is temporarily released in this
  19. function! */
  20. trx_t*
  21. row_vers_impl_x_locked_off_kernel(
  22. /*==============================*/
  23. /* out: NULL if committed, else the active
  24. transaction; NOTE that the kernel mutex is
  25. temporarily released! */
  26. const rec_t* rec, /* in: record in a secondary index */
  27. dict_index_t* index, /* in: the secondary index */
  28. const ulint* offsets);/* in: rec_get_offsets(rec, index) */
  29. /*********************************************************************
  30. Finds out if we must preserve a delete marked earlier version of a clustered
  31. index record, because it is >= the purge view. */
  32. ibool
  33. row_vers_must_preserve_del_marked(
  34. /*==============================*/
  35. /* out: TRUE if earlier version should be preserved */
  36. dulint trx_id, /* in: transaction id in the version */
  37. mtr_t* mtr); /* in: mtr holding the latch on the clustered index
  38. record; it will also hold the latch on purge_view */
  39. /*********************************************************************
  40. Finds out if a version of the record, where the version >= the current
  41. purge view, should have ientry as its secondary index entry. We check
  42. if there is any not delete marked version of the record where the trx
  43. id >= purge view, and the secondary index entry == ientry; exactly in
  44. this case we return TRUE. */
  45. ibool
  46. row_vers_old_has_index_entry(
  47. /*=========================*/
  48. /* out: TRUE if earlier version should have */
  49. ibool also_curr,/* in: TRUE if also rec is included in the
  50. versions to search; otherwise only versions
  51. prior to it are searched */
  52. rec_t* rec, /* in: record in the clustered index; the
  53. caller must have a latch on the page */
  54. mtr_t* mtr, /* in: mtr holding the latch on rec; it will
  55. also hold the latch on purge_view */
  56. dict_index_t* index, /* in: the secondary index */
  57. const dtuple_t* ientry);/* in: the secondary index entry */
  58. /*********************************************************************
  59. Constructs the version of a clustered index record which a consistent
  60. read should see. We assume that the trx id stored in rec is such that
  61. the consistent read should not see rec in its present version. */
  62. ulint
  63. row_vers_build_for_consistent_read(
  64. /*===============================*/
  65. /* out: DB_SUCCESS or DB_MISSING_HISTORY */
  66. rec_t* rec, /* in: record in a clustered index; the
  67. caller must have a latch on the page; this
  68. latch locks the top of the stack of versions
  69. of this records */
  70. mtr_t* mtr, /* in: mtr holding the latch on rec; it will
  71. also hold the latch on purge_view */
  72. dict_index_t* index, /* in: the clustered index */
  73. ulint** offsets,/* in/out: offsets returned by
  74. rec_get_offsets(rec, index) */
  75. read_view_t* view, /* in: the consistent read view */
  76. mem_heap_t** offset_heap,/* in/out: memory heap from which
  77. the offsets are allocated */
  78. mem_heap_t* in_heap,/* in: memory heap from which the memory for
  79. old_vers is allocated; memory for possible
  80. intermediate versions is allocated and freed
  81. locally within the function */
  82. rec_t** old_vers);/* out, own: old version, or NULL if the
  83. record does not exist in the view, that is,
  84. it was freshly inserted afterwards */
  85. /*********************************************************************
  86. Constructs the last committed version of a clustered index record,
  87. which should be seen by a semi-consistent read. */
  88. ulint
  89. row_vers_build_for_semi_consistent_read(
  90. /*====================================*/
  91. /* out: DB_SUCCESS or DB_MISSING_HISTORY */
  92. rec_t* rec, /* in: record in a clustered index; the
  93. caller must have a latch on the page; this
  94. latch locks the top of the stack of versions
  95. of this records */
  96. mtr_t* mtr, /* in: mtr holding the latch on rec */
  97. dict_index_t* index, /* in: the clustered index */
  98. ulint** offsets,/* in/out: offsets returned by
  99. rec_get_offsets(rec, index) */
  100. mem_heap_t** offset_heap,/* in/out: memory heap from which
  101. the offsets are allocated */
  102. mem_heap_t* in_heap,/* in: memory heap from which the memory for
  103. old_vers is allocated; memory for possible
  104. intermediate versions is allocated and freed
  105. locally within the function */
  106. rec_t** old_vers);/* out, own: rec, old version, or NULL if the
  107. record does not exist in the view, that is,
  108. it was freshly inserted afterwards */
  109. #ifndef UNIV_NONINL
  110. #include "row0vers.ic"
  111. #endif
  112. #endif