gooderp18绿色标准版
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.

114 lines
3.3KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * gistxlog.h
  4. * gist xlog routines
  5. *
  6. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/access/gistxlog.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef GIST_XLOG_H
  14. #define GIST_XLOG_H
  15. #include "access/gist.h"
  16. #include "access/xlogreader.h"
  17. #include "lib/stringinfo.h"
  18. #define XLOG_GIST_PAGE_UPDATE 0x00
  19. #define XLOG_GIST_DELETE 0x10 /* delete leaf index tuples for a
  20. * page */
  21. #define XLOG_GIST_PAGE_REUSE 0x20 /* old page is about to be reused
  22. * from FSM */
  23. #define XLOG_GIST_PAGE_SPLIT 0x30
  24. /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */
  25. /* #define XLOG_GIST_CREATE_INDEX 0x50 */ /* not used anymore */
  26. #define XLOG_GIST_PAGE_DELETE 0x60
  27. /*
  28. * Backup Blk 0: updated page.
  29. * Backup Blk 1: If this operation completes a page split, by inserting a
  30. * downlink for the split page, the left half of the split
  31. */
  32. typedef struct gistxlogPageUpdate
  33. {
  34. /* number of deleted offsets */
  35. uint16 ntodelete;
  36. uint16 ntoinsert;
  37. /*
  38. * In payload of blk 0 : 1. todelete OffsetNumbers 2. tuples to insert
  39. */
  40. } gistxlogPageUpdate;
  41. /*
  42. * Backup Blk 0: Leaf page, whose index tuples are deleted.
  43. */
  44. typedef struct gistxlogDelete
  45. {
  46. TransactionId latestRemovedXid;
  47. uint16 ntodelete; /* number of deleted offsets */
  48. /*
  49. * In payload of blk 0 : todelete OffsetNumbers
  50. */
  51. } gistxlogDelete;
  52. #define SizeOfGistxlogDelete (offsetof(gistxlogDelete, ntodelete) + sizeof(uint16))
  53. /*
  54. * Backup Blk 0: If this operation completes a page split, by inserting a
  55. * downlink for the split page, the left half of the split
  56. * Backup Blk 1 - npage: split pages (1 is the original page)
  57. */
  58. typedef struct gistxlogPageSplit
  59. {
  60. BlockNumber origrlink; /* rightlink of the page before split */
  61. GistNSN orignsn; /* NSN of the page before split */
  62. bool origleaf; /* was splitted page a leaf page? */
  63. uint16 npage; /* # of pages in the split */
  64. bool markfollowright; /* set F_FOLLOW_RIGHT flags */
  65. /*
  66. * follow: 1. gistxlogPage and array of IndexTupleData per page
  67. */
  68. } gistxlogPageSplit;
  69. /*
  70. * Backup Blk 0: page that was deleted.
  71. * Backup Blk 1: parent page, containing the downlink to the deleted page.
  72. */
  73. typedef struct gistxlogPageDelete
  74. {
  75. FullTransactionId deleteXid; /* last Xid which could see page in scan */
  76. OffsetNumber downlinkOffset; /* Offset of downlink referencing this
  77. * page */
  78. } gistxlogPageDelete;
  79. #define SizeOfGistxlogPageDelete (offsetof(gistxlogPageDelete, downlinkOffset) + sizeof(OffsetNumber))
  80. /*
  81. * This is what we need to know about page reuse, for hot standby.
  82. */
  83. typedef struct gistxlogPageReuse
  84. {
  85. RelFileNode node;
  86. BlockNumber block;
  87. FullTransactionId latestRemovedFullXid;
  88. } gistxlogPageReuse;
  89. #define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, latestRemovedFullXid) + sizeof(FullTransactionId))
  90. extern void gist_redo(XLogReaderState *record);
  91. extern void gist_desc(StringInfo buf, XLogReaderState *record);
  92. extern const char *gist_identify(uint8 info);
  93. extern void gist_xlog_startup(void);
  94. extern void gist_xlog_cleanup(void);
  95. extern void gist_mask(char *pagedata, BlockNumber blkno);
  96. #endif
上海开阖软件有限公司 沪ICP备12045867号-1