read0read.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小: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. Checks if a read view sees the specified transaction. */
  39. UNIV_INLINE
  40. ibool
  41. read_view_sees_trx_id(
  42. /*==================*/
  43. /* out: TRUE if sees */
  44. read_view_t* view, /* in: read view */
  45. dulint trx_id); /* in: trx id */
  46. /* Read view lists the trx ids of those transactions for which a consistent
  47. read should not see the modifications to the database. */
  48. struct read_view_struct{
  49. ibool can_be_too_old; /* TRUE if the system has had to purge old
  50. versions which this read view should be able
  51. to access: the read view can bump into the
  52. DB_MISSING_HISTORY error */
  53. dulint low_limit_no; /* The view does not need to see the undo
  54. logs for transactions whose transaction number
  55. is strictly smaller (<) than this value: they
  56. can be removed in purge if not needed by other
  57. views */
  58. dulint low_limit_id; /* The read should not see any transaction
  59. with trx id >= this value */
  60. dulint up_limit_id; /* The read should see all trx ids which
  61. are strictly smaller (<) than this value */
  62. ulint n_trx_ids; /* Number of cells in the trx_ids array */
  63. dulint* trx_ids; /* Additional trx ids which the read should
  64. not see: typically, these are the active
  65. transactions at the time when the read is
  66. serialized, except the reading transaction
  67. itself; the trx ids in this array are in a
  68. descending order */
  69. trx_t* creator; /* Pointer to the creating transaction, or
  70. NULL if used in purge */
  71. UT_LIST_NODE_T(read_view_t) view_list;
  72. /* List of read views in trx_sys */
  73. };
  74. #ifndef UNIV_NONINL
  75. #include "read0read.ic"
  76. #endif
  77. #endif