read0read.h
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /******************************************************
  2. Cursor read
  3. (c) 1997 Innobase Oy
  4. Created 2/16/1997 Heikki Tuuri
  5. *******************************************************/
  6. #ifndef read0read_h
  7. #define read0read_h
  8. #include "univ.i"
  9. #include "ut0byte.h"
  10. #include "ut0lst.h"
  11. #include "trx0trx.h"
  12. #include "read0types.h"
  13. /*************************************************************************
  14. Opens a read view where exactly the transactions serialized before this
  15. point in time are seen in the view. */
  16. read_view_t*
  17. read_view_open_now(
  18. /*===============*/
  19. /* out, own: read view struct */
  20. trx_t* cr_trx, /* in: creating transaction, or NULL */
  21. mem_heap_t* heap); /* in: memory heap from which allocated */
  22. /*************************************************************************
  23. Makes a copy of the oldest existing read view, or opens a new. The view
  24. must be closed with ..._close. */
  25. read_view_t*
  26. read_view_oldest_copy_or_open_new(
  27. /*==============================*/
  28. /* out, own: read view struct */
  29. trx_t* cr_trx, /* in: creating transaction, or NULL */
  30. mem_heap_t* heap); /* in: memory heap from which allocated */
  31. /*************************************************************************
  32. Closes a read view. */
  33. void
  34. read_view_close(
  35. /*============*/
  36. read_view_t* view); /* in: read view */
  37. /*************************************************************************
  38. Closes a consistent read view for MySQL. This function is called at an SQL
  39. statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
  40. void
  41. read_view_close_for_mysql(
  42. /*======================*/
  43. trx_t* trx); /* in: trx which has a read view */
  44. /*************************************************************************
  45. Checks if a read view sees the specified transaction. */
  46. UNIV_INLINE
  47. ibool
  48. read_view_sees_trx_id(
  49. /*==================*/
  50. /* out: TRUE if sees */
  51. read_view_t* view, /* in: read view */
  52. dulint trx_id); /* in: trx id */
  53. /*************************************************************************
  54. Prints a read view to stderr. */
  55. void
  56. read_view_print(
  57. /*============*/
  58. read_view_t* view); /* in: read view */
  59. /* Read view lists the trx ids of those transactions for which a consistent
  60. read should not see the modifications to the database. */
  61. struct read_view_struct{
  62. ibool can_be_too_old; /* TRUE if the system has had to purge old
  63. versions which this read view should be able
  64. to access: the read view can bump into the
  65. DB_MISSING_HISTORY error */
  66. dulint low_limit_no; /* The view does not need to see the undo
  67. logs for transactions whose transaction number
  68. is strictly smaller (<) than this value: they
  69. can be removed in purge if not needed by other
  70. views */
  71. dulint low_limit_id; /* The read should not see any transaction
  72. with trx id >= this value */
  73. dulint up_limit_id; /* The read should see all trx ids which
  74. are strictly smaller (<) than this value */
  75. ulint n_trx_ids; /* Number of cells in the trx_ids array */
  76. dulint* trx_ids; /* Additional trx ids which the read should
  77. not see: typically, these are the active
  78. transactions at the time when the read is
  79. serialized, except the reading transaction
  80. itself; the trx ids in this array are in a
  81. descending order */
  82. trx_t* creator; /* Pointer to the creating transaction, or
  83. NULL if used in purge */
  84. UT_LIST_NODE_T(read_view_t) view_list;
  85. /* List of read views in trx_sys */
  86. };
  87. #ifndef UNIV_NONINL
  88. #include "read0read.ic"
  89. #endif
  90. #endif